automated-code-fixer

Euda1mon1a's avatarfrom Euda1mon1a

Automated IT helper for detecting and fixing code issues. Use when code fails tests, linting, type-checking, or has security vulnerabilities. Enforces strict quality gates before accepting fixes.

⭐2stars🔀0forks📁View on GitHub🕐Updated Jan 4, 2026

When & Why to Use This Skill

The Automated Code Fixer is a high-performance AI agent designed to autonomously diagnose and resolve software defects. By integrating seamlessly with testing frameworks, linters, and security scanners, it ensures code integrity through a multi-layered validation process. This skill significantly reduces technical debt and accelerates development cycles by enforcing strict quality gates—including type safety, security compliance, and architectural standards—before any fix is finalized.

Use Cases

  • Automated CI/CD Recovery: Rapidly fixing broken builds and failed unit tests to restore pipeline health without manual intervention.
  • Security Vulnerability Remediation: Identifying and patching critical security flaws such as SQL injection, path traversal, and hardcoded secrets.
  • Code Quality Standardization: Automatically resolving linting errors and formatting inconsistencies using industry-standard tools like Ruff and Black.
  • Type Safety Enforcement: Correcting complex type-checking errors and missing annotations to ensure a robust, type-safe Python codebase.
  • Architectural Compliance: Ensuring that code modifications adhere to specific project patterns, such as layered architecture and proper async/await database operations.
nameautomated-code-fixer
descriptionAutomated IT helper for detecting and fixing code issues. Use when code fails tests, linting, type-checking, or has security vulnerabilities. Enforces strict quality gates before accepting fixes.
model_tieropus
can_parallel_with[lint-monorepo, test-writer]
must_serialize_with[database-migration, systematic-debugger]
preferred_batch_size3
max_file_context80
compression_level1
requires_git_contexttrue
requires_db_contextfalse
- pattern"migration|schema"
reason"Database changes require database-migration skill"

Automated Code Fixer

An intelligent "IT guy" skill that automatically detects and fixes code issues with strict quality controls.

When This Skill Activates

  • Test failures detected
  • Linting errors reported
  • Type-checking errors found
  • Security vulnerabilities identified
  • Build failures encountered
  • CI/CD pipeline failures

Strict Quality Gates

CRITICAL: All fixes must pass these gates before being accepted:

Gate 1: Test Validation

  • All existing tests must pass after fix
  • New code must have corresponding tests
  • Coverage cannot decrease below 70%

Gate 2: Linting Compliance

  • Black formatting must pass
  • Ruff linting with zero errors
  • No new security warnings

Gate 3: Type Safety

  • mypy type-checking must pass
  • No untyped function signatures
  • No Any type escapes

Gate 4: Security Check

  • No hardcoded secrets
  • No SQL injection vulnerabilities
  • No path traversal issues
  • Input validation on all user data

Gate 5: Architectural Compliance

  • Follow layered architecture (Route -> Controller -> Service -> Model)
  • Database changes require migrations
  • Async/await for all DB operations

Fix Process

Step 1: Diagnose

# Run diagnostics
cd /home/user/Autonomous-Assignment-Program-Manager/backend
pytest --tb=short 2>&1 | head -50
ruff check app/ tests/
mypy app/ --python-version 3.11

Step 2: Analyze

  • Identify root cause (not just symptoms)
  • Check related files for context
  • Review test expectations

Step 3: Fix

  • Make minimal, focused changes
  • Follow existing code patterns
  • Add comments only where logic isn't self-evident

Step 4: Validate

# Must all pass before accepting fix
pytest --tb=short
ruff check app/ tests/
black --check app/ tests/
mypy app/ --python-version 3.11

Step 5: Report

Provide concise summary:

  • What was broken
  • Root cause
  • What was fixed
  • Tests added/modified

Escalation Rules

Escalate to human when:

  1. Fix requires changing models/migrations
  2. Fix affects ACGME compliance logic
  3. Fix touches authentication/security code
  4. Multiple interdependent failures
  5. Unclear requirements or business logic
  6. Fix would take >30 minutes

Rollback Protocol

If fix causes additional failures:

  1. Immediately revert changes
  2. Document what went wrong
  3. Escalate to human with full context

Integration with Existing Commands

This skill works with the project's slash commands:

  • /run-tests - Execute test suite
  • /lint-fix - Auto-format and fix linting
  • /health-check - System health validation
  • /check-compliance - ACGME compliance verification

Example Fixes

Test Failure

pytest output: FAILED tests/test_swap_executor.py::test_execute_swap - AssertionError

Diagnosis: SwapExecutor.execute_swap() not awaiting async call
Fix: Added 'await' to database query on line 47
Validation: All tests pass, coverage maintained at 78%

Type Error

mypy output: app/services/schedule.py:23: error: Missing return type annotation

Diagnosis: Function missing type hints
Fix: Added -> Optional[Schedule] return type
Validation: mypy passes, no runtime changes

Security Issue

ruff output: S105 Possible hardcoded password in variable assignment

Diagnosis: Test file using hardcoded password
Fix: Replaced with environment variable via conftest fixture
Validation: No security warnings, tests pass

References

  • See reference.md for detailed fix patterns
  • See examples.md for common fix scenarios