一键导入
recipe-add-integration-tests
Add integration/E2E tests to existing codebase using Design Docs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add integration/E2E tests to existing codebase using Design Docs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Anti-pattern detection, root-cause discipline, quality check workflow, and implementation completeness assurance. Use when: fixing bugs, reviewing code quality, refactoring, making technical decisions, or performing quality assurance.
Language-agnostic coding standards for maintainability, readability, and quality. Use when: implementing features, refactoring code, reviewing code quality, or writing functions.
Documentation creation criteria for PRD, ADR, Design Doc, UI Spec, and Work Plan with templates. Use when: creating or reviewing technical documents, determining which documents are required, or following document templates.
Implementation strategy selection framework with meta-cognitive approach. Use when: planning implementation strategy, selecting between vertical/horizontal slicing, or defining verification criteria for tasks.
Integration and E2E test design principles, value-based selection, test skeleton specification, and review criteria. Use when: designing integration tests, E2E tests, generating test skeletons, or reviewing test quality.
Guides subagent coordination through implementation workflows. Use when: orchestrating multiple agents, managing workflow phases, determining autonomous execution mode, or coordinating recipe execution.
| name | recipe-add-integration-tests |
| description | Add integration/E2E tests to existing codebase using Design Docs. |
testing — test strategy and quality gatesintegration-e2e-testing — integration and E2E test patternsdocumentation-criteria — document creation rules and templatesllm-friendly-context — clear prompts, handoffs, and generated artifactsSpawn rule: every spawn_agent call uses fork_turns="none" so the subagent receives only the task message and explicitly provided context.
Context: Test addition workflow for existing implementations
Core Identity: "I am not a worker. I am an orchestrator."
First Action: Register Steps 0-8 before any execution.
Why Spawn: Orchestrator's context is shared across all steps. Direct implementation consumes context needed for review and quality check phases. Task files create context boundaries. Subagents work in isolated context.
Execution Method:
Document paths: $ARGUMENTS
Reference documentation-criteria skill for task file template in Step 3.
# Verify at least one document path was provided
test -n "$ARGUMENTS" || { echo "ERROR: No document paths provided"; exit 1; }
# Verify provided paths exist
ls $ARGUMENTS
Use only the user-provided paths in $ARGUMENTS. Do not auto-discover additional Design Docs or UI Specs.
Classify provided documents by path and filename, using first-match-wins:
docs/ui-spec/*.md -> UI Specdocs/design/*-backend-*.md or docs/design/*backend*.md -> Design Doc (backend)docs/design/*-frontend-*.md or docs/design/*frontend*.md -> Design Doc (frontend)docs/design/*.md and none of the above -> single-layer Design DocIf a filename appears to match both backend and frontend, halt and ask the user which layer it belongs to.
Spawn acceptance-test-generator agent with only the documents that exist from Step 1:
Generate test skeletons from the following documents:
- Design Doc (backend): [path] <- include only if exists
- Design Doc (frontend): [path] <- include only if exists
- UI Spec: [path] <- include only if exists
Expected output: generatedFiles as a structured object grouped by layer, for example:
{
"backend": ["path/to/backend.int.test.ts"],
"frontend": ["path/to/frontend.int.test.ts"],
"e2e": ["path/to/flow.e2e.test.ts"]
}
[STOP — BLOCKING] Present task file content to user for confirmation before proceeding to implementation. CANNOT proceed until user explicitly confirms.
Create one task file per layer, using the monorepo-flow.md naming convention for deterministic agent routing:
docs/plans/tasks/integration-tests-backend-task-YYYYMMDD.mddocs/plans/tasks/integration-tests-frontend-task-YYYYMMDD.mddocs/plans/tasks/integration-tests-backend-task-YYYYMMDD.mdTemplate (per task file):
---
name: Implement [layer] integration tests for [feature name]
type: test-implementation
---
## Objective
Implement test cases defined in skeleton files.
## Target Files
- Skeleton: [layer-specific paths from Step 2 generatedFiles]
- Design Doc: [layer-specific Design Doc from Step 1]
## Tasks
- [ ] Implement each test case in skeleton
- [ ] Verify all tests pass
- [ ] Ensure coverage meets requirements
## Acceptance Criteria
- All skeleton test cases implemented
- All tests passing
- No quality issues
Output: "Task file(s) created at [path(s)]. Ready for Step 4."
For each task file from Step 3, invoke task-executor routed by filename pattern:
*-backend-task-* -> Spawn task-executor*-frontend-task-* -> Spawn task-executor-frontendExecute one task file at a time through Steps 4 -> 5 -> 6 -> 7 before starting the next.
Expected output: status, testsAdded
Spawn integration-test-reviewer agent: "Review test quality. Test files: [paths from Step 4 testsAdded]. Skeleton files: [layer-specific paths from Step 2 generatedFiles matching current task's layer]."
Expected output: status (approved/needs_revision), requiredFixes
Check Step 5 result:
status: approved -> Mark complete, proceed to Step 7status: needs_revision -> Spawn the layer-appropriate executor with: "Fix the following issues in test files: [requiredFixes from Step 5]." Then return to Step 5. Maximum 2 revision cycles per task file; if still needs_revision, escalate to the user.Spawn quality-fixer routed by task filename pattern:
*-backend-task-* -> Spawn quality-fixer*-frontend-task-* -> Spawn quality-fixer-frontendExpected output: status (stub_detected/approved/blocked)
On quality-fixer result:
status: "stub_detected" -> Return to Step 4 with stubFindingsstatus: "blocked" -> Escalate to userstatus: "approved" -> Commit test filesdocs/plans/tasks/Before the completion report, delete only the integration-test task files this recipe created for the current run. Their work is committed; docs/plans/ is ephemeral working state.
If cleanup fails, report the failed path but do not invalidate completed test work.