Skip to content
story-scan logo

Story Scan

story-scan

Load for brownfield stories where existing code must be understood before planning. Use when a story extends, modifies, or integrates with significant existing functionality. Produces codebase-scan.md — skip for fully greenfield stories. FIRST ACTION after loading: read template at .speck/templat...

telum-ai/speck0installs2stars

SKILL.md

Full skill instructions

The user input to you can be provided directly by the agent or as a command argument - you MUST consider it before proceeding with the prompt (if not empty).

User input:

$ARGUMENTS

⚠️ Step 0: Read Template First

Before any other action — read this template now using the Read tool:

.speck/​templates/​story/​codebase-scan-template.md

The template defines required sections and formatting for codebase-scan.md, including how to document existing patterns, file references, and copy-paste-adapt examples. Reading it first ensures your scan findings land in the structure story-plan expects.

Checkpoint: After reading, note the top-level sections from the template. Then continue to Step 1.

Deep dive into codebase to find specific implementations to guide this story's development.

Time: 20-30 minutes (thorough code reading)
Confidence: HIGH - actual code read and analyzed
Purpose: Find EXACTLY how to build THIS story
Output: Implementation guide with copy-paste-adapt examples

When to Use

  • After /​story-specify or /​story-clarify - Before planning implementation
  • After /​epic-scan (optional) - Epic-scan found patterns, story-scan finds specifics
  • Before /​story-plan - Inform technical design with real implementations
  • When similar features exist - "How did we implement X last time?"

When to SKIP:

  • Greenfield project - No existing code to scan
  • Completely novel feature - Nothing similar exists (epic-scan would have found it)
  • After project-scan said "no similar features" - Don't waste time

Relationship to other scans:

  • /​project-scan → Spotted potential areas (LOW confidence)
  • /​epic-scan → Found relevant patterns (MEDIUM confidence)
  • /​story-scan → Deep implementation guide (HIGH confidence) ← You are here

Subagent Parallelization

This command benefits from parallel speck-scanner execution for domain analysis:

├── [Parallel] speck-scanner: "Deep analyze auth patterns in src/"
├── [Parallel] speck-scanner: "Deep analyze API patterns in src/​api/"
├── [Parallel] speck-scanner: "Deep analyze data models in src/​models/"
├── [Parallel] speck-scanner: "Deep analyze UI components in src/​components/"
├── [Parallel] speck-scanner: "Analyze testing patterns in tests/"
├── [Parallel] speck-scanner: "Analyze error handling patterns in src/"
├── [Parallel] speck-scanner: "Quick scan logging patterns in src/"
├── [Parallel] speck-scanner: "Quick scan code conventions in src/"
└── [Wait] → Synthesize into codebase-scan-*.md

Each scanner returns domain-specific patterns and examples.

Speedup: 5-6x compared to sequential scanning.

Scan Process

  1. Locate the active story directory (STORY_DIR):

    • Preferred: user is already in the story directory (or a subfolder like contracts/)
    • Determine STORY_DIR by walking up from current directory until you find spec.md
    • If spec.md exists: Load it to understand story domain
    • Parse $ARGUMENTS for flags: --domain=X, --similar-to="X", --patterns-only
  2. Check if codebase exists:

    • Look for source directories (src/, lib/, backend/, frontend/, app/, etc.)
    • If no source found: INFO "No existing codebase detected (greenfield project). Skip /​story-scan."
  3. Determine project type:

    • Single: src/, lib/, tests/ at root
    • Web: frontend/ and backend/ directories
    • Mobile: api/ with ios/ or android/
    • Monorepo: packages/, apps/, or libs/
  4. Perform analysis:

    A. Structure Analysis:

    • Map directory organization
    • Identify module boundaries
    • Document test organization

    B. Technology Stack:

    • Check package.json, requirements.txt, go.mod, Cargo.toml, etc.
    • List: Languages, frameworks, ORMs, databases, testing tools

    C. Pattern Detection (focus on feature domain if specified):

    • Auth patterns (if --domain=auth or feature involves auth)
    • API patterns (if --domain=api or feature involves endpoints)
    • Data patterns (if --domain=data or feature involves models)
    • Error handling, logging, testing patterns

    D. Reference Implementations:

    • If --similar-to specified: Find that feature
    • Else: Find 2-3 similar features based on domain
    • Extract: File paths, patterns used, code examples (max 20 lines each)

    E. Convention Analysis:

    • File naming (snake_case, kebab-case, PascalCase)
    • Function/​class naming
    • Import organization
    • Documentation style

    F. Conflict Detection:

    • Check for naming collisions with entities in spec
    • Check for route conflicts with endpoints in spec
    • Flag potential integration issues
  5. Generate scan report:

    CRITICAL: Load and follow the template exactly:

    .speck/​templates/​story/​codebase-scan-template.md
    

    The template is self-documenting - follow all sections and guidelines within it.

  6. Save scan report:

    • To: {STORY_DIR}/​codebase-scan-{domain/​similar-to}.md
  7. Report completion:

    • Executive summary (3-5 key findings)
    • Reference implementations found
    • Potential conflicts (if any)
    • Recommendations for planning
    • Next suggested command
  8. Confidence statement:

    **Confidence Level**: HIGH
    
    This scan involved:
    - ✅ Reading actual source code (not just file names)
    - ✅ Extracting real implementation examples
    - ✅ Validating patterns through code inspection
    - ✅ Identifying specific file paths and line numbers
    
    You can trust these findings for implementation planning.
    However, always verify during implementation that:
    - Code hasn't changed since scan
    - Pattern still fits your specific use case
    - No hidden dependencies exist
    

Behavior rules:

  • Never hallucinate patterns—only report what exists in code
  • Include real file paths for every example
  • Limit code examples to 20 lines max
  • Flag patterns that violate constitution
  • If --patterns-only: Skip structure analysis
  • If --domain specified: Focus analysis on that domain only
  • HIGH confidence: This is deep analysis with code reading

Integration with Other Commands

Optional context:

  • /​project-scan - May have spotted similar areas
  • /​epic-scan - May have found relevant patterns

Feeds into:

  • /​story-plan - Uses findings to create technical design
  • /​story-tasks - Implementation guided by scan examples

Confidence comparison:

/​project-scan  → LOW confidence  (directory scan)
/​epic-scan     → MEDIUM confidence (pattern matching)
/​story-scan    → HIGH confidence (code reading) ← Most detailed

Context: $ARGUMENTS

More skills from telum-ai

project-brainstorm logo
telum-ai/speck

project-brainstorm

Load when a user has a vague idea, problem, or inspiration but isn't sure what to build. Use before /project-specify when the project concept needs crystallizing from loose thoughts into something concrete.

2 0
View

Load when using Docker for containerizing applications. Applies when creating Dockerfiles, docker-compose setups, multi-stage builds, or optimizing container images.

2 0
View
visual-quality logo
telum-ai/speck

visual-quality

Enforce visual design quality in every UI file. Fires for .tsx, .jsx, .vue, .svelte, and similar component files. Ensures implementations express the project's design personality rather than producing generic/boilerplate UI.

2 0
View
project-clarify logo
telum-ai/speck

project-clarify

Load after project.md exists to fill gaps through targeted Q&A. Use when project goals, target users, or scope feel underspecified. Run before project-context or project-architecture to prevent rework downstream.

2 0
View
story-outline logo
telum-ai/speck

story-outline

DEPRECATED in Speck v7. Use /speck-skeptical-review + /speck-decision-log instead — they replace outline-style research mapping with structured alternative enumeration and decision locking. /story-plan now performs just-in-time research inline. This skill remains for v6 compatibility but redirect...

2 0
View

Load when building offline-first applications that work without network connectivity. Applies when implementing local storage, sync queues, conflict resolution, or background sync.

2 0
View
project-constitution logo
telum-ai/speck

project-constitution

Load (Platform play level only) to define technical principles and architectural guardrails for the project. Produces constitution.md — optional but valuable when a team needs explicit coding standards, governance rules, or non-negotiable constraints. FIRST ACTION after loading: read template at ...

2 0
View
posthog-integration logo
telum-ai/speck

posthog-integration

Load when integrating PostHog for product analytics and feature flags. Applies when implementing event tracking, A/B testing, session replay, or funnel analysis.

2 0
View
project-validate logo
telum-ai/speck

project-validate

Load when all epics are validated and /audit has run for the project. Verifies the project meets its original vision and product-contract.md paid promise. Runs end-to-end JTBD smoke test via /larp across all personas. Declares a project-level readiness state. Produces project-validation-report.md...

2 0
View

Load when building serverless applications with AWS Lambda, Vercel Functions, or Cloudflare Workers. Applies when implementing FaaS patterns, managing cold starts, or optimizing serverless costs.

2 0
View
epic-scan logo
telum-ai/speck

epic-scan

Load for brownfield epics to analyze existing code patterns and implementations relevant to this epic's domain before planning. Use when the epic modifies or extends significant existing functionality. Skip for fully greenfield epics. FIRST ACTION after loading: read template at .speck/templates/...

2 0
View
epic-analyze logo
telum-ai/speck

epic-analyze

Load after epic-tech-spec.md and epic-breakdown.md exist — quality check for consistency and completeness before any story work begins. Catches spec drift and missing coverage between the tech spec and story breakdown. FIRST ACTION after loading: read template at .speck/templates/epic/epic-analys...

2 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View