| name | quality-gates |
| description | Checkpoint framework and validation rules for all agents. Ensures quality gates are passed at every stage of development. |
| allowed-tools | Read, Grep, Bash |
Quality Gates (Checkpoint Framework)
When to Use
- Before starting implementation (pre-implementation gate)
- During implementation (implementation gate)
- After writing tests (testing gate)
- Before completing work (review gate)
Overview
Quality gates are checkpoints that prevent bugs from being committed. Every agent must pass these gates before proceeding.
Gate Framework
Pre-Implementation Gate
Must pass BEFORE writing any code:
How to pass:
- Read all related files and tests
- Document understanding in brief plan
- Identify which architectural patterns apply
- List all types/interfaces needed
- Check for security concerns (auth, input validation, etc.)
Implementation Gate
Must pass DURING code writing:
How to pass:
- Run TypeScript compiler:
npx tsc --noEmit
- Check for
any types: grep -r ": any" src/
- Check for
@ts-ignore: grep -r "@ts-ignore" src/
- Verify Zod validation on all inputs
- Verify error handling with try/catch
- Check environment variables used correctly
Validators:
- typescript-strict-guard/validate-types.py
- security-sentinel/validate-security.py
- nextjs-15-specialist/validate-patterns.py
Testing Gate
Must pass AFTER implementation:
How to pass:
- Run tests:
npm test -- --run
- Check coverage:
npm test -- --coverage
- Verify AAA pattern in all tests
- Ensure no
.skip() or .only() in tests
- Check E2E tests exist for UI changes
Validators:
- tdd-enforcer/validate-coverage.py
- quality-gates/validate-test-quality.py
Review Gate
Must pass BEFORE finishing:
How to pass:
- Run code-reviewer agent
- Run security-auditor agent (for auth/API/data handling)
- Run all validators:
quality-gates/validate.py
- Verify build:
npm run build
- Check documentation updated
Validators:
- quality-gates/validate.py (aggregates all)
- security-sentinel/validate-security.py
- drizzle-orm-patterns/validate-queries.py
Validation Rules
TypeScript Strict Mode
function process(data: any) { }
function process(data: UserData): ProcessedData { }
const value = getData()
if (isValidData(value)) {
const data = getData()
}
const user = users.find(u => u.id === id)!
const user = users.find(u => u.id === id)
if (!user) throw new Error('User not found')
Input Validation
export async function POST(request: Request) {
const body = await request.json()
const user = await createUser(body)
}
import { z } from 'zod'
const createUserSchema = z.object({
email: z.string().email(),
password: z.string().min(8),
})
export async function POST(request: Request) {
const body = await request.json()
const validated = createUserSchema.parse(body)
const user = await createUser(validated)
}
Error Handling
async function fetchUser(id: string): Promise<User> {
const response = await fetch(`/api/users/${id}`)
return response.json()
}
async function fetchUser(id: string): Promise<User> {
try {
const response = await fetch(`/api/users/${id}`)
if (!response.ok) {
throw new Error(`Failed to fetch user: ${response.status}`)
}
return await response.json()
} catch (error) {
logger.error('fetchUser failed', { id, error })
throw new Error(`Failed to fetch user ${id}`)
}
}
Security
const apiKey = 'sk_live_abc123'
const apiKey = process.env.STRIPE_API_KEY
if (!apiKey) throw new Error('STRIPE_API_KEY not set')
const query = `SELECT * FROM users WHERE email = '${email}'`
const user = await prisma.user.findUnique({ where: { email } })
Test Quality
it('should work', () => {
const result = doThing()
expect(result).toBe(true)
const other = doOther()
expect(other).toBe(false)
})
it('should return true for valid input', () => {
const input = { valid: true }
const result = doThing(input)
expect(result).toBe(true)
})
it('should change color', () => {
fireEvent.click(button)
expect(mockSetColor).toHaveBeenCalled()
})
it('should change color', () => {
const button = getByTestId('button')
expect(button).toHaveClass('bg-blue-500')
fireEvent.click(button)
(button).()
})
Progressive Disclosure
Agents load metadata first (this file), then supporting files as needed:
- SKILL.md (this file) - Overview and quick reference
- checkpoint-framework.md - Detailed gate requirements
- validation-rules.md - Comprehensive validation criteria
- test-patterns.md - TDD patterns and coverage requirements
- validate.py - Automated validation script
Usage Pattern
1. Load quality-gates skill metadata
2. Check pre-implementation gate
3. Plan implementation
4. Check implementation gate during coding
5. Write tests
6. Check testing gate
7. Request code review
8. Check review gate
9. Finish only when all gates pass
Integration with Other Skills
Quality gates aggregate validation from:
- typescript-strict-guard: Type safety validation
- security-sentinel: Security vulnerability checks
- nextjs-15-specialist: Next.js pattern compliance
- drizzle-orm-patterns: Database query safety
- tdd-enforcer: Test coverage and quality
Critical Rules
- Never bypass gates - If a gate fails, fix the issue, don't skip
- Fail fast - Check gates early and often
- Automate validation - Use validate.py before finishing
- Document exceptions - Any deviation needs explicit approval
See Also
- checkpoint-framework.md - Detailed gate requirements
- validation-rules.md - Complete validation rules
- test-patterns.md - TDD patterns
- ../typescript-strict-guard/SKILL.md - TypeScript validation
- ../security-sentinel/SKILL.md - Security validation