ワンクリックで
brownfield
Discover and map an existing codebase before planning or changing it.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Discover and map an existing codebase before planning or changing it.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Change the behavior of existing code — story-driven by default, or --issue N for a GitHub bug fix. Test-first, full verification, code review.
Use when a planned change touches persisted data shape — ORM models, migration files, schema definitions, serialized formats, or message contracts — in /change, /refactor, or /implement on an existing codebase. Routes schema changes through expand-contract and proves reversibility before any deploy.
Generate production code and tests for a story group using agent teams for parallel execution.
Refactor existing code for quality, performance, or maintainability. Enforces core quality principles with ratchet gate.
Generate test plan, test cases, test data fixtures, and Playwright E2E tests mapped to acceptance criteria.
Use when bumping a dependency version — package.json, pyproject.toml, requirements, or lockfile changes — in an existing codebase. Classifies the bump, audits the usage surface from the code graph, and isolates the upgrade in its own proven commit.
| name | brownfield |
| description | Discover and map an existing codebase before planning or changing it. |
| argument-hint | [optional-focus-path-or-goal] |
| context | fork |
| agent | planner |
Use /brownfield in existing repositories before substantial planning, improvements, refactors, or bug work. The goal is to build a factual map of the current system so agents respect the codebase instead of inventing a parallel architecture.
This skill does not change production code.
Ultracode tip: Mapping an unknown codebase is the canonical fan-out task, so run
/effort ultracodebefore this phase — broad parallel coverage plus adversarial verification produces better maps. Drop back to/effort highbefore the execution phases (/auto,/implement).
/brownfield
/brownfield backend/src
/brownfield "map auth and billing before adding team invites"
Write these files:
| File | Purpose |
|---|---|
specs/brownfield/codebase-map.md | Languages, frameworks, package managers, entry points, services, commands. LLM-written inventory — distinct from symbol-map.md, the script-generated navigation index from /code-map |
specs/brownfield/code-graph.json | Deterministic dependency graph produced by /code-map |
specs/brownfield/code-graph.meta.json | Producer, language counts, scan warnings, timestamp |
specs/brownfield/dependency-graph.md | Mermaid render of file/module-level edges |
specs/brownfield/coupling-report.md | Fan-in, fan-out, cycles, hubs, unstable modules |
specs/brownfield/architecture-map.md | Modules, layers, data flow, public interfaces, external dependencies — cites graph evidence |
specs/brownfield/test-map.md | Test commands, coverage signals, public interfaces covered/missing, slow/flaky tests |
specs/brownfield/risk-map.md | Sensitive areas, fragile zones, structural risks, auth/security/billing/data risks |
specs/brownfield/change-strategy.md | Recommended lane for future work: /vibe, /change, /refactor, /spec, /auto |
specs/brownfield/seams-<goal>.md | Optional ranked seam candidates produced by /seam-finder "<goal>" |
CONTEXT.md | Optional domain glossary, created only when meaningful domain terms are discovered |
Discover facts, not guesses:
Use rg, find, package manifests, config files, and existing docs. Prefer primary repo evidence over assumptions.
/code-map)Run the /code-map skill (.claude/skills/code-map/SKILL.md) — its Steps 1–3 are the single source of truth for producer detection (AST indexer → Understand-Anything import → regex fallback), the exact commands, and the rendering of symbol-map.md, dependency-graph.md, and coupling-report.md. Do not restate or improvise those commands here; if anything in this skill disagrees with code-map's SKILL.md, code-map wins.
Expected artifacts under specs/brownfield/ when it completes: code-graph.json (+ .meta.json), symbol-map.md, skeletons/ (god files only), dependency-graph.md, coupling-report.md.
If the graph is empty or has only warnings, stop and report. Do not invent architecture from filenames. When the AST producer ran, treat symbol-map.md and skeletons/ as the navigation layer: read a single symbol with Read(offset=START, limit=END-START+1) instead of reading god files whole.
Write architecture-map.md with:
code-graph.jsonimports / calls chainsext:* targets from the graph where availablecoupling-report.mdEvery "module X depends on Y" claim must reference graph evidence, preferably an edge with file:line evidence. Do not redesign the system. Capture what exists.
Write test-map.md with:
If commands are obvious and safe, run lightweight discovery commands such as npm test -- --help, pytest --collect-only, or package script listing. Do not run expensive test suites unless the user asked.
Write risk-map.md with:
Read these from coupling-report.md and code-graph.json:
test-map.md.For each risk, include the evidence path or graph node id.
Write change-strategy.md with:
/vibe/change (behavior change; --issue N for a tracked bug)/refactor/spec → /design → /autoInclude a short "first safe next steps" list.
When recommending /spec → /design → /auto for any cluster of work, note in the strategy that /auto parallelizes on two axes:
.claude/agents/generator.md Rule 2..claude/skills/auto/SKILL.md.This shapes how you cluster stories AND how you shape the dependency graph: clusters with truly independent stories get within-group parallelism, and independent dependency groups (backend vs frontend vs ingest, for example) get cross-group parallelism. Prefer designs that surface independence at both levels — group by integration boundary internally, and minimize cross-group Consumes: edges in the dependency graph.
If the requested work has a concrete goal, recommend running /seam-finder "<goal>" after /brownfield. Use seams-<goal>.md to choose whether the next lane should extend an existing seam, wrap a boundary, introduce an adapter, split a read/write path, or avoid a poor seam.
If recurring domain terms are discovered, create or update CONTEXT.md.
Keep it domain-level:
# Context
## Terms
### Account
Definition meaningful to users/domain experts.
### User
Definition and how it differs from Account.
Do not fill CONTEXT.md with implementation details.
Before recommending implementation, present:
Do not proceed to code changes from /brownfield unless the user explicitly asks.
After all discovery artifacts are written, spawn the evaluator agent (artifact mode) to validate the brownfield analysis.
Agent invocation:
Spawn Agent with subagent_type="evaluator" and prompt:
Ratchet loop (max 2 iterations):
Human approval is required before proceeding to implementation.
Present the discovery maps with the evaluator's quality summary:
Ask: "Does this brownfield analysis look accurate? Approve to proceed, or flag areas that need re-scanning."
Do not proceed to code changes from /brownfield unless the user explicitly approves the discovery AND requests changes.
CONTEXT.md.