npx claudepluginhub joshuarweaver/cascade-code-general-misc-1 --plugin packlikez-claude-code-dev-plugin<feature-name># Step 4: API Integration Tests ## Prerequisites ## Process ### 1. Load Context ### 2. Build Context Map ### 3. Delegate to Test Writer Use Task tool with `test-writer` agent: ### 4. Key Requirements **Real Infrastructure (no mocks):** - Real database (test DB) - Real services - Real auth middleware - Only mock external APIs **Per Endpoint:** - Success response (200/201) - Validation error (400) - Unauthorized (401) - Forbidden (403) if roles - Not found (404) - Conflict (409) if unique **Database Verification:** - Check state after mutations - Verify rollback on errors ##...
/api-testRuns API testing workflow: validates endpoints, performs load testing, and generates tests.
/api-testRuns API testing workflow: validates endpoints, performs load testing, and generates tests.
□ 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