| 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:
- Requirements fully understood
- Architecture decision made
- Types and interfaces planned
- Dependencies identified
- Security implications assessed
- Pattern compliance verified
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:
- TypeScript strict mode (no
any, no@ts-ignore) - Explicit types on all functions (params + return)
- Error handling for all failure cases
- Input validation using Zod schemas
- No hardcoded secrets (use env vars)
- No console.log statements
- Security best practices followed
How to pass:
- Run TypeScript compiler:
npx tsc --noEmit - Check for
anytypes: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:
- Tests written FIRST (TDD)
- AAA pattern followed (Arrange, Act, Assert)
- Coverage ≥ 75% overall
- Coverage ≥ 90% for business logic (services, utils)
- All tests passing
- No skipped tests without reason
- E2E tests for visual state changes
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:
- Code review passed (no critical issues)
- Security audit passed (OWASP Top 10)
- All quality gates passed
- Documentation updated if needed
- No breaking changes without migration plan
- Build succeeds:
npm run build
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
// ❌ BLOCKS: Using 'any' type
function process(data: any) { }
// ✅ PASSES: Explicit types
function process(data: UserData): ProcessedData { }
// ❌ BLOCKS: @ts-ignore
// @ts-ignore
const value = getData()
// ✅ PASSES: Type guard
if (isValidData(value)) {
const data = getData()
}
// ❌ BLOCKS: Non-null assertion
const user = users.find(u => u.id === id)!
// ✅ PASSES: Null handling
const user = users.find(u => u.id === id)
if (!user) throw new Error('User not found')
Input Validation
// ❌ BLOCKS: No validation
export async function POST(request: Request) {
const body = await request.json()
const user = await createUser(body) // Unsafe!
}
// ✅ PASSES: Zod validation
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
// ❌ BLOCKS: No error handling
async function fetchUser(id: string): Promise<User> {
const response = await fetch(`/api/users/${id}`)
return response.json() // What if it fails?
}
// ✅ PASSES: Proper error handling
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
// ❌ BLOCKS: Hardcoded secrets
const apiKey = 'sk_live_abc123'
// ✅ PASSES: Environment variables
const apiKey = process.env.STRIPE_API_KEY
if (!apiKey) throw new Error('STRIPE_API_KEY not set')
// ❌ BLOCKS: SQL injection risk
const query = `SELECT * FROM users WHERE email = '${email}'`
// ✅ PASSES: Parameterized queries (Prisma)
const user = await prisma.user.findUnique({ where: { email } })
Test Quality
// ❌ BLOCKS: No AAA pattern
it('should work', () => {
const result = doThing()
expect(result).toBe(true)
const other = doOther()
expect(other).toBe(false)
})
// ✅ PASSES: AAA pattern
it('should return true for valid input', () => {
// ARRANGE: Setup test data
const input = { valid: true }
// ACT: Execute behavior
const result = doThing(input)
// ASSERT: Verify outcome
expect(result).toBe(true)
})
// ❌ BLOCKS: Only mock assertions for UI
it('should change color', () => {
fireEvent.click(button)
expect(mockSetColor).toHaveBeenCalled()
})
// ✅ PASSES: DOM state assertions
it('should change color', () => {
const button = getByTestId('button')
expect(button).toHaveClass('bg-blue-500')
fireEvent.click(button)
expect(button).toHaveClass('bg-red-500')
})
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
// Agent workflow example:
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