epci:spec

Create comprehensive technical specifications from CDC (Cahier des Charges) or brief output. Decomposes features into 1-2h atomic tasks with 15-30min steps. Generates Markdown specs (index.md + task-X

SKILL.md

GitHub

Spec โ€” Technical Specification Generator

Transform CDC/brief documents into executable technical specifications with Ralph-ready artifacts.

Quick Start

/spec auth-oauth                                    # From description
/spec auth-oauth @docs/briefs/auth/brief.md         # From brief file
/spec auth-oauth @"OAuth integration for users"    # From inline description

MANDATORY EXECUTION RULES (READ FIRST):

  • ๐Ÿ”ด NEVER generate specs without understanding the source
  • ๐Ÿ”ด NEVER skip @decompose-validator before generation
  • ๐Ÿ”ด NEVER create circular dependencies in task DAG
  • ๐Ÿ”ด NEVER exceed granularity limits (tasks 1-2h, steps 15-30min)
  • ๐Ÿ”ด NEVER call EnterPlanMode during skill execution
  • โœ… ALWAYS start with step-00-init.md
  • โœ… ALWAYS follow next_step from each step
  • โœ… ALWAYS present breakpoints at phase transitions
  • โœ… ALWAYS validate with @decompose-validator before generation
  • โ›” FORBIDDEN generating PRD.json with missing acceptance criteria
  • ๐Ÿ”ต YOU ARE A METHODICAL SPECIFICATION WRITER following EPCI discipline
  • ๐Ÿ’ญ FOCUS on one phase at a time, complete before proceeding

EXECUTION PROTOCOLS:

  1. Load step-00-init.md
  2. Execute current step protocols completely
  3. Present breakpoint if specified in step
  4. Evaluate next step trigger conditions
  5. Proceed to next_step or conditional_next

CONTEXT BOUNDARIES:

  • IN scope: Transforming CDC/briefs into specs, task decomposition, Ralph artifacts
  • OUT scope: Ideation (use /brainstorm), implementation (use /implement or /quick)

Input Detection

INPUT
โ”œโ”€โ”€ @docs/briefs/*.md โ†’ BRIEF-FIRST workflow
โ”‚   โ””โ”€ Parse CDC sections, extract requirements
โ”œโ”€โ”€ @"text description" โ†’ TEXT workflow
โ”‚   โ””โ”€ Clarify with clarification-engine, then proceed
โ””โ”€โ”€ feature-slug only โ†’ DISCOVERY workflow
    โ””โ”€ Search for existing brief, else ask for input

Workflow Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    SPEC WORKFLOW (3 Phases)                          โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                      โ”‚
โ”‚  Step 00: INIT                                                       โ”‚
โ”‚  โ””โ”€ Parse input, detect source type                                  โ”‚
โ”‚  โ””โ”€ Load project context via project-memory                          โ”‚
โ”‚     โ””โ”€ If no source โ†’ ask for brief/description                      โ”‚
โ”‚                                                                      โ”‚
โ”‚  Step 01: ANALYZE & DECOMPOSE                                        โ”‚
โ”‚  โ””โ”€ Parse CDC/brief structure                                        โ”‚
โ”‚  โ””โ”€ Calculate complexity via complexity-calculator                   โ”‚
โ”‚  โ””โ”€ Decompose into tasks (1-2h) with steps (15-30min)                โ”‚
โ”‚  โ””โ”€ Build DAG (dependency graph)                                     โ”‚
โ”‚  โ””โ”€ Validate with @decompose-validator                               โ”‚
โ”‚     โ””โ”€ BREAKPOINT: Decomposition review                              โ”‚
โ”‚                                                                      โ”‚
โ”‚  Step 02: GENERATE SPECS                                             โ”‚
โ”‚  โ””โ”€ Create docs/specs/{slug}/ directory                              โ”‚
โ”‚  โ””โ”€ Generate index.md (orchestrator)                                 โ”‚
โ”‚  โ””โ”€ Generate task-XXX.md for each task                               โ”‚
โ”‚  โ””โ”€ Generate {slug}.prd.json (machine-readable)                      โ”‚
โ”‚     โ””โ”€ BREAKPOINT: Specs review                                      โ”‚
โ”‚                                                                      โ”‚
โ”‚  Step 03: GENERATE RALPH                                             โ”‚
โ”‚  โ””โ”€ Detect project stack                                             โ”‚
โ”‚  โ””โ”€ Create .ralph/{slug}/ directory                                  โ”‚
โ”‚  โ””โ”€ Generate PROMPT.md (stack-aware)                                 โ”‚
โ”‚  โ””โ”€ Generate MEMORY.md (template)                                    โ”‚
โ”‚  โ””โ”€ Generate ralph.sh (runner)                                       โ”‚
โ”‚  โ””โ”€ Update .ralph/index.json                                         โ”‚
โ”‚     โ””โ”€ BREAKPOINT: Completion summary with routing                   โ”‚
โ”‚                                                                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Steps

Step Name Description
00 init Parse input, detect source, load context
01 analyze Decompose into tasks, build DAG, validate
02 generate-specs Create index.md, task-XXX.md, PRD.json
03 generate-ralph Create Ralph artifacts

Granularity Rules

Level Duration Purpose
Task 1-2 hours Human-readable units, complete deliverables
Step 15-30 minutes Atomic execution units for Ralph

Task Structure

Each task-XXX.md contains:

  • YAML frontmatter (id, title, deps, complexity, effort)
  • Objective section
  • Acceptance Criteria (Given-When-Then or checklist)
  • Steps section (numbered 15-30min steps)
  • Files to modify/create
  • Test approach

Step Structure

Each step within a task:

  • Action verb title
  • Expected duration
  • Input requirements
  • Output deliverable
  • Validation criteria

Decision Tree

IF source is brief (@*.md):
  โ†’ Parse sections, extract requirements
  โ†’ Calculate complexity
  โ†’ Proceed to decomposition
ELSE IF source is text (@"..."):
  โ†’ Clarify with clarification-engine if needed
  โ†’ Convert to structured requirements
  โ†’ Proceed to decomposition
ELSE IF no source:
  โ†’ Search for existing brief in docs/briefs/{slug}/
  โ†’ If found โ†’ use it
  โ†’ If not found โ†’ ask user for input

Step Files

Reference Files

Templates

Output Structure

docs/specs/{feature-slug}/
โ”œโ”€โ”€ index.md                    # Orchestrator (table + Mermaid DAG + context)
โ”œโ”€โ”€ task-001-{slug}.md          # Task 1 (1-2h, with Steps)
โ”œโ”€โ”€ task-002-{slug}.md          # Task 2
โ”œโ”€โ”€ ...
โ””โ”€โ”€ {feature-slug}.prd.json     # Machine version (Ralph-ready)

.ralph/{feature-slug}/
โ”œโ”€โ”€ PROMPT.md                   # Claude Code instructions (stack-aware)
โ”œโ”€โ”€ MEMORY.md                   # Persistent context (template)
โ””โ”€โ”€ ralph.sh                    # Runner script

Shared Components Used

  • epci:complexity-calculator โ€” Scope estimation for routing
  • epci:project-memory โ€” Velocity calibration, conventions
  • epci:clarification-engine โ€” Input clarification if needed
  • epci:breakpoint-system โ€” Phase checkpoints
  • @decompose-validator โ€” DAG validation

Subagents

Agent Model Usage
@decompose-validator Opus Validate DAG before generation
@Explore - Codebase analysis for context

Breakpoints

This skill uses these breakpoint types:

  • decomposition: Task table + DAG review (Step 01)
  • plan-review: Specs preview (Step 02)
  • validation: Completion summary with routing (Step 03)

Complexity Routing (at completion)

Complexity Workflow
TINY/SMALL Recommend /quick
STANDARD/LARGE Recommend /implement

Error Handling

Error Cause Recovery
@decompose-validator NEEDS_REVISION Circular deps, missing coverage Fix issues, re-decompose
Brief parsing failure Malformed brief Ask for clarification
Stack detection failure No project markers Use generic templates
Granularity violation Task too large/small Split or merge tasks

Constraints

Constraint Value Rationale
Max tasks 20 Avoid overwhelming complexity
Min tasks 2 At least 2 for meaningful spec
Task duration 1-2h Goldilocks zone
Step duration 15-30min Atomic execution
AC per task >= 2 Quality gate

INVOCATION PROTOCOL (CRITICAL)

Les syntaxes @skill:epci:xxx et @agent:xxx dans les step files sont DOCUMENTAIRES SEULEMENT. Claude interprรจte les blocs de code comme des exemples, pas comme des instructions d'exรฉcution.

Pour invoquer rรฉellement:

Type Syntaxe documentaire Invocation rรฉelle
Breakpoints @skill:epci:breakpoint-system Section impรฉrative + AskUserQuestion explicite
Agents @agent:decompose-validator Task({ subagent_type: "decompose-validator", ... })
Core skills @skill:epci:project-memory Read(".claude/state/...") pour fichiers d'รฉtat

Rรจgle pour auteurs de step files:

  • Utiliser le format impรฉratif direct (pas dans bloc de code)
  • Afficher les boรฎtes ASCII hors bloc exรฉcutable
  • Appeler AskUserQuestion explicitement
  • Ajouter โธ๏ธ ATTENDS la rรฉponse aprรจs chaque breakpoint

Limitations

This skill does NOT:

  • Ideate or explore (use /brainstorm)
  • Implement code (use /implement or /quick)
  • Debug existing code (use /debug)
  • Create new skills (use /factory)
  • Execute Ralph batches (use ralph.sh directly)