Quick Summary
Goal: Analyze an implementation plan, assess its impact on the codebase, and update specification documents accordingly.
Workflow:
- Discovery — Parse plan, extract requirements, catalog planned changes
- Knowledge Graph — Build detailed component-level impact map with test/spec mappings
- Analysis — Assess architecture impact, business logic changes, testing strategy
- Approval Gate — Present findings for explicit user approval before any spec updates
- Spec Update — Execute approved changes to specification documents
Key Rules:
- Planning-only skill -- never implement code changes
- Always collaborate and get user approval before proceeding
- Maintain bidirectional traceability between plan and specification
Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence percentages (Idea should be more than 80%).
Implementation Plan Analysis & Specification Update
PLANNING-ONLY — Collaboration Required
DO NOT use the EnterPlanMode tool — you are ALREADY in a planning workflow.
DO NOT implement or execute any code changes.
COLLABORATE with the user: ask decision questions, present options with recommendations.
After plan analysis, validate findings with user approval.
ASK user to confirm the analysis before any next steps.
You are to operate as an expert full-stack principal developer, software architect, and technical analyst to analyze a detailed implementation plan, perform comprehensive impact analysis, and update specification documents using the configured repository stack.
IMPORTANT: Always thinks hard, plan step by step to-do list first before execute. Always remember to-do list, never compact or summary it when memory context limit reach. Always preserve and carry your to-do list through every operation.
Prerequisites:
PHASE 1: EXTERNAL MEMORY-DRIVEN IMPLEMENTATION PLAN ANALYSIS
Build a structured knowledge model in .ai/workspace/analysis/[plan-name].analysis.md.
PHASE 1A: INITIALIZATION AND DISCOVERY
- Initialize the analysis file with standard headings
IMPLEMENTATION PLAN COMPREHENSIVE ANALYSIS
IMPLEMENTATION_PLAN_DEEP_ANALYSIS: Thorough analysis of the implementation plan file:
Plan Structure Analysis:
- Read and parse the implementation plan completely
- Extract all planned features, requirements, and changes
- Identify implementation phases and dependencies
- Document under
## Implementation Plan Overview
Requirements Extraction:
- Parse Knowledge Graph from implementation plan
- Extract new business requirements
- Map functional and non-functional requirements
- Identify changed business workflows
- Document under
## Extracted Requirements
Planned Changes Analysis:
- Catalog all planned code changes (new files, modifications, deletions)
- Identify affected components, services, and layers
- Map file-level changes to business capabilities
- Extract integration points
- Document under
## Planned Changes Analysis
Architecture Impact Assessment:
- Analyze how changes affect overall system architecture
- Identify CQRS pattern impacts (new Commands/Queries/Events)
- Map domain entity changes and repository patterns
- Document under
## Architecture Impact Assessment
Existing Specification Analysis:
- Read and analyze existing specification document structure
- Identify current test cases, requirements, entity relationships
- Map existing test coverage to planned changes
- Document under
## Current Specification Analysis
AFFECTED_COMPONENTS_DISCOVERY: For each planned change, discover:
- Direct Dependencies
- Indirect Dependencies
- Test Coverage Impact
- API Integration Impact
- Cross-Service Communication
- Database Schema Impact
Save to ## Comprehensive File List with:
filePath, changeType, relationshipType, impactLevel
serviceContext, planContext, specificationRelevance
PHASE 1B: KNOWLEDGE GRAPH CONSTRUCTION
IMPORTANT: MUST ATTENTION DO WITH TODO LIST
For each file, document in ## Knowledge Graph:
- Standard fields plus plan-specific:
currentContent: Existing functionality (if file exists)
plannedChanges: Specific changes planned
changeImpactAnalysis: How changes affect other components
testingRequirements: New test cases needed
specificationMapping: How component maps to spec sections
testCaseImpact: Existing test cases needing modification
PHASE 1C: SPECIFICATION MAPPING ANALYSIS
- Test Case Mapping: Which existing test cases are affected
- Business Requirement Mapping: How new requirements relate to existing
- Entity Relationship Impact: Changes to entity relationships
- Workflow Integration: How new workflows integrate with existing
- Coverage Gap Analysis: Areas where new test cases needed
PHASE 1D: OVERALL ANALYSIS
Write comprehensive summary showing:
- Complete end-to-end workflows affected
- Architectural patterns impacted
- Business logic workflow changes
- Integration points affected
- Comprehensive test coverage requirements
PHASE 2: COMPREHENSIVE ANALYSIS AND PLANNING
Generate detailed analysis under these headings:
Implementation Impact Analysis: Component impact, integration points, data flow changes, architectural-pattern compliance
Business Logic Analysis: New business rules, modified workflows, validation requirements
Testing Strategy Analysis: Test coverage requirements, new test scenarios, regression testing needs
Specification Update Strategy: How to integrate new requirements, maintain traceability, preserve existing coverage
Rollback and Safety Strategy: Backup procedures, rollback plan, validation checkpoints
PHASE 3: APPROVAL GATE
CRITICAL: Present comprehensive analysis for explicit approval. DO NOT proceed without it.
PHASE 4: SPECIFICATION UPDATE EXECUTION
Once approved, execute with MANDATORY steps:
- Backup Original Specification
- Read and Parse Existing Specification
- Execute Planned Updates:
- New Requirements Integration
- Entity Relationship Updates
- Test Case Enhancement
- Traceability Matrix Updates
- Coverage Analysis Updates
- Maintain Specification Structure
- Quality Assurance Validation
SUCCESS VALIDATION
Verify under ## Specification Validation:
- Requirements Traceability: All plan requirements mapped
- Test Coverage Validation: All changes covered by tests
- Business Workflow Validation: End-to-end workflows documented
- Integration Testing Coverage: Cross-service impacts covered
- Regression Prevention: Existing functionality protected
Plan Analysis Guidelines
- Plan-Driven Analysis: Base all analysis on the detailed implementation plan
- Specification Structure Preservation: Maintain standardized specification format
- Comprehensive Impact Assessment: Analyze direct and indirect effects
- End-to-End Workflow Mapping: Understand affected business processes
- Enterprise Architecture Awareness: Respect the project's architectural patterns
- Quality-Focused Testing: Create comprehensive test specifications
- Specification Completeness: Ensure full traceability
- Risk Assessment and Mitigation: Identify risks and provide rollback strategies
- Bidirectional Traceability: Maintain clear mapping between plan and spec
- Coverage Preservation: Maintain existing test coverage while adding new
Related
REMINDER — Planning-Only Skill
DO NOT use EnterPlanMode tool.
DO NOT start implementing.
ALWAYS validate with user approval after analysis.
ASK user to confirm findings before any execution begins.
ASK user for clarification when multiple approaches exist.
[IMPORTANT] Use TaskCreate to break ALL work into small tasks BEFORE starting — including tasks for each file read. This prevents context loss from long files. For simple tasks, AI MUST ATTENTION ask user whether to skip.
Prerequisites:
docs/specs/ — Test specifications by module (read existing TCs to include test strategy in plan)
AI Mistake Prevention — Failure modes to avoid on every task:
Re-read files after context changes. Context compaction, resume, or long-running work can make memory stale; verify current files before acting.
Verify generated content against source evidence. AI hallucinates APIs, names, claims, and document facts. Check the relevant source before documenting or referencing.
Check downstream references before deleting or renaming. Removing an artifact can stale docs, generated mirrors, configs, and callers; map references first.
Trace the full impact chain after edits. Changing a definition can miss derived outputs and consumers. Follow the affected chain before declaring done.
Verify ALL affected outputs, not just the first. One green check is not all green checks; validate every output surface the change can affect.
Assume existing values are intentional — ask WHY before changing OR flagging one as a defect. Before changing or reporting a constant, limit, flag, cutoff, wording, or pattern, read nearby context and history, the CALLER's ordering, and 2+ sibling call sites of the same convention. A doc stating WHAT without WHY is missing rationale, not proof of a missing guard.
Surface ambiguity before acting — don't pick silently. Multiple valid interpretations require an explicit question or stated assumption with risk.
Assert the outcome your system owns, not the intermediate state your infrastructure owns. When verifying async work, assert the final business state — never the delivery/retry bookkeeping held in shared infrastructure that any co-running process can write. Such a check passes when run alone and flakes the moment anything else shares that infrastructure.
Keep shared guidance role-relevant. Universal guidance must help every receiving skill or agent; code-specific obligations belong only in code-specific protocols.
Understand Code First — HARD-GATE: Do NOT write, plan, or fix until you READ existing code.
- Search 3+ similar patterns (
grep/glob) — cite file:line evidence
- Read existing files in target area — understand structure, base classes, conventions
- Run
python .claude/scripts/code_graph trace <file> --direction both --json when .code-graph/graph.db exists
- Map dependencies via
connections or callers_of — know what depends on your target
- Write investigation to
.ai/workspace/analysis/ for non-trivial tasks (3+ files)
- Re-read analysis file before implementing — never work from memory alone. — why: long context drifts from the file; the file is ground truth
- NEVER invent new patterns when existing ones work — match exactly or document deviation. — why: divergent patterns fragment the codebase and slow every future reader
BLOCKED until: - [ ] Read target files - [ ] Grep 3+ patterns - [ ] Graph trace (if graph.db exists) - [ ] Assumptions verified with evidence
Evidence-Based Reasoning — Speculation is FORBIDDEN. Every claim needs proof.
- Cite
file:line, grep results, or framework docs for EVERY claim
- Declare confidence: >80% act freely, 60-80% verify first, <60% DO NOT recommend
- Cross-service validation required for architectural changes
- "I don't have enough evidence" is valid and expected output
BLOCKED until: - [ ] Evidence file path (file:line) - [ ] Grep search performed - [ ] 3+ similar patterns found - [ ] Confidence level stated
Forbidden without proof: "obviously", "I think", "should be", "probably", "this is because"
If incomplete → output: "Insufficient evidence. Verified: [...]. Not verified: [...]."
Nested Task Expansion Contract — For workflow-step invocation, the [Workflow] ... row is only a parent container; the child skill still creates visible phase tasks.
- Call
TaskList first. If a matching active parent workflow row exists, set nested=true and record parentTaskId; otherwise run standalone.
- Create one task per declared phase before phase work. When nested, prefix subjects
[N.M] $skill-name — phase.
- When nested, link the parent with
TaskUpdate(parentTaskId, addBlockedBy: [childIds]).
- Orchestrators must pre-expand a child skill's phase list and link the workflow row before invoking that child skill or sub-agent.
- Mark exactly one child
in_progress before work and completed immediately after evidence is written.
- Complete the parent only after all child tasks are completed or explicitly cancelled with reason.
Blocked until: TaskList done, child phases created, parent linked when nested, first child marked in_progress.
Project Reference Docs Gate — Run after task-tracking bootstrap and before target/source file reads, grep, edits, or analysis. Project docs override generic framework assumptions.
- Identify scope: file types, domain area, and operation.
- Read
docs/project-config.json first — the project's machine-readable map. It is the single source of truth for THIS repo (modules/paths, framework + search keywords, test/E2E/integration run-commands, design system, architecture rules, workflow patterns); ground exact paths, run-commands, and conventions on it before investigating, planning, or coding — never assume framework defaults (CLAUDE.md + reference docs are derived from it). If it — or the docs index, lessons.md, CLAUDE.md, AGENTS.md, or any required reference doc — is missing or stale, auto-run /project-init or the narrow route (/project-config, /docs-init, /scan-all, /scan --target=<key>, /claude-md-init) first; if Codex mirrors or AGENTS.md are stale, ask the user to run /sync-codex (never auto-run it).
- Required docs by trigger: always
docs/project-reference/lessons.md; doc lookup docs-index-reference.md; review code-review-rules.md; backend/CQRS/API backend-patterns-reference.md; domain/entity domain-entities-reference.md; frontend/UI frontend-patterns-reference.md; styles/design scss-styling-guide.md + design-system/design-system-canonical.md; integration tests integration-test-reference.md; E2E e2e-test-reference.md; feature docs/specs feature-spec-reference.md + spec-system-reference.md + spec-principles.md; behavior/public-contract/spec-test-code sync workflow-spec-test-code-cycle-reference.md; derived spec index/ERD/reimplementation guides spec-system-reference.md + source Feature Specs under docs/specs/; architecture/new area project-structure-reference.md.
- Read every required doc, then before target work state:
Reference docs read: ... | Not applicable: ....
Ready when: scope evaluated, docs/project-config.json consulted, required docs checked/read or setup route completed, lessons.md confirmed, citation emitted.
Task Tracking & External Report Persistence — Bootstrap this before execution; then run project-reference doc prefetch before target/source work.
- Create a small task breakdown before target file reads, grep, edits, or analysis. On context loss, inspect the current task list first.
- Mark one task
in_progress before work and completed immediately after evidence; never batch transitions.
- For plan/review work, create
plans/reports/{skill}-{YYMMDD}-{HHmm}-{slug}.md before first finding.
- Append findings after each file/section/decision and synthesize from the report file at the end.
- Final output cites
Full report: plans/reports/{filename}.
Blocked until: task breakdown exists, report path declared for plan/review work, first finding persisted before the next finding.
Critical Thinking Mindset — Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence >80% to act.
Anti-hallucination: Never present guess as fact — cite sources for every claim, admit uncertainty freely, self-check output for errors, cross-reference independently, stay skeptical of own confidence — certainty without evidence root of all hallucination.
Sequential Thinking Protocol — Structured multi-step reasoning for complex/ambiguous work. Use when planning, reviewing, debugging, or refining ideas where one-shot reasoning is unsafe.
Trigger when: complex problem decomposition · adaptive plans needing revision · analysis with course correction · unclear/emerging scope · multi-step solutions · hypothesis-driven debugging · cross-cutting trade-off evaluation.
Format (explicit mode — visible thought trail):
Thought N/M: [aspect] — one aspect per thought, state assumptions/uncertainty
Thought N/M [REVISION of Thought K]: ... — when prior reasoning invalidated; state Original / Why revised / Impact
Thought N/M [BRANCH A from Thought K]: ... — explore alternative; converge with decision rationale
Thought N/M [HYPOTHESIS]: ... then [VERIFICATION]: ... — test before acting
Thought N/N [FINAL] — only when verified, all critical aspects addressed, confidence >80%
Mandatory closers: Confidence % stated · Assumptions listed · Open questions surfaced · Next action concrete.
Stop conditions: confidence <80% on any critical decision → escalate via AskUserQuestion · ≥3 revisions on same thought → re-frame the problem · branch count >3 → split into sub-task.
Implicit mode: apply methodology internally without visible markers when adding markers would clutter the response (routine work where reasoning aids accuracy).
Deep-dive: see /sequential-thinking skill (.claude/skills/sequential-thinking/SKILL.md) for worked examples (API design, debugging, architecture), advanced techniques (spiral refinement, hypothesis testing, convergence), and meta-strategies (uncertainty handling, revision cascades).
Plan Quality — Every plan phase MUST ATTENTION include test specifications.
- Add
## Test Specifications section with TC-{FEATURE}-{NNN} IDs to every phase file
- Map every functional requirement to ≥1 TC (or explicit
TBD with rationale)
- TC IDs follow
TC-{FEATURE}-{NNN} format — reference by ID, never embed full content
- Before any new workflow step: call
TaskList and re-read the phase file
- On context compaction: call
TaskList FIRST — never create duplicate tasks
- Verify TC satisfaction per phase before marking complete (evidence must be
file:line, not TBD)
Mode: TDD-first → reference existing TCs with Evidence: TBD. Implement-first → use TBD → /spec [mode=tests] fills after.
Iterative Phase Quality — Score complexity BEFORE planning.
Complexity signals: >5 files +2, cross-service +3, new pattern +2, DB migration +2
Score >=6 → MUST ATTENTION decompose into phases. Each phase:
- ≤5 files modified
- ≤3h effort
- Follows cycle: plan → implement → review → fix → verify
- Start Phase N+1 only after Phase N passes VERIFY — why: building on an unverified phase compounds errors downstream
Phase success = all TCs pass + code-reviewer agent approves + no CRITICAL findings.
- MANDATORY IMPORTANT MUST ATTENTION include
## Test Specifications with TC IDs per phase. Call TaskList before creating new tasks.
- MANDATORY IMPORTANT MUST ATTENTION search 3+ existing patterns and read code BEFORE any modification. Run graph trace when graph.db exists.
- MANDATORY IMPORTANT MUST ATTENTION cite
file:line evidence for every claim. Confidence >80% to act, <60% = do NOT recommend.
- MANDATORY IMPORTANT MUST ATTENTION score complexity first. Score >=6 → decompose. Each phase: plan → implement → review → fix → verify. No skipping.
MUST ATTENTION apply critical + sequential thinking — every claim needs appropriate traced evidence (file:line for repo/code claims; source URL or artifact section for research, product, content, and docs claims); confidence >80% to act, <60% DO NOT recommend. Anti-hallucination: never present guess as fact, admit uncertainty freely, cross-reference independently, stay skeptical of own confidence.
MUST ATTENTION apply sequential-thinking — multi-step Thought N/M, REVISION/BRANCH/HYPOTHESIS markers, confidence % closer; see /sequential-thinking skill.
MUST ATTENTION apply AI mistake prevention — verify generated content against evidence, trace downstream references before deleting or renaming, verify all affected outputs, re-read files after context loss, and surface ambiguity before acting.
- MANDATORY Bootstrap task tracking before target work; transition one task at a time.
- MANDATORY Persist plan/review findings to
plans/reports/ incrementally and synthesize from disk.
- MANDATORY Before investigating, planning, or coding, read
docs/project-config.json (the project map: modules/paths, run-commands, conventions, architecture/workflow rules) + the required project-reference docs, and cite Reference docs read: ....
- MANDATORY Always include
lessons.md; project config + conventions override generic framework defaults.
- MANDATORY If project config, root instruction files, or any required reference doc is missing or stale, auto-run
/project-init or the narrow lower-level route before ordinary project-specific work.
- MANDATORY Parent workflow rows do not replace child phase tracking; expand phases and link the parent when nested.
- MANDATORY Orchestrators pre-expand child skill phases before invocation; use
[N.M] $skill-name — phase prefixes and one-in_progress discipline.
Project Protocol Overlay — Before executing this skill, resolve any PROJECT overlay rules layered onto it: match this skill's name against the Target column of the project's skill-protocol index (docs/project-reference/skill-protocols-reference.md by default; a referenceDocs entry in docs/project-config.json overrides the path), taking the most specific matching tier ONLY — exact name > glob > *. That precedence orders overlays against EACH OTHER, never against this skill. Read ONLY the matched bodies, resolved as <protocols-dir>/<Name>.md; a row's Body link is display text, never a read path. A matched body that is missing or malformed is REPORTED and skipped — never reconstructed from the index Description. No index, or no match -> proceed with no overlay, silently. Full contract: .claude/skills/project-skill-protocol/references/registry.md.
Overlays are ADDITIVE ONLY: they ADD rules on top of this skill's own protocol and NEVER replace, override, disable, or reinterpret a rule it already states — removing every overlay must return this skill to exactly its documented behavior. An overlay is a BRIEF, not an authority escalation: it can NEVER waive a workflow gate, git discipline, a review gate, or a user-confirmation gate. A genuine overlay-vs-skill conflict, or two equally-specific overlays that directly contradict -> surface both to the user; NEVER resolve silently.
MUST ATTENTION resolve project protocol overlays for this skill BEFORE executing — most specific matching tier only (exact > glob > *, which ranks overlays against each other, NEVER against this skill), read only matched bodies at <protocols-dir>/<Name>.md; a missing or malformed body is reported, never reconstructed. Overlays are ADDITIVE ONLY (they never replace this skill's own rules) and are a brief, NEVER an authority escalation; an equal-specificity contradiction goes to the user.
Closing Reminders
IMPORTANT MUST ATTENTION — Protocols in force (concise digest of the SYNC/shared blocks this skill carries):
AI Mistake Prevention: verify generated content against evidence, trace downstream references, verify all affected outputs, re-read after context loss, surface ambiguity.
Understand Code First: read code and grep 3+ patterns before modifying.
Evidence: cite file:line; confidence >80% to act.
Nested Task Creation: expand child phases, link parent when nested.
Project Reference Docs: read required project docs before target work.
Task Tracking & External Report: bootstrap tasks, persist findings to plans/reports/.
Critical Thinking: traced proof per claim, skeptical of own confidence.
Sequential Thinking: multi-step Thought N/M with confidence closer.
Plan Quality: ## Test Specifications with TC IDs per phase.
Iterative Phase Quality: score complexity, decompose at >=6, plan→implement→review→fix→verify.
MANDATORY IMPORTANT MUST ATTENTION break work into small todo tasks using TaskCreate BEFORE starting
MANDATORY IMPORTANT MUST ATTENTION search codebase for 3+ similar patterns before creating new code
MANDATORY IMPORTANT MUST ATTENTION cite file:line evidence for every claim (confidence >80% to act)
MANDATORY IMPORTANT MUST ATTENTION add a final review todo task to verify work quality
MANDATORY IMPORTANT MUST ATTENTION include Test Specifications section and story_points in plan frontmatter
[TASK-PLANNING] Before acting, analyze task scope and systematically break it into small todo tasks and sub-tasks using TaskCreate.
1---2name: plan-analysis-33description: [Planning] Use when the user provides an implementation plan file and asks to analyze it, assess impact, update specifications, or verify planned changes.4---56## Quick Summary78**Goal:** Analyze an implementation plan, assess its impact on the codebase, and update specification documents accordingly.910**Workflow:**11121. **Discovery** — Parse plan, extract requirements, catalog planned changes132. **Knowledge Graph** — Build detailed component-level impact map with test/spec mappings143. **Analysis** — Assess architecture impact, business logic changes, testing strategy154. **Approval Gate** — Present findings for explicit user approval before any spec updates165. **Spec Update** — Execute approved changes to specification documents1718**Key Rules:**1920- Planning-only skill -- never implement code changes21- Always collaborate and get user approval before proceeding22- Maintain bidirectional traceability between plan and specification2324**Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence percentages (Idea should be more than 80%).**2526# Implementation Plan Analysis & Specification Update2728## PLANNING-ONLY — Collaboration Required2930> **DO NOT** use the `EnterPlanMode` tool — you are ALREADY in a planning workflow.31> **DO NOT** implement or execute any code changes.32> **COLLABORATE** with the user: ask decision questions, present options with recommendations.33> After plan analysis, validate findings with user approval.34> **ASK** user to confirm the analysis before any next steps.3536You are to operate as an expert full-stack principal developer, software architect, and technical analyst to analyze a detailed implementation plan, perform comprehensive impact analysis, and update specification documents using the configured repository stack.3738**IMPORTANT**: Always thinks hard, plan step by step to-do list first before execute. Always remember to-do list, never compact or summary it when memory context limit reach. Always preserve and carry your to-do list through every operation.3940**Prerequisites:**4142---4344## PHASE 1: EXTERNAL MEMORY-DRIVEN IMPLEMENTATION PLAN ANALYSIS4546Build a structured knowledge model in `.ai/workspace/analysis/[plan-name].analysis.md`.4748### PHASE 1A: INITIALIZATION AND DISCOVERY49501. **Initialize** the analysis file with standard headings5152### IMPLEMENTATION PLAN COMPREHENSIVE ANALYSIS5354**IMPLEMENTATION_PLAN_DEEP_ANALYSIS**: Thorough analysis of the implementation plan file:55561. **Plan Structure Analysis**:57 - Read and parse the implementation plan completely58 - Extract all planned features, requirements, and changes59 - Identify implementation phases and dependencies60 - Document under `## Implementation Plan Overview`61622. **Requirements Extraction**:63 - Parse Knowledge Graph from implementation plan64 - Extract new business requirements65 - Map functional and non-functional requirements66 - Identify changed business workflows67 - Document under `## Extracted Requirements`68693. **Planned Changes Analysis**:70 - Catalog all planned code changes (new files, modifications, deletions)71 - Identify affected components, services, and layers72 - Map file-level changes to business capabilities73 - Extract integration points74 - Document under `## Planned Changes Analysis`75764. **Architecture Impact Assessment**:77 - Analyze how changes affect overall system architecture78 - Identify CQRS pattern impacts (new Commands/Queries/Events)79 - Map domain entity changes and repository patterns80 - Document under `## Architecture Impact Assessment`81825. **Existing Specification Analysis**:83 - Read and analyze existing specification document structure84 - Identify current test cases, requirements, entity relationships85 - Map existing test coverage to planned changes86 - Document under `## Current Specification Analysis`8788**AFFECTED_COMPONENTS_DISCOVERY**: For each planned change, discover:8990- Direct Dependencies91- Indirect Dependencies92- Test Coverage Impact93- API Integration Impact94- Cross-Service Communication95- Database Schema Impact9697Save to `## Comprehensive File List` with:9899- `filePath`, `changeType`, `relationshipType`, `impactLevel`100- `serviceContext`, `planContext`, `specificationRelevance`101102### PHASE 1B: KNOWLEDGE GRAPH CONSTRUCTION103104**IMPORTANT: MUST ATTENTION DO WITH TODO LIST**105106For each file, document in `## Knowledge Graph`:107108- Standard fields plus plan-specific:109- `currentContent`: Existing functionality (if file exists)110- `plannedChanges`: Specific changes planned111- `changeImpactAnalysis`: How changes affect other components112- `testingRequirements`: New test cases needed113- `specificationMapping`: How component maps to spec sections114- `testCaseImpact`: Existing test cases needing modification115116### PHASE 1C: SPECIFICATION MAPPING ANALYSIS117118- **Test Case Mapping**: Which existing test cases are affected119- **Business Requirement Mapping**: How new requirements relate to existing120- **Entity Relationship Impact**: Changes to entity relationships121- **Workflow Integration**: How new workflows integrate with existing122- **Coverage Gap Analysis**: Areas where new test cases needed123124### PHASE 1D: OVERALL ANALYSIS125126Write comprehensive summary showing:127128- Complete end-to-end workflows affected129- Architectural patterns impacted130- Business logic workflow changes131- Integration points affected132- Comprehensive test coverage requirements133134---135136## PHASE 2: COMPREHENSIVE ANALYSIS AND PLANNING137138Generate detailed analysis under these headings:1391401. **Implementation Impact Analysis**: Component impact, integration points, data flow changes, architectural-pattern compliance1411422. **Business Logic Analysis**: New business rules, modified workflows, validation requirements1431443. **Testing Strategy Analysis**: Test coverage requirements, new test scenarios, regression testing needs1451464. **Specification Update Strategy**: How to integrate new requirements, maintain traceability, preserve existing coverage1471485. **Rollback and Safety Strategy**: Backup procedures, rollback plan, validation checkpoints149150---151152## PHASE 3: APPROVAL GATE153154**CRITICAL**: Present comprehensive analysis for explicit approval. **DO NOT** proceed without it.155156---157158## PHASE 4: SPECIFICATION UPDATE EXECUTION159160Once approved, execute with MANDATORY steps:1611621. **Backup Original Specification**1632. **Read and Parse Existing Specification**1643. **Execute Planned Updates**:165 - New Requirements Integration166 - Entity Relationship Updates167 - Test Case Enhancement168 - Traceability Matrix Updates169 - Coverage Analysis Updates1704. **Maintain Specification Structure**1715. **Quality Assurance Validation**172173---174175## SUCCESS VALIDATION176177Verify under `## Specification Validation`:178179- **Requirements Traceability**: All plan requirements mapped180- **Test Coverage Validation**: All changes covered by tests181- **Business Workflow Validation**: End-to-end workflows documented182- **Integration Testing Coverage**: Cross-service impacts covered183- **Regression Prevention**: Existing functionality protected184185---186187## Plan Analysis Guidelines188189- **Plan-Driven Analysis**: Base all analysis on the detailed implementation plan190- **Specification Structure Preservation**: Maintain standardized specification format191- **Comprehensive Impact Assessment**: Analyze direct and indirect effects192- **End-to-End Workflow Mapping**: Understand affected business processes193- **Enterprise Architecture Awareness**: Respect the project's architectural patterns194- **Quality-Focused Testing**: Create comprehensive test specifications195- **Specification Completeness**: Ensure full traceability196- **Risk Assessment and Mitigation**: Identify risks and provide rollback strategies197- **Bidirectional Traceability**: Maintain clear mapping between plan and spec198- **Coverage Preservation**: Maintain existing test coverage while adding new199200## Related201202- `plan`203- `workflow-feature`204205- **MANDATORY FINAL TASKS:** After creating all planning todo tasks, ALWAYS add these three final tasks:206 1. **Task: "Write test specifications for each phase"** — Add `## Test Specifications` with TC-{FEATURE}-{NNN} IDs to every phase file. Use `/spec [mode=tests]` if feature docs exist. Use `Evidence: TBD` for TDD-first mode.207 2. **Task: "Run /plan-validate"** — Trigger `/plan-validate` skill to interview the user with critical questions and validate plan assumptions208 3. **Task: "Run /plan-review"** — Trigger `/plan-review` skill to auto-review plan for validity, correctness, and best practices209210## REMINDER — Planning-Only Skill211212> **DO NOT** use `EnterPlanMode` tool.213> **DO NOT** start implementing.214> **ALWAYS** validate with user approval after analysis.215> **ASK** user to confirm findings before any execution begins.216> **ASK** user for clarification when multiple approaches exist.217218---219220> **[IMPORTANT]** Use `TaskCreate` to break ALL work into small tasks BEFORE starting — including tasks for each file read. This prevents context loss from long files. For simple tasks, AI MUST ATTENTION ask user whether to skip.221222**Prerequisites:**223224- `docs/specs/` — Test specifications by module (read existing TCs to include test strategy in plan)225226<!-- SYNC:ai-mistake-prevention -->227228> **AI Mistake Prevention** — Failure modes to avoid on every task:229>230> **Re-read files after context changes.** Context compaction, resume, or long-running work can make memory stale; verify current files before acting.231> **Verify generated content against source evidence.** AI hallucinates APIs, names, claims, and document facts. Check the relevant source before documenting or referencing.232> **Check downstream references before deleting or renaming.** Removing an artifact can stale docs, generated mirrors, configs, and callers; map references first.233> **Trace the full impact chain after edits.** Changing a definition can miss derived outputs and consumers. Follow the affected chain before declaring done.234> **Verify ALL affected outputs, not just the first.** One green check is not all green checks; validate every output surface the change can affect.235> **Assume existing values are intentional — ask WHY before changing OR flagging one as a defect.** Before changing or reporting a constant, limit, flag, cutoff, wording, or pattern, read nearby context and history, the CALLER's ordering, and 2+ sibling call sites of the same convention. A doc stating WHAT without WHY is missing rationale, not proof of a missing guard.236> **Surface ambiguity before acting — don't pick silently.** Multiple valid interpretations require an explicit question or stated assumption with risk.237> **Assert the outcome your system owns, not the intermediate state your infrastructure owns.** When verifying async work, assert the final business state — never the delivery/retry bookkeeping held in shared infrastructure that any co-running process can write. Such a check passes when run alone and flakes the moment anything else shares that infrastructure.238> **Keep shared guidance role-relevant.** Universal guidance must help every receiving skill or agent; code-specific obligations belong only in code-specific protocols.239240<!-- /SYNC:ai-mistake-prevention -->241242<!-- SYNC:understand-code-first -->243244> **Understand Code First** — HARD-GATE: Do NOT write, plan, or fix until you READ existing code.245>246> 1. Search 3+ similar patterns (`grep`/`glob`) — cite `file:line` evidence247> 2. Read existing files in target area — understand structure, base classes, conventions248> 3. Run `python .claude/scripts/code_graph trace <file> --direction both --json` when `.code-graph/graph.db` exists249> 4. Map dependencies via `connections` or `callers_of` — know what depends on your target250> 5. Write investigation to `.ai/workspace/analysis/` for non-trivial tasks (3+ files)251> 6. Re-read analysis file before implementing — never work from memory alone. — why: long context drifts from the file; the file is ground truth252> 7. NEVER invent new patterns when existing ones work — match exactly or document deviation. — why: divergent patterns fragment the codebase and slow every future reader253>254> **BLOCKED until:** `- [ ]` Read target files `- [ ]` Grep 3+ patterns `- [ ]` Graph trace (if graph.db exists) `- [ ]` Assumptions verified with evidence255256<!-- /SYNC:understand-code-first -->257258<!-- SYNC:evidence-based-reasoning -->259260> **Evidence-Based Reasoning** — Speculation is FORBIDDEN. Every claim needs proof.261>262> 1. Cite `file:line`, grep results, or framework docs for EVERY claim263> 2. Declare confidence: >80% act freely, 60-80% verify first, <60% DO NOT recommend264> 3. Cross-service validation required for architectural changes265> 4. "I don't have enough evidence" is valid and expected output266>267> **BLOCKED until:** `- [ ]` Evidence file path (`file:line`) `- [ ]` Grep search performed `- [ ]` 3+ similar patterns found `- [ ]` Confidence level stated268>269> **Forbidden without proof:** "obviously", "I think", "should be", "probably", "this is because"270> **If incomplete →** output: `"Insufficient evidence. Verified: [...]. Not verified: [...]."`271272<!-- /SYNC:evidence-based-reasoning -->273274<!-- SYNC:nested-task-creation -->275276> **Nested Task Expansion Contract** — For workflow-step invocation, the `[Workflow] ...` row is only a parent container; the child skill still creates visible phase tasks.277>278> 1. Call `TaskList` first. If a matching active parent workflow row exists, set `nested=true` and record `parentTaskId`; otherwise run standalone.279> 2. Create one task per declared phase before phase work. When nested, prefix subjects `[N.M] $skill-name — phase`.280> 3. When nested, link the parent with `TaskUpdate(parentTaskId, addBlockedBy: [childIds])`.281> 4. Orchestrators must pre-expand a child skill's phase list and link the workflow row before invoking that child skill or sub-agent.282> 5. Mark exactly one child `in_progress` before work and `completed` immediately after evidence is written.283> 6. Complete the parent only after all child tasks are completed or explicitly cancelled with reason.284>285> **Blocked until:** `TaskList` done, child phases created, parent linked when nested, first child marked `in_progress`.286287<!-- /SYNC:nested-task-creation -->288289<!-- SYNC:project-reference-docs-guide -->290291> **Project Reference Docs Gate** — Run after task-tracking bootstrap and before target/source file reads, grep, edits, or analysis. Project docs override generic framework assumptions.292>293> 1. Identify scope: file types, domain area, and operation.294> 2. **Read `docs/project-config.json` first — the project's machine-readable map.** It is the single source of truth for THIS repo (modules/paths, framework + search keywords, test/E2E/integration run-commands, design system, architecture rules, workflow patterns); ground exact paths, run-commands, and conventions on it **before investigating, planning, or coding** — never assume framework defaults (`CLAUDE.md` + reference docs are derived from it). If it — or the docs index, `lessons.md`, `CLAUDE.md`, `AGENTS.md`, or any required reference doc — is missing or stale, auto-run `/project-init` or the narrow route (`/project-config`, `/docs-init`, `/scan-all`, `/scan --target=<key>`, `/claude-md-init`) first; if Codex mirrors or `AGENTS.md` are stale, ask the user to run `/sync-codex` (never auto-run it).295> 3. Required docs by trigger: always `docs/project-reference/lessons.md`; doc lookup `docs-index-reference.md`; review `code-review-rules.md`; backend/CQRS/API `backend-patterns-reference.md`; domain/entity `domain-entities-reference.md`; frontend/UI `frontend-patterns-reference.md`; styles/design `scss-styling-guide.md` + `design-system/design-system-canonical.md`; integration tests `integration-test-reference.md`; E2E `e2e-test-reference.md`; feature docs/specs `feature-spec-reference.md` + `spec-system-reference.md` + `spec-principles.md`; behavior/public-contract/spec-test-code sync `workflow-spec-test-code-cycle-reference.md`; derived spec index/ERD/reimplementation guides `spec-system-reference.md` + source Feature Specs under `docs/specs/`; architecture/new area `project-structure-reference.md`.296> 4. Read every required doc, then before target work state: `Reference docs read: ... | Not applicable: ...`.297>298> **Ready when:** scope evaluated, `docs/project-config.json` consulted, required docs checked/read or setup route completed, `lessons.md` confirmed, citation emitted.299300<!-- /SYNC:project-reference-docs-guide -->301302<!-- SYNC:task-tracking-external-report -->303304> **Task Tracking & External Report Persistence** — Bootstrap this before execution; then run project-reference doc prefetch before target/source work.305>306> 1. Create a small task breakdown before target file reads, grep, edits, or analysis. On context loss, inspect the current task list first.307> 2. Mark one task `in_progress` before work and `completed` immediately after evidence; never batch transitions.308> 3. For plan/review work, create `plans/reports/{skill}-{YYMMDD}-{HHmm}-{slug}.md` before first finding.309> 4. Append findings after each file/section/decision and synthesize from the report file at the end.310> 5. Final output cites `Full report: plans/reports/{filename}`.311>312> **Blocked until:** task breakdown exists, report path declared for plan/review work, first finding persisted before the next finding.313314<!-- /SYNC:task-tracking-external-report -->315316<!-- SYNC:critical-thinking-mindset -->317318> **Critical Thinking Mindset** — Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence >80% to act.319> **Anti-hallucination:** Never present guess as fact — cite sources for every claim, admit uncertainty freely, self-check output for errors, cross-reference independently, stay skeptical of own confidence — certainty without evidence root of all hallucination.320321<!-- /SYNC:critical-thinking-mindset -->322323<!-- SYNC:sequential-thinking-protocol -->324325> **Sequential Thinking Protocol** — Structured multi-step reasoning for complex/ambiguous work. Use when planning, reviewing, debugging, or refining ideas where one-shot reasoning is unsafe.326>327> **Trigger when:** complex problem decomposition · adaptive plans needing revision · analysis with course correction · unclear/emerging scope · multi-step solutions · hypothesis-driven debugging · cross-cutting trade-off evaluation.328>329> **Format (explicit mode — visible thought trail):**330>331> 1. `Thought N/M: [aspect]` — one aspect per thought, state assumptions/uncertainty332> 2. `Thought N/M [REVISION of Thought K]: ...` — when prior reasoning invalidated; state Original / Why revised / Impact333> 3. `Thought N/M [BRANCH A from Thought K]: ...` — explore alternative; converge with decision rationale334> 4. `Thought N/M [HYPOTHESIS]: ...` then `[VERIFICATION]: ...` — test before acting335> 5. `Thought N/N [FINAL]` — only when verified, all critical aspects addressed, confidence >80%336>337> **Mandatory closers:** Confidence % stated · Assumptions listed · Open questions surfaced · Next action concrete.338>339> **Stop conditions:** confidence <80% on any critical decision → escalate via AskUserQuestion · ≥3 revisions on same thought → re-frame the problem · branch count >3 → split into sub-task.340>341> **Implicit mode:** apply methodology internally without visible markers when adding markers would clutter the response (routine work where reasoning aids accuracy).342>343> **Deep-dive:** see `/sequential-thinking` skill (`.claude/skills/sequential-thinking/SKILL.md`) for worked examples (API design, debugging, architecture), advanced techniques (spiral refinement, hypothesis testing, convergence), and meta-strategies (uncertainty handling, revision cascades).344345<!-- /SYNC:sequential-thinking-protocol -->346347<!-- SYNC:plan-quality -->348349> **Plan Quality** — Every plan phase MUST ATTENTION include test specifications.350>351> 1. Add `## Test Specifications` section with TC-{FEATURE}-{NNN} IDs to every phase file352> 2. Map every functional requirement to ≥1 TC (or explicit `TBD` with rationale)353> 3. TC IDs follow `TC-{FEATURE}-{NNN}` format — reference by ID, never embed full content354> 4. Before any new workflow step: call `TaskList` and re-read the phase file355> 5. On context compaction: call `TaskList` FIRST — never create duplicate tasks356> 6. Verify TC satisfaction per phase before marking complete (evidence must be `file:line`, not TBD)357>358> **Mode:** TDD-first → reference existing TCs with `Evidence: TBD`. Implement-first → use TBD → `/spec [mode=tests]` fills after.359360<!-- /SYNC:plan-quality -->361362<!-- SYNC:iterative-phase-quality -->363364> **Iterative Phase Quality** — Score complexity BEFORE planning.365>366> **Complexity signals:** >5 files +2, cross-service +3, new pattern +2, DB migration +2367> **Score >=6 →** MUST ATTENTION decompose into phases. Each phase:368>369> - ≤5 files modified370> - ≤3h effort371> - Follows cycle: plan → implement → review → fix → verify372> - Start Phase N+1 only after Phase N passes VERIFY — why: building on an unverified phase compounds errors downstream373>374> **Phase success = all TCs pass + code-reviewer agent approves + no CRITICAL findings.**375376<!-- /SYNC:iterative-phase-quality -->377378<!-- SYNC:plan-quality:reminder -->379380- **MANDATORY IMPORTANT MUST ATTENTION** include `## Test Specifications` with TC IDs per phase. Call `TaskList` before creating new tasks.381 <!-- /SYNC:plan-quality:reminder -->382383<!-- SYNC:understand-code-first:reminder -->384385- **MANDATORY IMPORTANT MUST ATTENTION** search 3+ existing patterns and read code BEFORE any modification. Run graph trace when graph.db exists.386 <!-- /SYNC:understand-code-first:reminder -->387388<!-- SYNC:evidence-based-reasoning:reminder -->389390- **MANDATORY IMPORTANT MUST ATTENTION** cite `file:line` evidence for every claim. Confidence >80% to act, <60% = do NOT recommend.391 <!-- /SYNC:evidence-based-reasoning:reminder -->392393<!-- SYNC:iterative-phase-quality:reminder -->394395- **MANDATORY IMPORTANT MUST ATTENTION** score complexity first. Score >=6 → decompose. Each phase: plan → implement → review → fix → verify. No skipping.396 <!-- /SYNC:iterative-phase-quality:reminder -->397398<!-- SYNC:critical-thinking-mindset:reminder -->399400**MUST ATTENTION** apply critical + sequential thinking — every claim needs appropriate traced evidence (`file:line` for repo/code claims; source URL or artifact section for research, product, content, and docs claims); confidence >80% to act, <60% DO NOT recommend. Anti-hallucination: never present guess as fact, admit uncertainty freely, cross-reference independently, stay skeptical of own confidence.401402<!-- /SYNC:critical-thinking-mindset:reminder -->403404<!-- SYNC:sequential-thinking-protocol:reminder -->405406**MUST ATTENTION** apply sequential-thinking — multi-step Thought N/M, REVISION/BRANCH/HYPOTHESIS markers, confidence % closer; see `/sequential-thinking` skill.407408<!-- /SYNC:sequential-thinking-protocol:reminder -->409410<!-- SYNC:ai-mistake-prevention:reminder -->411412**MUST ATTENTION** apply AI mistake prevention — verify generated content against evidence, trace downstream references before deleting or renaming, verify all affected outputs, re-read files after context loss, and surface ambiguity before acting.413414<!-- /SYNC:ai-mistake-prevention:reminder -->415416<!-- SYNC:task-tracking-external-report:reminder -->417418- **MANDATORY** Bootstrap task tracking before target work; transition one task at a time.419- **MANDATORY** Persist plan/review findings to `plans/reports/` incrementally and synthesize from disk.420421<!-- /SYNC:task-tracking-external-report:reminder -->422423<!-- SYNC:project-reference-docs-guide:reminder -->424425- **MANDATORY** Before investigating, planning, or coding, read `docs/project-config.json` (the project map: modules/paths, run-commands, conventions, architecture/workflow rules) + the required project-reference docs, and cite `Reference docs read: ...`.426- **MANDATORY** Always include `lessons.md`; project config + conventions override generic framework defaults.427- **MANDATORY** If project config, root instruction files, or any required reference doc is missing or stale, auto-run `/project-init` or the narrow lower-level route before ordinary project-specific work.428429<!-- /SYNC:project-reference-docs-guide:reminder -->430431<!-- SYNC:nested-task-creation:reminder -->432433- **MANDATORY** Parent workflow rows do not replace child phase tracking; expand phases and link the parent when nested.434- **MANDATORY** Orchestrators pre-expand child skill phases before invocation; use `[N.M] $skill-name — phase` prefixes and one-`in_progress` discipline.435436<!-- /SYNC:nested-task-creation:reminder -->437438<!-- SYNC:project-protocol-overlay -->439440> **Project Protocol Overlay** — Before executing this skill, resolve any PROJECT overlay rules layered onto it: match this skill's name against the `Target` column of the project's skill-protocol index (`docs/project-reference/skill-protocols-reference.md` by default; a `referenceDocs` entry in `docs/project-config.json` overrides the path), taking the most specific matching tier ONLY — exact name > glob > `*`. **That precedence orders overlays against EACH OTHER, never against this skill.** Read ONLY the matched bodies, resolved as `<protocols-dir>/<Name>.md`; a row's Body link is display text, never a read path. A matched body that is missing or malformed is REPORTED and skipped — never reconstructed from the index Description. No index, or no match -> proceed with no overlay, silently. Full contract: `.claude/skills/project-skill-protocol/references/registry.md`.441>442> Overlays are **ADDITIVE ONLY**: they ADD rules on top of this skill's own protocol and NEVER replace, override, disable, or reinterpret a rule it already states — removing every overlay must return this skill to exactly its documented behavior. An overlay is a BRIEF, not an authority escalation: it can NEVER waive a workflow gate, git discipline, a review gate, or a user-confirmation gate. A genuine overlay-vs-skill conflict, or two equally-specific overlays that directly contradict -> surface both to the user; NEVER resolve silently.443444<!-- /SYNC:project-protocol-overlay -->445446<!-- SYNC:project-protocol-overlay:reminder -->447448**MUST ATTENTION** resolve project protocol overlays for this skill BEFORE executing — most specific matching tier only (exact > glob > `*`, which ranks overlays against each other, NEVER against this skill), read only matched bodies at `<protocols-dir>/<Name>.md`; a missing or malformed body is reported, never reconstructed. Overlays are ADDITIVE ONLY (they never replace this skill's own rules) and are a brief, NEVER an authority escalation; an equal-specificity contradiction goes to the user.449450<!-- /SYNC:project-protocol-overlay:reminder -->451452## Closing Reminders453454**IMPORTANT MUST ATTENTION — Protocols in force (concise digest of the SYNC/shared blocks this skill carries):**455456- **AI Mistake Prevention:** verify generated content against evidence, trace downstream references, verify all affected outputs, re-read after context loss, surface ambiguity.457- **Understand Code First:** read code and grep 3+ patterns before modifying.458- **Evidence:** cite `file:line`; confidence >80% to act.459- **Nested Task Creation:** expand child phases, link parent when nested.460- **Project Reference Docs:** read required project docs before target work.461- **Task Tracking & External Report:** bootstrap tasks, persist findings to `plans/reports/`.462- **Critical Thinking:** traced proof per claim, skeptical of own confidence.463- **Sequential Thinking:** multi-step Thought N/M with confidence closer.464- **Plan Quality:** `## Test Specifications` with TC IDs per phase.465- **Iterative Phase Quality:** score complexity, decompose at >=6, plan→implement→review→fix→verify.466467- **MANDATORY IMPORTANT MUST ATTENTION** break work into small todo tasks using `TaskCreate` BEFORE starting468- **MANDATORY IMPORTANT MUST ATTENTION** search codebase for 3+ similar patterns before creating new code469- **MANDATORY IMPORTANT MUST ATTENTION** cite `file:line` evidence for every claim (confidence >80% to act)470- **MANDATORY IMPORTANT MUST ATTENTION** add a final review todo task to verify work quality471- **MANDATORY IMPORTANT MUST ATTENTION** include Test Specifications section and story_points in plan frontmatter472473**[TASK-PLANNING]** Before acting, analyze task scope and systematically break it into small todo tasks and sub-tasks using TaskCreate.