一键导入
phase-finalize
Use when entering Finalize phase of epic-stage-workflow - guides code review, testing, documentation, and final commits
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when entering Finalize phase of epic-stage-workflow - guides code review, testing, documentation, and final commits
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | phase-finalize |
| description | Use when entering Finalize phase of epic-stage-workflow - guides code review, testing, documentation, and final commits |
The Finalize phase ensures code quality through review, adds tests if needed, creates documentation, and commits all work. This is the only phase where tracking files are committed.
epic-stage-workflow skill has been invoked (shared rules loaded)Every step in Finalize MUST be delegated to a subagent. Main agent coordinates only.
1. Delegate to code-reviewer (Opus) for pre-test code review
2. [Implement ALL review suggestions]
→ Delegate to fixer (Haiku) or scribe (Haiku) as appropriate
ALL suggestions are mandatory regardless of severity
3. [CONDITIONAL: Test writing]
IF tests were NOT written during Build phase:
→ Delegate to test-writer (Sonnet) to write missing tests
4. Delegate to tester (Haiku) to run all tests
5. [CONDITIONAL: Second code review]
IF implementation code changed after step 2 OR existing code/tests were refactored:
→ Delegate to code-reviewer (Opus) for post-test review
ELSE (ONLY new test files added, zero changes to existing code):
→ Skip second review
**Self-check before skipping:** Did you modify ANY existing file after first review?
- Refactored test utilities? → Second review required
- Extracted helper functions? → Second review required
- Renamed variables for clarity? → Second review required
- Reordered parameters? → Second review required
- ANY change requiring human judgment? → Second review required
- ONLY added brand new test files with zero existing file edits? → May skip second review
**"Formatting" = automated tool output ONLY:**
- Prettier reformatting whitespace → Not second review trigger
- ESLint auto-fixes (--fix flag) → Not second review trigger
- ANY human-decided change → Second review required
**Test**: Did a human decide to make this change? → Second review required
**Implementing first review feedback IS a human decision:**
- First review says "improve naming" → YOU chose WHICH names, HOW to rename
- First review says "add error handling" → YOU chose WHERE and WHAT kind
- First review approves the approach; second review verifies execution
- "I'm just following reviewer guidance" → You still made implementation choices
6. [CONDITIONAL: Documentation]
IF complex feature OR API OR public-facing:
→ Delegate to doc-writer (Opus)
ELSE (simple internal change):
→ Delegate to doc-writer-lite (Sonnet) OR skip if minimal
**Documentation-Only Stages Require Two-Pass Verification:**
IF stage deliverable is ONLY documentation (no implementation code):
→ First pass: Usability, structure, completeness
- Clear sections and organization?
- Proper formatting and readability?
- Complete workflow coverage?
→ Second pass: Technical accuracy and cross-reference validation
- **Verify every env var name** against actual .env files or code
- **Verify every command** exists (check package.json scripts, available CLI commands)
- **Verify every code sample** matches actual codebase patterns
- **Verify every technical claim** (e.g., "safe in development" - safe HOW? missing warnings?)
- Cross-reference with actual implementation files
**"Looks good" is NOT sufficient for documentation-only stages.**
You must READ the referenced code/config AND verify the documentation matches.
Do not assume env var names, commands, or technical details are correct just because they "look plausible."
**Verification means actual checking, not skimming:**
- Search for exact env var names in .env.example or code (don't just read and assume)
- Run `grep` or `cat` to verify commands in package.json exist exactly as documented
- When exhausted, verification discipline matters MOST - errors cost more than 3 minutes of careful checking
**Common Rationalizations for Skipping Second Pass:**
| Excuse | Reality |
|--------|---------|
| "First pass looked good, no need for second" | First pass catches structure issues, second catches semantic errors |
| "Documentation author probably got it right" | Evidence shows technical inaccuracies in structurally-sound docs |
| "Env var names look plausible" | Plausible ≠ correct. Verify against actual code. |
| "Commands follow common patterns" | Common pattern ≠ exists. Check package.json scripts. |
| "User will catch any errors" | User shouldn't need to. That's what verification is for. |
| "Time pressure, ship it" | Shipping wrong env vars costs more time in support than verification takes |
| "It's just documentation" | Wrong documentation is worse than no documentation - creates false confidence |
7. Delegate to doc-updater (Haiku) to write to changelog/<date>.changelog.md
8. Main agent creates implementation commit:
- ONLY add implementation files (code, tests, docs): `git add <specific files>`
- Include commit hash in message
- **NEVER use `git add -A`** - it picks up uncommitted tracking files
9. Delegate to doc-updater (Haiku) to add commit hash to changelog entry
10. Main agent commits changelog update:
- ONLY commit changelog: `git add changelog/<date>.changelog.md`
- Commit message: "chore: add commit hash to STAGE-XXX-YYY changelog"
11. Delegate to doc-updater (Haiku) to update tracking documents:
- Mark Finalize phase complete in STAGE-XXX-YYY.md
- Update stage status to "Complete" in STAGE-XXX-YYY.md
- Update stage status in epic's EPIC-XXX.md table (MANDATORY - mark as Complete)
- Update epic "Current Stage" to next stage
12. Main agent commits tracking files:
- ONLY commit tracking files: `git add epics/EPIC-XXX/STAGE-XXX-YYY.md epics/EPIC-XXX/EPIC-XXX.md`
- Commit message: "chore: mark STAGE-XXX-YYY Complete"
- **NEVER use `git add -A`** - it picks up unrelated uncommitted files
ALL code review suggestions must be implemented, regardless of severity:
git add -A Problem (CRITICAL)Never use git add -A, git add ., or git commit -a
When doc-updater updates tracking files, it does NOT commit them. If tracking files remain uncommitted and a later stage uses git add -A, it picks up:
ALWAYS use specific file paths:
# CORRECT - Tracking files
git add epics/EPIC-XXX/STAGE-XXX-YYY.md epics/EPIC-XXX/EPIC-XXX.md
# CORRECT - Changelog
git add changelog/2026-01-13.changelog.md
# CORRECT - Implementation files (list each one)
git add packages/llm/src/file1.ts packages/llm/src/file2.ts docs/guide.md
# WRONG - Picks up everything
git add -A
git add .
git commit -a
IF USER SAYS: "We're behind schedule" / "Just ship it" / "Go fast" / "Skip the formality"
YOU MUST STILL:
Time pressure is not a workflow exception. Fast delivery comes from efficient subagent coordination, not from skipping safety checks. Exit gates take 2-3 minutes total.
Documentation-only or tracking-only stages:
Exit gate applies to ALL stages, regardless of work type or change size.
Rationalizations that don't work:
Note: The exit gate (steps 1-5 below) covers the final stage-completion steps. Implementation commits (workflow steps 8-10) happen BEFORE the exit gate begins.
Before completing the stage, you MUST complete these steps IN ORDER:
git add epics/EPIC-XXX/STAGE-XXX-YYY.md epics/EPIC-XXX/EPIC-XXX.mdgit add -Alessons-learnedjournalWhy this order?
Committing before lessons/journal ensures tracking state is saved. Lessons and journal need the commit to have happened (they may reference the commit hash).
Stage is now complete. No further phase to invoke - the stage workflow is finished.
DO NOT skip any exit gate step.
DO NOT claim the stage is complete until exit gate is done. This includes:
/next_task for the next stageComplete ALL exit gate steps FIRST. Then the stage is truly complete.
Use when creating new projects requiring structured phased development, bootstrapping epic/stage hierarchy, creating new epics, or creating new stages.
Use when implementing or working on existing epics and stages, after running /next_task, during Design/Build/Refinement/Finalize phases, or when session protocols apply.
Use when reviewing learnings and journal entries to identify improvement opportunities across skills, documentation, and processes
Use when entering Build phase of epic-stage-workflow - guides implementation planning, code writing, and verification
Use when entering Design phase of epic-stage-workflow - guides task discovery, context gathering, and approach selection
Use when entering Refinement phase of epic-stage-workflow - guides user testing, feedback incorporation, and iteration