From 9ff99eceafe5600ac82399c4c5decab4f456a368 Mon Sep 17 00:00:00 2001 From: DJ Date: Sat, 4 Apr 2026 16:25:59 -0700 Subject: [PATCH 1/2] fix: add mandatory test generation to quick-dev workflow The quick-dev workflow never produced tests because no step required them. This adds a mandatory Tests section to step-03 (implement) and step-oneshot, adds test coverage verification to the step-04 acceptance auditor, and strengthens the spec template to require test tasks in the plan. Closes #2208 Co-Authored-By: Claude Opus 4.6 (1M context) --- .../bmad-quick-dev/spec-template.md | 2 +- .../bmad-quick-dev/step-03-implement.md | 17 ++++++++++++++++- .../bmad-quick-dev/step-04-review.md | 2 +- .../bmad-quick-dev/step-oneshot.md | 10 ++++++++++ 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/spec-template.md b/src/bmm-skills/4-implementation/bmad-quick-dev/spec-template.md index b0e4f53d3..db8ae7473 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/spec-template.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/spec-template.md @@ -53,7 +53,7 @@ context: [] # optional: `{project-root}/`-prefixed paths to project-wide standar ## Tasks & Acceptance - + **Execution:** diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md b/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md index 96e6041bf..d24c33d19 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md @@ -30,9 +30,24 @@ Hand `{spec_file}` to a sub-agent/task and let it implement. If no sub-agents ar **Path formatting rule:** Any markdown links written into `{spec_file}` must use paths relative to `{spec_file}`'s directory so they are clickable in VS Code. Any file paths displayed in terminal/conversation output must use CWD-relative format with `:line` notation (e.g., `src/path/file.ts:42`) for terminal clickability. No leading `/` in either case. +### Tests + +**This is mandatory, not optional.** After implementation, write tests for every new or modified behavior. Follow the project's testing conventions discovered from `{project_context}`, CLAUDE.md, or the existing test suite. + +1. **Discover conventions.** Identify the project's test framework, file-naming patterns, and test directory structure from existing tests. If no existing tests exist, use the project's language-idiomatic defaults. +2. **Write tests.** Cover: + - Happy-path behavior for each new or changed feature. + - Edge cases and error scenarios from the I/O & Edge-Case Matrix (if present in the spec). + - Regressions — any behavior that could break due to the change. +3. **Run tests.** Execute the test suite. All new and existing tests must pass. If any test fails, fix the implementation or the test before proceeding. + +If the project has no test infrastructure at all (no test framework, no test directory, no test scripts), note this in the spec under `## Verification` and skip — but this is the only acceptable reason to skip tests. + ### Self-Check -Before leaving this step, verify every task in the `## Tasks & Acceptance` section of `{spec_file}` is complete. Mark each finished task `[x]`. If any task is not done, finish it before proceeding. +Before leaving this step, verify: +1. Every task in the `## Tasks & Acceptance` section of `{spec_file}` is complete. Mark each finished task `[x]`. If any task is not done, finish it before proceeding. +2. Tests exist for every new or modified behavior (unless the project has no test infrastructure). If tests are missing, go back and write them before proceeding. ## NEXT diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/step-04-review.md b/src/bmm-skills/4-implementation/bmad-quick-dev/step-04-review.md index 2e4449733..38626ef76 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/step-04-review.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/step-04-review.md @@ -26,7 +26,7 @@ Launch three subagents without conversation context. If no sub-agents are availa - **Blind hunter** — receives `{diff_output}` only. No spec, no context docs, no project access. Invoke via the `bmad-review-adversarial-general` skill. - **Edge case hunter** — receives `{diff_output}` and read access to the project. Invoke via the `bmad-review-edge-case-hunter` skill. -- **Acceptance auditor** — receives `{diff_output}`, `{spec_file}`, and read access to the project. Must also read the docs listed in `{spec_file}` frontmatter `context`. Checks for violations of acceptance criteria, rules, and principles from the spec and context docs. +- **Acceptance auditor** — receives `{diff_output}`, `{spec_file}`, and read access to the project. Must also read the docs listed in `{spec_file}` frontmatter `context`. Checks for violations of acceptance criteria, rules, and principles from the spec and context docs. **Must also verify that tests exist for every new or modified behavior** — missing test coverage for changed code is a `bad_spec` finding unless the project has no test infrastructure. ### Classify diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md b/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md index b6384159a..1c8b15973 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md @@ -16,6 +16,16 @@ spec_file: '' # set by step-01 before entering this step Implement the clarified intent directly. +### Tests + +**This is mandatory, not optional.** After implementation, write tests for every new or modified behavior. Follow the project's testing conventions discovered from `{project_context}`, CLAUDE.md, or the existing test suite. + +1. **Discover conventions.** Identify the project's test framework, file-naming patterns, and test directory structure from existing tests. If no existing tests exist, use the project's language-idiomatic defaults. +2. **Write tests.** Cover happy-path behavior, edge cases, and regressions. +3. **Run tests.** All new and existing tests must pass. Fix failures before proceeding. + +If the project has no test infrastructure at all (no test framework, no test directory, no test scripts), skip — but this is the only acceptable reason to skip tests. + ### Review Invoke the `bmad-review-adversarial-general` skill in a subagent with the changed files. The subagent gets NO conversation context — to avoid anchoring bias. If no sub-agents are available, write the changed files to a review prompt file in `{implementation_artifacts}` and HALT. Ask the human to run the review in a separate session and paste back the findings. From 33bd6b5d864f6880cdd434a9a8cebe82d5983e8d Mon Sep 17 00:00:00 2001 From: DJ Date: Sat, 4 Apr 2026 20:23:37 -0700 Subject: [PATCH 2/2] fix: improve test convention discovery and require skip reason documentation Address PR #2212 review feedback: - Expand "Discover conventions" to check configured test tooling (test scripts, dependency manifests, config files) before falling back to language-idiomatic defaults, so repos with test infrastructure but no test files yet pick the correct framework. - Require explicit skip reason in final summary output when skipping tests due to missing infrastructure, improving traceability. - Apply consistently to both step-03-implement.md and step-oneshot.md. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../4-implementation/bmad-quick-dev/step-03-implement.md | 9 ++++++--- .../4-implementation/bmad-quick-dev/step-oneshot.md | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md b/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md index d24c33d19..a6362531f 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md @@ -32,16 +32,19 @@ Hand `{spec_file}` to a sub-agent/task and let it implement. If no sub-agents ar ### Tests -**This is mandatory, not optional.** After implementation, write tests for every new or modified behavior. Follow the project's testing conventions discovered from `{project_context}`, CLAUDE.md, or the existing test suite. +**This is mandatory, not optional.** After implementation, write tests for every new or modified behavior. Follow the project's testing conventions discovered from `{project_context}`, CLAUDE.md, the existing test suite, and any configured test tooling. -1. **Discover conventions.** Identify the project's test framework, file-naming patterns, and test directory structure from existing tests. If no existing tests exist, use the project's language-idiomatic defaults. +1. **Discover conventions.** Identify the project's test framework, file-naming patterns, and test directory structure in this order: + - First, inspect existing tests. + - If existing tests are missing or insufficient, inspect the repo's configured test tooling: test scripts, dependencies/devDependencies, and test config files (for example `package.json`, `pytest.ini`, `pyproject.toml`, `jest.config.*`, `vitest.config.*`, `mocha` config, `rspec` config, `go test` conventions, etc.). + - Only if neither existing tests nor configured tooling establish conventions should you fall back to the project's language-idiomatic defaults. 2. **Write tests.** Cover: - Happy-path behavior for each new or changed feature. - Edge cases and error scenarios from the I/O & Edge-Case Matrix (if present in the spec). - Regressions — any behavior that could break due to the change. 3. **Run tests.** Execute the test suite. All new and existing tests must pass. If any test fails, fix the implementation or the test before proceeding. -If the project has no test infrastructure at all (no test framework, no test directory, no test scripts), note this in the spec under `## Verification` and skip — but this is the only acceptable reason to skip tests. +If the project has no test infrastructure at all (no existing tests, no test framework, no relevant test config, no test directory, and no test scripts), note this in the spec under `## Verification` and skip — but this is the only acceptable reason to skip tests. Record this skip reason explicitly in the final summary output. ### Self-Check diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md b/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md index 1c8b15973..814e2177e 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md @@ -18,13 +18,16 @@ Implement the clarified intent directly. ### Tests -**This is mandatory, not optional.** After implementation, write tests for every new or modified behavior. Follow the project's testing conventions discovered from `{project_context}`, CLAUDE.md, or the existing test suite. +**This is mandatory, not optional.** After implementation, write tests for every new or modified behavior. Follow the project's testing conventions discovered from `{project_context}`, CLAUDE.md, the existing test suite, and any configured test tooling. -1. **Discover conventions.** Identify the project's test framework, file-naming patterns, and test directory structure from existing tests. If no existing tests exist, use the project's language-idiomatic defaults. +1. **Discover conventions.** Identify the project's test framework, file-naming patterns, and test directory structure in this order: + - First, inspect existing tests. + - If existing tests are missing or insufficient, inspect the repo's configured test tooling: test scripts, dependencies/devDependencies, and test config files (for example `package.json`, `pytest.ini`, `pyproject.toml`, `jest.config.*`, `vitest.config.*`, `mocha` config, `rspec` config, `go test` conventions, etc.). + - Only if neither existing tests nor configured tooling establish conventions should you fall back to the project's language-idiomatic defaults. 2. **Write tests.** Cover happy-path behavior, edge cases, and regressions. 3. **Run tests.** All new and existing tests must pass. Fix failures before proceeding. -If the project has no test infrastructure at all (no test framework, no test directory, no test scripts), skip — but this is the only acceptable reason to skip tests. +If the project has no test infrastructure at all (no existing tests, no test framework, no relevant test config, no test directory, and no test scripts), skip — but this is the only acceptable reason to skip tests. Record this skip reason explicitly in the final summary output. ### Review