Validation Skill
Defines quality gates and tool detection procedures for production readiness checks.
What It Provides
Quality Gate Definitions- What to check (tests, types, lint, coverage, security)
- Pass/fail criteria for each gate
- Adaptation strategies for different tech stacks
- How to detect test frameworks (Vitest, Jest, Playwright)
- How to detect type checkers (TypeScript, Flow)
- How to detect linters (ESLint, Biome)
- How to detect coverage tools
- Command sequences to run for each tool
- Output parsing patterns
- Error reporting formats
Quality Gates
Tests
What to check: All tests passing
Detection:# Check package.json scripts
- npm test → run test command
- check for: vitest, jest, @playwright/testPass criteria: Exit code 0, no failures
Adaptation:- No test script → Skip, warn user
- Multiple test types → Run all (unit, integration, e2e)
Type Checking
What to check: No type errors
Detection:# Check for tsconfig.json
if exists → run: tsc --noEmit
# Check for Flow
if .flowconfig → run: flow checkPass criteria: 0 errors
Adaptation:- JavaScript only → Skip type checking
- @ts-check comments → Validate those files
Linting
What to check: 0 lint errors
Detection:# Check for ESLint config
.eslintrc.* or package.json "eslintConfig" → run: eslint .
# Check for Biome
biome.json → run: biome check .Pass criteria: 0 errors (warnings OK)
Adaptation:- No linter → Skip
Dead Code
What to check: No unused exports/imports
Method:# Build dependency graph
1. Find all exports
2. Find all imports
3. Mark exports never imported as dead
4. Mark imports never used as deadPass criteria: 0 unused exports/imports
Note: Detection only. Removal delegated to fixer agent.
Coverage
What to check: ≥80% coverage
Detection:# Check test runner config
- Vitest → vitest.config.ts coverage settings
- Jest → jest.config.js coverage settingsPass criteria: 80% average (statement, branch, function, line)
Adaptation:- No coverage config → Warn, don't fail
- Custom threshold in package.json → Use that
Security
What to check: No high/critical vulnerabilities
Method:npm audit
# or
yarn audit
# or
pnpm auditPass criteria: 0 high or critical vulnerabilities
How Agents Use This
Reviewer Agent:- Reads this skill for validation procedures
- Executes each quality gate check
- Reports results
- Delegates fixes to fixer agent if needed
- Reads validation results
- Applies auto-fixes where possible
- Triggers re-validation
Validation Output Format
{
"gates": {
"tests": {
"passed": true,
"details": "47 tests passed"
},
"types": {
"passed": false,
"errors": [
{
"file": "src/components/LoginForm.tsx",
"line": 23,
"message": "Type 'string' not assignable to type 'number'"
}
]
},
"lint": {
"passed": true,
"details": "0 errors"
},
"coverage": {
"passed": false,
"percentage": 76,
"threshold": 80,
"uncovered": [
"src/components/TaskItem.tsx",
"lib/utils.ts"
]
},
"security": {
"passed": true,
"vulnerabilities": 0
}
},
"overall_passed": false
}Auto-Fix Capabilities
This skill defines what's auto-fixable:Auto-fixable:
- Unused imports → Remove
- Lint errors with --fix → Apply fixes
- Simple type errors → Add annotations
Not auto-fixable:
- Test failures → Logic bugs
- Complex type errors → Design issues
- Coverage gaps → Need new tests
- Security vulnerabilities → Need updates
Configuration
Override defaults in package.json:
{
"agentful": {
"validation": {
"coverageThreshold": 90,
"typeCheck": false,
"testCommand": "vitest run --coverage",
"e2eCommand": "playwright test"
}
}
}Implementation Details
Location: .claude/skills/validation/SKILL.md
Model: Sonnet
Tools Used:- Read (config files)
- Glob (find test files)
- Grep (search patterns)
- Bash (run validation commands)
package.jsontsconfig.json.eslintrc.*biome.jsonvitest.config.ts/jest.config.jsplaywright.config.ts/cypress.config.ts
Error Reporting Patterns
Test Failure
❌ Test failed: User authentication › should log in with valid credentials
Expected: true
Received: false
at src/__tests__/auth.test.ts:45Type Error
❌ Type error in LoginForm.tsx:23
Type 'string' is not assignable to type 'number'Coverage Gap
⚠️ Coverage below threshold: 76% (target: 80%)
Missing coverage:
• src/components/TaskItem.tsx (65%)
• lib/utils.ts (50%)Usage by Commands
/agentful-validate
- Primary consumer of this skill
- Runs all quality gate checks
- Reports results to user
- Uses validation before marking features complete
- Delegates to reviewer agent which uses this skill
Extending the Skill
Add custom quality gates by editing .claude/skills/validation/SKILL.md:
## Custom Gate: API Contract Validation
What to check: OpenAPI spec matches implementation
Detection:
- Find openapi.yml or swagger.json
- Run: npm run validate:api-contract
Pass criteria: 0 mismatches
Command:
\`\`\`bash
npx swagger-cli validate openapi.yml
\`\`\`See Also
- /agentful-validate - Runs validation checks
- Reviewer Agent - Uses this skill for code review
- Fixer Agent - Applies fixes based on validation results