@brunosps00/dev-workflow 0.10.0 → 0.13.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.
- package/README.md +78 -6
- package/lib/constants.js +20 -20
- package/lib/init.js +44 -4
- package/lib/migrate-skills.js +129 -0
- package/lib/removed-bundled-skills.js +16 -0
- package/lib/uninstall.js +6 -2
- package/lib/utils.js +51 -4
- package/package.json +1 -1
- package/scaffold/en/agent-instructions.md +68 -0
- package/scaffold/en/commands/dw-analyze-project.md +61 -0
- package/scaffold/en/commands/dw-autopilot.md +1 -1
- package/scaffold/en/commands/dw-brainstorm.md +1 -1
- package/scaffold/en/commands/dw-bugfix.md +3 -3
- package/scaffold/en/commands/dw-code-review.md +28 -0
- package/scaffold/en/commands/dw-create-prd.md +16 -0
- package/scaffold/en/commands/dw-create-tasks.md +42 -0
- package/scaffold/en/commands/dw-create-techspec.md +18 -1
- package/scaffold/en/commands/dw-deps-audit.md +1 -1
- package/scaffold/en/commands/dw-fix-qa.md +1 -1
- package/scaffold/en/commands/dw-functional-doc.md +2 -2
- package/scaffold/en/commands/dw-help.md +1 -1
- package/scaffold/en/commands/dw-redesign-ui.md +7 -7
- package/scaffold/en/commands/dw-run-qa.md +4 -4
- package/scaffold/en/commands/dw-run-task.md +2 -2
- package/scaffold/en/templates/constitution-template.md +111 -0
- package/scaffold/pt-br/agent-instructions.md +68 -0
- package/scaffold/pt-br/commands/dw-analyze-project.md +61 -0
- package/scaffold/pt-br/commands/dw-autopilot.md +1 -1
- package/scaffold/pt-br/commands/dw-brainstorm.md +1 -1
- package/scaffold/pt-br/commands/dw-bugfix.md +3 -3
- package/scaffold/pt-br/commands/dw-code-review.md +28 -0
- package/scaffold/pt-br/commands/dw-create-prd.md +16 -0
- package/scaffold/pt-br/commands/dw-create-tasks.md +42 -0
- package/scaffold/pt-br/commands/dw-create-techspec.md +18 -1
- package/scaffold/pt-br/commands/dw-deps-audit.md +1 -1
- package/scaffold/pt-br/commands/dw-fix-qa.md +1 -1
- package/scaffold/pt-br/commands/dw-functional-doc.md +2 -2
- package/scaffold/pt-br/commands/dw-help.md +1 -1
- package/scaffold/pt-br/commands/dw-redesign-ui.md +7 -7
- package/scaffold/pt-br/commands/dw-run-qa.md +4 -4
- package/scaffold/pt-br/commands/dw-run-task.md +2 -2
- package/scaffold/pt-br/templates/constitution-template.md +111 -0
- package/scaffold/skills/dw-council/SKILL.md +1 -1
- package/scaffold/skills/dw-testing-discipline/SKILL.md +148 -0
- package/scaffold/skills/dw-testing-discipline/references/ai-agent-gates.md +170 -0
- package/scaffold/skills/dw-testing-discipline/references/anti-patterns.md +336 -0
- package/scaffold/skills/dw-testing-discipline/references/flaky-discipline.md +163 -0
- package/scaffold/skills/dw-testing-discipline/references/iron-laws.md +128 -0
- package/scaffold/skills/dw-testing-discipline/references/playwright-recipes.md +282 -0
- package/scaffold/skills/dw-testing-discipline/references/positive-patterns.md +241 -0
- package/scaffold/skills/{webapp-testing → dw-testing-discipline}/references/security-boundary.md +1 -1
- package/scaffold/skills/dw-ui-discipline/SKILL.md +128 -0
- package/scaffold/skills/dw-ui-discipline/references/accessibility-floor.md +225 -0
- package/scaffold/skills/dw-ui-discipline/references/anti-slop.md +162 -0
- package/scaffold/skills/dw-ui-discipline/references/curated-defaults.md +195 -0
- package/scaffold/skills/dw-ui-discipline/references/hard-gate.md +142 -0
- package/scaffold/skills/dw-ui-discipline/references/state-matrix.md +101 -0
- package/scaffold/templates-overrides-readme.md +75 -0
- package/scaffold/skills/ui-ux-pro-max/LICENSE +0 -21
- package/scaffold/skills/ui-ux-pro-max/SKILL.md +0 -659
- package/scaffold/skills/ui-ux-pro-max/data/_sync_all.py +0 -414
- package/scaffold/skills/ui-ux-pro-max/data/app-interface.csv +0 -31
- package/scaffold/skills/ui-ux-pro-max/data/charts.csv +0 -26
- package/scaffold/skills/ui-ux-pro-max/data/colors.csv +0 -162
- package/scaffold/skills/ui-ux-pro-max/data/design.csv +0 -1776
- package/scaffold/skills/ui-ux-pro-max/data/draft.csv +0 -1779
- package/scaffold/skills/ui-ux-pro-max/data/google-fonts.csv +0 -1924
- package/scaffold/skills/ui-ux-pro-max/data/icons.csv +0 -106
- package/scaffold/skills/ui-ux-pro-max/data/landing.csv +0 -35
- package/scaffold/skills/ui-ux-pro-max/data/products.csv +0 -162
- package/scaffold/skills/ui-ux-pro-max/data/react-performance.csv +0 -45
- package/scaffold/skills/ui-ux-pro-max/data/stacks/angular.csv +0 -51
- package/scaffold/skills/ui-ux-pro-max/data/stacks/astro.csv +0 -54
- package/scaffold/skills/ui-ux-pro-max/data/stacks/flutter.csv +0 -53
- package/scaffold/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +0 -56
- package/scaffold/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +0 -53
- package/scaffold/skills/ui-ux-pro-max/data/stacks/laravel.csv +0 -51
- package/scaffold/skills/ui-ux-pro-max/data/stacks/nextjs.csv +0 -53
- package/scaffold/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +0 -51
- package/scaffold/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +0 -59
- package/scaffold/skills/ui-ux-pro-max/data/stacks/react-native.csv +0 -52
- package/scaffold/skills/ui-ux-pro-max/data/stacks/react.csv +0 -54
- package/scaffold/skills/ui-ux-pro-max/data/stacks/shadcn.csv +0 -61
- package/scaffold/skills/ui-ux-pro-max/data/stacks/svelte.csv +0 -54
- package/scaffold/skills/ui-ux-pro-max/data/stacks/swiftui.csv +0 -51
- package/scaffold/skills/ui-ux-pro-max/data/stacks/threejs.csv +0 -54
- package/scaffold/skills/ui-ux-pro-max/data/stacks/vue.csv +0 -50
- package/scaffold/skills/ui-ux-pro-max/data/styles.csv +0 -85
- package/scaffold/skills/ui-ux-pro-max/data/typography.csv +0 -74
- package/scaffold/skills/ui-ux-pro-max/data/ui-reasoning.csv +0 -162
- package/scaffold/skills/ui-ux-pro-max/data/ux-guidelines.csv +0 -100
- package/scaffold/skills/ui-ux-pro-max/scripts/core.py +0 -262
- package/scaffold/skills/ui-ux-pro-max/scripts/design_system.py +0 -1148
- package/scaffold/skills/ui-ux-pro-max/scripts/search.py +0 -114
- package/scaffold/skills/ui-ux-pro-max/skills/brand/SKILL.md +0 -97
- package/scaffold/skills/ui-ux-pro-max/skills/design/SKILL.md +0 -302
- package/scaffold/skills/ui-ux-pro-max/skills/design-system/SKILL.md +0 -244
- package/scaffold/skills/ui-ux-pro-max/templates/base/quick-reference.md +0 -297
- package/scaffold/skills/ui-ux-pro-max/templates/base/skill-content.md +0 -358
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/agent.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/augment.json +0 -18
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/claude.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/codebuddy.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/codex.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/continue.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/copilot.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/cursor.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/droid.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/gemini.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/kilocode.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/kiro.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/opencode.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/qoder.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/roocode.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/trae.json +0 -21
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/warp.json +0 -18
- package/scaffold/skills/ui-ux-pro-max/templates/platforms/windsurf.json +0 -21
- package/scaffold/skills/webapp-testing/SKILL.md +0 -138
- package/scaffold/skills/webapp-testing/assets/test-helper.js +0 -56
- /package/scaffold/skills/{webapp-testing → dw-testing-discipline}/references/three-workflow-patterns.md +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<!-- dev-workflow:start -->
|
|
2
|
+
# dev-workflow — AI Agent Instructions
|
|
3
|
+
|
|
4
|
+
This project uses [`@brunosps00/dev-workflow`](https://www.npmjs.com/package/@brunosps00/dev-workflow) (`dw-*` commands) for structured AI-driven development. The commands compose into a PRD → TechSpec → Tasks → Implement → Review → Commit → PR pipeline with hard gates for security, constitution compliance, and verification.
|
|
5
|
+
|
|
6
|
+
**The whole point of this file:** when the user states an intent that matches the Trigger Map below, run the matching `dw-*` command **without asking permission first** — unless the change is genuinely trivial (see Escape Hatches).
|
|
7
|
+
|
|
8
|
+
## Trigger Map
|
|
9
|
+
|
|
10
|
+
| User intent (literal or paraphrased) | Auto-trigger |
|
|
11
|
+
|--------------------------------------|--------------|
|
|
12
|
+
| "Implement X" / "Build Y" / "Add feature Z" / "I need ..." / "Create ..." | `/dw-autopilot "X"` |
|
|
13
|
+
| Pasted error / "X is broken" / "Bug in Y" / failing test screenshot | `/dw-bugfix "X"` |
|
|
14
|
+
| "Run this task" (with task ID) | `/dw-run-task <ID>` |
|
|
15
|
+
| "Run all pending tasks" / "Execute the plan" | `/dw-run-plan` |
|
|
16
|
+
| "Review my PR" / "Check code quality" / "Is this ready to ship?" | `/dw-code-review` |
|
|
17
|
+
| "Time to commit" / changes are validated and ready | `/dw-commit` |
|
|
18
|
+
| "Open a PR" / "Ship this" | `/dw-generate-pr` |
|
|
19
|
+
| "Write a PRD for X" / "Spec out Y" | `/dw-create-prd` |
|
|
20
|
+
| "Design the architecture" / "Make the techspec" | `/dw-create-techspec` |
|
|
21
|
+
| "Break this into tasks" | `/dw-create-tasks` |
|
|
22
|
+
| "Where is X?" / "What uses Y?" / "How is Z structured?" | `/dw-intel "<question>"` |
|
|
23
|
+
| "Audit our dependencies" / "Are we behind on packages?" | `/dw-deps-audit` |
|
|
24
|
+
| "Scan for vulnerabilities" / "Security check" | `/dw-security-check` |
|
|
25
|
+
| "QA this feature" / "Run the test plan" | `/dw-run-qa` |
|
|
26
|
+
| "Fix the QA bugs" | `/dw-fix-qa` |
|
|
27
|
+
|
|
28
|
+
**Priority:** when in doubt between two commands, `/dw-autopilot` is the safest default for any non-trivial feature request — it composes the rest.
|
|
29
|
+
|
|
30
|
+
## Hard Gates (the commands enforce these — don't bypass)
|
|
31
|
+
|
|
32
|
+
- **`.dw/constitution.md`**: principles with `severity: high` or `critical` block PRs / techspecs without an ADR justifying the deviation. Missing constitution? Commands auto-install defaults at `severity: info` (non-blocking) and continue — never blocks on absence.
|
|
33
|
+
- **`.dw/spec/<prd>/tasks-validation.md`**: auto-generated at the end of `/dw-create-tasks`. Any FAIL dimension blocks user approval until resolved or explicitly overridden.
|
|
34
|
+
- **Verification**: `/dw-generate-pr` requires a fresh `dw-verify` PASS (tests + lint + build) after the last edit.
|
|
35
|
+
- **Security**: TS / Python / C# / Rust projects must pass `/dw-security-check` (Trivy + OWASP + lockfile audit) before the PR opens.
|
|
36
|
+
|
|
37
|
+
## Escape Hatches — do NOT auto-trigger
|
|
38
|
+
|
|
39
|
+
When any of these apply, answer directly and do **not** invoke a `dw-*` command:
|
|
40
|
+
|
|
41
|
+
- One-line typo, rename, import sort, comment fix.
|
|
42
|
+
- Pure exploration: "how does this work?", "show me X", "explain Y".
|
|
43
|
+
- Aesthetic preference: "I prefer this style" — apply, don't run a pipeline.
|
|
44
|
+
- User explicitly says "do this directly" / "skip autopilot" / "no need for a PRD" — honor it.
|
|
45
|
+
- The conversation is already inside a `dw-*` flow (you're already executing tasks; don't start a new pipeline).
|
|
46
|
+
|
|
47
|
+
## Workflow Reference
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
/dw-autopilot "wish" ────► Runs entire pipeline automatically
|
|
51
|
+
(3 gates: PRD approval, Tasks approval, PR confirmation)
|
|
52
|
+
|
|
53
|
+
--- OR step-by-step ---
|
|
54
|
+
|
|
55
|
+
/dw-brainstorm ─► /dw-create-prd ─► /dw-create-techspec ─► /dw-create-tasks
|
|
56
|
+
│
|
|
57
|
+
▼
|
|
58
|
+
/dw-commit + /dw-generate-pr ◄──── /dw-code-review ◄──── /dw-run-plan
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Full command list and contextual help: `/dw-help`.
|
|
62
|
+
|
|
63
|
+
## Editing this section
|
|
64
|
+
|
|
65
|
+
This block lives between `<!-- dev-workflow:start -->` and `<!-- dev-workflow:end -->` markers. Anything you write **outside** these markers in `CLAUDE.md` / `AGENTS.md` is preserved on every `dev-workflow update`. Anything **inside** is refreshed from the package — your edits inside the block will be overwritten.
|
|
66
|
+
|
|
67
|
+
To customize the trigger map permanently, copy the block content to outside the markers (or to a separate file like `.dw/agent-instructions-custom.md`) and edit there.
|
|
68
|
+
<!-- dev-workflow:end -->
|
|
@@ -705,6 +705,67 @@ packages/auth → packages/db
|
|
|
705
705
|
6. {apps/web} — depends on ui, db, auth
|
|
706
706
|
```
|
|
707
707
|
|
|
708
|
+
### Step 8: Constitution Generation (Optional but Recommended)
|
|
709
|
+
|
|
710
|
+
After `.dw/rules/` is written, offer to generate `.dw/constitution.md` — the declarative principles the team wants enforced on PRDs, TechSpecs, and Code Reviews.
|
|
711
|
+
|
|
712
|
+
**Difference from `.dw/rules/`:**
|
|
713
|
+
- `.dw/rules/` is **analytical** — what the code IS (observed patterns, anti-patterns, conventions).
|
|
714
|
+
- `.dw/constitution.md` is **declarative** — what the code SHOULD BE (rules the team commits to).
|
|
715
|
+
|
|
716
|
+
**Behavior:**
|
|
717
|
+
|
|
718
|
+
If `.dw/constitution.md` already exists, print "Constitution already present at `.dw/constitution.md` — skipping (edit it manually if you want to update)" and finish.
|
|
719
|
+
|
|
720
|
+
Otherwise, present 3 options in the chat (use the user's preferred question UI when available; otherwise plain text):
|
|
721
|
+
|
|
722
|
+
```
|
|
723
|
+
A constitution would help PRDs/TechSpecs/PRs stay aligned with project standards.
|
|
724
|
+
Three options:
|
|
725
|
+
|
|
726
|
+
A) Synthesize from observed patterns (recommended)
|
|
727
|
+
I read `.dw/rules/` and propose 5–8 principles grounded in real code,
|
|
728
|
+
each with `Why:` linked to evidence and `severity: info` (won't block).
|
|
729
|
+
You review and approve before anything is written.
|
|
730
|
+
|
|
731
|
+
B) Install defaults template
|
|
732
|
+
Copy `templates/constitution-template.md` to `.dw/constitution.md` with
|
|
733
|
+
5 canonical principles (Code Quality, Testing, UX, Performance, Security)
|
|
734
|
+
pre-filled at `severity: info`. You customize manually.
|
|
735
|
+
|
|
736
|
+
C) Skip
|
|
737
|
+
No constitution. Downstream commands will operate without the gate.
|
|
738
|
+
You can run this step again later by re-running `/dw-analyze-project`.
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
**Option A — Synthesize:**
|
|
742
|
+
|
|
743
|
+
1. Read `.dw/rules/index.md` + each `.dw/rules/{module}.md`.
|
|
744
|
+
2. Propose 5–8 principles. Each must:
|
|
745
|
+
- Have a unique `P-NNN` ID.
|
|
746
|
+
- Map to an observation in `.dw/rules/` (cite the rule file + section).
|
|
747
|
+
- Start at `severity: info` (never propose `high`/`critical` automatically — that's the team's call).
|
|
748
|
+
- Follow the format: `**P-NNN — <name>** (severity: info): <rule>. **Why:** <ground in evidence>. **Enforcement:** <how to check>.`
|
|
749
|
+
3. **Show the proposed principles in the chat as a markdown list** (do not write the file yet). Include the evidence citation for each.
|
|
750
|
+
4. Ask: "Edit any of these before I write the file? Reply with the IDs to drop/edit, or 'approve' to write as-is."
|
|
751
|
+
5. After user approves (with edits applied), write to `.dw/constitution.md` using the same template structure as `templates/constitution-template.md`.
|
|
752
|
+
6. Set frontmatter `mode: custom` and `last_updated: <today's ISO date>`.
|
|
753
|
+
|
|
754
|
+
**Option B — Defaults:**
|
|
755
|
+
|
|
756
|
+
1. Locate `templates/constitution-template.md` (project-local at `.dw/templates/constitution-template.md`, falling back to the bundled scaffold).
|
|
757
|
+
2. Copy to `.dw/constitution.md` verbatim. Set frontmatter `mode: defaults`.
|
|
758
|
+
3. Print: "Installed defaults constitution at `.dw/constitution.md`. All 10 principles start at `severity: info` — they report but don't block. Edit the file to customize, then promote severities to `high`/`critical` when you trust the project enforces them."
|
|
759
|
+
|
|
760
|
+
**Option C — Skip:**
|
|
761
|
+
|
|
762
|
+
1. Do nothing.
|
|
763
|
+
2. Print: "Skipped. PRD/TechSpec/CodeReview will run without the constitution gate. Re-run `/dw-analyze-project` later if you want to enable it."
|
|
764
|
+
|
|
765
|
+
**No matter which option:**
|
|
766
|
+
- Never write `.dw/constitution.md` without explicit user approval (option A) or explicit choice (options B/C).
|
|
767
|
+
- Constitution file is committed to the repository like any other project artifact — never gitignored.
|
|
768
|
+
|
|
708
769
|
## Quality Checklist
|
|
709
770
|
|
|
710
771
|
Before declaring the analysis complete, verify:
|
|
@@ -141,7 +141,7 @@ Present to the user:
|
|
|
141
141
|
### Step 7: Design Contract (Conditional)
|
|
142
142
|
|
|
143
143
|
Evaluate whether tasks involve frontend:
|
|
144
|
-
- **YES** (run `/dw-redesign-ui`): if there are tasks with visual components AND the `ui-
|
|
144
|
+
- **YES** (run `/dw-redesign-ui`): if there are tasks with visual components AND the `dw-ui-discipline` skill is available
|
|
145
145
|
- Generate the design contract in `.dw/spec/prd-[name]/design-contract.md`
|
|
146
146
|
- Present a summary of the design contract to the user (palette, typography, mobile/desktop layout) as a visual checkpoint before proceeding
|
|
147
147
|
- **NO** (skip to step 8): purely backend/infra tasks
|
|
@@ -41,7 +41,7 @@ digraph brainstorm_decision {
|
|
|
41
41
|
When available in the project under `./.agents/skills/`, use these skills to enrich ideation:
|
|
42
42
|
|
|
43
43
|
- `dw-council` (opt-in via `--council`): multi-advisor stress-test of the most promising options with mandatory steel-manning and concession tracking. **DO NOT invoke by default** — only when the flag is present or when consensus forms too quickly (false-consensus signal).
|
|
44
|
-
- `ui-
|
|
44
|
+
- `dw-ui-discipline`: use when brainstorming involves frontend or UI direction — its hard-gate (scene sentence, surface job) is a generative forcing function during ideation, not just a review check
|
|
45
45
|
- `vercel-react-best-practices`: use when brainstorming React/Next.js architecture or performance trade-offs
|
|
46
46
|
- `security-review`: use when brainstorming touches auth, data handling, or security-sensitive features
|
|
47
47
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
- `dw-debug-protocol`: **ALWAYS** — runs the bug through the six-step triage (Reproduce → Localize → Reduce → Fix Root Cause → Guard → Verify End-to-End). Stop-the-line discipline; root-cause over symptom; regression test committed in the same atomic commit. Non-reproducible bugs follow the instrument-first sub-protocol — no guess fixes without explicit acknowledgement.
|
|
19
19
|
- `dw-verify`: **ALWAYS** — in Direct mode, invoked before committing the fix. The VERIFICATION REPORT must show the original bug symptom no longer reproduces (not just that tests pass).
|
|
20
20
|
- `vercel-react-best-practices`: use when the bug affects React/Next.js and there is suspicion of render, hydration, fetching, waterfall, bundle, or re-render issues
|
|
21
|
-
- `
|
|
21
|
+
- `dw-testing-discipline`: use when the fix requires a reproducible E2E/retest flow in a web app — `references/playwright-recipes.md` for recipes, Iron Laws + 7 AI Gates for any test the fix adds, flaky-discipline if the bug surfaces intermittently.
|
|
22
22
|
- `security-review`: use when the root cause touches auth, authorization, external input, upload, secrets, SQL, XSS, SSRF, or other sensitive surfaces
|
|
23
23
|
|
|
24
24
|
## Input Variables
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
- Related error messages
|
|
160
160
|
- Stack traces
|
|
161
161
|
- Recently modified files
|
|
162
|
-
- If the bug is UI-related or depends on browser flow, supplement collection with `
|
|
162
|
+
- If the bug is UI-related or depends on browser flow, supplement collection with `dw-testing-discipline` (playwright-recipes + three-workflow-patterns to pick the right verification mode)
|
|
163
163
|
|
|
164
164
|
### 3. Clarification Questions (MANDATORY - EXACTLY 3)
|
|
165
165
|
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
- **Probable Cause**: Based on the evidence
|
|
198
198
|
- **Affected Files**: List of files to modify
|
|
199
199
|
- **Impact**: Other components that may be affected
|
|
200
|
-
- **Skills used**: explicitly record if the analysis used `vercel-react-best-practices`, `
|
|
200
|
+
- **Skills used**: explicitly record if the analysis used `vercel-react-best-practices`, `dw-testing-discipline`, or `security-review`
|
|
201
201
|
|
|
202
202
|
### 4.1 Scope Checkpoint (MANDATORY)
|
|
203
203
|
|
|
@@ -166,6 +166,34 @@ For each impacted project, verify project-specific rules from `.dw/rules/`:
|
|
|
166
166
|
- [ ] API calls use project fetch utilities
|
|
167
167
|
- [ ] UI follows project design system
|
|
168
168
|
|
|
169
|
+
### 4.1. Constitution Compliance (Required when `.dw/constitution.md` exists)
|
|
170
|
+
|
|
171
|
+
<critical>**Auto-create if missing**: if `.dw/constitution.md` does NOT exist, copy `templates/constitution-template.md` (project-local `.dw/templates/constitution-template.md` first, falling back to bundled scaffold) verbatim with frontmatter `mode: defaults`. Print in chat: "Installed defaults constitution at `.dw/constitution.md` (all principles at `severity: info` — reported but not blocking this review). Continuing." Then proceed.</critical>
|
|
172
|
+
|
|
173
|
+
For each principle in `.dw/constitution.md`, check the diff for violations:
|
|
174
|
+
|
|
175
|
+
1. **Parse principles**: read each `**P-NNN — <name>** (severity: <S>)` entry; capture `P-NNN`, `severity`, and the `Enforcement` description.
|
|
176
|
+
2. **Apply enforcement**: for each principle, run the enforcement check against the diff (grep, file inspection, or pattern match per the Enforcement line).
|
|
177
|
+
3. **Classify violations**:
|
|
178
|
+
- Principle severity `info` → add row to "Issues Found" table with severity `low`. **Does not block** the verdict.
|
|
179
|
+
- Principle severity `high` → add row with severity `critical`. **Blocks** the verdict to `REJECTED` UNLESS an ADR in the same PRD's `adrs/` directory documents the deviation (look for `Deviates: P-NNN` in any ADR body).
|
|
180
|
+
- Principle severity `critical` → add row with severity `critical` AND require the ADR to have a non-empty `Approved by:` field. Missing field = still `REJECTED`.
|
|
181
|
+
4. **No silent skips**: if the diff is too large to analyze every principle, report which were checked and which were skipped due to scope.
|
|
182
|
+
|
|
183
|
+
**Output format in the report:**
|
|
184
|
+
|
|
185
|
+
```markdown
|
|
186
|
+
## Constitution Compliance
|
|
187
|
+
|
|
188
|
+
| Principle | Severity | Status | Evidence | ADR escape |
|
|
189
|
+
|-----------|----------|--------|----------|------------|
|
|
190
|
+
| P-001 — No `any` casts | info | VIOLATED | src/foo.ts:42 | n/a |
|
|
191
|
+
| P-009 — Server-side auth | high | VIOLATED | src/api/order.ts:18 missing auth middleware | none → BLOCKS |
|
|
192
|
+
| P-010 — Secrets in repo | critical | PASS | — | — |
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
If any `high`/`critical` violation has no ADR escape: append to the verdict line "REJECTED — constitution violation(s) without ADR (see Constitution Compliance section)".
|
|
196
|
+
|
|
169
197
|
### 5. Code Quality Analysis (Required)
|
|
170
198
|
|
|
171
199
|
| Aspect | Verification |
|
|
@@ -50,6 +50,22 @@
|
|
|
50
50
|
- Use `.dw/rules/` as context, falling back to grep
|
|
51
51
|
- Suggest running `/dw-map-codebase` for richer downstream context
|
|
52
52
|
|
|
53
|
+
## Constitution Gate
|
|
54
|
+
|
|
55
|
+
<critical>BEFORE the clarification questions, check `.dw/constitution.md`:
|
|
56
|
+
|
|
57
|
+
**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` and `last_updated` to today's ISO date. Print in chat:
|
|
58
|
+
|
|
59
|
+
> "I noticed `.dw/constitution.md` was missing. Installed defaults at `.dw/constitution.md` (10 canonical principles, all `severity: info` — they report but don't block). You can customize anytime — or re-run `/dw-analyze-project` for a tailored version. Continuing with PRD."
|
|
60
|
+
|
|
61
|
+
Then proceed normally, treating the new file as the constitution.
|
|
62
|
+
|
|
63
|
+
**If PRESENT**: read it before drafting requirements. Each FR in the PRD MUST include a "Constitution Alignment" line mapping to ≥1 relevant principle (`Respects: P-001, P-009`) OR explicitly declaring "no applicable principle" with a one-line reason. Missing alignment = the FR is incomplete.
|
|
64
|
+
|
|
65
|
+
**Severity rules** (applied by downstream commands, not enforced here):
|
|
66
|
+
- `severity: info` violations → reported, never block.
|
|
67
|
+
- `severity: high` / `critical` violations → block in `dw-create-techspec` and `dw-code-review` unless an ADR justifies the deviation.</critical>
|
|
68
|
+
|
|
53
69
|
## Multi-Project Features
|
|
54
70
|
|
|
55
71
|
Many features may involve more than one project in the workspace (e.g., a feature may impact both frontend and backend, or multiple services).
|
|
@@ -149,5 +149,47 @@
|
|
|
149
149
|
3. Create PR when all tasks are completed
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
+
## Final Consistency Check (Auto-invoked before user approval)
|
|
153
|
+
|
|
154
|
+
<critical>BEFORE presenting tasks to the user, run a 5-dimension consistency check. This is mandatory; do not skip even if you're confident the tasks are clean.</critical>
|
|
155
|
+
|
|
156
|
+
Run these 5 checks against the generated PRD + TechSpec + tasks set:
|
|
157
|
+
|
|
158
|
+
1. **FR coverage** — every numbered FR in the PRD maps to ≥1 task. Orphan FRs (PRD has it; no task covers it) are a FAIL.
|
|
159
|
+
2. **Task grounding** — every generated task body references ≥1 FR (`Covers: FR-N.M`). Tasks without FR reference signal scope creep.
|
|
160
|
+
3. **Test coverage** — every FR with user-facing behavior (UI, API endpoint, data mutation) has ≥1 task that adds a test (subtask containing "test", "spec", "e2e", or equivalent).
|
|
161
|
+
4. **Dependency graph** — task dependencies (X.0 → Y.0 declared as "Depends on") form a DAG. No cycles. Topological order valid.
|
|
162
|
+
5. **Constitution alignment** (only if `.dw/constitution.md` exists) — every task lists `Constitution: respects P-NNN, P-MMM` OR `Constitution: deviates P-NNN — ADR planned: <slug>` OR `Constitution: n/a — reason: <one-liner>`. Missing line = FAIL.
|
|
163
|
+
|
|
164
|
+
Write findings to `.dw/spec/prd-[feature-name]/tasks-validation.md` with this exact structure:
|
|
165
|
+
|
|
166
|
+
```markdown
|
|
167
|
+
# Tasks Validation Report
|
|
168
|
+
|
|
169
|
+
Generated by /dw-create-tasks on YYYY-MM-DD.
|
|
170
|
+
|
|
171
|
+
| Dimension | Status | Findings |
|
|
172
|
+
|-----------|--------|----------|
|
|
173
|
+
| 1. FR coverage | PASS / FAIL | <orphan FR list or "all FRs covered"> |
|
|
174
|
+
| 2. Task grounding | PASS / FAIL | <ungrounded task list or "all tasks reference FRs"> |
|
|
175
|
+
| 3. Test coverage | PASS / FAIL | <FRs missing tests or "all user-facing FRs covered"> |
|
|
176
|
+
| 4. Dependency graph | PASS / FAIL | <cycles or "DAG valid"> |
|
|
177
|
+
| 5. Constitution alignment | PASS / FAIL / N/A | <unaligned tasks or "all aligned" or "no constitution"> |
|
|
178
|
+
|
|
179
|
+
## Detailed Findings
|
|
180
|
+
|
|
181
|
+
<one section per FAILing dimension with concrete fixes; empty if all PASS>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Gate behavior:**
|
|
185
|
+
|
|
186
|
+
- **All 5 dimensions PASS (or N/A)** → present tasks to the user normally and ask for approval.
|
|
187
|
+
- **Any dimension FAIL** → STOP. Show the table in chat as markdown (do NOT bury it in the validation file; the user must see it before approving). Then ask the user:
|
|
188
|
+
- "(a) Want me to fix tasks automatically?" → regenerate the affected tasks, re-run the check.
|
|
189
|
+
- "(b) Will you edit tasks.md manually?" → wait for the user to signal completion, re-run the check.
|
|
190
|
+
- "(c) Override and proceed despite FAIL?" → require an explicit override message ("override: I accept the gap because <reason>"). Persist the override in `tasks-validation.md` so it's auditable.
|
|
191
|
+
|
|
192
|
+
The `tasks-validation.md` file is committed alongside `tasks.md`. Downstream commands (`/dw-run-plan`, `/dw-code-review`, `/dw-review-implementation`) may reference it.
|
|
193
|
+
|
|
152
194
|
After completing the analysis and generating all necessary files, present the results to the user and wait for confirmation to proceed with implementation.
|
|
153
195
|
</system_instructions>
|
|
@@ -25,7 +25,7 @@
|
|
|
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
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.
|
|
27
27
|
- `vercel-react-best-practices`: use when defining frontend architecture for React/Next.js projects
|
|
28
|
-
- `ui-
|
|
28
|
+
- `dw-ui-discipline`: use when the TechSpec includes UI sections — enforces the 4-checkpoint hard-gate (brand authorities / surface job / state matrix / scene sentence), the 14 anti-slop patterns, and the WCAG 2.2 AA floor BEFORE design decisions land.
|
|
29
29
|
- `security-review`: use when the feature touches auth, authorization, or sensitive data handling
|
|
30
30
|
|
|
31
31
|
## Codebase Intelligence
|
|
@@ -39,6 +39,23 @@
|
|
|
39
39
|
- Use `.dw/rules/` as context, falling back to grep
|
|
40
40
|
- Suggest running `/dw-map-codebase` to enrich downstream context
|
|
41
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
|
+
|
|
42
59
|
## Multi-Project Decision Flowchart
|
|
43
60
|
|
|
44
61
|
```dot
|
|
@@ -31,7 +31,7 @@ This command is **distinct** from `/dw-security-check`:
|
|
|
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
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. |
|
|
33
33
|
| `dw-council` | Auto opt-in when ≥3 packages land in tier COMPROMISED — multi-advisor stress-test on remediation order and scope |
|
|
34
|
-
| `
|
|
34
|
+
| `dw-testing-discipline` | Optional — when the scoped test phase needs Playwright recipes for frontend projects. Iron Laws + anti-patterns apply to any test added during the audit. |
|
|
35
35
|
|
|
36
36
|
## Input Variables
|
|
37
37
|
|
|
@@ -20,7 +20,7 @@ When available in the project under `./.agents/skills/`, use these skills as ope
|
|
|
20
20
|
|
|
21
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.
|
|
22
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`.
|
|
23
|
-
- `
|
|
23
|
+
- `dw-testing-discipline`: (UI mode) consult `references/playwright-recipes.md` for retest structures, captures, scripts. Apply Iron Laws + flaky discipline when retesting bug fixes — quarantine and SLOs from the doctrine apply.
|
|
24
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
|
|
25
25
|
- `api-testing-recipes`: **(API mode — ALWAYS)** source of the recipe used at QA time. Re-execute the original `.http`/pytest/supertest/etc. file for the bug's RF; append the retest result to a fresh JSONL log under `QA/logs/api/BUG-NN-retest.log`
|
|
26
26
|
|
|
@@ -55,10 +55,10 @@ Works best with project analyzed by `/dw-analyze-project`
|
|
|
55
55
|
|
|
56
56
|
When available in the project under `./.agents/skills/`, use these skills as operational support without replacing this command as source of truth:
|
|
57
57
|
|
|
58
|
-
- `
|
|
58
|
+
- `dw-testing-discipline`: support for structuring E2E flows (`references/playwright-recipes.md`), evidence collection patterns, and applying Iron Laws + selector hierarchy to any test the doc references
|
|
59
59
|
- `remotion-best-practices`: mandatory support when there is a final human video, captions, composition, transitions, FFmpeg, or Remotion
|
|
60
60
|
- `humanizer`: mandatory support for reviewing and naturalizing all captions, `.srt` files, descriptive texts, and any human-facing writing before final delivery
|
|
61
|
-
- `ui-
|
|
61
|
+
- `dw-ui-discipline`: use when documenting visual patterns — the state matrix and scene sentence become part of each screen's overview section
|
|
62
62
|
|
|
63
63
|
## Mandatory Browser Tools
|
|
64
64
|
|
|
@@ -380,7 +380,7 @@ Commands work across multiple AI tools, all pointing to the same source `.dw/com
|
|
|
380
380
|
- For comprehensive multi-source analysis, technology comparisons, state-of-the-art reviews, or any topic requiring cited evidence. Not for simple lookups or debugging.
|
|
381
381
|
|
|
382
382
|
**Q: Does `/dw-redesign-ui` work with Angular?**
|
|
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.
|
|
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. UI discipline (`dw-ui-discipline`) works with any framework — enforces the hard-gate, anti-slop catalog, and WCAG floor regardless of stack.
|
|
384
384
|
|
|
385
385
|
**Q: How do I get codebase intelligence and parallel execution?**
|
|
386
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.
|
|
@@ -40,9 +40,9 @@ digraph redesign_decision {
|
|
|
40
40
|
|
|
41
41
|
When available in the project under `./.agents/skills/`, use these to guide the redesign:
|
|
42
42
|
|
|
43
|
-
- `ui-
|
|
43
|
+
- `dw-ui-discipline`: **REQUIRED** — runs the 4-checkpoint hard-gate (brand authorities OR curated defaults; surface job sentence; complete state matrix; scene sentence) BEFORE any design proposal. The 14 anti-slop patterns are checked against each proposed direction. The WCAG 2.2 AA floor is non-negotiable at the validate step.
|
|
44
44
|
- `vercel-react-best-practices`: use when the project is React/Next.js for performance and implementation patterns
|
|
45
|
-
- `
|
|
45
|
+
- `dw-testing-discipline`: consult `references/playwright-recipes.md` for before/after screenshot capture and visual validation. Iron Laws + selector hierarchy apply to any tests generated alongside the redesign.
|
|
46
46
|
- `security-review`: use if the redesign touches authentication flows or sensitive forms
|
|
47
47
|
|
|
48
48
|
## Analysis Tools
|
|
@@ -56,12 +56,12 @@ Use diagnostic tools based on the project's framework:
|
|
|
56
56
|
## Required Behavior
|
|
57
57
|
|
|
58
58
|
1. Identify the target: page, component, or route to be redesigned.
|
|
59
|
-
2. **AUDIT**: read the current implementation, identify the CSS stack (Tailwind, CSS Modules, styled-components, etc.), capture screenshot
|
|
59
|
+
2. **AUDIT**: read the current implementation, identify the CSS stack (Tailwind, CSS Modules, styled-components, etc.), capture screenshot using `dw-testing-discipline`/playwright-recipes if available, run react-doctor if React project.
|
|
60
60
|
3. Ask 3 to 5 questions about redesign goals: style direction, brand constraints, inspirations, target audience, priority devices.
|
|
61
|
-
4. **PROPOSE**: present 2 to 3 design directions
|
|
61
|
+
4. **PROPOSE**: present 2 to 3 design directions after passing the `dw-ui-discipline` hard-gate (brand authorities or curated defaults selected; surface job sentence written; state matrix enumerated; scene sentence written). Each direction lists color palette, typography pairing, layout style, and rationale. Self-check each direction against the 14 anti-slop patterns. For EACH direction, explicitly describe the mobile layout (<=768px) and desktop layout (>=1024px), including how elements reorganize, stack, or hide between breakpoints.
|
|
62
62
|
5. Wait for explicit user approval before implementing.
|
|
63
63
|
6. **IMPLEMENT**: apply the chosen design with a mobile-first approach — implement the mobile layout first, then add media queries/breakpoints for tablet and desktop. Respect the existing stack. Use `vercel-react-best-practices` for React/Next.js. Maintain the project's CSS methodology.
|
|
64
|
-
7. **VALIDATE**: capture after-state in BOTH resolutions (mobile and desktop), compare before/after, verify accessibility (WCAG 2.2
|
|
64
|
+
7. **VALIDATE**: capture after-state in BOTH resolutions (mobile and desktop), compare before/after, verify accessibility against `dw-ui-discipline/references/accessibility-floor.md` (WCAG 2.2 AA — non-negotiable: contrast, focus-visible, keyboard nav, ARIA, no traps), run react-doctor `--diff` if React. Use `dw-testing-discipline/references/playwright-recipes.md` to capture screenshots at 375px viewport (mobile) and 1440px viewport (desktop).
|
|
65
65
|
8. **PERSIST CONTRACT**: if the user approved a direction, generate `design-contract.md` in the PRD directory (`.dw/spec/prd-[name]/design-contract.md`) with: approved direction, color palette, typography pairing, layout rules, accessibility rules, and component rules. This contract will be read by `dw-run-task` and `dw-run-plan` to ensure visual consistency.
|
|
66
66
|
|
|
67
67
|
## Codebase Intelligence
|
|
@@ -82,8 +82,8 @@ Use diagnostic tools based on the project's framework:
|
|
|
82
82
|
|
|
83
83
|
### 2. Design Proposal
|
|
84
84
|
- 2 to 3 directions with visual rationale
|
|
85
|
-
- Color palette (
|
|
86
|
-
- Typography pairing (
|
|
85
|
+
- Color palette (from brand authority OR `dw-ui-discipline/references/curated-defaults.md`)
|
|
86
|
+
- Typography pairing (same source)
|
|
87
87
|
- Layout pattern
|
|
88
88
|
- Effort level per direction
|
|
89
89
|
|
|
@@ -20,9 +20,9 @@ You are an AI assistant specialized in Quality Assurance. Your task is to valida
|
|
|
20
20
|
|
|
21
21
|
When available in the project under `./.agents/skills/`, use these skills as operational support without replacing this command:
|
|
22
22
|
|
|
23
|
-
- `
|
|
23
|
+
- `dw-testing-discipline`: (UI mode) **ALWAYS** — Iron Laws and 25 anti-patterns apply to every QA test authored. `references/playwright-recipes.md` for tactical patterns. `references/three-workflow-patterns.md` to pick the right verification mode (UI / network / perf). `references/security-boundary.md` for any flow that crosses an auth boundary.
|
|
24
24
|
- `vercel-react-best-practices`: (UI mode) use only if the frontend under test is React/Next.js and there is indication of regression related to rendering, fetching, hydration, or perceived performance
|
|
25
|
-
- `ui-
|
|
25
|
+
- `dw-ui-discipline`: (UI mode) use when validating design consistency — the anti-slop catalog and WCAG accessibility floor are checked as part of QA evidence
|
|
26
26
|
- `api-testing-recipes`: **(API mode — ALWAYS)** validated snippets for `.http`, pytest+httpx, supertest, WebApplicationFactory, reqwest. Composes per-RF test files in `QA/scripts/api/` and JSONL logs in `QA/logs/api/` per its references
|
|
27
27
|
|
|
28
28
|
## Analysis Tools
|
|
@@ -149,7 +149,7 @@ If NO credentials are found, STOP and ask the user before continuing. Do NOT gue
|
|
|
149
149
|
- Verify the application is running on localhost
|
|
150
150
|
- Use `browser_navigate` from Playwright MCP to access the application
|
|
151
151
|
- Confirm the page loaded correctly with `browser_snapshot`
|
|
152
|
-
- If persistent session, auth import, or network inspection beyond MCP is needed, complement with `
|
|
152
|
+
- If persistent session, auth import, or network inspection beyond MCP is needed, complement with `dw-testing-discipline/references/playwright-recipes.md`
|
|
153
153
|
|
|
154
154
|
### 3. Menu Page Verification (UI mode only -- Required, Execute BEFORE RF tests)
|
|
155
155
|
|
|
@@ -222,7 +222,7 @@ For each functional requirement from the PRD:
|
|
|
222
222
|
8. Mark as PASSED or FAILED
|
|
223
223
|
9. Save the Playwright flow script in `{{PRD_PATH}}/QA/scripts/` with standardized name: `RF-XX-[slug].spec.ts` (or `.js`)
|
|
224
224
|
10. Record in the report which credentials (user/profile) were used in each permission-sensitive flow
|
|
225
|
-
11. When the MCP flow becomes unstable or insufficient for operational evidence, complement with `
|
|
225
|
+
11. When the MCP flow becomes unstable or insufficient for operational evidence, complement with `dw-testing-discipline/references/playwright-recipes.md`, recording this explicitly in the report
|
|
226
226
|
|
|
227
227
|
<critical>It is not enough to validate only the happy path. Each requirement must be exercised against its boundary states and most likely regressions</critical>
|
|
228
228
|
<critical>If a requirement cannot be fully validated via E2E, QA must be marked as REJECTED or BLOCKED, never APPROVED</critical>
|
|
@@ -21,7 +21,7 @@ When available in the project at `./.agents/skills/`, use these skills as specia
|
|
|
21
21
|
| `dw-verify` | **ALWAYS** — invoked before the commit to produce a Verification Report with fresh evidence |
|
|
22
22
|
| `dw-memory` | **ALWAYS** — reads workflow memory at task start and updates it at task end (promotion test) |
|
|
23
23
|
| `vercel-react-best-practices` | Task touches React rendering, hydration, data fetching, bundle, cache, or performance |
|
|
24
|
-
| `
|
|
24
|
+
| `dw-testing-discipline` | Task needs tests (any layer) — applies Iron Laws, 7 AI Gates, anti-patterns catalog. Use `references/playwright-recipes.md` when the task has interactive frontend needing E2E validation. |
|
|
25
25
|
|
|
26
26
|
## Codebase Intelligence
|
|
27
27
|
|
|
@@ -93,7 +93,7 @@ After providing the summary and approach, **begin implementation immediately**:
|
|
|
93
93
|
- Follow established project patterns
|
|
94
94
|
- Ensure all requirements are met
|
|
95
95
|
- **Run tests**: use the project's test command
|
|
96
|
-
- If there is interactive frontend, also validate real behavior
|
|
96
|
+
- If there is interactive frontend, also validate real behavior using `dw-testing-discipline/references/playwright-recipes.md` when doing so reduces the risk of invisible regression in unit tests
|
|
97
97
|
|
|
98
98
|
**YOU MUST** start the implementation right after the process above.
|
|
99
99
|
|
|
@@ -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 `dw-testing-discipline/references/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.
|