Brownfield skills reference
Brownfield skills enable SDD adoption in existing projects by extracting artifacts from code, documentation, or detecting project state.onboarding
Diagnoses project state and generates a customized SDD adoption plan.Invocation
Detection phases
Environment checkDetects: project root, language/framework, package manager, CI/CD, containerization, git history
SDD artifact scanScans:
pipeline-state.json, all SDD directories, key files, cross-references, modification datesNon-SDD documentation scanFinds: README, docs/, API specs (OpenAPI, GraphQL), external tool exports (Jira, Notion), architecture docs
Code & test analysisAnalyzes: file counts, architectural layers, design patterns, test framework, test coverage, code quality signals
Scenario classificationClassifies into 1 of 8 scenarios using weighted signal matrix
Health score estimationScores (0-100): requirements coverage, specification coverage, test coverage, architecture docs, traceability, code quality, pipeline state
Action plan generationGenerates step-by-step plan with effort estimates and health score progression
8 scenarios
Greenfield — No code, no docsAction: Standard pipeline from
requirements-engineerBrownfield bare — Code exists, no docs, no testsAction:
reverse-engineer fullSDD drift — SDD artifacts + code divergedAction:
reconcilePartial SDD — Some SDD artifacts, incomplete pipelineAction: Resume pipeline from gap
Brownfield with docs — Code + non-SDD docsAction:
import → reverse-engineer → reconcileTests-as-spec — Good tests, poor/no docsAction:
reverse-engineer with test-first strategyMulti-team — Monorepo/microservices, mixed statesAction: Per-module assessment, phased adoption
Fork/migration — Forked from another projectAction: Assess upstream,
import/reverse-engineer deltaHealth score dimensions
0=none, 10=informal docs, 20=SDD format
0=none, 10=partial specs, 20=full spec/
0=none, 8=some tests, 15=good coverage+plan
0=none, 8=README/diagrams, 15=SDD plan/
0=none, 8=partial refs, 15=full chain
0=none, 5=linter, 10=types+linter+CI
0=none, 3=partial, 5=complete pipeline-state.json
Output artifacts
Diagnostic reportSections:
- Executive summary (scenario, health score, recommendation)
- Environment profile
- Current state assessment
- Scenario classification with evidence
- Health score breakdown
- Action plan (step-by-step with effort estimates)
- Risk factors and next steps
reverse-engineer
Extracts SDD artifacts from existing codebase.Invocation
Execution phases
Pre-flightValidates environment, checks for existing SDD artifacts, detects language/framework, identifies scope
Scan & inventoryBuilds complete codebase map: files by language, module dependency graph, architectural layers, design patterns, database schema, test structure
Code analysisExtracts: entities, routes/endpoints, state machines, invariants, dependencies, dead code, tech debt, workarounds, implicit rules, infrastructure patterns
Test analysisParses test files: structure, assertions → invariants, setup/teardown → preconditions, mocks → external contracts, test data → boundaries
Requirements extractionGenerates EARS-format requirements from: routes → functional requirements, validations → constraints, auth patterns → security requirements, performance configs → NFRs
Specification generationGenerates complete
spec/ directory: domain model, use cases, workflows, API contracts, NFRs, ADRsTest plan mappingMaps existing tests to requirements, identifies coverage gaps, generates
test/TEST-PLAN.mdPlan reconstructionGenerates
plan/ARCHITECTURE.md and plan/PLAN.md from detected architectureTask reconstructionGenerates retroactive task files documenting already-implemented features with
[RETROACTIVE] markersTraceability mapping & findingsBuilds full traceability chain, compiles findings report with markers
Findings markers
Unreachable or unused codeSeverity: INFO — MEDIUM
Suboptimal implementation requiring future workSeverity: LOW — HIGH
Temporary fix or hackSeverity: MEDIUM — HIGH
Cross-cutting concern patternSeverity: INFO
Code with no traceable requirementSeverity: LOW — MEDIUM
Artifact derived from code patterns, not explicit docsSeverity: INFO
Business rule embedded in code without documentationSeverity: MEDIUM — HIGH
Output artifacts
Extracted requirements in EARS format with
[INFERRED] tagsComplete specification directory generated from code
Test plan and matrices
Reconstructed architecture and plans
Retroactive task files with
[RETROACTIVE] markersCode health report with dead code, tech debt, workarounds catalogued by marker
Intermediate outputs: INVENTORY.md, ANALYSIS.md, TEST-ANALYSIS.md
reconcile
Detects drift between specifications and code, then aligns specs to match reality.Invocation
Divergence types
Code exists without spec; has tests or is actively usedResolution: Auto — Update specs (code wins)
Spec exists without code; no recent commitsResolution: Auto — Deprecate in specs (code wins)
Both exist but behavior differsResolution: Ask user — Is code correct or is it a bug?
Structure changed but behavior equivalent (tests pass)Resolution: Auto — Update technical specs only
Code contradicts spec AND tests fail or missingResolution: Ask user — Fix code or update spec?
Cannot determine type with confidenceResolution: Ask user — Classify manually
Execution phases
Context loadingLoads all SDD artifacts, verifies source code exists, builds spec artifact index
Code scanAnalyzes current code: endpoints, entities, business logic, integrations, configuration. Builds code feature index. Maps code features to spec artifacts via
Refs: comments and naming conventions. Enriches with SDD MCP server data if available.Spec-code comparisonCompares: API contracts (method, path, params, schemas), business rules (validations, thresholds), state machines (states, transitions), domain model (fields, types, relationships). Detects spec without code, code without spec, behavioral differences.
Divergence classificationClassifies each divergence using deterministic rules. Assigns confidence: HIGH, MEDIUM, LOW.
Reconciliation planGroups divergences by type, prepares spec changes for auto-resolvable, prepares questions for user-decision types, calculates pipeline cascade impact.
User reviewPresents summary, for each user-decision item presents options with recommendation. In
--code-wins mode: skip this phase.Apply changesFor NEW_FUNCTIONALITY: adds specs marked
[RECONCILED]. For REMOVED_FEATURE: marks specs [DEPRECATED]. For REFACTORING: updates technical references. For user-decided: applies chosen resolution.Pipeline state updateRecalculates hashes, marks affected stages as stale, updates
pipeline-state.json, generates reconciliation report.Output artifacts
Drift detection reportSections:
- Executive summary (divergence counts by type)
- Detailed divergence listing with classification evidence
- Actions taken (auto-resolved and user-decided)
- Pending items (deferred decisions, defect tasks)
- Pipeline cascade impact
- Traceability chain changes
Updated with new requirements or deprecations
Updated specifications reflecting code reality
import
Converts external documentation to SDD format.Invocation
Supported formats
Extensions:
.json, .csvMaps to: Epics → requirement groups, Stories → use cases, Bugs → defect tracking, Tasks → implementation notesExtensions:
.yaml, .jsonMaps to: Paths → API contracts, Schemas → domain model, Security → NFRs, Descriptions → requirementsExtensions:
.mdMaps to: Headings → requirement sections, Lists → individual requirements, Code blocks → technical specsExtensions:
.md (with metadata), .csvMaps to: Database rows → requirements, Pages → specifications, Properties → requirement attributesExtensions:
.csvMaps to: Columns → requirement fields, Rows → individual requirementsExtensions:
.xlsxMaps to: Sheets → artifact types, Rows → individual items, Named columns → requirement fieldsExecution phases
Format detectionIdentifies format via extension and content markers, validates format compatibility
Parse inputParses files into normalized intermediate representation with: items, metadata, parse errors, skipped items
Mapping previewApplies format-specific rules, converts descriptions to EARS, detects duplicates (if
--merge), generates preview for confirmationUser confirmationPresents mapping preview, handles duplicates (Skip/Merge/Replace), resolves ambiguities, confirms skipped items
Generate SDD artifactsGenerates requirements and/or specifications marked
[IMPORTED]. Applies merge logic if --merge.Quality checkVerifies completeness, consistency, traceability readiness. Generates quality metrics.
Pipeline state updateUpdates
pipeline-state.json, generates import reportOutput artifacts
Import summarySections:
- Source files and formats
- Import statistics (parsed, mapped, skipped, errors)
- Mapping summary (original → SDD)
- Quality assessment
- Items needing manual review
- Pipeline state impact
(if
--target=requirements or --target=both) Generated or merged requirements with [IMPORTED] markers(if
--target=specs or --target=both) Generated or merged specifications