From agents-bmad
One-time per-project setup for the BMAD pipeline — generates the `.forgeplan/bmad/stack.json` language binding that the `bmad-gate.sh` hook reads (test command, test/source file globs, the assertion-failure marker, lint command) and initialises the per-branch state file. Without stack.json the gate cannot classify files, so the no-code-before-plan rule cannot be enforced. Auto-detects the stack from repo markers (pyproject/go.mod/Cargo.toml/package.json/composer.json/ Gemfile/pom.xml), optionally reconciles with a stack-ADR, shows the result for human review, writes it. EN: Run once before the first `/bmad` cycle on a project. Detects the test/source stack and writes `.forgeplan/bmad/stack.json`; initialises `.forgeplan/bmad/state-<branch>.json` at phase=planning. RU: Запусти один раз перед первым циклом `/bmad`. Определяет тест/исходный стек и пишет `.forgeplan/bmad/stack.json`; инициализирует `.forgeplan/bmad/state-<branch>.json` в phase=planning. Triggers: "bmad init", "/bmad-init", "set up bmad", "bmad setup", "configure bmad", "generate bmad stack.json", "заведи bmad", "настрой bmad", "stack.json для bmad"
How this skill is triggered — by the user, by Claude, or both
Slash command
/agents-bmad:bmad-initThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
`/bmad` enforces "no application code before the plan is done" with the `bmad-gate.sh` PreToolUse
/bmad enforces "no application code before the plan is done" with the bmad-gate.sh PreToolUse
hook. That hook needs to know what counts as a source/test file (to block early code writes) — it
reads .forgeplan/bmad/stack.json. This skill creates it and initialises the per-branch state. Run it
once per project (re-run to update after a stack change).
With no stack.json the gate cannot classify files, so it allows everything — no enforcement.
stack.json is the per-project binding that turns the generic methodology into a concrete enforced
arc. It is the derived cache the hook reads on every write — fast, no MCP call (hooks cannot call MCP).
. "${CLAUDE_PLUGIN_ROOT}/scripts/bmad-lib.sh" # or plugins/agents-bmad/scripts/bmad-lib.sh
detect_stack # emits: language <TAB> test_command <TAB> test_file_glob <TAB> source_file_glob <TAB> red_confirm <TAB> lint_command
detect_stack recognises: Python (pyproject/setup.py/pytest.ini/tox.ini), Rust (Cargo.toml), Go
(go.mod), TypeScript/JS (package.json → vitest/jest/npm), PHP (composer.json), Ruby (Gemfile),
Java (pom.xml).
kind=adr titled like "Stack: …"), read it via forgeplan_get and prefer
its declared test_command / globs — the ADR is the source of truth; stack.json is its cache.red_confirm), and the lint
command. Do not guess silently — a wrong glob silently breaks file classification (the gate's #1 job).Present the six fields as a small table and confirm. On confirmation:
write_stack_json "<language>" "<test_command>" "<test_file_glob>" "<source_file_glob>" "<red_confirm>" "<lint_command>"
# writes <repo_root>/.forgeplan/bmad/stack.json and echoes the path
# initialise the per-branch state at phase=planning (governing_rfc filled later by the master)
bash "${CLAUDE_PLUGIN_ROOT}/scripts/bmad-lib.sh" init "$(branch_slug)" ""
Then show the final stack.json and tell the user BMAD is ready: "Run /bmad (or route a greenfield
brief through smith Row 1) to start the persona walk."
stack.json shape{
"language": "python",
"test_command": "pytest -q",
"test_file_glob": "test_*.py|*_test.py|tests/*.py",
"source_file_glob": "*.py",
"red_confirm": "FAILED",
"lint_command": "ruff check ."
}
test_file_glob / source_file_glob — pipe-delimited globs; a pattern with / matches the full
relative path, without / matches the basename. The gate's classify_file uses these; test patterns
win over source when both could match. These two globs are what the gate blocks during planning/
solutioning — get them right or the no-code rule misfires.red_confirm / lint_command — used by the QA personas; carried for parity with the methodology.stack.json blindly — run detect_stack first; fall back to asking the user
only when detection is uncertain. A wrong glob silently breaks the gate's file classification.stack.json is its cache. On disagreement,
prefer the ADR and note the drift.stack.json classifies files wrong and misfires the gate./bmad run
does the rest./bmad — the persona walk this config enables.scripts/bmad-lib.sh — detect_stack + write_stack_json + the state CLI.hooks/bmad-gate.sh — the consumer of stack.json + the state file.npx claudepluginhub forgeplan/marketplace --plugin agents-bmadEnforces cross-project coding conventions for naming, readability, immutability, and code-quality review. Activates on new projects, refactoring, or code review.