@brunosps00/dev-workflow 0.11.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.
Files changed (111) hide show
  1. package/README.md +48 -5
  2. package/lib/constants.js +20 -20
  3. package/lib/init.js +24 -1
  4. package/lib/migrate-skills.js +129 -0
  5. package/lib/removed-bundled-skills.js +16 -0
  6. package/lib/uninstall.js +6 -2
  7. package/lib/utils.js +43 -1
  8. package/package.json +1 -1
  9. package/scaffold/en/agent-instructions.md +68 -0
  10. package/scaffold/en/commands/dw-autopilot.md +1 -1
  11. package/scaffold/en/commands/dw-brainstorm.md +1 -1
  12. package/scaffold/en/commands/dw-bugfix.md +3 -3
  13. package/scaffold/en/commands/dw-create-techspec.md +1 -1
  14. package/scaffold/en/commands/dw-deps-audit.md +1 -1
  15. package/scaffold/en/commands/dw-fix-qa.md +1 -1
  16. package/scaffold/en/commands/dw-functional-doc.md +2 -2
  17. package/scaffold/en/commands/dw-help.md +1 -1
  18. package/scaffold/en/commands/dw-redesign-ui.md +7 -7
  19. package/scaffold/en/commands/dw-run-qa.md +4 -4
  20. package/scaffold/en/commands/dw-run-task.md +2 -2
  21. package/scaffold/en/templates/constitution-template.md +1 -1
  22. package/scaffold/pt-br/agent-instructions.md +68 -0
  23. package/scaffold/pt-br/commands/dw-autopilot.md +1 -1
  24. package/scaffold/pt-br/commands/dw-brainstorm.md +1 -1
  25. package/scaffold/pt-br/commands/dw-bugfix.md +3 -3
  26. package/scaffold/pt-br/commands/dw-create-techspec.md +1 -1
  27. package/scaffold/pt-br/commands/dw-deps-audit.md +1 -1
  28. package/scaffold/pt-br/commands/dw-fix-qa.md +1 -1
  29. package/scaffold/pt-br/commands/dw-functional-doc.md +2 -2
  30. package/scaffold/pt-br/commands/dw-help.md +1 -1
  31. package/scaffold/pt-br/commands/dw-redesign-ui.md +7 -7
  32. package/scaffold/pt-br/commands/dw-run-qa.md +4 -4
  33. package/scaffold/pt-br/commands/dw-run-task.md +2 -2
  34. package/scaffold/pt-br/templates/constitution-template.md +1 -1
  35. package/scaffold/skills/dw-council/SKILL.md +1 -1
  36. package/scaffold/skills/dw-testing-discipline/SKILL.md +148 -0
  37. package/scaffold/skills/dw-testing-discipline/references/ai-agent-gates.md +170 -0
  38. package/scaffold/skills/dw-testing-discipline/references/anti-patterns.md +336 -0
  39. package/scaffold/skills/dw-testing-discipline/references/flaky-discipline.md +163 -0
  40. package/scaffold/skills/dw-testing-discipline/references/iron-laws.md +128 -0
  41. package/scaffold/skills/dw-testing-discipline/references/playwright-recipes.md +282 -0
  42. package/scaffold/skills/dw-testing-discipline/references/positive-patterns.md +241 -0
  43. package/scaffold/skills/{webapp-testing → dw-testing-discipline}/references/security-boundary.md +1 -1
  44. package/scaffold/skills/dw-ui-discipline/SKILL.md +128 -0
  45. package/scaffold/skills/dw-ui-discipline/references/accessibility-floor.md +225 -0
  46. package/scaffold/skills/dw-ui-discipline/references/anti-slop.md +162 -0
  47. package/scaffold/skills/dw-ui-discipline/references/curated-defaults.md +195 -0
  48. package/scaffold/skills/dw-ui-discipline/references/hard-gate.md +142 -0
  49. package/scaffold/skills/dw-ui-discipline/references/state-matrix.md +101 -0
  50. package/scaffold/skills/ui-ux-pro-max/LICENSE +0 -21
  51. package/scaffold/skills/ui-ux-pro-max/SKILL.md +0 -659
  52. package/scaffold/skills/ui-ux-pro-max/data/_sync_all.py +0 -414
  53. package/scaffold/skills/ui-ux-pro-max/data/app-interface.csv +0 -31
  54. package/scaffold/skills/ui-ux-pro-max/data/charts.csv +0 -26
  55. package/scaffold/skills/ui-ux-pro-max/data/colors.csv +0 -162
  56. package/scaffold/skills/ui-ux-pro-max/data/design.csv +0 -1776
  57. package/scaffold/skills/ui-ux-pro-max/data/draft.csv +0 -1779
  58. package/scaffold/skills/ui-ux-pro-max/data/google-fonts.csv +0 -1924
  59. package/scaffold/skills/ui-ux-pro-max/data/icons.csv +0 -106
  60. package/scaffold/skills/ui-ux-pro-max/data/landing.csv +0 -35
  61. package/scaffold/skills/ui-ux-pro-max/data/products.csv +0 -162
  62. package/scaffold/skills/ui-ux-pro-max/data/react-performance.csv +0 -45
  63. package/scaffold/skills/ui-ux-pro-max/data/stacks/angular.csv +0 -51
  64. package/scaffold/skills/ui-ux-pro-max/data/stacks/astro.csv +0 -54
  65. package/scaffold/skills/ui-ux-pro-max/data/stacks/flutter.csv +0 -53
  66. package/scaffold/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +0 -56
  67. package/scaffold/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +0 -53
  68. package/scaffold/skills/ui-ux-pro-max/data/stacks/laravel.csv +0 -51
  69. package/scaffold/skills/ui-ux-pro-max/data/stacks/nextjs.csv +0 -53
  70. package/scaffold/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +0 -51
  71. package/scaffold/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +0 -59
  72. package/scaffold/skills/ui-ux-pro-max/data/stacks/react-native.csv +0 -52
  73. package/scaffold/skills/ui-ux-pro-max/data/stacks/react.csv +0 -54
  74. package/scaffold/skills/ui-ux-pro-max/data/stacks/shadcn.csv +0 -61
  75. package/scaffold/skills/ui-ux-pro-max/data/stacks/svelte.csv +0 -54
  76. package/scaffold/skills/ui-ux-pro-max/data/stacks/swiftui.csv +0 -51
  77. package/scaffold/skills/ui-ux-pro-max/data/stacks/threejs.csv +0 -54
  78. package/scaffold/skills/ui-ux-pro-max/data/stacks/vue.csv +0 -50
  79. package/scaffold/skills/ui-ux-pro-max/data/styles.csv +0 -85
  80. package/scaffold/skills/ui-ux-pro-max/data/typography.csv +0 -74
  81. package/scaffold/skills/ui-ux-pro-max/data/ui-reasoning.csv +0 -162
  82. package/scaffold/skills/ui-ux-pro-max/data/ux-guidelines.csv +0 -100
  83. package/scaffold/skills/ui-ux-pro-max/scripts/core.py +0 -262
  84. package/scaffold/skills/ui-ux-pro-max/scripts/design_system.py +0 -1148
  85. package/scaffold/skills/ui-ux-pro-max/scripts/search.py +0 -114
  86. package/scaffold/skills/ui-ux-pro-max/skills/brand/SKILL.md +0 -97
  87. package/scaffold/skills/ui-ux-pro-max/skills/design/SKILL.md +0 -302
  88. package/scaffold/skills/ui-ux-pro-max/skills/design-system/SKILL.md +0 -244
  89. package/scaffold/skills/ui-ux-pro-max/templates/base/quick-reference.md +0 -297
  90. package/scaffold/skills/ui-ux-pro-max/templates/base/skill-content.md +0 -358
  91. package/scaffold/skills/ui-ux-pro-max/templates/platforms/agent.json +0 -21
  92. package/scaffold/skills/ui-ux-pro-max/templates/platforms/augment.json +0 -18
  93. package/scaffold/skills/ui-ux-pro-max/templates/platforms/claude.json +0 -21
  94. package/scaffold/skills/ui-ux-pro-max/templates/platforms/codebuddy.json +0 -21
  95. package/scaffold/skills/ui-ux-pro-max/templates/platforms/codex.json +0 -21
  96. package/scaffold/skills/ui-ux-pro-max/templates/platforms/continue.json +0 -21
  97. package/scaffold/skills/ui-ux-pro-max/templates/platforms/copilot.json +0 -21
  98. package/scaffold/skills/ui-ux-pro-max/templates/platforms/cursor.json +0 -21
  99. package/scaffold/skills/ui-ux-pro-max/templates/platforms/droid.json +0 -21
  100. package/scaffold/skills/ui-ux-pro-max/templates/platforms/gemini.json +0 -21
  101. package/scaffold/skills/ui-ux-pro-max/templates/platforms/kilocode.json +0 -21
  102. package/scaffold/skills/ui-ux-pro-max/templates/platforms/kiro.json +0 -21
  103. package/scaffold/skills/ui-ux-pro-max/templates/platforms/opencode.json +0 -21
  104. package/scaffold/skills/ui-ux-pro-max/templates/platforms/qoder.json +0 -21
  105. package/scaffold/skills/ui-ux-pro-max/templates/platforms/roocode.json +0 -21
  106. package/scaffold/skills/ui-ux-pro-max/templates/platforms/trae.json +0 -21
  107. package/scaffold/skills/ui-ux-pro-max/templates/platforms/warp.json +0 -18
  108. package/scaffold/skills/ui-ux-pro-max/templates/platforms/windsurf.json +0 -21
  109. package/scaffold/skills/webapp-testing/SKILL.md +0 -138
  110. package/scaffold/skills/webapp-testing/assets/test-helper.js +0 -56
  111. /package/scaffold/skills/{webapp-testing → dw-testing-discipline}/references/three-workflow-patterns.md +0 -0
@@ -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
- | `webapp-testing` | Optional — when the project is frontend and the scoped test phase needs Playwright-aware test selection |
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
- - `webapp-testing`: (UI mode) support for structuring retests, captures, and scripts when complementary to Playwright MCP
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
- - `webapp-testing`: support for structuring E2E flows, local retests, and evidence collection
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-ux-pro-max`: use when documenting visual patterns, design system choices, and UI style consistency across screens
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. Visual design (`ui-ux-pro-max`) works with any framework.
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-ux-pro-max`: **REQUIRED** — use for all design decisions (color palette, typography, visual style, layout, WCAG accessibility)
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
- - `webapp-testing`: use to capture before/after screenshots and visual validation with Playwright
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 if `webapp-testing` is available, run react-doctor if React project.
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 using `ui-ux-pro-max` each with color palette, typography pairing, layout style, and rationale. For EACH direction, explicitly describe the mobile layout (<=768px) and desktop layout (>=1024px), including how elements reorganize, stack, or hide between breakpoints.
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 via `ui-ux-pro-max`), run react-doctor `--diff` if React. If `webapp-testing` is available, capture screenshots at 375px viewport (mobile) and 1440px viewport (desktop).
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 (via `ui-ux-pro-max`)
86
- - Typography pairing (via `ui-ux-pro-max`)
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
- - `webapp-testing`: (UI mode) support for structuring test flows, retests, screenshots, and logs when complementary to Playwright MCP
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-ux-pro-max`: (UI mode) use when validating design consistency, color palettes, typography, spacing, and visual hierarchy against industry standards
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 `webapp-testing`
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 `webapp-testing`, recording this explicitly in the report
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
- | `webapp-testing` | Task has interactive frontend needing E2E validation in a real browser |
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 with `webapp-testing` when doing so reduces the risk of invisible regression in unit tests
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
 
@@ -79,7 +79,7 @@ mode: defaults | custom
79
79
 
80
80
  **P-009 — Server-side authorization on every state-changing endpoint** (severity: info)
81
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.
82
+ **Why:** Browsers are untrusted (see `dw-testing-discipline/references/security-boundary.md`). UI gating is convenience; only server checks protect data.
83
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
84
 
85
85
  **P-010 — Secrets never enter the repository** (severity: info)
@@ -0,0 +1,68 @@
1
+ <!-- dev-workflow:start -->
2
+ # dev-workflow — Instruções para Agente de IA
3
+
4
+ Este projeto usa [`@brunosps00/dev-workflow`](https://www.npmjs.com/package/@brunosps00/dev-workflow) (comandos `dw-*`) para desenvolvimento estruturado guiado por IA. Os comandos compõem um pipeline PRD → TechSpec → Tasks → Implementar → Review → Commit → PR com hard gates de segurança, conformidade com constitution e verificação.
5
+
6
+ **Objetivo deste arquivo:** quando o usuário expressar uma intenção que casa com a Trigger Map abaixo, rode o comando `dw-*` correspondente **sem pedir permissão** — exceto se a mudança for genuinamente trivial (veja Escape Hatches).
7
+
8
+ ## Trigger Map
9
+
10
+ | Intenção do usuário (literal ou parafraseada) | Auto-trigger |
11
+ |------------------------------------------------|--------------|
12
+ | "Implementa X" / "Cria Y" / "Adiciona feature Z" / "Preciso de..." | `/dw-autopilot "X"` |
13
+ | Erro colado / "X está quebrado" / "Bug em Y" / screenshot de teste falhando | `/dw-bugfix "X"` |
14
+ | "Roda essa task" (com ID da task) | `/dw-run-task <ID>` |
15
+ | "Roda todas as tasks pendentes" / "Executa o plano" | `/dw-run-plan` |
16
+ | "Revisa meu PR" / "Checa qualidade do código" / "Tá pronto pra subir?" | `/dw-code-review` |
17
+ | "Hora de commitar" / mudanças validadas e prontas | `/dw-commit` |
18
+ | "Abre um PR" / "Sobe isso" | `/dw-generate-pr` |
19
+ | "Escreve PRD pra X" / "Especifica Y" | `/dw-create-prd` |
20
+ | "Desenha a arquitetura" / "Faz o techspec" | `/dw-create-techspec` |
21
+ | "Quebra em tasks" | `/dw-create-tasks` |
22
+ | "Onde está X?" / "O que usa Y?" / "Como Z é estruturado?" | `/dw-intel "<pergunta>"` |
23
+ | "Audita nossas dependências" / "Estamos atrasados em pacotes?" | `/dw-deps-audit` |
24
+ | "Scan de vulnerabilidades" / "Check de segurança" | `/dw-security-check` |
25
+ | "QA dessa feature" / "Roda o test plan" | `/dw-run-qa` |
26
+ | "Corrige os bugs do QA" | `/dw-fix-qa` |
27
+
28
+ **Prioridade:** na dúvida entre dois comandos, `/dw-autopilot` é o default mais seguro pra qualquer pedido de feature não-trivial — ele compõe os demais.
29
+
30
+ ## Hard Gates (os comandos enforçam — não burle)
31
+
32
+ - **`.dw/constitution.md`**: princípios com `severity: high` ou `critical` bloqueiam PRs / techspecs sem um ADR justificando o desvio. Constitution ausente? Os comandos auto-instalam defaults em `severity: info` (não-bloqueante) e seguem — ausência nunca bloqueia.
33
+ - **`.dw/spec/<prd>/tasks-validation.md`**: auto-gerado no fim do `/dw-create-tasks`. Qualquer dimensão FAIL bloqueia approval do usuário até resolver ou override explícito.
34
+ - **Verification**: `/dw-generate-pr` exige `dw-verify` PASS fresco (testes + lint + build) depois do último edit.
35
+ - **Segurança**: projetos TS / Python / C# / Rust precisam passar `/dw-security-check` (Trivy + OWASP + lockfile audit) antes do PR abrir.
36
+
37
+ ## Escape Hatches — NÃO auto-trigger
38
+
39
+ Quando qualquer destes se aplica, responda direto e **não** invoque comando `dw-*`:
40
+
41
+ - Correção de uma linha: typo, rename, sort de imports, ajuste de comentário.
42
+ - Exploração pura: "como isso funciona?", "me mostra X", "explica Y".
43
+ - Preferência estética: "prefiro esse estilo" — aplica, não roda pipeline.
44
+ - Usuário diz explicitamente "faz direto" / "pula autopilot" / "não precisa de PRD" — honre.
45
+ - A conversa já está dentro de um fluxo `dw-*` (você já está executando tasks; não inicie pipeline novo).
46
+
47
+ ## Referência de Workflow
48
+
49
+ ```
50
+ /dw-autopilot "wish" ────► Roda pipeline completo automaticamente
51
+ (3 gates: PRD approval, Tasks approval, PR confirmação)
52
+
53
+ --- OU passo a passo ---
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
+ Lista completa e ajuda contextual: `/dw-help`.
62
+
63
+ ## Editando esta seção
64
+
65
+ Este bloco vive entre os marcadores `<!-- dev-workflow:start -->` e `<!-- dev-workflow:end -->`. Qualquer coisa que você escrever **fora** dos marcadores em `CLAUDE.md` / `AGENTS.md` é preservada a cada `dev-workflow update`. Tudo **dentro** é regenerado do pacote — seus edits dentro do bloco serão sobrescritos.
66
+
67
+ Para customizar a trigger map permanentemente, copie o conteúdo pra fora dos marcadores (ou pra arquivo separado tipo `.dw/agent-instructions-custom.md`) e edite lá.
68
+ <!-- dev-workflow:end -->
@@ -141,7 +141,7 @@ Apresente ao usuario:
141
141
  ### Etapa 7: Design Contract (Condicional)
142
142
 
143
143
  Avalie se as tasks envolvem frontend:
144
- - **SIM** (execute `/dw-redesign-ui`): se houver tasks com componentes visuais E a skill `ui-ux-pro-max` estiver disponivel
144
+ - **SIM** (execute `/dw-redesign-ui`): se houver tasks com componentes visuais E a skill `dw-ui-discipline` estiver disponivel
145
145
  - Gere o design contract em `.dw/spec/prd-[nome]/design-contract.md`
146
146
  - Apresente um resumo do design contract ao usuario (paleta, tipografia, layout mobile/desktop) como checkpoint visual antes de prosseguir
147
147
  - **NAO** (pule para etapa 8): tasks puramente backend/infra
@@ -41,7 +41,7 @@ digraph brainstorm_decision {
41
41
  Quando disponíveis no projeto em `./.agents/skills/`, use para enriquecer a ideação:
42
42
 
43
43
  - `dw-council` (opt-in via `--council`): stress-test multi-advisor das opções mais promissoras com steel-manning obrigatório e concession tracking. **NÃO invocar por padrão** — só quando a flag está presente ou quando surge consenso rápido demais (sinal de false consensus).
44
- - `ui-ux-pro-max`: use quando o brainstorm envolver frontend, direção de estilo UI, escolhas de design system ou exploração de identidade visual
44
+ - `dw-ui-discipline`: use quando o brainstorm envolver frontend ou direção de UI — o hard-gate (scene sentence, surface job) é forcing function generativa durante ideação, não só check de review
45
45
  - `vercel-react-best-practices`: use quando explorar arquitetura React/Next.js ou trade-offs de performance
46
46
  - `security-review`: use quando o brainstorm tocar auth, manipulação de dados ou features sensíveis à segurança
47
47
 
@@ -18,7 +18,7 @@
18
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.
19
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).
20
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
21
- - `webapp-testing`: use quando a correção requer fluxo E2E/reteste reproduzível em uma web app
21
+ - `dw-testing-discipline`: use quando a correção requer fluxo E2E/reteste reproduzível em web app — `references/playwright-recipes.md` pra recipes, Iron Laws + 7 AI Gates pra qualquer teste que o fix adicione, flaky-discipline se o bug aparece de forma intermitente.
22
22
  - `security-review`: use quando a causa raiz toca auth, autorização, input externo, upload, secrets, SQL, XSS, SSRF ou outras superfícies sensíveis
23
23
 
24
24
  ## Variáveis de Entrada
@@ -153,7 +153,7 @@
153
153
  - Mensagens de erro relacionadas
154
154
  - Stack traces
155
155
  - Arquivos modificados recentemente
156
- - Se o bug for relacionado a UI ou depender de fluxo no navegador, complemente a coleta com `webapp-testing`
156
+ - Se o bug for relacionado a UI ou depender de fluxo no navegador, complemente a coleta com `dw-testing-discipline` (playwright-recipes + three-workflow-patterns pra escolher o modo certo de verificação)
157
157
 
158
158
  ### 3. Perguntas de Clarificação (OBRIGATÓRIO - EXATAMENTE 3)
159
159
 
@@ -180,7 +180,7 @@
180
180
  - **Causa Provável**: Baseado nas evidências
181
181
  - **Arquivos Afetados**: Lista de arquivos a modificar
182
182
  - **Impacto**: Outros componentes que podem ser afetados
183
- - **Skills utilizadas**: registre explicitamente se a análise usou `vercel-react-best-practices`, `webapp-testing` ou `security-review`
183
+ - **Skills utilizadas**: registre explicitamente se a análise usou `vercel-react-best-practices`, `dw-testing-discipline` ou `security-review`
184
184
 
185
185
  ### 4.1 Checkpoint de Escopo (OBRIGATÓRIO)
186
186
 
@@ -25,7 +25,7 @@
25
25
  - `dw-council` (opt-in via `--council`): debate multi-advisor da decisão arquitetural principal com steel-manning. **NÃO invocar por padrão**.
26
26
  - `dw-source-grounding` (**SEMPRE**): cada decisão de framework/library segue Detect → Fetch → Implement → Cite. O techspec emite citações inline `[source: <url>, version: X.Y, retrieved: YYYY-MM-DD]` ao lado de cada decisão arquitetural.
27
27
  - `vercel-react-best-practices`: use quando definir arquitetura frontend para projetos React/Next.js
28
- - `ui-ux-pro-max`: use quando definir decisões de design system, paletas de cores, tipografia e estilo UI no TechSpec
28
+ - `dw-ui-discipline`: use quando o TechSpec inclui seções de UI enforça o hard-gate de 4 checkpoints (brand authorities / surface job / state matrix / scene sentence), os 14 anti-slop patterns e o WCAG 2.2 AA floor ANTES das decisões de design.
29
29
  - `security-review`: use quando a feature tocar auth, autorização ou manipulação de dados sensíveis
30
30
 
31
31
  ## Inteligência do Codebase
@@ -31,7 +31,7 @@ Este comando e **distinto** do `/dw-security-check`:
31
31
  | `security-review` (`references/supply-chain.md`) | **SEMPRE** ao classificar findings — da o framing OWASP A06 (Vulnerable & Outdated Components) para os trade-offs do brainstorm |
32
32
  | `dw-source-grounding` | **SEMPRE** na fase de brainstorm — cada opcao de update por pacote (Conservadora/Balanceada/Ousada) cita o changelog/release notes oficial da versao alvo: `[source: <url>, version: X.Y, retrieved: YYYY-MM-DD]`. Previne "agent recomenda v5 porque parece moderno, mas v5 dropou Node 18". |
33
33
  | `dw-council` | Opt-in automatico quando >=3 pacotes caem em tier COMPROMISED — stress-test multi-conselheiro sobre ordem e escopo de remediacao |
34
- | `webapp-testing` | Opcional — quando o projeto e frontend e a fase de testes escopados precisa de selecao Playwright-aware |
34
+ | `dw-testing-discipline` | Opcional — quando a fase de testes escopados precisa de recipes Playwright pra projetos frontend. Iron Laws + anti-patterns valem pra qualquer teste adicionado durante o audit. |
35
35
 
36
36
  ## Variaveis de Entrada
37
37
 
@@ -20,7 +20,7 @@ Quando disponíveis no projeto em `./.agents/skills/`, use estas skills como sup
20
20
 
21
21
  - `dw-debug-protocol`: **SEMPRE** — todo finding bug-shaped (cenário falhando, não feature ausente) passa pelo six-step triage. A evidência de reteste é o artefato da etapa 6 (verify); o regression test da etapa 5 é o que sustenta o status `Corrigido`.
22
22
  - `dw-verify`: **SEMPRE** — invocada antes de marcar qualquer bug como `Corrigido` ou `Fechado` no `QA/bugs.md`. Sem VERIFICATION REPORT PASS (test + lint + build) + evidência de reteste (screenshot em modo UI OU linha JSONL em modo API), o status permanece `Reaberto` ou `Em análise`.
23
- - `webapp-testing`: (modo UI) suporte para estruturar retestes, capturas e scripts quando complementar ao Playwright MCP
23
+ - `dw-testing-discipline`: (modo UI) consulte `references/playwright-recipes.md` para estruturas de reteste, capturas, scripts. Aplique Iron Laws + flaky discipline ao retestar fixes — quarantine e SLOs da doutrina valem aqui.
24
24
  - `vercel-react-best-practices`: (modo UI) use apenas se a correção afetar frontend React/Next.js e houver risco de regressão de renderização, hidratação, fetching ou performance
25
25
  - `api-testing-recipes`: **(modo API — SEMPRE)** fonte da recipe usada no QA. Re-execute o arquivo `.http`/pytest/supertest/etc. original do RF do bug; anexe o resultado do reteste a um log JSONL fresco em `QA/logs/api/BUG-NN-retest.log`
26
26
 
@@ -55,10 +55,10 @@ Funciona melhor com projeto analisado por `/dw-analyze-project`
55
55
 
56
56
  Quando disponíveis no projeto em `./.agents/skills/`, use estas skills como apoio operacional, sem substituir este comando como fonte de verdade:
57
57
 
58
- - `webapp-testing`: apoio para estruturar fluxos E2E, retestes locais e coleta de evidências
58
+ - `dw-testing-discipline`: apoio para estruturar fluxos E2E (`references/playwright-recipes.md`), padrões de coleta de evidência, e aplicar Iron Laws + hierarquia de seletores em qualquer teste referenciado pelo doc
59
59
  - `remotion-best-practices`: apoio obrigatório quando houver vídeo humano final, legendas, composição, transições, FFmpeg ou Remotion
60
60
  - `humanizer`: apoio obrigatório para revisar e naturalizar todas as legendas, captions `.srt`, textos descritivos e qualquer redação voltada a leitura humana antes da entrega final
61
- - `ui-ux-pro-max`: use quando documentar padrões visuais, escolhas de design system e consistência de estilo UI entre telas
61
+ - `dw-ui-discipline`: use ao documentar padrões visuais state matrix e scene sentence viram parte da seção de overview de cada tela
62
62
 
63
63
  ## Ferramentas obrigatórias para browser
64
64
 
@@ -319,7 +319,7 @@ workspace/
319
319
  - Sim, é recomendado para projetos novos. Ele gera as rules em `.dw/rules/` que todos os outros comandos utilizam.
320
320
 
321
321
  **Q: O `/dw-redesign-ui` funciona com Angular?**
322
- - Sim. O comando é framework-agnostic. Para React usa react-doctor e `vercel-react-best-practices`; para Angular usa `ng lint` e Angular DevTools. Design visual (`ui-ux-pro-max`) funciona com qualquer framework.
322
+ - Sim. O comando é framework-agnostic. Para React usa react-doctor e `vercel-react-best-practices`; para Angular usa `ng lint` e Angular DevTools. Disciplina de UI (`dw-ui-discipline`) funciona com qualquer framework — enforça o hard-gate, anti-slop catalog e WCAG floor independente do stack.
323
323
 
324
324
  **Q: Como obtenho inteligência do codebase e execução paralela?**
325
325
  - Os dois são nativos do dev-workflow. Rode `/dw-map-codebase` para construir o índice queryable em `.dw/intel/`, depois `/dw-intel "<pergunta>"` para consultá-lo. Para execução paralela, `/dw-run-plan` invoca os agentes bundled de execução de fase (executor + plan-checker) diretamente para dispatcha tasks em waves com commits atômicos por task. Sem dependência externa.
@@ -40,9 +40,9 @@ digraph redesign_decision {
40
40
 
41
41
  Quando disponíveis no projeto em `./.agents/skills/`, use para guiar o redesign:
42
42
 
43
- - `ui-ux-pro-max`: **OBRIGATÓRIO** — use para todas as decisões de design (paleta de cores, tipografia, estilo visual, layout, acessibilidade WCAG)
43
+ - `dw-ui-discipline`: **OBRIGATÓRIO** — roda o hard-gate de 4 checkpoints (brand authorities OU curated defaults; surface job sentence; state matrix completa; scene sentence) ANTES de qualquer proposta. Os 14 anti-slop patterns são checados contra cada direção. O WCAG 2.2 AA floor é não-negociável no step de validate.
44
44
  - `vercel-react-best-practices`: use quando o projeto for React/Next.js para padrões de performance e implementação
45
- - `webapp-testing`: use para capturar screenshots antes/depois e validação visual com Playwright
45
+ - `dw-testing-discipline`: consulte `references/playwright-recipes.md` para captura de screenshots antes/depois e validação visual. Iron Laws + hierarquia de seletores valem pra qualquer teste gerado junto com o redesign.
46
46
  - `security-review`: use se o redesign tocar flows de autenticação ou formulários sensíveis
47
47
 
48
48
  ## Ferramentas de Análise
@@ -56,12 +56,12 @@ Utilize ferramentas de diagnóstico conforme o framework do projeto:
56
56
  ## Comportamento Obrigatório
57
57
 
58
58
  1. Identifique o alvo: página, componente ou rota que será redesenhada.
59
- 2. **AUDITAR**: leia a implementação atual, identifique stack CSS (Tailwind, CSS Modules, styled-components, etc.), capture screenshot se `webapp-testing` disponível, rode react-doctor se projeto React.
59
+ 2. **AUDITAR**: leia a implementação atual, identifique stack CSS (Tailwind, CSS Modules, styled-components, etc.), capture screenshot usando `dw-testing-discipline`/playwright-recipes se disponível, rode react-doctor se projeto React.
60
60
  3. Faça 3 a 5 perguntas sobre objetivos do redesign: direção de estilo, constraints de marca, inspirações, público-alvo, dispositivos prioritários.
61
- 4. **PROPOR**: apresente 2 a 3 direções de design usando `ui-ux-pro-max` cada uma com paleta de cores, par tipográfico, estilo de layout e racional. Para CADA direção, descreva explicitamente o layout mobile (<=768px) e o layout desktop (>=1024px), incluindo como os elementos se reorganizam, empilham ou escondem entre breakpoints.
61
+ 4. **PROPOR**: apresente 2 a 3 direções de design depois de passar pelo hard-gate de `dw-ui-discipline` (brand authorities ou curated defaults; surface job sentence; state matrix enumerada; scene sentence). Cada direção lista paleta de cores, par tipográfico, estilo de layout e racional. Self-check de cada direção contra os 14 anti-slop patterns. Para CADA direção, descreva explicitamente o layout mobile (<=768px) e o layout desktop (>=1024px), incluindo como os elementos se reorganizam, empilham ou escondem entre breakpoints.
62
62
  5. Espere aprovação explícita do usuário antes de implementar.
63
63
  6. **IMPLEMENTAR**: aplique o design escolhido com abordagem mobile-first — implemente primeiro o layout mobile e depois adicione media queries/breakpoints para tablet e desktop. Respeite a stack existente. Use `vercel-react-best-practices` para React/Next.js. Mantenha a metodologia CSS do projeto.
64
- 7. **VALIDAR**: capture estado depois em AMBAS as resoluções (mobile e desktop), compare antes/depois, verifique acessibilidade (WCAG 2.2 via `ui-ux-pro-max`), rode react-doctor `--diff` se React. Se `webapp-testing` disponível, capture screenshots em viewport 375px (mobile) e 1440px (desktop).
64
+ 7. **VALIDAR**: capture estado depois em AMBAS as resoluções (mobile e desktop), compare antes/depois, verifique acessibilidade contra `dw-ui-discipline/references/accessibility-floor.md` (WCAG 2.2 AA — não-negociável: contraste, focus-visible, keyboard nav, ARIA, sem traps), rode react-doctor `--diff` se React. Use `dw-testing-discipline/references/playwright-recipes.md` para capturar screenshots em viewport 375px (mobile) e 1440px (desktop).
65
65
  8. **PERSISTIR CONTRATO**: se o usuário aprovou uma direção, gere `design-contract.md` no diretório do PRD (`.dw/spec/prd-[nome]/design-contract.md`) com: direção aprovada, paleta de cores, par tipográfico, regras de layout, regras de acessibilidade e regras de componentes. Este contrato será lido por `dw-run-task` e `dw-run-plan` para garantir consistência visual.
66
66
 
67
67
  ## Inteligência do Codebase
@@ -82,8 +82,8 @@ Utilize ferramentas de diagnóstico conforme o framework do projeto:
82
82
 
83
83
  ### 2. Proposta de Design
84
84
  - 2 a 3 direções com racional visual
85
- - Paleta de cores (via `ui-ux-pro-max`)
86
- - Par tipográfico (via `ui-ux-pro-max`)
85
+ - Paleta de cores (de brand authority OU `dw-ui-discipline/references/curated-defaults.md`)
86
+ - Par tipográfico (mesma fonte)
87
87
  - Padrão de layout
88
88
  - Nível de esforço por direção
89
89
 
@@ -20,9 +20,9 @@ Você é um assistente IA especializado em Quality Assurance. Sua tarefa é vali
20
20
 
21
21
  Quando disponíveis no projeto em `./.agents/skills/`, use estas skills como apoio operacional sem substituir este comando:
22
22
 
23
- - `webapp-testing`: (modo UI) apoio para estruturar fluxos de teste, retestes, screenshots e logs quando complementar ao Playwright MCP
23
+ - `dw-testing-discipline`: (modo UI) **SEMPRE** Iron Laws e 25 anti-patterns valem pra todo teste de QA autorado. `references/playwright-recipes.md` pra patterns táticos. `references/three-workflow-patterns.md` pra escolher o modo certo (UI / network / perf). `references/security-boundary.md` pra qualquer fluxo que cruza boundary de auth.
24
24
  - `vercel-react-best-practices`: (modo UI) use apenas se o frontend sob teste for React/Next.js e houver indicação de regressão relacionada a renderização, fetching, hidratação ou performance percebida
25
- - `ui-ux-pro-max`: (modo UI) use quando validar consistência de design, paletas de cores, tipografia, espaçamento e hierarquia visual contra padrões da indústria
25
+ - `dw-ui-discipline`: (modo UI) use ao validar consistência de design o catálogo anti-slop e o floor de acessibilidade WCAG são checados como parte da evidência de QA
26
26
  - `api-testing-recipes`: **(modo API — SEMPRE)** snippets validados para `.http`, pytest+httpx, supertest, WebApplicationFactory, reqwest. Compõe um arquivo de teste por RF em `QA/scripts/api/` e logs JSONL em `QA/logs/api/` segundo seus references
27
27
 
28
28
  ## Ferramentas de Análise
@@ -149,7 +149,7 @@ Se NENHUMA credencial for encontrada, PARE e pergunte ao usuário antes de conti
149
149
  - Verificar se a aplicação está rodando em localhost
150
150
  - Usar `browser_navigate` do Playwright MCP para acessar a aplicação
151
151
  - Confirmar que a página carregou corretamente com `browser_snapshot`
152
- - Se sessão persistente, import de auth, inspeção de rede além do MCP ou reprodução browser-first forem necessários, complementar com `webapp-testing`
152
+ - Se sessão persistente, import de auth, inspeção de rede além do MCP ou reprodução browser-first forem necessários, complementar com `dw-testing-discipline/references/playwright-recipes.md`
153
153
 
154
154
  ### 3. Verificação de Páginas do Menu (Somente modo UI — Obrigatório, Executar ANTES dos testes de RF)
155
155
 
@@ -222,7 +222,7 @@ Para cada requisito funcional do PRD:
222
222
  8. Marcar como PASSOU ou FALHOU
223
223
  9. Salvar o script Playwright do fluxo em `{{PRD_PATH}}/QA/scripts/` com nome padronizado: `RF-XX-[slug].spec.ts` (ou `.js`)
224
224
  10. Registrar no relatório quais credenciais (usuário/perfil) foram usadas em cada fluxo sensível a permissões
225
- 11. Quando o fluxo MCP ficar instável ou insuficiente para evidência operacional, complementar com `webapp-testing`, registrando isso explicitamente no relatório
225
+ 11. Quando o fluxo MCP ficar instável ou insuficiente para evidência operacional, complementar com `dw-testing-discipline/references/playwright-recipes.md`, registrando isso explicitamente no relatório
226
226
 
227
227
  <critical>Não basta validar apenas o caminho feliz. Cada requisito deve ser exercitado contra seus estados de borda e suas regressões mais prováveis</critical>
228
228
  <critical>Se um requisito não puder ser completamente validado via E2E, o QA deve ser marcado como REJEITADO ou BLOQUEADO, nunca APROVADO</critical>
@@ -21,7 +21,7 @@ Quando disponíveis no projeto em `./.agents/skills/`, use estas skills como sup
21
21
  | `dw-verify` | **SEMPRE** — invocada antes do commit para produzir Verification Report com evidence fresca |
22
22
  | `dw-memory` | **SEMPRE** — lê memory da workflow no início e atualiza ao final da task (promotion test) |
23
23
  | `vercel-react-best-practices` | Task envolve renderização React, hidratação, data fetching, bundle, cache ou performance |
24
- | `webapp-testing` | Task tem frontend interativo que necessita validação E2E em navegador real |
24
+ | `dw-testing-discipline` | Task precisa de testes (qualquer layer) — aplica Iron Laws, 7 AI Gates, catálogo de anti-patterns. Use `references/playwright-recipes.md` quando a task tem frontend interativo precisando de validação E2E. |
25
25
 
26
26
  ## Inteligência do Codebase
27
27
 
@@ -93,7 +93,7 @@ Após fornecer o resumo e abordagem, **comece imediatamente** a implementar a ta
93
93
  - Seguir padrões estabelecidos do projeto
94
94
  - Garantir que todos os requisitos sejam atendidos
95
95
  - **Rodar testes**: use o comando de teste do projeto
96
- - Se houver frontend interativo, valide também o comportamento real com `webapp-testing` quando isso reduzir o risco de regressão invisível nos testes unitários
96
+ - Se houver frontend interativo, valide também o comportamento real usando `dw-testing-discipline/references/playwright-recipes.md` quando isso reduzir o risco de regressão invisível nos testes unitários
97
97
 
98
98
  **VOCÊ DEVE** iniciar a implementação logo após o processo acima.
99
99
 
@@ -79,7 +79,7 @@ mode: defaults | custom
79
79
 
80
80
  **P-009 — Authorization server-side em todo endpoint que altera estado** (severity: info)
81
81
  **Regra:** Endpoint que cria, atualiza ou deleta dado deve verificar autorização do caller no servidor. Gating em UI (botões escondidos, formulários disabled) não é segurança.
82
- **Why:** Browsers são untrusted (ver `webapp-testing/security-boundary.md`). Gating em UI é conveniência; só checks server-side protegem dado.
82
+ **Why:** Browsers são untrusted (ver `dw-testing-discipline/references/security-boundary.md`). Gating em UI é conveniência; só checks server-side protegem dado.
83
83
  **Enforcement:** `dw-code-review` e `dw-security-check` exigem check de auth explícito (decorator, middleware ou assertion in-handler) em rotas POST/PUT/PATCH/DELETE.
84
84
 
85
85
  **P-010 — Secrets nunca entram no repositório** (severity: info)
@@ -22,7 +22,7 @@ A real embedded subagent workflow — not inline roleplay. Each archetype is dis
22
22
 
23
23
  - Low-stakes or obviously-reversible decisions (a council is expensive; reserve for meaningful debates)
24
24
  - Decisions already covered by an existing ADR
25
- - When a single specialized skill suffices (e.g., `security-review` for auth concerns, `ui-ux-pro-max` for visual direction)
25
+ - When a single specialized skill suffices (e.g., `security-review` for auth concerns, `dw-ui-discipline` for visual direction)
26
26
 
27
27
  ## Required Inputs
28
28
 
@@ -0,0 +1,148 @@
1
+ ---
2
+ name: dw-testing-discipline
3
+ description: Use when authoring, reviewing, or debugging tests — enforces Six Iron Laws (behavior over mocks, push to lowest layer, fix prod first on red, real systems gate merge), 25 anti-patterns, 7 AI agent gates, and flaky-test discipline so tests reveal bugs instead of decorating CI.
4
+ ---
5
+
6
+ # Testing Discipline
7
+
8
+ > **Inspired by** [`pedronauck/skills/testing-boss`](https://github.com/pedronauck/skills/tree/main/skills/mine/testing-boss) (MIT). Six Iron Laws, positive/anti-pattern catalogs, AI agent gates, and flaky-test taxonomy adapted from Pedro Nauck's work. The browser security-boundary and three-workflow-patterns references additionally cite [`addyosmani/agent-skills/browser-devtools`](https://github.com/addyosmani/agent-skills) (MIT), and Playwright recipes carry over from earlier dev-workflow work.
9
+
10
+ ## Cardinal Premise
11
+
12
+ > Tests exist to expose defects, not to keep CI green.
13
+ > A test that fails has done its job.
14
+ > A test that passes for the wrong reason is worse than no test.
15
+
16
+ ## Six Iron Laws
17
+
18
+ ```
19
+ 1. Test the behavior, never the mock.
20
+ 2. Push every test to the lowest layer that can detect the failure.
21
+ 3. When a test fails, fix production first — change the test only after writing why.
22
+ 4. Real systems gate the merge. Mocks isolate; they do not validate.
23
+ 5. Coverage is a flashlight. Mutation score is a quality probe. Neither is a target.
24
+ 6. No test-only methods, branches, or flags leak into production code.
25
+ ```
26
+
27
+ Each law has nuance — read `references/iron-laws.md` for the full version with examples.
28
+
29
+ ## Required Reading Router
30
+
31
+ | Task | MUST read |
32
+ |------|-----------|
33
+ | Deciding where a test belongs | `references/iron-laws.md` (Law 2 deep-dive) |
34
+ | Writing new tests | `references/positive-patterns.md` |
35
+ | Reviewing / debugging tests | `references/anti-patterns.md` |
36
+ | Test authored by an AI agent | `references/ai-agent-gates.md` + `references/anti-patterns.md` |
37
+ | Flaky tests appeared | `references/flaky-discipline.md` |
38
+ | Browser-based E2E with Playwright | `references/playwright-recipes.md` |
39
+ | Browser security boundary testing | `references/security-boundary.md` |
40
+ | Picking the right test workflow (UI vs network vs perf) | `references/three-workflow-patterns.md` |
41
+
42
+ ## Twelve positive patterns (one-liners, full version in references/positive-patterns.md)
43
+
44
+ 1. Query by behavior and accessible role; never CSS selectors or DOM indices.
45
+ 2. Selector hierarchy: role → label → text → test-id → structural (stop at highest rung that disambiguates).
46
+ 3. Wait on observable conditions; never wall-clock sleeps.
47
+ 4. Each test independent and order-free; setup over teardown.
48
+ 5. One behavior per test; as many assertions as that behavior needs.
49
+ 6. Names read like specifications: `should <outcome> when <condition> given <state>`.
50
+ 7. Table-driven / parameterized when inputs vary.
51
+ 8. Build test data via factories; literal blobs only for fields under test.
52
+ 9. Mock at boundaries you don't control; real wiring for owned systems.
53
+ 10. Real systems gate final merge; contract tests bridge unit and E2E.
54
+ 11. Mutation score, not coverage percentage, measures suite strength.
55
+ 12. Page Object Model is a tool, not a religion — collapse for small suites.
56
+
57
+ ## Five anti-pattern families (25 total, full catalog in references/anti-patterns.md)
58
+
59
+ **Brittleness** — tests bound to internals:
60
+ - Implementation-detail selectors, internal-structure assertions, testing private methods, snapshot-as-test, vague existence assertions, action-without-assertion.
61
+
62
+ **Flakiness** — tests randomizing verdicts:
63
+ - Static sleeps, test order dependency, non-deterministic inputs (clock, RNG, locale).
64
+
65
+ **Mock misuse** — tests testing the test setup:
66
+ - Asserting the mock exists, mock drift, over-mocking children, incomplete mocks, mocking wrong level.
67
+
68
+ **Process** — team and suite pathologies:
69
+ - Coverage-as-vanity, happy-path-only, eternal `beforeAll`, cleanup in `afterEach`, magic strings, testing third-party sites, quarantine-as-cemetery, retry-as-fix, duplicate tests across layers, weakening tests to make them pass, mock-driven confidence.
70
+
71
+ **AI-specific** — agent failure modes:
72
+ - The seven failure modes that gates in `ai-agent-gates.md` block.
73
+
74
+ ## Seven AI agent gates (mandatory when an agent writes tests)
75
+
76
+ These are mandatory pre-conditions whenever an LLM produces test code. Each gate is a forcing function against a specific LLM tendency:
77
+
78
+ 1. **Invariant first** — agent prints `INVARIANT: …`, `OWNING_LAYER: …`, `EXISTING_SUITE: …` before any code.
79
+ 2. **Owning layer** — extend an existing suite; reject new files without a named invariant.
80
+ 3. **Real execution** — every test runs against real DB / real route / real external integration at least once before merging.
81
+ 4. **Failure → fix production** — on a red test, the next move reads production code, NOT the test. Document the analysis before changing either.
82
+ 5. **No snapshot without contract** — classify the artifact as `PRODUCT_CONTRACT` or `IMPLEMENTATION_DETAIL`. The latter forbids snapshots.
83
+ 6. **No assertion on self-set mock** — cannot assert on values the same test body wrote into the mock.
84
+ 7. **Negative companion** — every positive assertion ships with a negative test for invalid input or failure mode.
85
+
86
+ Full prompt blocks and verification recipes in `references/ai-agent-gates.md`.
87
+
88
+ ## Placement doctrine (tripwires)
89
+
90
+ Before writing test code:
91
+
92
+ - Name the invariant in **one sentence**. Fuzzy language signals unclear requirements — stop and clarify.
93
+ - Place the test at the **lowest layer** capable of detecting the failure when the invariant breaks.
94
+ - Reject tests where `(likelihood × blast-radius)` falls below the ten-minute-maintenance threshold (the test is more expensive to maintain than the bug would be to fix).
95
+
96
+ ## Flaky discipline (tripwires)
97
+
98
+ - Quarantine flaky tests within ONE HOUR of detection. Assign a named owner within 24 hours with a fix-by date.
99
+ - Track `flaky_rate` as a first-class metric: SLO under 1–2%; alert at >5%.
100
+ - Real systems at the final gate: mock at unit; contract-test boundaries; real DB/queue/route at integration; near-zero mocks at E2E.
101
+
102
+ Full taxonomy in `references/flaky-discipline.md`.
103
+
104
+ ## Cross-cutting red flags
105
+
106
+ Any of these in a PR triggers REJECTED in `/dw-code-review`:
107
+
108
+ - Mock setup larger than test logic.
109
+ - Test breaks when an internal method is renamed (not the public contract).
110
+ - Removing the assertion body leaves the test green.
111
+ - Test fails when run with `.only` in isolation.
112
+ - `sleep`, `Thread.sleep`, or `cy.wait(<number>)` appears.
113
+ - Selector contains CSS class, index, or `xpath`.
114
+ - Test asserts a third-party site is reachable.
115
+ - Snapshot diffs accepted without reading.
116
+ - Coverage percentage is the only metric quoted.
117
+ - Failing tests auto-retried until green; no investigation.
118
+ - Skipped/quarantined tests without named owner and fix-by date.
119
+ - Test depends on `new Date()`, `Math.random()`, or system locale.
120
+ - `afterEach` resets database (move to `beforeEach`).
121
+ - AI-written test has 6+ assertions and zero edge cases.
122
+ - Phrase "I'll mock this to be safe" appears in the diff.
123
+
124
+ ## When NOT to use this skill
125
+
126
+ - General code review unrelated to tests.
127
+ - Library-specific debugging where the test is just a reproduction.
128
+ - Non-testing CI pipeline design (deploys, artifacts, secrets).
129
+ - Production observability and alerting.
130
+ - Single-line typo fixes in existing tests.
131
+
132
+ ## Integration with dev-workflow commands
133
+
134
+ - `/dw-create-tasks` uses the placement doctrine — each test-adding task must name the invariant.
135
+ - `/dw-run-task` applies the 7 AI gates when generating tests as part of implementation.
136
+ - `/dw-code-review` runs the anti-pattern checks on diff hunks under test paths.
137
+ - `/dw-fix-qa` runs flaky-discipline taxonomy when retesting bugs.
138
+ - `/dw-run-qa` (UI mode) references `playwright-recipes.md` for concrete recipes.
139
+
140
+ ## Why this skill exists
141
+
142
+ The previous bundled skill (`webapp-testing`) mixed Playwright recipes with two discipline references (`security-boundary`, `three-workflow-patterns`) added later. The discipline references were enterred in a tactical skill that the agent didn't reach for as doctrine.
143
+
144
+ This skill consolidates: doctrine at the top, Playwright recipes as one reference, security and workflow patterns as their own references. One skill, coherent voice, doctrine-first.
145
+
146
+ ## Bottom line
147
+
148
+ > A test that cannot fail is decorative. A test that fails for the wrong reason is misleading. Build tests that fail for exactly one reason — the reason the invariant was violated — and trust them when they do. Mocks isolate. Real systems validate. Coverage shines a light. Mutation score grades the suite. Agents will reach for the mock and the snapshot; the gates here make them put both down. Tests reveal bugs, not just pass.