$npx -y skills add gotalab/cc-sdd --skill kiro-validate-gapAnalyze implementation gap between requirements and existing codebase
| 1 | # Implementation Gap Validation |
| 2 | |
| 3 | <background_information> |
| 4 | - **Mission**: Analyze the gap between requirements and existing codebase to inform implementation strategy |
| 5 | - **Success Criteria**: |
| 6 | - Comprehensive understanding of existing codebase patterns and components |
| 7 | - Clear identification of missing capabilities and integration challenges |
| 8 | - Multiple viable implementation approaches evaluated |
| 9 | - Technical research needs identified for design phase |
| 10 | </background_information> |
| 11 | |
| 12 | <instructions> |
| 13 | ## Core Task |
| 14 | Analyze implementation gap for feature **$1** based on approved requirements and existing codebase. |
| 15 | |
| 16 | ## Execution Steps |
| 17 | |
| 18 | 1. **Load Context**: |
| 19 | - Read `{{KIRO_DIR}}/specs/$1/spec.json` for language and metadata |
| 20 | - Read `{{KIRO_DIR}}/specs/$1/requirements.md` for requirements |
| 21 | - Core steering context: `product.md`, `tech.md`, `structure.md` |
| 22 | - Additional steering files only when directly relevant to the feature's domain rules, integrations, runtime prerequisites, compliance/security constraints, or existing product boundaries |
| 23 | - Relevant local agent skills or playbooks only when they clearly match the feature's host environment or use case and provide analysis-relevant context |
| 24 | |
| 25 | 2. **Read Analysis Guidelines**: |
| 26 | - Read `rules/gap-analysis.md` from this skill's directory for comprehensive analysis framework |
| 27 | |
| 28 | #### Parallel Research |
| 29 | |
| 30 | The following research areas are independent and can be executed in parallel: |
| 31 | 1. **Codebase analysis**: Existing implementations, architecture patterns, integration points, extension possibilities |
| 32 | 2. **External dependency research**: Dependency compatibility, version constraints, known integration challenges (when needed) |
| 33 | 3. **Context loading**: Requirements, core steering, task-relevant extra steering, relevant local agent skills/playbooks, and gap-analysis rules |
| 34 | |
| 35 | If multi-agent is enabled, spawn sub-agents for each area above. Otherwise execute sequentially. |
| 36 | |
| 37 | After all parallel research completes, synthesize findings for gap analysis. |
| 38 | |
| 39 | 3. **Execute Gap Analysis**: |
| 40 | - Follow gap-analysis.md framework for thorough investigation |
| 41 | - Analyze existing codebase using Grep and Read tools |
| 42 | - Use WebSearch/WebFetch for external dependency research if needed |
| 43 | - Evaluate multiple implementation approaches (extend/new/hybrid) |
| 44 | - Use language specified in spec.json for output |
| 45 | |
| 46 | 4. **Generate Analysis Document**: |
| 47 | - Create comprehensive gap analysis following the output guidelines in gap-analysis.md |
| 48 | - Present multiple viable options with trade-offs |
| 49 | - Flag areas requiring further research |
| 50 | |
| 51 | 5. **Write Gap Analysis to Disk**: |
| 52 | |
| 53 | **Write the gap analysis to disk so it survives session boundaries and can be referenced during design phase.** |
| 54 | |
| 55 | - Save the gap analysis to `{{KIRO_DIR}}/specs/$1/research.md` |
| 56 | - If the file already exists, append the new analysis (separated by a horizontal rule `---`) rather than overwriting previous research |
| 57 | - Verify the file was written by reading it back |
| 58 | |
| 59 | ## Important Constraints |
| 60 | - **Information over Decisions**: Provide analysis and options, not final implementation choices |
| 61 | - **Multiple Options**: Present viable alternatives when applicable |
| 62 | - **Thorough Investigation**: Use tools to deeply understand existing codebase |
| 63 | - **Explicit Gaps**: Clearly flag areas needing research or investigation |
| 64 | - **Context Discipline**: Start with core steering and expand only with analysis-relevant steering or use-case-aligned local agent skills/playbooks |
| 65 | </instructions> |
| 66 | |
| 67 | ## Tool Guidance |
| 68 | - **Read first**: Load spec, core steering, relevant local playbooks/agent skills, and rules before analysis |
| 69 | - **Grep extensively**: Search codebase for patterns, conventions, and integration points |
| 70 | - **WebSearch/WebFetch**: Research external dependencies and best practices when needed |
| 71 | - **Write last**: Generate analysis only after complete investigation |
| 72 | |
| 73 | ## Output Description |
| 74 | Provide output in the language specified in spec.json with: |
| 75 | |
| 76 | 1. **Analysis Summary**: Brief overview (3-5 bullets) of scope, challenges, and recommendations |
| 77 | 2. **Document Status**: Confirm analysis approach used |
| 78 | 3. **Next Steps**: Guide user on proceeding to design phase |
| 79 | |
| 80 | **Format Requirements**: |
| 81 | - Use Markdown headings for clarity |
| 82 | - Keep summary concise (under 300 words) |
| 83 | - Detailed analysis follows gap-analysis.md output guidelines |
| 84 | |
| 85 | ## Safety & Fallback |
| 86 | |
| 87 | ### Error Scenarios |
| 88 | - **Missing Requirements**: If requirements.md doesn't exist, stop with message: "Run `/kiro-spec-requirements $1` first to generate requirements" |
| 89 | - **Requirements Not Approved**: If requirements not approved, warn user but proceed (gap analysis can inform requirement revisions) |
| 90 | - **Empty Steering Directory**: Warn user that project context is missing and may affect analysis quality |
| 91 | - **Complex Integration Unclear**: Flag for comprehensive research in design phase r |