agentleFS
isabelle-barpisabelle-barp/agent-brain/skills/flow-adoption/SKILL.md

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.

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
  1. Very specific:

    Use the seams docs/map/USAGES.md flags: boundaries with few callers and stable shapes — HTTP handlers, service facades, repository ports, …

    line 61
  2. Distinctive:

    Prefer the narrowest seam that covers the behavior the upcoming change touches.

    line 62
  3. Distinctive:

    Born-green discipline: every characterization test passes against the UNTOUCHED code at commit time (✅ test commit).

    line 70
  4. Distinctive:

    Do NOT fix it — the fix is planned after blessing, red-first, like any behavior change.

    line 75

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Flow: Adoption (existing project → spec-driven BDD)

Process playbook, not a stack overlay: it never appears in docs/TECH_STACK.md ## Detected stacks and 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-adopter reads this file before its workflow (its Inputs say so).
  • unit-integration-tester / e2e-tester consult it when a task's ACs are marked (characterization) or the feature's SPEC_<FEATURE>.md carries origin: reverse-engineered with status: draft.
  • Dev agents and code-reviewer consult it when executing or reviewing tasks inside an adopted feature that is not yet blessed (R-ADOPT-03).
  • spec-validate-final loads ONLY the ## Spec validation checks section, and only when the spec under validation carries origin: reverse-engineered (its Adoption overlay).
  • The migration flow consumes it indirectly: /migrate-legacy corridors that lack behavior specs are adopted first via /repository-to-claude <corridor-scope> (.claude/workflows/LEGACY_MIGRATION_WORKFLOW.md M.4 precondition).
  • It does NOT apply to greenfield capabilities — those follow the normal /create-spec flow even inside an adopted project.

Gap analysis checklist

Audit every row; record current state + evidence + severity in docs/ADOPTION_PLAN.md.

Requirement of the flowWhat to checkEvidence
Specs per featurespecs/features/<feature>/SPEC_<FEATURE>.md exists per inventoried feature; frontmatter parsesls specs/features/*/SPEC_*.md; frontmatter grep
Test baselineunit/integration/e2e suites exist and run green; commands match docs/VALIDATION.mdrun the validation commands
Coverage shapetests cover the hot paths the map flags; pyramid not inverteddocs/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 mergeread .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-githubread .github/ISSUE_TEMPLATE/*; gh label list vs labels.yml
Generated docs setall of docs/{PROJECT_SPEC,ARCHITECTURE,TECH_STACK,DATABASE,VERSION_CONTROL,VALIDATION,DEV_SETUP}.md present, non-emptywc -l docs/*.md
CICI exists and runs the same commands as docs/VALIDATION.mdCI config vs VALIDATION.md
Commit/branch conventionrecent history vs docs/COMMIT_CONVENTION.md and docs/VERSION_CONTROL.mdgit 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.md flags: 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:

  1. Build an input matrix at the seam: typical + boundary + error inputs; the map's hot paths decide which seams deserve density.
  2. Capture actual outputs verbatim (response bodies, emitted events, resulting rows) as approved snapshots or explicit assertions.
  3. Normalize nondeterminism (timestamps, generated ids, unordered collections) BEFORE approving — a flaky golden master pins nothing.
  4. 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):

  1. Pin the buggy behavior, with a comment naming it a pinned defect.
  2. Append a pending entry to specs/features/<feature>/CHANGELOG.md (Follow-up: pending-plan) stating current vs expected behavior.
  3. 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).

Axis123Evidence
Riskwell-tested, small blast radiuspartial tests or wide dependentsuntested + map hot path / wide blast radiusUSAGES.md dependents, test inventory
Change frequencyuntouched >12 monthsoccasionalhigh churngit log --since per module
Valueinternal conveniencesupporting capabilityuser/revenue criticaldocs/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):

CheckSeverity
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 markerBLOCKER
Characterization test masquerading as red-first: committed red, or asserting target (not current) behavior before blessingBLOCKER
Silent bug-fix during characterization: behavior change inside a characterization commit, or a pinned defect with no pending CHANGELOG entryBLOCKER
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 questionWARNING

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.