From 730f0fbd203def54ffc26251d4eb25d118f9ed77 Mon Sep 17 00:00:00 2001 From: KKranthi6881 Date: Mon, 18 May 2026 10:29:09 -0500 Subject: [PATCH] Add guarded implement-all command --- CHANGELOG.md | 2 + README.md | 1 + commands/dbt.implement-all.md | 60 +++++++++++++++++++ docs/getting-started.md | 4 +- docs/methodology.md | 4 ++ docs/tutorials/02-jaffle-shop-change.md | 8 +++ .../04-skills-and-sub-agent-handoffs.md | 3 + templates/CLAUDE.md.template | 1 + tests/test_docs.py | 15 +++++ tests/test_init.py | 1 + 10 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 commands/dbt.implement-all.md diff --git a/CHANGELOG.md b/CHANGELOG.md index da68d7b..7c9978e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Warehouse presets and guides for Redshift, Postgres, SQL Server, Azure SQL, MySQL, DuckDB, MotherDuck, and Athena. +- `/dbt.implement-all` command template for sequential multi-task implementation with validation + checkpoints and stop conditions. ## [1.1.0] — 2026-05-18 diff --git a/README.md b/README.md index 9eca840..5088fb2 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ The agent commands are: - `/dbt.plan` creates a file-by-file implementation contract. - `/dbt.tasks` decomposes the approved plan into small tasks. - `/dbt.implement` executes one task at a time. +- `/dbt.implement-all` executes approved pending tasks sequentially, stopping on validation or scope failures. - `/dbt.analyze` checks traceability before implementation. - `/dbt.review` reviews the final diff against the approved plan. diff --git a/commands/dbt.implement-all.md b/commands/dbt.implement-all.md new file mode 100644 index 0000000..79945f4 --- /dev/null +++ b/commands/dbt.implement-all.md @@ -0,0 +1,60 @@ +# /dbt.implement-all — execute approved pending tasks with checkpoints + +You are implementing the remaining approved tasks in order. This command is for small, well-scoped +plans where the approved task list already names all files and validation evidence. + +## Read these first +1. The current `specs/-/tasks.md` +2. The approved `specs/-/plan.md` +3. The approved `specs/-/spec.md` +4. `.dbt-specify/constitution.md` +5. `CLAUDE.md` +6. Relevant `.dbt-specify/skills/` and dbt Labs skills + +## Preflight + +Before editing, confirm: + +1. The plan is approved. +2. Every pending task has a clear "Done when" validation step. +3. The plan contains a concrete "Files to add/modify/delete" list. +4. There are no unrelated uncommitted changes in files you need to edit. +5. The work fits the approved scope. + +If any preflight item fails, stop and tell the user what must be fixed. + +## What to do + +1. Find the first unchecked task in `tasks.md`. +2. Implement ONLY that task. +3. Run the task's validation step, `dbt parse`, and relevant `dbt test` selectors. +4. If validation passes, check the task's box `[x]`. +5. Commit using the message format `T-NN: ` with a body referencing the spec, + plan, and task paths. +6. Continue to the next unchecked task only after the prior task is committed. +7. After all tasks are complete, run: + - `dbt-specify validate project` + - `dbt parse` + - `dbt-specify validate dbt --manifest target/manifest.json`, if a manifest exists + - `dbt-specify report --format markdown` +8. Stop and summarize completed tasks, commits, validation evidence, and remaining review steps. + +## Stop immediately if + +- A validation command fails. +- A task requires a file not listed in the approved plan. +- A dbt model or YAML file would be edited outside the current task. +- A business rule, grain, contract, metric, or governance decision is unclear. +- You discover unrelated bugs or refactors. +- Two tasks would require conflicting edits in the same file. + +## Hard rules + +- Execute tasks sequentially, never in parallel. +- Do not skip tasks. +- Do not combine task commits. +- Do not add files not listed in the approved plan. +- Do not silently update the spec, plan, or task scope. +- Do not mark a task complete if validation fails. +- Do not run `/dbt.review` for yourself. Ask the user to run review after implementation. +- Never auto-merge. Human approval is the final gate. diff --git a/docs/getting-started.md b/docs/getting-started.md index a67a4e1..fe36bd0 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -73,7 +73,9 @@ In your AI agent, invoke `/dbt.specify `. The agent 3. Draft `specs/001-/spec.md` 4. Tell you to review -Once you approve, run `/dbt.plan` to get a plan, then `/dbt.tasks` to break it down, then `/dbt.implement` to execute one task at a time. +Once you approve, run `/dbt.plan` to get a plan, then `/dbt.tasks` to break it down, then +`/dbt.implement` to execute one task at a time. For small approved plans, `/dbt.implement-all` can +run pending tasks sequentially while stopping on validation failures or scope changes. Validate your spec is EARS-conformant: diff --git a/docs/methodology.md b/docs/methodology.md index 90273d0..30ae5d1 100644 --- a/docs/methodology.md +++ b/docs/methodology.md @@ -50,6 +50,10 @@ Tasks are ordered by dependency: sources → staging → intermediate → marts **Human checkpoint:** the engineer reviews and approves the final diff before merge. `/dbt.implement` runs one task per invocation. After each task: validate, commit with the task-id message format, and stop. Never work ahead. + +For small, approved plans, `/dbt.implement-all` may run the pending tasks sequentially. It still +validates and commits after each task, stops on any failure or scope expansion, and never merges. +Use it only after the spec, plan, and task list have been reviewed. If delegated, the implementation worker follows `.dbt-specify/agents/implementation-agent.md` and may edit only files listed in the approved plan. diff --git a/docs/tutorials/02-jaffle-shop-change.md b/docs/tutorials/02-jaffle-shop-change.md index cc1f311..2fed474 100644 --- a/docs/tutorials/02-jaffle-shop-change.md +++ b/docs/tutorials/02-jaffle-shop-change.md @@ -81,6 +81,14 @@ Good tasks are small: The implementation agent should complete one checked task and stop. +For a short demo with a reviewed plan, you can use: + +```text +/dbt.implement-all +``` + +It still runs tasks sequentially and stops if validation fails or the file scope changes. + ## 6. Validate and review Run: diff --git a/docs/tutorials/04-skills-and-sub-agent-handoffs.md b/docs/tutorials/04-skills-and-sub-agent-handoffs.md index e3af57d..72f09ca 100644 --- a/docs/tutorials/04-skills-and-sub-agent-handoffs.md +++ b/docs/tutorials/04-skills-and-sub-agent-handoffs.md @@ -64,6 +64,9 @@ T1. Stop after validation evidence is recorded. Do not run two implementation agents against the same model or YAML file. +For small, approved plans, `/dbt.implement-all` can process pending tasks in order. It must still +commit after each task and stop on validation failure, unclear scope, or unapproved files. + ## 5. Review final evidence Before merge: diff --git a/templates/CLAUDE.md.template b/templates/CLAUDE.md.template index 886b8d1..3067183 100644 --- a/templates/CLAUDE.md.template +++ b/templates/CLAUDE.md.template @@ -25,6 +25,7 @@ Core commands map to the phases: - `/dbt.plan` — reads the current spec and proposes a plan - `/dbt.tasks` — decomposes the approved plan into ordered tasks - `/dbt.implement` — executes the next task +- `/dbt.implement-all` — executes approved pending tasks sequentially with validation checkpoints - `/dbt.analyze` — checks spec/plan/task traceability before implementation - `/dbt.review` — reviews the final diff against the approved plan diff --git a/tests/test_docs.py b/tests/test_docs.py index 5749e0c..8e5c03b 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -33,6 +33,21 @@ def test_jaffle_shop_walkthrough_has_required_commands() -> None: assert command in text +def test_implement_all_command_is_documented() -> None: + command = (ROOT / "commands" / "dbt.implement-all.md").read_text() + assert "execute approved pending tasks" in command + assert "Commit using the message format" in command + assert "Stop immediately" in command + assert "Never auto-merge" in command + + readme = (ROOT / "README.md").read_text() + claude_template = (ROOT / "templates" / "CLAUDE.md.template").read_text() + methodology = (ROOT / "docs" / "methodology.md").read_text() + assert "/dbt.implement-all" in readme + assert "/dbt.implement-all" in claude_template + assert "/dbt.implement-all" in methodology + + def test_launch_ready_oss_files_exist() -> None: required_paths = [ "SECURITY.md", diff --git a/tests/test_init.py b/tests/test_init.py index d480854..9d74c27 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -69,6 +69,7 @@ def test_init_creates_dbt_specify_dir(minimal_dbt_project: Path) -> None: # Commands and skills directories created assert (minimal_dbt_project / ".dbt-specify" / "commands").is_dir() assert (minimal_dbt_project / ".dbt-specify" / "commands" / "dbt.analyze.md").exists() + assert (minimal_dbt_project / ".dbt-specify" / "commands" / "dbt.implement-all.md").exists() assert (minimal_dbt_project / ".dbt-specify" / "commands" / "dbt.review.md").exists() assert (minimal_dbt_project / ".dbt-specify" / "skills").is_dir() agents_dir = minimal_dbt_project / ".dbt-specify" / "agents"