Fix code and test issues in specified files using intelligent area detection and the write-code workflow. Uses context from available project documentation, runs diagnostics, detects the type of fixes needed, and applies the appropriate workflow steps to resolve issues.
Fixes code and test issues using intelligent area detection and the write-code workflow.
/plugin marketplace add alvis/.claude/plugin install coding@alvisFix code and test issues in specified files using intelligent area detection and the write-code workflow. Uses context from available project documentation, runs diagnostics, detects the type of fixes needed, and applies the appropriate workflow steps to resolve issues.
What this command does NOT do:
When to REJECT:
ultrathink: you'd perform the following steps
When specifier is provided:
src/components/Button.tssrc/**/*.spec.ts, **/*.{ts,tsx}@myapp/coregit diff, git diff HEAD~1, git diff main...HEADpr (uses current branch's changes)src/components/When NO specifier is provided:
Locate Project Root:
package.json (Node.js/TypeScript/JavaScript)Cargo.toml (Rust)pyproject.toml or setup.py (Python)go.mod (Go)pom.xml or build.gradle (Java/Kotlin)Detect Language and Infer File Patterns:
TypeScript/JavaScript (package.json):
src/**/*.{ts,tsx,js,jsx}, lib/**/*.{ts,tsx,js,jsx}**/*.spec.{ts,tsx,js,jsx}, **/*.test.{ts,tsx,js,jsx}, __tests__/**/*.{ts,tsx,js,jsx}Python (pyproject.toml, setup.py):
**/*.py (excluding tests/, test_*.py, *_test.py)tests/**/*.py, test_*.py, *_test.pyRust (Cargo.toml):
src/**/*.rs, lib.rs, main.rstests/**/*.rsGo (go.mod):
**/*.go (excluding *_test.go)**/*_test.goJava/Kotlin (pom.xml, build.gradle):
src/main/**/*.java, src/main/**/*.ktsrc/test/**/*.java, src/test/**/*.ktResolve to Concrete File List:
Find All Markdown Files:
**/*.mdnode_modules/, README.md, CHANGELOG.md, LICENSE.mdAnalyze Content to Identify Relevant Documents:
Review/Findings Documents:
Handover/Continuation Documents:
Context Documents:
Planning Documents:
Research/Investigation Documents:
Extract Fix Requirements:
Prioritize Information:
get_project_overview MCP tool to understand:
npx tsc --noEmit to understand:
npm run lint to identify:
Analyze diagnostics and context to determine what needs fixing:
Check Test Status:
test areatest area*.spec.ts, *.spec.tsxCheck Lint Status:
lint areatest,lintCheck Context Files:
/review command detected → use same areas as reviewCheck File Types:
testfixturesfixturesimplementationDefault Fallback:
Map detected/specified areas to write-code workflow steps:
test → Resume From Step 3 (Fix Test Issues & Standards Compliance)fixtures → Resume From Step 4 (Optimize Test Structure & Fixtures)implementation → Resume From Step 2 (Implementation - Green Phase)refactoring → Resume From Step 5 (Refactoring & Documentation)lint → Applied throughout relevant stepsCompile information from context discovery into Change Direction for workflow:
Configure workflow:write-code execution with:
YOU MUST follow workflow:write-code to fix issues with subagents
This command MUST NOT perform any fixes directly. Instead, you MUST:
Delegate ALL fix execution to subagents using the Task tool with workflow:write-code
Follow workflow:write-code specifications exactly as documented in the write-code workflow file
Use the subagent orchestration patterns specified in workflow:write-code:
Pass complete configuration to the write-code workflow:
Monitor and coordinate workflow execution:
This ensures consistent quality, proper standards application, and adherence to established workflows.
</IMPORTANT>Execute workflow:write-code using Task tool with all configuration parameters prepared in previous steps.
After workflow completion:
Execute Diagnostics:
lsp_get_diagnostics or ide__getDiagnostics MCP toolnpx tsc --noEmit to verify type checkingnpm run lint to verify linting compliancenpm run test to verify all tests passVerify Fixes Applied:
Check Context File Updates:
Output Format:
[✅/❌] Command: fix $ARGUMENTS
## Summary
- Files processed: [count]
- Areas addressed: [list]
- Issues fixed: [count]
- Workflow steps executed: [list]
- Validation results: [PASS/FAIL]
## Context Discovery
- Context files found: [REVIEW.md, DESIGN.md, ...]
- Issues extracted: [count]
- Initial diagnostics: [summary]
## Area Detection
- Detection method: [auto/manual]
- Detected areas: [list]
- Workflow steps: [step numbers]
- Change direction: [summary]
## Actions Taken
1. [Action with result]
2. [Action with result]
## Workflows Applied
- write-code (Steps X-Y): [Status]
## Validation Results
- Type checking: [PASS/FAIL with details]
- Linting: [PASS/FAIL with details]
- Tests: [PASS/FAIL with test results]
- Issue resolution: [verified fixes]
## Issues Requiring Manual Intervention (if any)
- **Issue**: [Description]
**Reason**: [Why auto-fix wasn't possible]
**Recommendation**: [Suggested manual fix]
/fix "src/components/Button.spec.ts"
# Auto-detects area=test based on .spec.ts pattern
# Reads context files if present
# Runs diagnostics to understand issues
# Executes write-code Step 3 only
# Reports test fixes applied
/fix "git diff"
# Gets changed files from git diff
# Auto-detects areas based on file types and diagnostics
# Reads REVIEW.md if present from recent review
# Applies appropriate workflow steps
# Validates all changes
/fix "src/api/**/*.ts" --area=implementation,test
# Explicitly specifies areas to address
# Reads context files for requirements
# Executes write-code Steps 2-3
# Validates implementation and tests
# Reports comprehensive results
/fix "@myapp/auth" --area=test,fixtures,refactoring
# Resolves package to file paths
# Executes write-code Steps 3-5
# Optimizes tests, fixtures, and refactors
# Comprehensive validation
/fix "pr"
# Gets files changed in current PR/branch
# Reads REVIEW.md from review findings
# Auto-detects areas from review issues
# Applies fixes based on review feedback
# Validates against review criteria
/fix "src/{components,utils}/**/*.{ts,tsx}" --area=implementation,test,lint
# Processes multiple directories and file types
# Reads REVIEW.md, DESIGN.md, CONTEXT.md for direction
# Runs comprehensive diagnostics
# Executes write-code Steps 2-3 with lint focus
# Reports detailed fix results
/fix
# Discovers package.json → identifies TypeScript project
# Auto-generates patterns:
# - Source: src/**/*.{ts,tsx}
# - Tests: **/*.spec.{ts,tsx}, **/*.test.{ts,tsx}
# Scans all *.md files in project
# Finds and analyzes: code-review-2024-01-15.md
# → Contains review findings with severity levels
# → Extracts 12 critical issues, 8 major issues
# Runs initial diagnostics (tsc, lint)
# Auto-detects areas: implementation, test, lint
# Executes write-code workflow Steps 2-3
# Validates all fixes applied successfully
/fix
# Discovers pyproject.toml → identifies Python project
# Auto-generates patterns:
# - Source: **/*.py (excluding tests)
# - Tests: tests/**/*.py, test_*.py
# Scans markdown files
# Finds: handover-jan-2024.md, technical-notes.md
# → Extracts work-in-progress items
# → Identifies 5 pending bug fixes with file locations
# Runs diagnostics (mypy, pylint)
# Auto-detects areas from diagnostics and docs
# Applies appropriate fixes
# Reports completion with test results
/fix
# Discovers Cargo.toml → identifies Rust project
# Auto-generates patterns:
# - Source: src/**/*.rs, lib.rs, main.rs
# - Tests: tests/**/*.rs
# Scans for context documents
# Finds: IMPLEMENTATION_STATUS.md
# → Contains known compiler warnings
# → Lists clippy suggestions
# Runs cargo check and cargo clippy
# Fixes identified issues
# Validates with cargo test
/fix
# Discovers package.json → TypeScript project
# Auto-generates file patterns
# No context markdown files found
# Falls back to diagnostic-driven approach:
# - Runs get_project_overview
# - Executes tsc --noEmit
# - Runs npm run lint
# Identifies issues from diagnostics alone
# Auto-detects areas based on error types
# Applies fixes
# Validates resolution
/fix "src/mixed-changes/**/*.ts"
# Runs diagnostics and finds multiple issue types
# Cannot auto-detect area with confidence
# Prompts user: "Found test, implementation, and lint issues. Please specify --area:
# /fix "src/mixed-changes/**/*.ts" --area=implementation,test
# /fix "src/mixed-changes/**/*.ts" --area=test,lint
# Shows breakdown of detected issues to help user decide
# After running /review command that created REVIEW.md
/fix "src/api" --area=implementation
# Reads REVIEW.md automatically
# Extracts specific issues for src/api
# Uses review findings as Change Direction
# Applies fixes targeting review issues
# Validates fixes resolve review concerns
# Complete workflow:
# 1. Review code and save results
/review "src/services" --format=yaml --verbose
# 2. Fix identified issues (auto-detects from REVIEW.md)
/fix "src/services"
# Auto-detects areas from REVIEW.md issues
# Applies appropriate fixes
# Validates resolution
# 3. Commit changes
/coding:commit