Skip to main content
command CX Codex

validate-and-fix — Claude Code command: checks and setup

validate-and-fix is a Claude Code command that runs project checks and assigns independent fixes to parallel agents. It discovers build, test, and lint commands in project instructions and package.json.

MIT ★ 763 updated 2026-03-31

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/validate-and-fix.md
Open on GitHub

What validate-and-fix does

validate-and-fix looks for the checks a project defines, runs them, and sorts the findings by severity. It tackles low- and medium-priority fixes first; critical changes wait for explicit user approval. Before editing files, it creates a checkpoint with git stash.

The command sends independent work to agents in parallel and handles dependent tasks in sequence. It reruns checks after each phase, then reports completed fixes and remaining manual work. Specialized agents can be listed with claudekit list agents.

What it helps with

  • discover project checks in AGENTS.md, CLAUDE.md, and package.json
  • sort lint, type, test, and build failures by priority
  • assign independent fixes to separate agents
  • rerun checks after code changes

Example prompts for the agent

  • Run /validate-and-fix to check the project and address the findings.
  • Use /validate-and-fix to run the tests and build, then report remaining failures.
  • Run /validate-and-fix and split independent fixes across agents.

How to install validate-and-fix

Manually: put the files in place

.claude/commands/validate-and-fix.md

Call it with /validate-and-fix. For all projects use ~/.claude/commands/

Questions about validate-and-fix

How do I install validate-and-fix in Claude Code?

Save the command file at .claude/commands/validate-and-fix.md in the project. Then invoke it with /validate-and-fix.

What does validate-and-fix do?

It discovers and runs project checks, ranks the findings, and coordinates fixes followed by verification. Independent tasks can go to parallel agents.

How does validate-and-fix handle critical issues?

It asks for user confirmation and lays out a plan before changing critical issues. It creates a git stash checkpoint before making any changes.

Source text

validate-and-fix.md · MIT
---
description: Run quality checks and automatically fix issues using concurrent agents
category: workflow
allowed-tools: Bash, Task, TodoWrite, Read, Edit, MultiEdit
---

# Validate and Fix

Run quality checks and automatically fix discovered issues using parallel execution.

## Process

### 1. SYSTEMATIC PRIORITY-BASED ANALYSIS

#### Command Discovery
First, discover what validation commands are available:
1. Check AGENTS.md/CLAUDE.md for documented build/test/lint commands
2. Examine package.json scripts section for available commands
3. Look for common patterns in scripts:
   - Linting: "lint", "eslint", "lint:fix", "check:lint", "lint:js"
   - Type checking: "typecheck", "type-check", "tsc", "check:types", "types"
   - Testing: "test", "test:unit", "jest", "check:test", "test:all"
   - Formatting: "format", "prettier", "fmt", "format:fix"
   - Build: "build", "compile", "build:prod"
4. Check README.md for any additional validation instructions

#### Discovery with Immediate Categorization
Run all discovered quality checks in parallel using Bash. Capture full output including file paths, line numbers, and error messages:
- Linting (ESLint, Prettier, Ruff, etc.)
- Type checking (TypeScript, mypy, etc.)
- Tests (Jest, pytest, go test, etc.)
- Build verification
- Custom project checks

Immediately categorize findings by:
- **CRITICAL**: Security issues, breaking changes, data loss risk
- **HIGH**: Functionality bugs, test failures, build breaks
- **MEDIUM**: Code quality, style violations, documentation gaps
- **LOW**: Formatting, minor optimizations

#### Risk Assessment Before Action
- Identify "quick wins" vs. complex fixes
- Map dependencies between issues (fix A before B)
- Flag issues that require manual intervention

### 2. STRATEGIC FIX EXECUTION

#### Phase 1 - Safe Quick Wins
- Start with LOW and MEDIUM priority fixes that can't break anything
- Verify each fix immediately before proceeding

#### Phase 2 - Functionality Fixes
- Address HIGH priority issues one at a time
- Run tests after each fix to ensure no regressions

#### Phase 3 - Critical Issues
- Handle CRITICAL issues with explicit user confirmation
- Provide detailed plan before executing

#### Phase 4 - Verification
- Re-run ALL checks to confirm fixes were successful
- Provide summary of what was fixed vs. what remains

### 3. COMPREHENSIVE ERROR HANDLING

#### Rollback Capability
- Create git stash checkpoint before ANY changes
- Provide instant rollback procedure if fixes cause issues

#### Partial Success Handling
- Continue execution even if some fixes fail
- Clearly separate successful fixes from failures
- Provide manual fix instructions for unfixable issues

#### Quality Validation
- Accept 100% success in each phase before proceeding
- If phase fails, diagnose and provide specific next steps

#### Task Distribution
Create detailed task plans where each agent gets:
- A specific, focused objective (e.g., "Fix all TypeScript errors in src/components/")
- Exact file paths and line numbers to modify
- Clear success criteria (e.g., "Ensure the project's type checking command passes for these files")
- Any relevant context about dependencies or patterns to follow

### 4. Parallel Execution
Launch multiple agents concurrently for independent, parallelizable tasks:
- **CRITICAL**: Include multiple Task tool calls in a SINGLE message ONLY when tasks can be done in parallel
- Tasks that depend on each other should be executed sequentially (separate messages)
- Parallelizable tasks: Different file fixes, independent test suites, non-overlapping components
- Sequential tasks: Tasks with dependencies, shared state modifications, ordered phases
- **Use specialized subagents** when tasks match expert domains (TypeScript, React, testing, databases, etc.)
- Run `claudekit list agents` to see available specialized experts  
- Match task requirements to expert domains for optimal results
- Use general-purpose approach only when no specialized expert fits
- Each parallel agent should have non-overlapping responsibilities to avoid conflicts
- Agents working on related files must understand the shared interfaces
- Each agent verifies their fixes work before completing
- Track progress with TodoWrite
- Execute phases sequentially: complete Phase 1 before Phase 2, etc.
- Create checkpoint after each successful phase

### 5. Final Verification
After all agents complete:
- Re-run all checks to confirm 100% of fixable issues are resolved
- Confirm no new issues were introduced by fixes
- Report any remaining manual fixes needed with specific instructions
- Provide summary: "Fixed X/Y issues, Z require manual intervention"

This approach maximizes efficiency through parallel discovery and fixing while ensuring coordinated, conflict-free changes.

© carlrannaberg · MIT · carlrannaberg/claudekit

Similar slash commands

All slash commands for Testing and QA →

From the same set54

The whole set →
bash-timeout bash-timeout configures bash command timeout values in Claude Code settings.json. Useful when long test runs, builds, or deployments fail due to the default 2-minute cap. CX Codex +1 ★ 763repo stars create-command The create-command command builds a Claude Code slash command from your requirements, then shows its file location and how to invoke it. CX Codex +1 ★ 763repo stars commit Builds a git commit that matches your project's conventions: scans the diff, updates docs, writes the message. CX Codex +1 ★ 763repo stars code-search code-search searches the codebase for matching files, functions, and patterns, returning a clean list of paths. Handy for locating relevant code quickly without full explanations. CX Codex ★ 763repo stars migration migration moves CLAUDE.md, .cursorrules and the rest of your AI config files into one AGENTS.md, then links each tool's expected filename to it. CX Codex +1 ★ 763repo stars research-expert research-expert gathers web information in parallel, adapts depth across three distinct modes, and outputs full reports to files to avoid token bloat. CX Codex ★ 763repo stars create-subagent create-subagent builds a domain-focused subagent with defined tasks, tools, boundaries, and project context checks. Use it when a one-off command is too narrow. CX Codex +1 ★ 763repo stars research research fans a question out to parallel subagents, reads their saved reports from /tmp, and merges the lot into one cited file. CX Codex +1 ★ 763repo stars

Project sponsors

Companies that keep this analytics open