flow-adoption
Skill0 starsChanged 5 months agoApache-2.0View on GitHub
Playbook for onboarding existing projects into the spec-driven BDD flow — gap analysis, reverse-engineering specs from code, characterization testing, adoption prioritization. Loaded by project-adopter; consulted by testers and devs executing adoption tasks, and by spec-validate-final on origin:reverse-engineered specs (Spec validation checks section only). Explicitly loaded — never stack-detected.
In this repository17 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- flow-legacy-migrationSkill
- stack-awsSkill
- stack-azureSkill
- stack-design-systemSkill
- stack-gcpSkill
- stack-javaSkill
- stack-kafkaSkill
- stack-mongodbSkill
- stack-natsSkill
- stack-nestjsSkill
- stack-nextjs-reactSkill
- stack-nxSkill
- stack-playwrightSkill
- stack-postgresqlSkill
- stack-quarkusSkill
- stack-react-nativeSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 61
Use the seams docs/map/USAGES.md flags: boundaries with few callers and stable shapes — HTTP handlers, service facades, repository ports, …
- Distinctive: line 62
Prefer the narrowest seam that covers the behavior the upcoming change touches.
- Distinctive: line 70
Born-green discipline: every characterization test passes against the UNTOUCHED code at commit time (✅ test commit).
- Distinctive: line 75
Do NOT fix it — the fix is planned after blessing, red-first, like any behavior change.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Flow: Adoption (existing project → spec-driven BDD)
Process playbook, not a stack overlay: it never appears in
docs/TECH_STACK.md## Detected stacksand is loaded explicitly by the agents named below. Binding rules live in.claude/rules/ADOPTION.md(R-ADOPT-01..05); this file is the HOW.
When this applies
project-adopterreads this file before its workflow (its Inputs say so).unit-integration-tester/e2e-testerconsult it when a task's ACs are marked(characterization)or the feature's SPEC_<FEATURE>.md carriesorigin: reverse-engineeredwithstatus: draft.- Dev agents and
code-reviewerconsult it when executing or reviewing tasks inside an adopted feature that is not yet blessed (R-ADOPT-03). spec-validate-finalloads ONLY the## Spec validation checkssection, and only when the spec under validation carriesorigin: reverse-engineered(its Adoption overlay).- The migration flow consumes it indirectly:
/migrate-legacycorridors that lack behavior specs are adopted first via/repository-to-claude <corridor-scope>(.claude/workflows/LEGACY_MIGRATION_WORKFLOW.mdM.4 precondition). - It does NOT apply to greenfield capabilities — those follow the normal
/create-specflow even inside an adopted project.
Gap analysis checklist
Audit every row; record current state + evidence + severity in docs/ADOPTION_PLAN.md.
| Requirement of the flow | What to check | Evidence |
| Specs per feature | specs/features/<feature>/SPEC_<FEATURE>.md exists per inventoried feature; frontmatter parses | ls specs/features/*/SPEC_*.md; frontmatter grep |
| Test baseline | unit/integration/e2e suites exist and run green; commands match docs/VALIDATION.md | run the validation commands |
| Coverage shape | tests cover the hot paths the map flags; pyramid not inverted | docs/map/USAGES.md hot paths vs test inventory |
| Branch/gitignore hygiene | .gitignore contains tmp/ and .claude/settings.local.json; no stale feature/* branches lingering after merge | read .gitignore; git branch --list 'feature/*' 'hotfix/*' |
| Devcontainer sandbox | .devcontainer/ exists, no /var/run/docker.sock mount, dev service non-privileged (Docker via rootless dind sidecar), every allowlist.txt line justified by a current stack (R-DEVC-02/03/07) | read .devcontainer/*; diff allowlist vs docs/TECH_STACK.md |
| GitHub configuration | .github/ issue forms + label taxonomy installed and conforming (R-ISSUE-04) when tracker mode is on — gap row proposes /setup-github | read .github/ISSUE_TEMPLATE/*; gh label list vs labels.yml |
| Generated docs set | all of docs/{PROJECT_SPEC,ARCHITECTURE,TECH_STACK,DATABASE,VERSION_CONTROL,VALIDATION,DEV_SETUP}.md present, non-empty | wc -l docs/*.md |
| CI | CI exists and runs the same commands as docs/VALIDATION.md | CI config vs VALIDATION.md |
| Commit/branch convention | recent history vs docs/COMMIT_CONVENTION.md and docs/VERSION_CONTROL.md | git log --oneline -30 sample |
Severity: missing spec/characterization on a feature about to change = BLOCKER for that change (R-ADOPT-01). Hygiene/CI/docs gaps = plan items, not blockers. A gap of the kind "the structure or stack itself must change shape" is out of adoption's scope — record it in docs/ADOPTION_PLAN.md under ## Structural mismatch with a pointer to /migrate-legacy (recommendation only; migrations start exclusively on explicit user intent — legacy-migrator Gate 2).
Reverse-engineering specs from code
Behavior-first: spec what the system DOES at its boundaries, not how files are organized. Evidence comes from the map; raw source reads only verify specific seams the map flags.
| Code evidence (via the map) | Spec section |
Routes, handlers, CLI/queue entry points (SOURCE_TREE.md entry points) | §2 User Stories — one per user-meaningful operation |
| Validations, guards, constraint checks, authz branches | §5 Business Rules — with the concrete boundary values found in code |
| Persisted shapes, migrations, indexes | §3 Data Model — as-is, including warts |
Exported operations + request/response shapes (USAGES.md key symbols) | §4 API & Domain |
| Observed edge-case handling: error paths, retries, idempotency keys, tenant filters | §8 ACs — GWT, asserting CURRENT behavior |
What NOT to spec from code:
- Dead paths — anything in the map's dead-looking zones. Spec nothing; list under §10 Open Questions ("dead? confirm, then delete via the pipeline").
- Accidental behavior — incidental ordering, timing windows, tolerance of unvalidated input, behavior that exists only because nothing forbids it. Never enshrine as an AC; record as a §10 open question for the blessing review.
- Aspirations — comments/TODOs describing intended-but-absent behavior. The draft describes what IS.
Frontmatter for every draft: origin: reverse-engineered, status: draft. The draft stays DESCRIPTIVE until the user blesses it (R-ADOPT-03 HARD STOP) — only then does .claude/rules/SPEC_IS_SOURCE_OF_TRUTH.md bind.
Characterization testing
Goal: pin current behavior — including bugs — so subsequent change becomes observable. Born GREEN: the single documented exception to red-first (R-ADOPT-02, citing .claude/rules/BDD_GWT.md).
Picking pinch points — test at seams, not internals:
- Use the seams
docs/map/USAGES.mdflags: boundaries with few callers and stable shapes — HTTP handlers, service facades, repository ports, message consumers. - Prefer the narrowest seam that covers the behavior the upcoming change touches; internals churn, seams survive refactors.
Golden-master / approval recipes:
- Build an input matrix at the seam: typical + boundary + error inputs; the map's hot paths decide which seams deserve density.
- Capture actual outputs verbatim (response bodies, emitted events, resulting rows) as approved snapshots or explicit assertions.
- Normalize nondeterminism (timestamps, generated ids, unordered collections) BEFORE approving — a flaky golden master pins nothing.
- Name tests
AC-<FEATURE>-NN (characterization): <behavior>, mirroring the draft AC's GWT wording.
Born-green discipline: every characterization test passes against the UNTOUCHED code at commit time (✅ test commit). A red characterization test asserts what you wish, not what is — rewrite it, or move it to a post-blessing fix task.
Bug-found-while-characterizing protocol (R-ADOPT-02):
- Pin the buggy behavior, with a comment naming it a pinned defect.
- Append a pending entry to
specs/features/<feature>/CHANGELOG.md(Follow-up: pending-plan) stating current vs expected behavior. - Do NOT fix it — the fix is planned after blessing, red-first, like any behavior change.
Prioritization
Score every inventoried feature 1–3 per axis; priority = risk × change-frequency × value (max 27). Adopt highest first; tie-break by lowest characterization cost (fewest/narrowest seams).
| Axis | 1 | 2 | 3 | Evidence |
| Risk | well-tested, small blast radius | partial tests or wide dependents | untested + map hot path / wide blast radius | USAGES.md dependents, test inventory |
| Change frequency | untouched >12 months | occasional | high churn | git log --since per module |
| Value | internal convenience | supporting capability | user/revenue critical | docs/PROJECT_SPEC.md, user input |
A feature about to be MODIFIED jumps the queue regardless of score — R-ADOPT-01 forces its adoption first.
Spec validation checks
Adoption-specific checks. Loaded by code-reviewer on adopted-feature diffs, and by spec-validate-final whenever the spec under validation carries origin: reverse-engineered frontmatter (its Adoption overlay — the only spec validator wired to this section; the other validators never load this file):
| Check | Severity |
| Code modified in an adopted feature without a reverse-engineered spec + characterization coverage of the touched behavior (R-ADOPT-01) | BLOCKER |
Spec for an adopted feature missing the origin: reverse-engineered frontmatter marker | BLOCKER |
| Characterization test masquerading as red-first: committed red, or asserting target (not current) behavior before blessing | BLOCKER |
| Silent bug-fix during characterization: behavior change inside a characterization commit, or a pinned defect with no pending CHANGELOG entry | BLOCKER |
Draft spec treated as canonical: status: draft but findings cite it prescriptively (R-ADOPT-03) | MAJOR |
| Accidental or dead-path behavior enshrined as an AC instead of a §10 open question | WARNING |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

