Overview
Adding a feature to an established codebase is rarely greenfield work. Most of the effort — and most of the risk — lies in understanding how the new feature interacts with what already exists: which data structures need new fields, which UI components need modification, which business rules extend or conflict, and which integration points need updating. CoreStory acts as a persistent intelligence layer across this process. As Expert, it holds deep architectural knowledge of the existing system. As Navigator, it maps file structures and component relationships. As Gap Analyzer, it compares a feature specification against the current system to surface exactly what’s present, what’s absent, and what needs to change — down to specific files and functions. The primary deliverable is a Feature Gap Analysis Report: a structured, developer-ready breakdown of gaps across data models, UI, business logic, rendering, integrations, and constraints, with an implementation plan ordered by dependency. This playbook pairs naturally with the Feature Implementation playbook (which uses gap analysis as one phase of a broader workflow) and the Business Rules Extraction playbook (which catalogs the rules your gap analysis will need to account for).When to Use This Playbook
- You have a feature specification (PRD, user story, design doc) and need to understand the implementation surface area before writing code
- You’re evaluating build effort or feasibility for a proposed feature
- You want to de-risk implementation by identifying conflicts, missing structures, and downstream effects before development begins
- You need a structured handoff document between product/architecture and engineering
- You’re onboarding a new team to a feature and need them to understand what already exists vs. what must be built
When to Skip This Playbook
- The feature is entirely greenfield with no interaction with existing code (use Spec-Driven Development instead)
- You need to extract and catalog existing business rules before analyzing gaps (run Business Rules Extraction first)
- You’re past gap analysis and ready to implement (move to Feature Implementation)
Prerequisites
Before starting, ensure you have:- CoreStory account with the target project onboarded and analyzed
- CoreStory MCP server connected to your AI coding agent (setup guide)
- An AI coding agent — Claude Code, GitHub Copilot, Cursor, or any MCP-compatible agent
- A feature specification — PRD, user story, design document, or detailed description of what you want to build
- Repository access — your agent should have local access to the codebase under analysis
How It Works
The playbook follows four phases, each building on the previous:MCP Tools Used
If your project’s PRD or TechSpec is too large for a single context window, use
send_message to query specific sections rather than loading the full document.Step-by-Step Walkthrough
Phase 1: Context Loading
Goal: Establish project context so CoreStory can provide grounded, codebase-specific answers. Step 1.1 — Connect to the project Uselist_projects to find your target project, then start a dedicated conversation:
Phase 2: Gap Identification
Goal: Produce a structured gap analysis across seven categories, each grounded in specific files and components. Step 2.1 — Run the seven-category gap analysis This is the core query. Send the following to CoreStory, replacing the bracketed section with your feature specification:Phase 3: Validation & Completeness
Goal: Verify the gap analysis is thorough, identify missed dependencies, and flag conflicts with existing patterns. Step 3.1 — Run the completeness checkPhase 4: Implementation Planning
Goal: Transform the validated gaps into a dependency-ordered implementation plan. Step 4.1 — Generate the implementation planOutput Format
The gap analysis should produce a structured report. Use this template:Agent Implementation Guides
The skill content below is plain markdown and works in any agentic harness — only the install location varies. The sections that follow show end-to-end setup for the four most common harnesses; for any other harness, install the skill file per the conventions below. The skill file shown below is plain markdown. The workflow it encodes works in any agentic harness — only the install location differs. Common conventions:
If your harness isn’t listed, the SKILL.md content itself is portable — install it wherever your harness loads workflow context and adapt the activation step (auto-trigger, slash command, explicit invocation) to your harness’s conventions.
Claude Code
Save the SKILL.md content below at.claude/skills/feature-gap-analysis/SKILL.md:
GitHub Copilot
Create the file.github/skills/feature-gap-analysis/SKILL.md in your repository:
.github/copilot-instructions.md:
Cursor
Create the file.cursor/rules/playbooks/feature-gap-analysis.md in your repository:
Factory.ai
Use this droid configuration:Tips & Best Practices
Query patterns, from most to least effective:- Specific and scoped: “What data model changes are needed in the user-profile module to support multi-currency pricing?” — targets a single category and subsystem
- Category-focused: “What UI gaps exist for the checkout flow redesign?” — targets one category across a feature area
- Comparison-based: “How does the existing notification system need to change to support scheduled notifications?” — frames the gap as a delta
- Full seven-category sweep: The core gap analysis query — comprehensive but produces the most output to validate
- Open-ended: “What do I need to build this feature?” — usable but produces less structured output
- Vague: “Tell me about the codebase” — too broad, not actionable
- Start with the full seven-category query, then drill into the categories most relevant to your feature
- For large features, break the specification into sub-features and run separate gap analyses
- Use the scope summary to identify what can be deferred to a follow-up iteration
- When a gap contradicts an existing pattern, flag it explicitly — don’t silently introduce a new pattern
- Ask CoreStory whether the existing pattern should be extended or whether a new approach is justified
- Document pattern exceptions in the gap report so reviewers understand the trade-off
- Data model gaps first (everything downstream depends on the data layer)
- Business logic second (rules and calculations before presentation)
- UI and rendering third (built on stable data and logic)
- Integration last (connects the completed feature to external systems)
- Re-run the analysis if the feature spec changes materially
- Reference previous gap analysis conversations using
list_conversationsto track how the analysis evolved - Use the gap analysis as a living document during implementation — update gap statuses as work progresses