Skip to main content

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

Prerequisites

Before starting, ensure you have:
  1. CoreStory account with the target project onboarded and analyzed
  2. CoreStory MCP server connected to your AI coding agent (setup guide)
  3. An AI coding agent — Claude Code, GitHub Copilot, Cursor, or any MCP-compatible agent
  4. A feature specification — PRD, user story, design document, or detailed description of what you want to build
  5. 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 Use list_projects to find your target project, then start a dedicated conversation:
Select the appropriate project and create a conversation thread:
Step 1.2 — Load architectural context Retrieve available specifications to ground the analysis:
Step 1.3 — Orient CoreStory to the feature Send an initial message establishing the scope of your analysis:
Review the response to confirm CoreStory has sufficient context. If key areas are missing or the response is vague, provide additional specification detail or ask targeted follow-up questions.

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:
Step 2.2 — Drill into sparse categories Review the response. If any category returned fewer than expected results, probe deeper:
Step 2.3 — Identify cross-cutting concerns Some gaps span multiple categories. Ask CoreStory to surface these:

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 check
Step 3.2 — Check for pattern conflicts
Step 3.3 — Estimate scope

Phase 4: Implementation Planning

Goal: Transform the validated gaps into a dependency-ordered implementation plan. Step 4.1 — Generate the implementation plan
Step 4.2 — Label the conversation Rename the conversation for future reference:

Output 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:
Want a single install that works across the most harnesses? Append the content to AGENTS.md at your repository root. The AGENTS.md spec is read by Codex, Aider, Cursor, Factory, Jules, Gemini CLI, Windsurf, GitHub Copilot’s coding agent, JetBrains Junie, Warp, and others — so a single file covers most users without harness-specific setup.
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:
Lightweight alternative: Add this to .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:
  1. 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
  2. Category-focused: “What UI gaps exist for the checkout flow redesign?” — targets one category across a feature area
  3. Comparison-based: “How does the existing notification system need to change to support scheduled notifications?” — frames the gap as a delta
  4. Full seven-category sweep: The core gap analysis query — comprehensive but produces the most output to validate
  5. Open-ended: “What do I need to build this feature?” — usable but produces less structured output
  6. Vague: “Tell me about the codebase” — too broad, not actionable
Scoping your analysis:
  • 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
Handling conflicts:
  • 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
Prioritization order:
  • 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)
Keeping gap analyses current:
  • Re-run the analysis if the feature spec changes materially
  • Reference previous gap analysis conversations using list_conversations to track how the analysis evolved
  • Use the gap analysis as a living document during implementation — update gap statuses as work progresses

Troubleshooting