| name | redsub-validate |
| description | Run lint, type check, and unit tests with evidence. |
Code Validation
Command Resolution
Determine the project's validation commands:
- Check project CLAUDE.md for explicit commands (lint, check, test)
- If not found, read
package.json scripts and infer:
- Lint: script containing "lint" (e.g.,
lint, lint:fix)
- Type check: script containing "check" (e.g.,
check, typecheck)
- Unit test: script containing "test" (e.g.,
test, test:unit)
- Detect package manager: look for lock files (
pnpm-lock.yaml → pnpm, yarn.lock → yarn, default → npm)
- If ambiguous, ask the user
Procedure
Run sequentially. Stop on first failure.
1. Lint
<package-manager> run <lint-script>
2. Type check
<package-manager> run <check-script>
3. Unit tests
<package-manager> run <test-script>
If the test script doesn't include a --run flag for watch-mode frameworks (e.g., vitest), append -- --run.
4. SSOT Consistency Checks
When a canonical source exists (config, constants, types), verify consumers stay in sync:
- Config-driven values: verify runtime reads match the canonical source (e.g., routes file exports match router config)
- Shared types: verify API response shapes match the declared type (snapshot or schema validation)
- i18n: verify all keys used in components exist in translation files
- If a test duplicates a magic number or string, extract to shared fixture or import from source module
5. Evidence (5-Step Verification Gate)
No claims without evidence. Follow this exact sequence:
- IDENTIFY: What command proves this claim?
- RUN: Execute the full command (fresh, complete)
- READ: Check entire output, exit code, failure count
- VERIFY: Does the output support the claim?
- CLAIM: Only then make the claim
Forbidden before verification: "should", "probably", "seems to", or satisfaction expressions ("Great!", "Done!", "Perfect!").
On success:
Validation passed (with evidence):
- lint: pass (0 errors, 0 warnings)
- type check: pass (0 errors)
- unit test: pass (N tests, 0 failures)
On failure:
Validation failed:
- [step]: [error details]
- Fix: [suggestion]