@brunosps00/dev-workflow 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +48 -20
  2. package/lib/constants.js +2 -10
  3. package/lib/init.js +20 -3
  4. package/lib/migrate-gsd.js +1 -1
  5. package/lib/utils.js +8 -3
  6. package/package.json +1 -1
  7. package/scaffold/en/commands/dw-analyze-project.md +61 -0
  8. package/scaffold/en/commands/dw-autopilot.md +6 -6
  9. package/scaffold/en/commands/dw-brainstorm.md +1 -1
  10. package/scaffold/en/commands/dw-bugfix.md +1 -0
  11. package/scaffold/en/commands/dw-code-review.md +29 -0
  12. package/scaffold/en/commands/dw-commit.md +6 -0
  13. package/scaffold/en/commands/dw-create-prd.md +16 -0
  14. package/scaffold/en/commands/dw-create-tasks.md +42 -0
  15. package/scaffold/en/commands/dw-create-techspec.md +19 -0
  16. package/scaffold/en/commands/dw-deep-research.md +6 -0
  17. package/scaffold/en/commands/dw-deps-audit.md +1 -0
  18. package/scaffold/en/commands/dw-find-skills.md +4 -4
  19. package/scaffold/en/commands/dw-fix-qa.md +1 -0
  20. package/scaffold/en/commands/dw-generate-pr.md +1 -0
  21. package/scaffold/en/commands/dw-help.md +9 -29
  22. package/scaffold/en/commands/dw-intel.md +1 -1
  23. package/scaffold/en/commands/dw-refactoring-analysis.md +2 -1
  24. package/scaffold/en/commands/dw-review-implementation.md +28 -2
  25. package/scaffold/en/commands/dw-run-plan.md +2 -2
  26. package/scaffold/en/templates/constitution-template.md +111 -0
  27. package/scaffold/en/templates/idea-onepager.md +1 -1
  28. package/scaffold/pt-br/commands/dw-analyze-project.md +61 -0
  29. package/scaffold/pt-br/commands/dw-autopilot.md +6 -6
  30. package/scaffold/pt-br/commands/dw-brainstorm.md +1 -1
  31. package/scaffold/pt-br/commands/dw-bugfix.md +1 -0
  32. package/scaffold/pt-br/commands/dw-code-review.md +29 -0
  33. package/scaffold/pt-br/commands/dw-commit.md +6 -0
  34. package/scaffold/pt-br/commands/dw-create-prd.md +16 -0
  35. package/scaffold/pt-br/commands/dw-create-tasks.md +42 -0
  36. package/scaffold/pt-br/commands/dw-create-techspec.md +19 -0
  37. package/scaffold/pt-br/commands/dw-deep-research.md +6 -0
  38. package/scaffold/pt-br/commands/dw-deps-audit.md +1 -0
  39. package/scaffold/pt-br/commands/dw-find-skills.md +4 -4
  40. package/scaffold/pt-br/commands/dw-fix-qa.md +1 -0
  41. package/scaffold/pt-br/commands/dw-generate-pr.md +1 -0
  42. package/scaffold/pt-br/commands/dw-help.md +9 -29
  43. package/scaffold/pt-br/commands/dw-intel.md +1 -1
  44. package/scaffold/pt-br/commands/dw-refactoring-analysis.md +2 -1
  45. package/scaffold/pt-br/commands/dw-review-implementation.md +21 -2
  46. package/scaffold/pt-br/commands/dw-run-plan.md +2 -2
  47. package/scaffold/pt-br/templates/constitution-template.md +111 -0
  48. package/scaffold/pt-br/templates/idea-onepager.md +1 -1
  49. package/scaffold/skills/dw-codebase-intel/SKILL.md +1 -0
  50. package/scaffold/skills/dw-codebase-intel/references/api-design-discipline.md +138 -0
  51. package/scaffold/skills/dw-debug-protocol/SKILL.md +106 -0
  52. package/scaffold/skills/dw-debug-protocol/references/error-categorization.md +127 -0
  53. package/scaffold/skills/dw-debug-protocol/references/non-reproducible-strategy.md +108 -0
  54. package/scaffold/skills/dw-debug-protocol/references/six-step-triage.md +139 -0
  55. package/scaffold/skills/dw-debug-protocol/references/stop-the-line.md +52 -0
  56. package/scaffold/skills/dw-git-discipline/SKILL.md +120 -0
  57. package/scaffold/skills/dw-git-discipline/references/atomic-commits-discipline.md +158 -0
  58. package/scaffold/skills/dw-git-discipline/references/branch-hygiene.md +150 -0
  59. package/scaffold/skills/dw-git-discipline/references/trunk-based-pattern.md +82 -0
  60. package/scaffold/skills/dw-memory/SKILL.md +1 -2
  61. package/scaffold/skills/dw-simplification/SKILL.md +142 -0
  62. package/scaffold/skills/dw-simplification/references/behavior-preserving.md +148 -0
  63. package/scaffold/skills/dw-simplification/references/chestertons-fence.md +152 -0
  64. package/scaffold/skills/dw-simplification/references/complexity-metrics.md +147 -0
  65. package/scaffold/skills/dw-source-grounding/SKILL.md +128 -0
  66. package/scaffold/skills/dw-source-grounding/references/citation-protocol.md +108 -0
  67. package/scaffold/skills/dw-source-grounding/references/freshness-check.md +108 -0
  68. package/scaffold/skills/dw-source-grounding/references/source-priority.md +146 -0
  69. package/scaffold/skills/dw-verify/SKILL.md +0 -1
  70. package/scaffold/skills/vercel-react-best-practices/SKILL.md +4 -0
  71. package/scaffold/skills/vercel-react-best-practices/references/perf-discipline.md +122 -0
  72. package/scaffold/skills/webapp-testing/SKILL.md +5 -0
  73. package/scaffold/skills/webapp-testing/references/security-boundary.md +115 -0
  74. package/scaffold/skills/webapp-testing/references/three-workflow-patterns.md +144 -0
  75. package/scaffold/templates-overrides-readme.md +75 -0
  76. package/scaffold/en/commands/dw-execute-phase.md +0 -149
  77. package/scaffold/en/commands/dw-plan-checker.md +0 -144
  78. package/scaffold/en/commands/dw-quick.md +0 -103
  79. package/scaffold/en/commands/dw-resume.md +0 -84
  80. package/scaffold/pt-br/commands/dw-execute-phase.md +0 -149
  81. package/scaffold/pt-br/commands/dw-plan-checker.md +0 -144
  82. package/scaffold/pt-br/commands/dw-quick.md +0 -103
  83. package/scaffold/pt-br/commands/dw-resume.md +0 -84
@@ -23,6 +23,7 @@
23
23
  When available in the project under `./.agents/skills/`, use these skills as support:
24
24
 
25
25
  - `dw-council` (opt-in via `--council`): multi-advisor debate on the primary architectural decision with steel-manning. **DO NOT invoke by default**.
26
+ - `dw-source-grounding` (**ALWAYS**): every framework/library decision must follow Detect → Fetch → Implement → Cite. The techspec emits inline citations `[source: <url>, version: X.Y, retrieved: YYYY-MM-DD]` next to each architectural decision.
26
27
  - `vercel-react-best-practices`: use when defining frontend architecture for React/Next.js projects
27
28
  - `ui-ux-pro-max`: use when defining design system decisions, color palettes, typography, and UI style for the TechSpec
28
29
  - `security-review`: use when the feature touches auth, authorization, or sensitive data handling
@@ -32,11 +33,29 @@
32
33
  <critical>If `.dw/intel/` exists, querying it via `/dw-intel` is MANDATORY before writing the techspec. Do NOT skip this step.</critical>
33
34
  - Internally run: `/dw-intel "architectural patterns and technical decisions in the project"`
34
35
  - Align proposals with existing patterns; flag deviations explicitly
36
+ - When the techspec defines API endpoints, ALSO consult `dw-codebase-intel/references/api-design-discipline.md` (Hyrum's Law, contract-first, error semantics, boundary validation, versioning) — the new endpoint must match conventions surfaced in `apis.json`, not impose external "best practices" that conflict with existing patterns.
35
37
 
36
38
  If `.dw/intel/` does NOT exist:
37
39
  - Use `.dw/rules/` as context, falling back to grep
38
40
  - Suggest running `/dw-map-codebase` to enrich downstream context
39
41
 
42
+ ## Constitution Gate
43
+
44
+ <critical>BEFORE drafting architectural decisions, check `.dw/constitution.md`:
45
+
46
+ **If MISSING**: copy `templates/constitution-template.md` (project-local at `.dw/templates/constitution-template.md`, falling back to bundled scaffold) verbatim to `.dw/constitution.md`. Set frontmatter `mode: defaults`. Print in chat: "Installed defaults constitution at `.dw/constitution.md` (severity: info — won't block this techspec). Continuing." Then proceed.
47
+
48
+ **If PRESENT**: read it. Every framework / library / architectural choice in the techspec MUST carry one of:
49
+ - `Respects: P-NNN` — the decision actively honors the named principle(s).
50
+ - `Deviates: P-NNN — justification: <ADR slug or one-line rationale>` — the decision intentionally departs from the principle.
51
+
52
+ **Severity-graded gate:**
53
+ - Deviation from a `severity: info` principle → record only, never blocks.
54
+ - Deviation from a `severity: high` principle without a linked ADR (`.dw/spec/<prd>/adrs/adr-NNN.md`) → BLOCK the techspec. Instruct the user to either revise the decision OR create an ADR via `/dw-adr` documenting the trade-off.
55
+ - Deviation from a `severity: critical` principle → BLOCK the techspec with the same ADR requirement, additionally requiring reviewer acknowledgment captured in the ADR's `Approved by` field.
56
+
57
+ No exceptions for `high`/`critical` without an ADR. If the user pushes back, point them to `/dw-adr` — that's the escape hatch by design.</critical>
58
+
40
59
  ## Multi-Project Decision Flowchart
41
60
 
42
61
  ```dot
@@ -13,6 +13,12 @@ You are an AI assistant specialized in conducting enterprise-grade research with
13
13
  <critical>Bibliography must be COMPLETE -- every citation, no placeholders, no ranges</critical>
14
14
  <critical>Operate independently -- infer assumptions from context, only stop for critical errors</critical>
15
15
 
16
+ ## Complementary Skills
17
+
18
+ | Skill | Trigger |
19
+ |-------|---------|
20
+ | `dw-source-grounding` | **ALWAYS** — applies the Detect → Fetch → Implement → Cite protocol with the strict source-priority hierarchy (official versioned docs > changelogs > web standards > compatibility tables; Stack Overflow / blogs / training data are discovery only). Each finding ends with `[source: <url>, version: X.Y, retrieved: YYYY-MM-DD]`; the bibliography is built from these citations. |
21
+
16
22
  ## Input Variables
17
23
 
18
24
  | Variable | Description | Example |
@@ -29,6 +29,7 @@ This command is **distinct** from `/dw-security-check`:
29
29
  | `dw-verify` | **ALWAYS** — every phase emits a VERIFICATION REPORT (commands run, exit codes, artifacts) before the next phase starts |
30
30
  | `dw-review-rigor` | **ALWAYS** — applies de-duplication (same advisory across N packages = 1 finding with affected list), severity ordering, and signal-over-volume on the OUTDATED-MINOR list |
31
31
  | `security-review` (`references/supply-chain.md`) | **ALWAYS** when classifying findings — gives OWASP A06 (Vulnerable & Outdated Components) framing for the brainstorm trade-offs |
32
+ | `dw-source-grounding` | **ALWAYS** in the brainstorm phase — each per-package update option (Conservative/Balanced/Bold) cites the official changelog/release notes for the target version: `[source: <url>, version: X.Y, retrieved: YYYY-MM-DD]`. Catches "agent recommends v5 because it sounds modern, but v5 dropped Node 18 support" errors. |
32
33
  | `dw-council` | Auto opt-in when ≥3 packages land in tier COMPROMISED — multi-advisor stress-test on remediation order and scope |
33
34
  | `webapp-testing` | Optional — when the project is frontend and the scoped test phase needs Playwright-aware test selection |
34
35
 
@@ -15,7 +15,7 @@ You are an agent skills discovery helper for this workspace. Your job is to help
15
15
 
16
16
  ## Pipeline Position
17
17
 
18
- **Predecessor:** any exploratory question | **Successor:** none (independent flow). If no skill is found, fall back to `/dw-brainstorm` (idea exploration) or `/dw-quick` (small one-off task) when applicable.
18
+ **Predecessor:** any exploratory question | **Successor:** none (independent flow). If no skill is found, fall back to `/dw-brainstorm` (idea exploration) or `/dw-run-task` (small one-off task) when applicable.
19
19
 
20
20
  ## Complementary Skills
21
21
 
@@ -81,7 +81,7 @@ Browse skills at: https://skills.sh/
81
81
  - Acknowledge no match was found, no fabrication
82
82
  - Offer to help directly with general capabilities
83
83
  - Suggest `/dw-brainstorm` if the user wants to explore options before building it themselves
84
- - Suggest `/dw-quick` if the request fits a small one-off change (≤ 3 files, no PRD)
84
+ - Suggest `/dw-run-task` if the request fits a small one-off change (≤ 3 files, no PRD)
85
85
  - Mention `npx skills init <name>` as a path to author the missing skill
86
86
 
87
87
  ## Common Skill Categories
@@ -128,7 +128,7 @@ I searched for skills related to "<query>" and didn't find a strong match
128
128
 
129
129
  I can still help directly with general capabilities. Or:
130
130
  /dw-brainstorm "<your idea>" — if you want to explore approaches first
131
- /dw-quick "<small change>" — if it's a tiny change that fits one task
131
+ /dw-run-task "<small change>" — if it's a tiny change that fits one task (write quick PRD first)
132
132
  npx skills init <name> — if this would be valuable as a reusable skill
133
133
  ```
134
134
 
@@ -150,7 +150,7 @@ I can still help directly with general capabilities. Or:
150
150
  `dw-find-skills` ports the `find-skills` skill (from the Claude superpowers bundle, `~/.agents/skills/find-skills/SKILL.md`) into a `dw-*` workflow command so every supported platform (Claude Code, Codex, Copilot, OpenCode) gets the same discovery on-ramp. Adaptations for dev-workflow:
151
151
 
152
152
  - Pipeline integration: `/dw-help <keyword>` routes here when the keyword matches `skill`/`find skill`/`install skill`/`extend agent`.
153
- - Fallback to `/dw-brainstorm` or `/dw-quick` when no skill matches — keeps the user inside the workflow instead of dumping them empty-handed.
153
+ - Fallback to `/dw-brainstorm` or `/dw-run-task` when no skill matches — keeps the user inside the workflow instead of dumping them empty-handed.
154
154
  - Explicit scope question (`-g` vs local) before installing, instead of always installing globally.
155
155
 
156
156
  Credit: the `find-skills` skill from the Claude superpowers ecosystem and the `npx skills` / [skills.sh](https://skills.sh/) project.
@@ -18,6 +18,7 @@ You are an AI assistant specialized in post-QA bug fixing with evidence-driven r
18
18
 
19
19
  When available in the project under `./.agents/skills/`, use these skills as operational support without replacing this command:
20
20
 
21
+ - `dw-debug-protocol`: **ALWAYS** — every bug-shaped finding (failing scenario, not missing feature) flows through the six-step triage. The retest evidence is the step-6 verification artifact; the regression test added in step 5 is what allows `Fixed` status to stick.
21
22
  - `dw-verify`: **ALWAYS** — invoked before marking any bug as `Fixed` or `Closed` in `QA/bugs.md`. Without a VERIFICATION REPORT PASS (test + lint + build) **and** retest evidence (screenshot in UI mode OR JSONL log line in API mode), status stays `Reopened` or `Under review`.
22
23
  - `webapp-testing`: (UI mode) support for structuring retests, captures, and scripts when complementary to Playwright MCP
23
24
  - `vercel-react-best-practices`: (UI mode) use only if the fix affects React/Next.js frontend and there is risk of rendering, hydration, fetching, or performance regression
@@ -14,6 +14,7 @@ You are an assistant specialized in creating well-documented Pull Requests. Your
14
14
  | Skill | Trigger |
15
15
  |-------|---------|
16
16
  | `dw-verify` | **ALWAYS** — invoked before `git push`. Without a VERIFICATION REPORT PASS in the current session AFTER the last code edit, the PR **CANNOT** be created. |
17
+ | `dw-git-discipline` | **ALWAYS** — validates branch naming (`<type>/<scope>` kebab-case), atomic-commit history (each commit single-intent, conventional message), branch lifetime (flag if >7 days old), and PR scope (suggest split if diff > ~400 lines). PR description follows summary + test plan structure, not a `git log` dump. |
17
18
  | `/dw-security-check` | **ALWAYS for TS/Python/C#/Rust projects** — `security-check.md` with status ≠ REJECTED is required for supported-language projects. |
18
19
 
19
20
  <critical>Hard gate 1 (verify): if the current session has no VERIFICATION REPORT PASS from `dw-verify` produced AFTER the last edit/commit, STOP and invoke `dw-verify` before proceeding. A PR is a permanent artifact — it demands the highest verification standard.</critical>
@@ -23,20 +23,14 @@ You are a workspace help assistant. When invoked, present the user with a comple
23
23
  | qa, visual test, playwright | `/dw-run-qa` | E2E QA with browser automation |
24
24
  | refactor, smell, fowler | `/dw-refactoring-analysis` | Prioritized code-smell audit |
25
25
  | design, ui, redesign | `/dw-redesign-ui` | Audit + propose + implement visual |
26
- | decision, adr, architecture | `/dw-adr` | Record an Architecture Decision Record |
27
26
  | debate, council, stress-test, opinions | `/dw-brainstorm --council` or `/dw-create-techspec --council` | Invokes `dw-council` for a multi-advisor debate |
28
27
  | security, vulnerability, owasp, trivy, cve | `/dw-security-check` | Rigid multi-layer check (OWASP static + Trivy SCA/IaC + native audit) for TS/Python/C#/Rust |
29
28
  | supply chain, outdated, compromised, malicious package, deps update, package upgrade, npm audit, pip-audit | `/dw-deps-audit` | Detect + classify + per-package update plan with scoped QA. Goes beyond `/dw-security-check` by adding remediation. |
30
29
  | skill, find skill, install skill, ecosystem, capability, extend agent | `/dw-find-skills` | Discover skills from skills.sh / `npx skills` and install them globally or locally |
31
30
  | new project, scaffold, bootstrap, start, kickoff, init project, fullstack, monorepo | `/dw-new-project` | Stack interview + create-* tools + docker-compose for dev. Runs after `npx dev-workflow init`. |
32
31
  | dockerize, docker, dockerfile, compose, container, prod image, multi-stage | `/dw-dockerize` | Reads existing project, brainstorms base image, generates Dockerfile + docker-compose for dev/prod/both, or audits existing artifacts. |
33
- | map codebase, intel index, code map, knowledge graph, queryable index | `/dw-map-codebase` | Builds .dw/intel/ (stack/files/apis/deps/arch) so /dw-intel and other commands stop re-exploring the codebase. |
34
- | execute phase, parallel tasks, wave, dispatch, atomic commits | `/dw-execute-phase` | Runs a PRD phase in waves with atomic commits per task, deviation handling, and a hard plan-checker gate before any code is touched. |
35
- | plan check, verify plan, plan validation, goal backward | `/dw-plan-checker` | Goal-backward verification of tasks.md before execution. PASS / REVISE / BLOCK across 6 dimensions. |
36
32
  | refine, refinement, idea, one-pager | `/dw-brainstorm --onepager` | Idea refinement with Product Inventory + classification (IMPROVES/CONSOLIDATES/NEW) + durable one-pager |
37
33
  | revert, rollback task | `/dw-revert-task` | Safe revert with dependency checks |
38
- | hotfix, quick change | `/dw-quick` | One-off task with guarantees, no PRD |
39
- | resume, where I left off | `/dw-resume` | Restore previous session context |
40
34
  | research | `/dw-deep-research` | Multi-source research with citations |
41
35
  | idea, brainstorm | `/dw-brainstorm` | Structured ideation with trade-offs |
42
36
  | update dev-workflow | `/dw-update` | Update to latest npm version |
@@ -130,9 +124,6 @@ This workspace uses an AI command system that automates the full development cyc
130
124
  | `/dw-bugfix` | Analyzes and fixes bugs (bug vs feature triage) | Target + description | Fix + commit OR PRD (if feature) |
131
125
  | `/dw-fix-qa` | Fixes documented QA bugs and retests with evidence | PRD path | Code + `QA/bugs.md` + `QA/qa-report.md` updated |
132
126
  | `/dw-redesign-ui` | Audits, proposes, and implements visual redesign of pages/components | Target page/component | Redesign brief + code |
133
- | `/dw-quick` | Execute a one-off task with workflow guarantees without PRD | Change description | Code + commit |
134
- | `/dw-resume` | Restore session context and suggest next step | (none) | Summary + suggestion |
135
- | `/dw-intel` | Query codebase intelligence about patterns and architecture | Question | Answer with sources |
136
127
  | `/dw-autopilot` | Full pipeline orchestrator: from a wish to a PR with minimal intervention | Wish description | PRD + code + commits + PR |
137
128
 
138
129
  ### Research
@@ -168,11 +159,15 @@ This workspace uses an AI command system that automates the full development cyc
168
159
  | `/dw-generate-pr` | Push + create PR + copy body + open URL | Target branch | PR on GitHub |
169
160
  | `/dw-revert-task` | Safely revert a specific task's commits (dependency checks + confirmation) | PRD path + task number | Reverted commits + updated `tasks.md` |
170
161
 
171
- ### Architectural Decisions
162
+ ### Internal commands (used by other dw-* commands; rarely invoked directly)
172
163
 
173
- | Command | What it does | Input | Output |
174
- |---------|-------------|-------|--------|
175
- | `/dw-adr` | Record an Architecture Decision Record (ADR) for a non-trivial decision during a PRD | PRD path + title | `.dw/spec/<prd>/adrs/adr-NNN.md` + cross-refs updated |
164
+ | Command | What it does | Typically invoked by |
165
+ |---------|-------------|----------------------|
166
+ | `/dw-adr` | Record an Architecture Decision Record during PRD execution | `/dw-create-techspec`, `/dw-run-task` when a non-trivial decision arises |
167
+ | `/dw-intel` | Query the codebase index built in `.dw/intel/` | `/dw-create-prd`, `/dw-create-techspec`, `/dw-code-review`, etc. |
168
+ | `/dw-map-codebase` | Build/refresh the queryable codebase index in `.dw/intel/` | `/dw-analyze-project` (auto-runs after rules generation) |
169
+
170
+ These are exposed as slash commands for occasional manual use (e.g., quickly recording an ADR mid-session, ad-hoc codebase queries) but most users never invoke them directly — they're called by the higher-level commands above.
176
171
 
177
172
  ### Maintenance
178
173
 
@@ -293,16 +288,6 @@ LEVEL 3 - Formal Code Review (/dw-code-review)
293
288
  /dw-autopilot "description of what you want to build" # Research → PRD → Tasks → Code → QA → PR
294
289
  ```
295
290
 
296
- ### Quick Task
297
- ```bash
298
- /dw-quick "change description" # Implement + validate + commit
299
- ```
300
-
301
- ### Resume Session
302
- ```bash
303
- /dw-resume # Restore context + suggest next step
304
- ```
305
-
306
291
  ### Query Codebase
307
292
  ```bash
308
293
  /dw-intel "how does X work in this project?" # Answer with sources
@@ -334,9 +319,7 @@ your-project/
334
319
  │ │ ├── dw-autopilot.md
335
320
  │ │ ├── dw-deep-research.md
336
321
  │ │ ├── dw-intel.md
337
- │ │ ├── dw-quick.md
338
322
  │ │ ├── dw-redesign-ui.md
339
- │ │ ├── dw-resume.md
340
323
  │ │ ├── dw-bugfix.md
341
324
  │ │ ├── dw-commit.md
342
325
  │ │ ├── dw-functional-doc.md
@@ -400,10 +383,7 @@ Commands work across multiple AI tools, all pointing to the same source `.dw/com
400
383
  - Yes. The command is framework-agnostic. For React it uses react-doctor and `vercel-react-best-practices`; for Angular it uses `ng lint` and Angular DevTools. Visual design (`ui-ux-pro-max`) works with any framework.
401
384
 
402
385
  **Q: How do I get codebase intelligence and parallel execution?**
403
- - Both are native to dev-workflow as of v0.9.0. Run `/dw-map-codebase` to build the queryable index in `.dw/intel/`, then `/dw-intel "<question>"` to query it. For parallel execution, `/dw-execute-phase` dispatches tasks in waves with atomic commits per task. No external dependency needed.
404
-
405
- **Q: Does `/dw-quick` replace `/dw-run-task`?**
406
- - No. `/dw-quick` is for one-off changes without a PRD. `/dw-run-task` executes tasks from a structured plan with PRD and TechSpec.
386
+ - Both are native to dev-workflow. Run `/dw-map-codebase` to build the queryable index in `.dw/intel/`, then `/dw-intel "<question>"` to query it. For parallel execution, `/dw-run-plan` invokes the bundled phase-execution agents (executor + plan-checker) directly to dispatch tasks in waves with atomic commits per task. No external dependency needed.
407
387
 
408
388
  **Q: Does `/dw-autopilot` replace all other commands?**
409
389
  - No. It orchestrates existing commands in sequence. You can still use each command individually for manual control. Autopilot is for when you want to go from a wish to a PR with minimal intervention.
@@ -10,7 +10,7 @@ You are a codebase intelligence assistant. This command answers questions about
10
10
  - Use to understand how something works in the project (auth flow, data model, route surface)
11
11
  - Use to find patterns, conventions, or architectural decisions
12
12
  - Use to verify if something already exists before implementing
13
- - Do NOT use to implement changes (use `/dw-quick` or `/dw-run-task`)
13
+ - Do NOT use to implement changes (use `/dw-run-task`)
14
14
 
15
15
  ## Pipeline Position
16
16
 
@@ -21,8 +21,9 @@ Prerequisite: Run `/dw-analyze-project` first to understand project patterns and
21
21
  When available in the project under `./.agents/skills/`, use these skills as analytical support without replacing this command:
22
22
 
23
23
  - `dw-review-rigor`: **ALWAYS** — when cataloging code smells, apply de-duplication (same smell in N files = 1 entry with affected list), severity ordering across P0-P3, signal-over-volume (max ~20 findings; keep criticals, prune marginal ones). A smell with a justifying ADR drops to `low` at most.
24
+ - `dw-simplification`: **ALWAYS** — every flagged smell is filtered through Chesterton's Fence (what does the construct DO, why was it added, what breaks if removed). Smells with no clear "why-was-it-there" answer get downgraded to `info` and a research note instead of a refactor proposal. Complexity metrics back the severity (cognitive complexity ≥16 or nesting depth ≥4 = `high` candidate; <10 = `low` at most).
24
25
  - `security-review`: defer security concerns to this skill — do not duplicate
25
- - `vercel-react-best-practices`: defer React/Next.js performance patterns to this skill
26
+ - `vercel-react-best-practices`: defer React/Next.js performance patterns to this skill — when flagging perf-related smells, follow its `references/perf-discipline.md` (measure → identify → fix → verify → guard) and cite the metric + tool, not vibes
26
27
 
27
28
  ## Analysis Tools
28
29
 
@@ -318,6 +318,32 @@ git diff <commit> -- path/to/file
318
318
 
319
319
  <critical>DO NOT APPROVE requirements without concrete evidence in the code</critical>
320
320
  <critical>ANALYZE the actual code, do not trust only the checkboxes in tasks.md</critical>
321
- <critical>If 100% of requirements were implemented and there are NO gaps: DO NOT enter plan mode, DO NOT create tasks, DO NOT dispatch agents. Just present the report and END.</critical>
322
- <critical>If gaps are found, enter the fix-review loop automatically. Do NOT wait for user instructions to fix gaps. Maximum 3 cycles before marking as BLOCKED.</critical>
321
+ <critical>If 100% of requirements were implemented and there are NO gaps: DO NOT enter plan mode, DO NOT create tasks, DO NOT dispatch agents. Just present the Level 2 report, then proceed to Level 3 (next section).</critical>
322
+ <critical>If gaps are found, enter the fix-review loop automatically. Do NOT wait for user instructions to fix gaps. Maximum 3 cycles before marking as BLOCKED. Level 3 only runs after the loop reaches APPROVED on Level 2.</critical>
323
+
324
+ ## Level 3 — Quality Layer (auto-invoked at the end)
325
+
326
+ After Level 2 (PRD coverage) reaches APPROVED, **automatically invoke `/dw-code-review`** to add the formal quality layer (best practices, SOLID, DRY, complexity, security, conventions). Addresses the user expectation that a single review covers both "did we deliver everything?" (Level 2) and "is what we delivered well-built?" (Level 3).
327
+
328
+ Pipeline:
329
+
330
+ 1. After Level 2 APPROVED, run `/dw-code-review {{PRD_PATH}}` with the same PRD scope.
331
+ 2. Wait for `/dw-code-review` to produce its verdict (APPROVED / APPROVED WITH CAVEATS / REJECTED).
332
+ 3. Write a consolidated summary at `{{PRD_PATH}}/QA/review-consolidated.md` referencing both:
333
+ - Level 2: `{{PRD_PATH}}/QA/review-coverage.md` (PRD compliance map)
334
+ - Level 3: `{{PRD_PATH}}/QA/dw-code-review.md` (formal review)
335
+ 4. Final status combines both verdicts:
336
+ - Level 2 APPROVED + Level 3 APPROVED → consolidated APPROVED
337
+ - Level 2 APPROVED + Level 3 APPROVED WITH CAVEATS → consolidated APPROVED WITH CAVEATS
338
+ - Level 2 APPROVED + Level 3 REJECTED → consolidated REJECTED (Level 3 wins)
339
+ - Level 2 REJECTED → never reaches Level 3 (loop fixes coverage first)
340
+
341
+ ### Flag to skip Level 3
342
+
343
+ If the user runs `/dw-review-implementation --no-code-review`, skip Level 3 and emit only the Level 2 report. Use case: re-running coverage after a small targeted gap fix when a full Level 3 sweep was just done.
344
+
345
+ ### Why this auto-chain exists
346
+
347
+ `dw-review-implementation` historically returned only Level 2 (coverage). Users expected a single review to also cover quality. Splitting the natural intent into two separate commands created friction. The auto-chain restores the natural "review the implementation" semantics: cover + quality, by default, in one invocation. Standalone `/dw-code-review` remains available for cases where only Level 3 is wanted (e.g., reviewing a cherry-picked refactor branch with no PRD).
348
+
323
349
  </system_instructions>
@@ -165,7 +165,7 @@ If a task FAILS during execution:
165
165
 
166
166
  ### Plan Verification (Pre-Execution)
167
167
 
168
- Before starting execution, delegate to `/dw-plan-checker {{PRD_PATH}}`:
168
+ Before starting execution, spawn the **plan-checker agent** from `.agents/skills/dw-execute-phase/agents/plan-checker.md`:
169
169
  - The plan-checker agent verifies the 6 dimensions (requirement coverage, task completeness, dependency soundness, artifact wiring, context budget, constraint compliance)
170
170
  - If REVISE: present issues found and suggest fixes. Maximum 3 correction cycles via `/dw-create-tasks --revise`
171
171
  - If BLOCK: surface conflict to user, do NOT auto-replan
@@ -173,7 +173,7 @@ Before starting execution, delegate to `/dw-plan-checker {{PRD_PATH}}`:
173
173
 
174
174
  ### Parallel Execution (Wave-Based)
175
175
 
176
- After plan-checker PASS, delegate to `/dw-execute-phase {{PRD_PATH}}`:
176
+ After plan-checker PASS, spawn the **executor agent** from `.agents/skills/dw-execute-phase/agents/executor.md`:
177
177
  - The executor agent analyzes each task's `Depends on:` field to build the dependency graph
178
178
  - Groups tasks into waves:
179
179
  - Wave 1: tasks with no dependencies (run in parallel)
@@ -0,0 +1,111 @@
1
+ ---
2
+ schema_version: "1.0"
3
+ generated_by: dev-workflow
4
+ last_updated: YYYY-MM-DD
5
+ mode: defaults | custom
6
+ ---
7
+
8
+ # Project Constitution
9
+
10
+ > Declarative principles this team has chosen to follow. PRDs, TechSpecs, and Code Reviews read this file as a hard gate. Anything that violates a principle with `severity: critical` or `high` is blocked unless explicitly justified by an ADR.
11
+
12
+ ## How this file works
13
+
14
+ - **Each principle has an ID (`P-NNN`), a severity, a rule, a `Why`, and an `Enforcement`.**
15
+ - **Severity ladder:** `info` (reports only, never blocks) → `high` (blocks PR without ADR) → `critical` (blocks PR without ADR, requires reviewer sign-off).
16
+ - **Edit freely.** This file is yours to evolve. Promote principles from `info` to `high` once you trust the project enforces them.
17
+ - **ADR escape hatch.** A PR that violates a `high`/`critical` principle is unblocked only when an ADR in the same feature documents the deviation and trade-off.
18
+ - **Regenerate analytical version** anytime via `/dw-analyze-project` (offers to synthesize principles from observed code patterns).
19
+
20
+ ---
21
+
22
+ ## Code Quality
23
+
24
+ **P-001 — No `any` / `unknown` casts in TypeScript without justification** (severity: info)
25
+ **Rule:** Production code must not use `as any`, `as unknown`, or `// @ts-ignore` without an inline `// @ts-ignore — reason: <X>` comment naming the constraint.
26
+ **Why:** Silent type escapes leak runtime bugs that the type system was meant to catch. Each escape is a contract the type system stops enforcing.
27
+ **Enforcement:** `dw-code-review` greps the diff for `as any`/`@ts-ignore`/`@ts-expect-error` without an accompanying reason comment.
28
+
29
+ **P-002 — Functions must be testable in isolation** (severity: info)
30
+ **Rule:** A function that touches network, filesystem, database, or system clock must accept its dependency as a parameter (or via a factory) instead of importing it directly.
31
+ **Why:** Code that constructs its own dependencies cannot be tested without integration setup. Tests slow down, get skipped, and bugs ship.
32
+ **Enforcement:** `dw-code-review` flags functions importing `fs`, `axios`, `prisma`, `Date.now`, etc., directly inside business logic modules.
33
+
34
+ ---
35
+
36
+ ## Testing Standards
37
+
38
+ **P-003 — Every bug fix ships with a regression test** (severity: info)
39
+ **Rule:** A commit with type `fix:` must add or modify at least one test that would have caught the bug before the fix.
40
+ **Why:** Without the test, the bug returns the next time someone refactors the area. The fix decays.
41
+ **Enforcement:** `dw-code-review` checks that `fix:` commits include diff under `**/*test*` or `**/*spec*` paths.
42
+
43
+ **P-004 — Tests must be deterministic** (severity: info)
44
+ **Rule:** No sleep-based waits, no real-clock comparisons, no network calls to live services in unit tests. Mock at boundaries.
45
+ **Why:** Flaky tests train the team to ignore failures. The next real failure goes unnoticed.
46
+ **Enforcement:** `dw-code-review` greps tests for `setTimeout`, real fetch/axios calls, and `Date.now()` without `vi.useFakeTimers()`/`jest.useFakeTimers()`.
47
+
48
+ ---
49
+
50
+ ## UX Consistency
51
+
52
+ **P-005 — User-facing strings live in a single source** (severity: info)
53
+ **Rule:** All visible copy (labels, error messages, empty states) goes through a centralized i18n / strings module — not inline in components.
54
+ **Why:** Inline strings drift in tone, break i18n efforts, and cause duplicate-but-different copies of the same message.
55
+ **Enforcement:** `dw-code-review` flags JSX text nodes and error messages declared inside components instead of imported from `src/strings/`, `src/i18n/`, or equivalent.
56
+
57
+ **P-006 — Loading + empty + error states are mandatory for any data-fetching UI** (severity: info)
58
+ **Rule:** Any component or page that fetches data must explicitly render loading, empty, and error states — not just the happy path.
59
+ **Why:** "Just the spinner" experiences and silent error states are the #1 source of user-reported bugs.
60
+ **Enforcement:** `dw-review-implementation` checks data-fetching components for all three states in JSX or equivalent.
61
+
62
+ ---
63
+
64
+ ## Performance
65
+
66
+ **P-007 — Performance changes must cite a measurement** (severity: info)
67
+ **Rule:** Any commit that claims to improve performance must include the metric, the tool, and the before/after numbers in the commit body OR in the techspec.
68
+ **Why:** Without measurement, "performance" optimization is guesswork — and usually wrong (see `dw-simplification` + `perf-discipline.md`).
69
+ **Enforcement:** `dw-code-review` checks `perf:` commits for a numeric before/after; flags if missing.
70
+
71
+ **P-008 — N+1 queries are flagged at code review** (severity: info)
72
+ **Rule:** Loops or list operations that issue per-item database/HTTP calls must batch (e.g., `IN (...)`, `findMany`, DataLoader) or be explicitly justified.
73
+ **Why:** N+1 patterns scale linearly with data size and silently degrade until production load reveals them.
74
+ **Enforcement:** `dw-code-review` and `dw-refactoring-analysis` detect await-in-loop patterns against repository / API client modules.
75
+
76
+ ---
77
+
78
+ ## Security
79
+
80
+ **P-009 — Server-side authorization on every state-changing endpoint** (severity: info)
81
+ **Rule:** Any endpoint that creates, updates, or deletes data must verify caller authorization on the server. UI-level gating (hidden buttons, disabled forms) is not security.
82
+ **Why:** Browsers are untrusted (see `webapp-testing/security-boundary.md`). UI gating is convenience; only server checks protect data.
83
+ **Enforcement:** `dw-code-review` and `dw-security-check` require an explicit auth check (decorator, middleware, or in-handler assertion) on POST/PUT/PATCH/DELETE routes.
84
+
85
+ **P-010 — Secrets never enter the repository** (severity: info)
86
+ **Rule:** No API keys, passwords, signing keys, tokens, or production endpoints checked into source. `.env.example` documents shape only.
87
+ **Why:** Repository history is permanent. A secret committed once is leaked even if reverted next commit.
88
+ **Enforcement:** `dw-security-check` runs Trivy + secret scanners on the diff.
89
+
90
+ ---
91
+
92
+ ## Custom Principles
93
+
94
+ > Add your team's specific principles below. Follow the same format: `**P-NNN — <name>** (severity: info|high|critical): <rule>. **Why:** <reason>. **Enforcement:** <how>.`
95
+
96
+ <!-- Example:
97
+ **P-100 — All financial calculations use Decimal, never Number** (severity: critical)
98
+ **Rule:** Money values must use `Decimal` / `BigDecimal` types end-to-end. No `parseFloat`, no `Number` arithmetic.
99
+ **Why:** IEEE 754 rounding errors accumulate to cents lost over millions of transactions; audited environments mandate exact arithmetic.
100
+ **Enforcement:** `dw-code-review` greps for `Number(`/`parseFloat(` in any file under `src/billing/`, `src/payments/`, `src/finance/`.
101
+ -->
102
+
103
+ ---
104
+
105
+ ## How to evolve this file
106
+
107
+ 1. **Live in `info` for at least one release.** Watch how often each principle is violated organically; the data tells you if it's worth promoting.
108
+ 2. **Promote to `high` once violations are rare and the team agrees.** PRs that violate a `high` principle now need an ADR.
109
+ 3. **Promote to `critical` for principles that protect users / data / compliance.** Treat these as load-bearing; the ADR escape requires reviewer sign-off, not just author opt-out.
110
+ 4. **Demote or remove principles that don't earn their weight.** A constitution is a tool, not a museum.
111
+ 5. **Re-run `/dw-analyze-project`** when the codebase shifts substantially (new stack, major refactor); it can propose updates grounded in fresh observation.
@@ -86,5 +86,5 @@ Ideally 2-4 stories. If it's more than 5, it's probably not MVP.]
86
86
  Pick ONE:
87
87
 
88
88
  - **`/dw-create-prd`** using this one-pager as input — when the direction is clear but we need to detail user stories, acceptance criteria, and hand off to techspec
89
- - **`/dw-quick`** — when it's an IMPROVES so small that it fits in a single task (up to 3 files, no new endpoint/screen)
89
+ - **`/dw-run-task`** — when it's an IMPROVES so small that it fits in a single task (up to 3 files, no new endpoint/screen) — write a quick PRD first
90
90
  - **Stop here** — if any "Open Question" is blocking, stop and resolve with the stakeholder before advancing
@@ -645,6 +645,67 @@ packages/auth → packages/db
645
645
  - Crie o diretório .dw/rules/ se não existir
646
646
  </critical>
647
647
 
648
+ ### Step 8: Constitution Generation (Opcional, mas Recomendado)
649
+
650
+ Após escrever `.dw/rules/`, oferecer gerar `.dw/constitution.md` — os princípios declarativos que o time quer ver enforçados em PRDs, TechSpecs e Code Reviews.
651
+
652
+ **Diferença vs `.dw/rules/`:**
653
+ - `.dw/rules/` é **analítico** — o que o código É (padrões observados, anti-patterns, convenções).
654
+ - `.dw/constitution.md` é **declarativo** — o que o código DEVE SER (regras às quais o time se compromete).
655
+
656
+ **Comportamento:**
657
+
658
+ Se `.dw/constitution.md` já existir, imprimir "Constituição já existe em `.dw/constitution.md` — pulando (edite manualmente se quiser atualizar)" e encerrar.
659
+
660
+ Caso contrário, apresentar 3 opções no chat (use a UI de pergunta preferida quando disponível; caso contrário texto puro):
661
+
662
+ ```
663
+ Uma constitution ajudaria PRDs/TechSpecs/PRs a permanecerem alinhados aos padrões.
664
+ Três opções:
665
+
666
+ A) Sintetizar dos padrões observados (recomendado)
667
+ Leio `.dw/rules/` e proponho 5–8 princípios fundamentados no código real,
668
+ cada um com `Why:` ligado a evidência e `severity: info` (não bloqueia).
669
+ Você revisa e aprova antes de qualquer escrita.
670
+
671
+ B) Instalar template de defaults
672
+ Copia `templates/constitution-template.md` para `.dw/constitution.md` com
673
+ 5 princípios canônicos (Qualidade, Testes, UX, Performance, Segurança)
674
+ pré-preenchidos em `severity: info`. Você customiza manualmente.
675
+
676
+ C) Pular
677
+ Sem constitution. Comandos downstream operam sem o gate.
678
+ Você pode rodar este step novamente re-executando `/dw-analyze-project`.
679
+ ```
680
+
681
+ **Opção A — Sintetizar:**
682
+
683
+ 1. Ler `.dw/rules/index.md` + cada `.dw/rules/{module}.md`.
684
+ 2. Propor 5–8 princípios. Cada um deve:
685
+ - Ter ID único `P-NNN`.
686
+ - Mapear para uma observação em `.dw/rules/` (citar o arquivo + seção).
687
+ - Começar em `severity: info` (nunca propor `high`/`critical` automaticamente — isso é decisão do time).
688
+ - Seguir formato: `**P-NNN — <nome>** (severity: info): <regra>. **Why:** <fundamentar em evidência>. **Enforcement:** <como checar>.`
689
+ 3. **Mostrar os princípios propostos no chat como lista markdown** (não escreva o arquivo ainda). Incluir a citação de evidência para cada um.
690
+ 4. Perguntar: "Edita algum antes de eu gravar? Responda com os IDs para descartar/editar, ou 'aprovar' para escrever como está."
691
+ 5. Após aprovação (com edits aplicados), gravar em `.dw/constitution.md` usando a mesma estrutura de `templates/constitution-template.md`.
692
+ 6. Setar frontmatter `mode: custom` e `last_updated: <data ISO de hoje>`.
693
+
694
+ **Opção B — Defaults:**
695
+
696
+ 1. Localizar `templates/constitution-template.md` (projeto-local em `.dw/templates/constitution-template.md`, com fallback para scaffold bundled).
697
+ 2. Copiar para `.dw/constitution.md` literalmente. Setar frontmatter `mode: defaults`.
698
+ 3. Imprimir: "Constituição defaults instalada em `.dw/constitution.md`. Todos os 10 princípios começam em `severity: info` — reportam mas não bloqueiam. Edite o arquivo para customizar, depois promova severities para `high`/`critical` quando confiar."
699
+
700
+ **Opção C — Pular:**
701
+
702
+ 1. Nada a fazer.
703
+ 2. Imprimir: "Pulado. PRD/TechSpec/CodeReview rodarão sem o constitution gate. Re-rode `/dw-analyze-project` mais tarde se quiser habilitar."
704
+
705
+ **Em qualquer opção:**
706
+ - Nunca escrever `.dw/constitution.md` sem aprovação explícita (opção A) ou escolha explícita (opções B/C).
707
+ - Constitution é commitada ao repositório como qualquer outro artefato do projeto — nunca gitignored.
708
+
648
709
  ## Checklist de Qualidade
649
710
 
650
711
  - [ ] Estrutura do repositório escaneada
@@ -26,7 +26,7 @@ Uma etapa que invoca um comando `/dw-xxx` SO e considerada completa quando os ar
26
26
  ## Quando Usar
27
27
  - Use quando quiser ir de uma ideia ate um PR com minima intervencao manual
28
28
  - Use para features completas que passam por todo o pipeline (pesquisa, planejamento, execucao, qualidade)
29
- - NAO use para mudancas pontuais (use `/dw-quick`)
29
+ - NAO use para tasks pequenas e bem-escopadas — use `/dw-run-task` direto com um PRD curto
30
30
  - NAO use para corrigir bugs (use `/dw-bugfix`)
31
31
  - NAO use quando quiser controle manual entre cada fase (use os comandos individuais)
32
32
 
@@ -56,7 +56,7 @@ O autopilot para APENAS nestes 3 momentos:
56
56
 
57
57
  ## Retomada de Sessao
58
58
 
59
- Se este comando for invocado para retomar um autopilot interrompido (via `/dw-resume`):
59
+ Se este comando for re-invocado no mesmo PRD apos interrupcao:
60
60
 
61
61
  <critical>Leia o arquivo `autopilot-state.json` no diretorio do PRD. Pule TODAS as etapas listadas em `completed_steps`. Retome a execucao a partir de `current_step`. Gates ja passados (listados em `gates_passed`) NAO devem ser reapresentados.</critical>
62
62
 
@@ -149,7 +149,7 @@ Avalie se as tasks envolvem frontend:
149
149
  ### Etapa 8: Execucao
150
150
 
151
151
  Execute `/dw-run-plan` com o path do PRD.
152
- - Siga TODAS as instrucoes do comando, incluindo o gate nativo do plan-checker (PASS obrigatorio) e execucao paralela em waves via `/dw-execute-phase`
152
+ - Siga TODAS as instrucoes do comando, incluindo o gate nativo do plan-checker (PASS obrigatorio) e execucao paralela em waves via os agentes da skill bundled `dw-execute-phase`
153
153
  - Cada task segue `/dw-run-task` com validacao Level 1
154
154
 
155
155
  ### Etapa 9: Review de Implementacao (Loop)
@@ -250,11 +250,11 @@ Pergunte ao usuario: **"Commits realizados. Deseja gerar o Pull Request?"**
250
250
 
251
251
  ## Engine Nativo
252
252
 
253
- O autopilot depende de infraestrutura dev-workflow-native para inteligencia de codebase (`/dw-map-codebase` + `/dw-intel`), verificacao de plano (`/dw-plan-checker`), e execucao paralela (`/dw-execute-phase`). Os quatro vem bundled e nao precisam de dependencias externas. Veja as skills bundled `dw-codebase-intel` e `dw-execute-phase` em `.agents/skills/` para detalhes.
253
+ O autopilot depende de infraestrutura dev-workflow-native para inteligencia de codebase (`/dw-map-codebase` + `/dw-intel`) e dos agentes bundled de execucao de fase (plan-checker + executor em `.agents/skills/dw-execute-phase/agents/`). Tudo bundled, sem dependencias externas. Veja as skills bundled `dw-codebase-intel` e `dw-execute-phase` em `.agents/skills/` para detalhes.
254
254
 
255
255
  ## Persistencia de Estado
256
256
 
257
- <critical>O autopilot DEVE salvar seu estado apos cada etapa completada para permitir retomada via `/dw-resume` em caso de interrupcao.</critical>
257
+ <critical>O autopilot DEVE salvar seu estado apos cada etapa completada para permitir re-invocacao no mesmo PRD em caso de interrupcao.</critical>
258
258
 
259
259
  Salve o arquivo `.dw/spec/prd-[nome]/autopilot-state.json` com o seguinte formato:
260
260
 
@@ -286,7 +286,7 @@ Salve o arquivo `.dw/spec/prd-[nome]/autopilot-state.json` com o seguinte format
286
286
 
287
287
  - Atualize `current_step`, `completed_steps` e `step_artifacts` ANTES de iniciar a proxima etapa
288
288
  - Uma etapa SO vai para `completed_steps` apos verificar que seus artefatos existem no disco
289
- - Se a sessao cair, o `/dw-resume` lera este arquivo e continuara da etapa correta e revalidara os artefatos antes de confiar em `completed_steps`
289
+ - Se a sessao cair, re-invoque `/dw-autopilot` no mesmo PRD; o comando le `autopilot-state.json` e continua da etapa correta, revalidando artefatos antes de confiar em `completed_steps`
290
290
  - Ao finalizar o pipeline (apos commit ou PR), remova o arquivo ou marque `"status": "completed"`
291
291
 
292
292
  <critical>Apos CADA etapa completada, exiba o bloco de progresso atualizado ao usuario. Isso e OBRIGATORIO — o usuario DEVE ver o que foi feito e o que vem a seguir. Se uma etapa foi pulada, o motivo DEVE aparecer no bloco de progresso.</critical>
@@ -109,7 +109,7 @@ Use este comando quando o usuario quiser:
109
109
  - lista curta e executavel
110
110
  - se apropriado, sugira qual comando usar em seguida:
111
111
  - `/dw-create-prd` (principal sucessor; aceita one-pager como input reduzindo perguntas de clarificação)
112
- - `/dw-quick` (se é IMPROVES pequeno que cabe em task única, ≤3 arquivos)
112
+ - `/dw-run-task` (se é IMPROVES pequeno que cabe em task única com um PRD curto)
113
113
  - `/dw-create-techspec`
114
114
  - `/dw-create-tasks`
115
115
  - `/dw-bugfix`
@@ -15,6 +15,7 @@
15
15
 
16
16
  Quando disponíveis no projeto em `./.agents/skills/`, use estas skills como suporte contextual sem substituir este comando:
17
17
 
18
+ - `dw-debug-protocol`: **SEMPRE** — conduz o bug pelo six-step triage (Reproduzir → Localizar → Reduzir → Fix Root Cause → Guardar → Verificar End-to-End). Stop-the-line discipline; root-cause sobre symptom; regression test commitado no mesmo commit atômico. Bugs não-reprodutíveis seguem o sub-protocolo instrument-first — sem fix por palpite a não ser com acknowledgement explícito.
18
19
  - `dw-verify`: **SEMPRE** — em modo Direto, invocada antes do commit da correção. O VERIFICATION REPORT deve mostrar que o sintoma original do bug não se reproduz mais (não apenas que os testes passam).
19
20
  - `vercel-react-best-practices`: use quando o bug afeta React/Next.js e há suspeita de problemas de render, hidratação, fetching, waterfall, bundle ou re-render
20
21
  - `webapp-testing`: use quando a correção requer fluxo E2E/reteste reproduzível em uma web app
@@ -24,6 +24,7 @@ Quando disponíveis no projeto em `./.agents/skills/`, use estas skills como apo
24
24
  - `dw-review-rigor`: **SEMPRE** — aplica de-duplication (mesmo pattern em N arquivos = 1 finding), severity ordering (critical → high → medium → low), verify-before-flag, skip-what-linter-catches, e signal-over-volume. A tabela "Problemas Encontrados" do relatório segue essa disciplina.
25
25
  - `dw-verify`: **SEMPRE** — invocada antes de emitir verdict `APROVADO` ou `APROVADO COM RESSALVAS`. Sem VERIFICATION REPORT PASS (test + lint + build), o verdict não pode sair como APROVADO.
26
26
  - `/dw-security-check`: **SEMPRE para projetos TS/Python/C#/Rust** — invocado como step 6.7 (Camada de Segurança) antes de emitir verdict. Se o projeto usa linguagem suportada e `security-check.md` não existe OU tem status REJECTED, o verdict é **REPROVADO** — sem exceção.
27
+ - `dw-simplification`: use quando o diff toca código denso ou tortuoso — aplica Chesterton's Fence (entender POR QUÊ antes de propor remoção), protocolo de refactor preservando comportamento (test gate antes/depois) e métricas de complexidade (ciclomática, cognitiva, depth, fan-out) para que findings de "simplifique isso" sejam concretos, não opinativos.
27
28
  - `security-review`: use quando auth, autorização, input externo, upload, SQL, integração externa, secrets, SSRF, XSS ou superfícies sensíveis estiverem presentes
28
29
  - `vercel-react-best-practices`: use quando o diff tocar React/Next.js para revisar padrões de renderização, fetching, bundle, hidratação e performance
29
30
 
@@ -158,6 +159,34 @@ Para cada projeto impactado, verificar rules específicas em `.dw/rules/`:
158
159
  - [ ] Chamadas de API usam utilitários fetch do projeto
159
160
  - [ ] UI segue o design system do projeto
160
161
 
162
+ ### 4.1. Constitution Compliance (Obrigatório quando `.dw/constitution.md` existe)
163
+
164
+ <critical>**Auto-create se ausente**: se `.dw/constitution.md` NÃO existir, copie `templates/constitution-template.md` (project-local `.dw/templates/constitution-template.md` primeiro, com fallback para scaffold bundled) literalmente com frontmatter `mode: defaults`. Imprimir no chat: "Constituição defaults instalada em `.dw/constitution.md` (todos os princípios em `severity: info` — reportam mas não bloqueiam este review). Seguindo." Depois prossiga.</critical>
165
+
166
+ Para cada princípio em `.dw/constitution.md`, verificar o diff por violações:
167
+
168
+ 1. **Parsear princípios**: ler cada entrada `**P-NNN — <nome>** (severity: <S>)`; capturar `P-NNN`, `severity` e descrição de `Enforcement`.
169
+ 2. **Aplicar enforcement**: para cada princípio, rodar a checagem de enforcement contra o diff (grep, inspeção de arquivo ou pattern match conforme a linha Enforcement).
170
+ 3. **Classificar violações**:
171
+ - Princípio `severity: info` → adicione linha à tabela "Issues Found" com severity `low`. **Não bloqueia** o verdict.
172
+ - Princípio `severity: high` → adicione linha com severity `critical`. **Bloqueia** o verdict como `REJECTED` EXCETO se um ADR no `adrs/` do mesmo PRD documenta o desvio (busque `Deviates: P-NNN` no corpo de qualquer ADR).
173
+ - Princípio `severity: critical` → adicione linha com severity `critical` E exigir que o ADR tenha campo `Approved by:` não-vazio. Campo ausente = ainda `REJECTED`.
174
+ 4. **Sem skip silencioso**: se o diff for grande demais para analisar todos os princípios, reportar quais foram checados e quais foram pulados por escopo.
175
+
176
+ **Formato de saída no relatório:**
177
+
178
+ ```markdown
179
+ ## Constitution Compliance
180
+
181
+ | Princípio | Severity | Status | Evidência | ADR escape |
182
+ |-----------|----------|--------|-----------|------------|
183
+ | P-001 — Sem `any` casts | info | VIOLATED | src/foo.ts:42 | n/a |
184
+ | P-009 — Auth server-side | high | VIOLATED | src/api/order.ts:18 sem auth middleware | none → BLOQUEIA |
185
+ | P-010 — Secrets no repo | critical | PASS | — | — |
186
+ ```
187
+
188
+ Se houver violação `high`/`critical` sem ADR escape: adicionar à linha de verdict "REPROVADO — violação(ões) de constitution sem ADR (ver seção Constitution Compliance)".
189
+
161
190
  ### 5. Análise de Qualidade de Código (Obrigatório)
162
191
 
163
192
  | Aspecto | Verificação |
@@ -9,6 +9,12 @@
9
9
  ## Posição no Pipeline
10
10
  **Antecessor:** `/dw-run-task` ou `/dw-bugfix` | **Sucessor:** `/dw-generate-pr`
11
11
 
12
+ ## Skills Complementares
13
+
14
+ Quando disponíveis no projeto em `./.agents/skills/`, use estas skills como suporte operacional sem substituir este comando:
15
+
16
+ - `dw-git-discipline`: **SEMPRE** — aplica atomic commits (uma intenção lógica por commit; refactor separado de feature), formato Conventional Commits, lint+tests+build verdes ANTES do commit e proíbe pular hooks (`--no-verify`) ou amend de commits já empurrados. Em mudanças mistas, separa via `git add -p`.
17
+
12
18
  ## Variáveis de Entrada
13
19
 
14
20
  | Variável | Descrição | Exemplo |