S

Smart Fix Command

Intelligent problem resolver that analyzes the type of issue (build error, test failure, runtime crash, type error, lint violation) and applies the appropriate fix strategy. Automatically diagnoses and resolves common development problems.

CommandCommunitydevelopmentv1.0.0MIT
0 views0 copies

Command

/fix

Description

Automatically diagnoses and fixes development issues by first classifying the problem type, then applying the appropriate resolution strategy. Handles build errors, test failures, type errors, lint violations, runtime crashes, and dependency conflicts.

Behavior

Arguments

  • $ARGUMENTS -- Error message, file path, or description of the issue. If empty, runs common check commands to detect issues automatically.

Issue Detection (when no arguments)

# Auto-detect issues by running checks npm run build 2>&1 # Build errors npm test 2>&1 # Test failures npx tsc --noEmit 2>&1 # Type errors npm run lint 2>&1 # Lint violations

Fix Strategies by Issue Type

Build Errors

  1. Parse the error output for file path and line number
  2. Read the file and surrounding context
  3. Identify the cause (missing import, syntax error, incompatible types)
  4. Apply the fix
  5. Re-run the build to verify

Test Failures

  1. Run the failing test in isolation with verbose output
  2. Compare expected vs actual values
  3. Determine if the test or the implementation is wrong
  4. Fix the root cause (not just the assertion)
  5. Run the full test suite to check for regressions

Type Errors

  1. Read the TypeScript error with file location
  2. Examine the type definitions involved
  3. Determine the correct type (not any -- use proper types)
  4. Apply type fixes: annotations, guards, or interface updates
  5. Re-run tsc --noEmit to verify

Lint Violations

  1. Parse lint output for rule name and location
  2. Understand what the rule enforces
  3. Fix the code to satisfy the rule (not disable the rule)
  4. Only disable a rule if it's genuinely a false positive
  5. Re-run the linter to verify

Runtime Errors

  1. Analyze the stack trace
  2. Identify the throw/crash point
  3. Trace the data flow to find the root cause
  4. Add proper error handling and input validation
  5. Add a test that reproduces the error

Dependency Conflicts

  1. Check npm ls or pip list for version conflicts
  2. Identify which packages have incompatible peer dependencies
  3. Find compatible version ranges
  4. Update package.json and reinstall
  5. Verify the build still works

Output Format

## Fix Applied **Issue Type**: Type Error **Root Cause**: `fetchUser` returns `User | undefined` but caller assumes `User` **File**: src/pages/profile.tsx:23 ### Changes Made 1. Added null check at src/pages/profile.tsx:23 2. Added loading state for undefined user 3. Updated return type annotation on fetchUser ### Verification - `tsc --noEmit`: PASS (0 errors) - `npm test`: PASS (42/42)

Examples

# Auto-detect and fix issues /fix # Fix a specific error /fix TypeError: Cannot read property 'name' of undefined at src/api.ts:42 # Fix a specific file /fix src/components/UserProfile.tsx # Fix failing tests /fix tests are failing in auth.test.ts
Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates