Step 4: API integration tests - requires GATE 3 passed
Writes API integration tests with real database and full HTTP cycle coverage. Use this after unit tests pass to validate endpoints, auth, and data mutations against the spec.
/plugin marketplace add packlikez/claude-code-dev-plugin/plugin install dev@packlikez-dev-plugins<feature-name>□ GATE 3 PASSED (backend unit tests complete)
□ All unit tests passing with ≥80% coverage
cat specs/{type}/{feature-name}.md # Spec (source of truth)
cat src/routes/{feature}.ts # Route implementation
cat tests/unit/services/{feature}*.test.ts # Unit tests (what's tested)
cat skills/test-patterns-api.md # API test patterns
cat skills/gate-4-api-test.md # Gate 4 criteria
## What Unit Tests Cover
- Service layer logic
- Validation rules (mocked DB)
## What API Tests Must Cover
- Full HTTP request/response cycle
- Real database (no mocks)
- Auth middleware integration
- Response format matches spec
- Database state after mutations
Use Task tool with test-writer agent:
Write API integration tests for {feature-name}:
- Real database (no mocks)
- Every endpoint from spec
- Every error response from spec
- Isolated seed data per test
- Follow test-patterns-api skill
Real Infrastructure (no mocks):
Per Endpoint:
Database Verification:
If response doesn't match spec:
Use AskUserQuestion:
"API response doesn't match spec:
Spec says: {expected}
API returns: {actual}
Options:
1. Fix implementation
2. Update spec"
Load api-contract skill for format:
cat skills/api-contract.md
After tests pass, generate contract following the skill format.
Use Task tool with gate-keeper agent:
Validate GATE 4 for {feature-name}
See gate-4-api-test skill for all 26 criteria.
tests/integration/api/tests/seeds/api-contracts/{feature}.yaml