Run validation checks to ensure code quality, security, and correctness. Supports quick (scoped), full (CI pipeline), fix (auto-correct), and CI mirror modes.
Run validation checks to ensure code quality, security, and correctness. Supports quick (scoped), full (CI pipeline), fix (auto-correct), and CI mirror modes.
category
process
triggers
["run checks","verify quality","typecheck","lint","does it pass"]
Validate
Purpose: Run validation checks for code quality, security, and correctness
Modes: Quick (default) | Full (--full) | Fix (--fix) | CI Mirror (--ci)
Usage:/validate [scope flags]
Iron Laws
NEVER SKIP TYPE CHECK — Type check is the first gate. If it fails, nothing else matters. Fix types before running lint or tests.
REPORT WHAT THE OUTPUT SAYS — Never summarize or interpret validation output. Show the actual errors with file paths and line numbers.
FAILURES ARE NOT SUGGESTIONS — A failing validation means the code is not ready. Do not proceed past a failing check.
NO CLAIMS WITHOUT FRESH EVIDENCE — Never report a check as passing without showing the actual command output from this session. Words like "should pass," "probably works," or "looks correct" are not verification. Run the command, read the output, then state the result.
When to Use
After making code changes to check nothing is broken
Before committing to ensure quality
As part of /implement or /finish workflows
To check if CI will pass locally
When NOT to Use
Writing or running specific tests → /test-coverage or /tdd
Reviewing code quality and patterns → /review
Fixing bugs → /debug
Security-specific audit → /security-review
Early Exit
If git status shows no changes and no specific mode is requested, report "No changes to validate" and offer to run full validation anyway.
Constraints
Type check must pass before running tests
Report all failures clearly with file, line, and suggested fix
Stop at first failing level (don't waste time on later checks)
Never skip type check
Never commit with lint errors
Run scoped tests by default (not full suite unless --full)
Note: Detect package manager from lockfile (package-lock.json = npm, pnpm-lock.yaml = pnpm, yarn.lock = yarn, bun.lockb = bun). Use detected manager for all commands. Command examples below use npm as placeholder — substitute the detected manager.
Scope Flags
Flag
Description
--files=<paths>
Validate specific files/directories
--uncommitted
Validate uncommitted changes (default)
--staged
Validate staged changes only
--full
Run complete CI pipeline
--ci
Mirror exact CI configuration
--fix
Auto-fix correctable issues
--security
Include security checks
--coverage
Include test coverage report
Examples:
/validate # Quick validation of uncommitted changes
/validate --files=src/components/ # Specific directory
/validate --full # Complete CI pipeline
/validate --fix # Auto-fix lint/format issues
/validate --ci # Mirror exact CI checks
/validate --full --coverage # Full validation with coverage
Quick Validation (Default)
Fast feedback during development — validate only what changed.
Step 0: Determine Scope
git diff --name-only HEAD
git diff --name-only --staged # if --staged flag
Level 1: Syntax & Style
Execution order within this level: Run checks in dependency order: (a) Typecheck first (catches type errors that cause other failures), (b) Lint second (may depend on types), (c) Tests third (need types and imports correct), (d) Build last (depends on all above). This prevents cascading failures from obscuring root causes.
Format Check:
npm run format:check 2>/dev/null || npx prettier --check [changed-files]
Type Check:
npm run typecheck
Lint:
npm run lint -- [changed-files]
Security Scan (always runs):
See references/security-scan-patterns.md for concrete grep patterns for secrets, dangerous functions, and security anti-patterns. Run these scans as part of full validation.
Detect CI config: Look for .github/workflows/*.yml, .gitlab-ci.yml, Jenkinsfile
Extract CI steps: Parse config and run equivalent local commands
Report: Show CI job → local command → status mapping
In CI mode (--mode=ci):
Run the same checks as full mode
Use non-interactive output (no fix offers)
Exit with non-zero code on any failure
Output results in a format parseable by CI systems (structured JSON or standard exit codes)
Verification Patterns
Regression Test Verification
When validating a bug fix with a regression test, verify the test actually catches the bug:
1. Write the regression test
2. Run it → MUST PASS (with the fix in place)
3. Revert the fix
4. Run it → MUST FAIL (proves the test catches the bug)
5. Restore the fix
6. Run it → MUST PASS (confirms fix works)
A regression test that passes both with and without the fix proves nothing. Skip the red-green cycle only for tests that verify new behavior (not bug fixes).
Agent Delegation Verification
When a subagent reports task completion, verify independently:
Check the VCS diff — does it show the expected changes?
Run validation commands yourself — don't trust "all tests pass" claims from agents
Report the actual state based on your own verification
Common Issues & Solutions (see references/validation-troubleshooting.md for expanded patterns including build failures and CI discrepancies)