@brunosps00/dev-workflow 0.8.1 → 0.10.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 (96) hide show
  1. package/README.md +30 -27
  2. package/bin/dev-workflow.js +1 -1
  3. package/lib/constants.js +6 -8
  4. package/lib/init.js +6 -0
  5. package/lib/install-deps.js +0 -5
  6. package/lib/migrate-gsd.js +164 -0
  7. package/lib/uninstall.js +2 -2
  8. package/package.json +1 -1
  9. package/scaffold/en/commands/dw-analyze-project.md +6 -11
  10. package/scaffold/en/commands/dw-autopilot.md +10 -17
  11. package/scaffold/en/commands/dw-brainstorm.md +2 -2
  12. package/scaffold/en/commands/dw-bugfix.md +1 -0
  13. package/scaffold/en/commands/dw-code-review.md +7 -5
  14. package/scaffold/en/commands/dw-commit.md +6 -0
  15. package/scaffold/en/commands/dw-create-prd.md +5 -4
  16. package/scaffold/en/commands/dw-create-techspec.md +7 -4
  17. package/scaffold/en/commands/dw-deep-research.md +6 -0
  18. package/scaffold/en/commands/dw-deps-audit.md +1 -0
  19. package/scaffold/en/commands/dw-find-skills.md +4 -4
  20. package/scaffold/en/commands/dw-fix-qa.md +1 -0
  21. package/scaffold/en/commands/dw-generate-pr.md +1 -0
  22. package/scaffold/en/commands/dw-help.md +10 -27
  23. package/scaffold/en/commands/dw-intel.md +99 -30
  24. package/scaffold/en/commands/dw-map-codebase.md +125 -0
  25. package/scaffold/en/commands/dw-new-project.md +1 -1
  26. package/scaffold/en/commands/dw-redesign-ui.md +5 -9
  27. package/scaffold/en/commands/dw-refactoring-analysis.md +8 -6
  28. package/scaffold/en/commands/dw-review-implementation.md +28 -2
  29. package/scaffold/en/commands/dw-run-plan.md +14 -20
  30. package/scaffold/en/commands/dw-run-task.md +5 -4
  31. package/scaffold/en/commands/dw-update.md +3 -1
  32. package/scaffold/en/templates/idea-onepager.md +2 -2
  33. package/scaffold/pt-br/commands/dw-analyze-project.md +6 -11
  34. package/scaffold/pt-br/commands/dw-autopilot.md +10 -17
  35. package/scaffold/pt-br/commands/dw-brainstorm.md +2 -2
  36. package/scaffold/pt-br/commands/dw-bugfix.md +1 -0
  37. package/scaffold/pt-br/commands/dw-code-review.md +7 -5
  38. package/scaffold/pt-br/commands/dw-commit.md +6 -0
  39. package/scaffold/pt-br/commands/dw-create-prd.md +5 -4
  40. package/scaffold/pt-br/commands/dw-create-techspec.md +7 -4
  41. package/scaffold/pt-br/commands/dw-deep-research.md +6 -0
  42. package/scaffold/pt-br/commands/dw-deps-audit.md +1 -0
  43. package/scaffold/pt-br/commands/dw-find-skills.md +4 -4
  44. package/scaffold/pt-br/commands/dw-fix-qa.md +1 -0
  45. package/scaffold/pt-br/commands/dw-generate-pr.md +1 -0
  46. package/scaffold/pt-br/commands/dw-help.md +10 -27
  47. package/scaffold/pt-br/commands/dw-intel.md +99 -30
  48. package/scaffold/pt-br/commands/dw-map-codebase.md +125 -0
  49. package/scaffold/pt-br/commands/dw-new-project.md +1 -1
  50. package/scaffold/pt-br/commands/dw-redesign-ui.md +5 -9
  51. package/scaffold/pt-br/commands/dw-refactoring-analysis.md +8 -6
  52. package/scaffold/pt-br/commands/dw-review-implementation.md +21 -2
  53. package/scaffold/pt-br/commands/dw-run-plan.md +16 -22
  54. package/scaffold/pt-br/commands/dw-run-task.md +5 -4
  55. package/scaffold/pt-br/commands/dw-update.md +3 -1
  56. package/scaffold/pt-br/templates/idea-onepager.md +2 -2
  57. package/scaffold/skills/dw-codebase-intel/SKILL.md +102 -0
  58. package/scaffold/skills/dw-codebase-intel/agents/intel-updater.md +318 -0
  59. package/scaffold/skills/dw-codebase-intel/references/api-design-discipline.md +138 -0
  60. package/scaffold/skills/dw-codebase-intel/references/incremental-update.md +79 -0
  61. package/scaffold/skills/dw-codebase-intel/references/intel-format.md +208 -0
  62. package/scaffold/skills/dw-codebase-intel/references/query-patterns.md +148 -0
  63. package/scaffold/skills/dw-debug-protocol/SKILL.md +106 -0
  64. package/scaffold/skills/dw-debug-protocol/references/error-categorization.md +127 -0
  65. package/scaffold/skills/dw-debug-protocol/references/non-reproducible-strategy.md +108 -0
  66. package/scaffold/skills/dw-debug-protocol/references/six-step-triage.md +139 -0
  67. package/scaffold/skills/dw-debug-protocol/references/stop-the-line.md +52 -0
  68. package/scaffold/skills/dw-execute-phase/SKILL.md +133 -0
  69. package/scaffold/skills/dw-execute-phase/agents/executor.md +264 -0
  70. package/scaffold/skills/dw-execute-phase/agents/plan-checker.md +215 -0
  71. package/scaffold/skills/dw-execute-phase/references/atomic-commits.md +143 -0
  72. package/scaffold/skills/dw-execute-phase/references/plan-verification.md +156 -0
  73. package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +102 -0
  74. package/scaffold/skills/dw-git-discipline/SKILL.md +120 -0
  75. package/scaffold/skills/dw-git-discipline/references/atomic-commits-discipline.md +158 -0
  76. package/scaffold/skills/dw-git-discipline/references/branch-hygiene.md +150 -0
  77. package/scaffold/skills/dw-git-discipline/references/trunk-based-pattern.md +82 -0
  78. package/scaffold/skills/dw-memory/SKILL.md +1 -2
  79. package/scaffold/skills/dw-simplification/SKILL.md +142 -0
  80. package/scaffold/skills/dw-simplification/references/behavior-preserving.md +148 -0
  81. package/scaffold/skills/dw-simplification/references/chestertons-fence.md +152 -0
  82. package/scaffold/skills/dw-simplification/references/complexity-metrics.md +147 -0
  83. package/scaffold/skills/dw-source-grounding/SKILL.md +128 -0
  84. package/scaffold/skills/dw-source-grounding/references/citation-protocol.md +108 -0
  85. package/scaffold/skills/dw-source-grounding/references/freshness-check.md +108 -0
  86. package/scaffold/skills/dw-source-grounding/references/source-priority.md +146 -0
  87. package/scaffold/skills/dw-verify/SKILL.md +0 -1
  88. package/scaffold/skills/vercel-react-best-practices/SKILL.md +4 -0
  89. package/scaffold/skills/vercel-react-best-practices/references/perf-discipline.md +122 -0
  90. package/scaffold/skills/webapp-testing/SKILL.md +5 -0
  91. package/scaffold/skills/webapp-testing/references/security-boundary.md +115 -0
  92. package/scaffold/skills/webapp-testing/references/three-workflow-patterns.md +144 -0
  93. package/scaffold/en/commands/dw-quick.md +0 -85
  94. package/scaffold/en/commands/dw-resume.md +0 -82
  95. package/scaffold/pt-br/commands/dw-quick.md +0 -85
  96. package/scaffold/pt-br/commands/dw-resume.md +0 -82
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: dw-source-grounding
3
+ description: Discipline of grounding architectural and dependency decisions in versioned official documentation, with mandatory citations. Other commands invoke this skill when they need to decide based on framework/library behavior — never on hallucinated APIs or stale Stack Overflow answers. Adapted from addyosmani/agent-skills (MIT).
4
+ allowed-tools:
5
+ - Read
6
+ - Bash
7
+ - Grep
8
+ - Glob
9
+ - WebFetch
10
+ ---
11
+
12
+ # dw-source-grounding
13
+
14
+ Behavioral protocol for grounding decisions in **versioned, official documentation** — and citing those sources verifiably. Used by `dw-create-techspec`, `dw-deps-audit`, `dw-deep-research` whenever a decision depends on what a framework or library actually does at the version installed in the project.
15
+
16
+ ## Why this skill exists
17
+
18
+ Decisions made on hallucinated APIs or 2-year-old Stack Overflow answers cause silent breakage. The cost shows up later — code that "worked in testing" because the agent matched an older version's API, then breaks in production where the real version is different. This skill enforces a four-step protocol that prevents that class of failure.
19
+
20
+ ## When to Use
21
+
22
+ Read this skill when:
23
+
24
+ - A command needs to recommend a library/framework version (`dw-deps-audit` brainstorm phase).
25
+ - A command must propose architectural patterns that depend on framework specifics (`dw-create-techspec`).
26
+ - A command is researching a topic that has version-specific answers (`dw-deep-research`).
27
+ - You're about to cite an API, CLI flag, configuration option, or behavior — and you want the citation to be verifiable later.
28
+
29
+ Do NOT use when:
30
+
31
+ - The decision doesn't depend on external documentation (e.g., naming a variable inside a single function).
32
+ - The library/framework version is irrelevant to the answer (e.g., "use a hash map for O(1) lookup").
33
+ - You're writing examples that are intentionally generic / pseudocode.
34
+
35
+ ## The Protocol — Detect → Fetch → Implement → Cite
36
+
37
+ ### 1. Detect — read the actual version first
38
+
39
+ Before researching anything, read the project's manifest and identify the EXACT version of the library/framework that matters:
40
+
41
+ | Stack | File | Field |
42
+ |-------|------|-------|
43
+ | Node/TS | `package.json` | `dependencies`, `devDependencies` |
44
+ | Python | `pyproject.toml`, `requirements*.txt`, `Pipfile.lock` | each dep with version |
45
+ | .NET | `*.csproj`, `packages.lock.json` | `PackageReference Version="..."` |
46
+ | Rust | `Cargo.toml`, `Cargo.lock` | `[dependencies]` |
47
+
48
+ Record the version. If a range (`^4.18.0`), note the lockfile-resolved version.
49
+
50
+ If no manifest exists OR the dep is not yet in the manifest (e.g., choosing what to install), record "no version yet — choosing fresh".
51
+
52
+ ### 2. Fetch — pull the matching version's official docs
53
+
54
+ Authority hierarchy:
55
+
56
+ 1. **Official docs** for the EXACT version (or nearest stable). E.g., `react.dev/reference/react?version=18` not `react.dev` default.
57
+ 2. **Official changelog / migration guide** when transitioning across versions.
58
+ 3. **Web standards** (MDN, RFCs, W3C) for cross-implementation behavior.
59
+ 4. **Compatibility tables** (caniuse, Compat data) for API support across runtimes.
60
+
61
+ Forbidden as primary source:
62
+
63
+ - Stack Overflow answers (use only as discovery, then verify via official).
64
+ - Tutorial blogs (frequently outdated; never authoritative).
65
+ - AI training data (your training is months/years stale).
66
+ - README screenshots from random GitHub repos.
67
+
68
+ Fetch via `WebFetch` or `mcp__context7__*` if available. If both fail, surface to the user that you're falling back to training-data knowledge AND mark the citation `[source: training-data, unverified]`.
69
+
70
+ ### 3. Implement — apply the documented pattern
71
+
72
+ Use exactly the API the documented version provides. Don't mix patterns from multiple versions ("this useEffect example is from React 16; you're on 18.3"). When the doc shows multiple acceptable patterns, pick the simplest that matches the project's style.
73
+
74
+ If the doc presents migration warnings (e.g., "deprecated in v5, use X instead"), follow the new path unless the project explicitly pins to the old version for a documented reason.
75
+
76
+ ### 4. Cite — record the source verifiably
77
+
78
+ Every decision that depended on an external source ends with a citation block:
79
+
80
+ ```
81
+ [source: <url>, version: <X.Y>, retrieved: <YYYY-MM-DD>]
82
+ ```
83
+
84
+ Examples:
85
+
86
+ ```
87
+ [source: https://react.dev/reference/react/useEffect, version: 18.3, retrieved: 2026-05-07]
88
+ [source: https://docs.python.org/3.12/library/asyncio-task.html, version: 3.12, retrieved: 2026-05-07]
89
+ [source: https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html, version: SDK v3, retrieved: 2026-05-07]
90
+ ```
91
+
92
+ When citing in PRDs, techspecs, decision logs, or deps-audit reports, the citation is mandatory adjacent to each claim. A future engineer reading the doc can click and verify.
93
+
94
+ ## How `dw-create-techspec` uses this
95
+
96
+ Before writing the "Architectural Decisions" section, the techspec command:
97
+
98
+ 1. Lists every framework/library decision the techspec depends on (e.g., "use Server Actions for mutations").
99
+ 2. For each, runs the protocol: detects version, fetches official doc, cites verifiably.
100
+ 3. Writes each decision as: `<decision> — <one-line rationale> — [source: ...]`.
101
+
102
+ If the protocol can't reach official docs (offline, paywall, dead link), the techspec prefixes the decision with `⚠ training-data fallback` so the human reviewer knows to verify.
103
+
104
+ ## How `dw-deps-audit` uses this
105
+
106
+ In the brainstorm phase (Conservative/Balanced/Bold per package), each option's "target version" cites the source where that version's release notes were checked. This catches the "agent recommends v5 because it sounds modern, but v5 dropped Node 18 support" class of error.
107
+
108
+ ## How `dw-deep-research` uses this
109
+
110
+ Already does multi-source research; gains the citation discipline. Each finding line ends with a `[source: ...]` block. The output report's bibliography is built from these citations automatically.
111
+
112
+ ## Anti-patterns
113
+
114
+ 1. Citing Stack Overflow as primary source. (Use as DISCOVERY, then fetch the official doc the SO answer points to.)
115
+ 2. Citing "the docs" without a URL. The whole point is verifiability.
116
+ 3. Citing a doc URL that isn't pinned to a version (e.g., `react.dev` instead of `react.dev/reference/react?version=18`).
117
+ 4. Pretending knowledge is current when it's training data. Mark unverified.
118
+ 5. Citing your own previous answer in this session as authority. The chain has to terminate at an external source.
119
+
120
+ ## References
121
+
122
+ - `references/citation-protocol.md` — exact format of `[source: ...]` blocks; how to consolidate multiple citations in a single decision; how to track citation freshness over time.
123
+ - `references/source-priority.md` — full hierarchy with examples; when secondary sources are acceptable.
124
+ - `references/freshness-check.md` — how to validate a doc URL still applies to the version in use; how to detect doc drift between when you fetched and when the user reads the artifact.
125
+
126
+ ## Inspired by
127
+
128
+ Adapted from [`addyosmani/agent-skills/source-driven-development`](https://github.com/addyosmani/agent-skills) by Addy Osmani (MIT license). Core protocol (Detect → Fetch → Implement → Cite) and source authority hierarchy preserved. dev-workflow integration: invoked by `dw-create-techspec`, `dw-deps-audit`, `dw-deep-research` via Complementary Skills, and citation format aligned with our existing report frontmatter conventions (`type: ...`, `schema_version: ...`).
@@ -0,0 +1,108 @@
1
+ # Citation protocol — exact format of `[source: ...]` blocks
2
+
3
+ Citations are not optional decoration. They turn a decision into a verifiable claim. Future engineers reading a techspec/deps-audit/research report click the URL and confirm.
4
+
5
+ ## Required format
6
+
7
+ Single citation:
8
+
9
+ ```
10
+ [source: <url>, version: <X.Y>, retrieved: <YYYY-MM-DD>]
11
+ ```
12
+
13
+ All three fields required:
14
+
15
+ - `<url>` — direct URL to the section/page that supports the claim. Not the docs homepage.
16
+ - `<version>` — the version of the library/framework the URL applies to. If the URL is version-pinned (e.g., `?version=18`), the value here matches.
17
+ - `<retrieved>` — ISO date you fetched. Establishes when the doc was current.
18
+
19
+ Examples (good):
20
+
21
+ ```
22
+ [source: https://react.dev/reference/react/useEffect, version: 18.3, retrieved: 2026-05-07]
23
+ [source: https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations, version: 14.2, retrieved: 2026-05-07]
24
+ [source: https://docs.python.org/3.12/library/asyncio.html, version: 3.12, retrieved: 2026-05-07]
25
+ [source: https://docs.docker.com/compose/compose-file/build/, version: Compose Spec, retrieved: 2026-05-07]
26
+ ```
27
+
28
+ Examples (bad):
29
+
30
+ ```
31
+ [source: react.dev] # no version, no date, not pinned
32
+ [source: docs, retrieved: today] # vague URL, vague date
33
+ [source: https://stackoverflow.com/q/12345] # not authoritative — see source-priority.md
34
+ [the React docs say ...] # not a citation block; future reader can't verify
35
+ ```
36
+
37
+ ## Multiple citations on one decision
38
+
39
+ When a decision rests on more than one source (e.g., "use Server Actions for mutations" depends on the React 19 form actions API + the Next.js 14 routing layer), list each:
40
+
41
+ ```
42
+ Decision: use Server Actions for the form submission flow.
43
+
44
+ Rationale: Server Actions provide automatic revalidation
45
+ [source: https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations, version: 14.2, retrieved: 2026-05-07]
46
+ and align with React 19's `useActionState`
47
+ [source: https://react.dev/reference/react/useActionState, version: 19.0, retrieved: 2026-05-07].
48
+ ```
49
+
50
+ Inline form for short claims:
51
+
52
+ ```
53
+ - Postgres 16 introduces `pg_stat_io` for IO observability
54
+ [source: https://www.postgresql.org/docs/16/monitoring-stats.html, version: 16, retrieved: 2026-05-07].
55
+ ```
56
+
57
+ ## Where citations live
58
+
59
+ Per artifact:
60
+
61
+ | Artifact | Citations live in |
62
+ |----------|-------------------|
63
+ | PRD (`prd.md`) | "Open Questions" section when the answer needs research, OR inline next to specific functional requirements |
64
+ | TechSpec (`techspec.md`) | Inline next to every architectural decision; consolidated in a "Sources" section at the end |
65
+ | Deps-audit report | Adjacent to each package's recommended version |
66
+ | Deep-research report | Inline next to every finding; consolidated bibliography auto-generated |
67
+ | ADR | Mandatory in the "References" section |
68
+
69
+ ## Freshness notation
70
+
71
+ If the citation is older than 90 days when the artifact is consumed, suspect drift. Best-practice:
72
+
73
+ - Re-verify the citation before acting on the decision.
74
+ - If the cited URL has moved or been deprecated, update the artifact: `[source: <new-url>, version: ..., retrieved: <new-date>, supersedes: <old-url>]`.
75
+
76
+ For artifacts that age (e.g., a 6-month-old ADR), agents reading them downstream should flag stale citations rather than silently trust them.
77
+
78
+ ## Unverified fallback
79
+
80
+ When official docs are unreachable (network down, paywall, deleted page) AND the agent must still produce an answer, mark the citation explicitly:
81
+
82
+ ```
83
+ [source: training-data, unverified, claim: <X>, last-known-version: <Y>]
84
+ ```
85
+
86
+ This signals to the human reviewer that the answer needs verification before commit.
87
+
88
+ NEVER use `unverified` as a default. The four-step protocol (Detect → Fetch → Implement → Cite) demands fetch attempts; `unverified` is the failsafe, not the path.
89
+
90
+ ## Consolidation in reports
91
+
92
+ When a report has dozens of citations (e.g., a deep-research output), build a numbered bibliography at the end:
93
+
94
+ ```
95
+ ## Sources
96
+
97
+ [1] https://react.dev/reference/react/useEffect, version: 18.3, retrieved: 2026-05-07
98
+ [2] https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations, version: 14.2, retrieved: 2026-05-07
99
+ [3] https://docs.python.org/3.12/library/asyncio.html, version: 3.12, retrieved: 2026-05-07
100
+ ```
101
+
102
+ In-line, refer to bibliography entries: `... uses Server Actions [2] for mutations ...`.
103
+
104
+ ## Don't
105
+
106
+ - Don't cite an internal Slack thread or private wiki as if it were authoritative — the citation must point to something the reader can read.
107
+ - Don't cite a URL that requires login (paywalls); find an open-access equivalent or note the access barrier in the citation.
108
+ - Don't backfill citations after the fact ("I'll add the source later"). Cite as you decide; if you can't cite, you don't have a verified decision.
@@ -0,0 +1,108 @@
1
+ # Freshness check — keeping citations valid over time
2
+
3
+ A citation goes stale in two ways: the URL stops resolving (404, redirect, paywall added) OR the project's installed version moves past the version the citation pinned. Both invalidate the citation's authority. This file describes how to detect both and what to do.
4
+
5
+ ## Two staleness modes
6
+
7
+ ### Mode 1 — URL drift
8
+
9
+ The URL still loads, but the content has changed (doc was rewritten, section deleted, deprecated). Or the URL 404s outright.
10
+
11
+ Detection: re-fetch the URL on demand. Compare the section/heading the original citation pointed to.
12
+
13
+ Action when detected:
14
+ - If the new content still supports the original claim → update the citation's `retrieved` date.
15
+ - If the new content contradicts or removes the claim → the citation is invalid. Find a replacement source OR revisit the decision.
16
+
17
+ ### Mode 2 — Version drift
18
+
19
+ The URL is fine, but the project bumped from React 18.3 to React 19. The citation `[..., version: 18.3, ...]` no longer pins to the version installed.
20
+
21
+ Detection: compare the cited version with the manifest's current version (`package.json` etc.). Mismatch → drift.
22
+
23
+ Action:
24
+ - If the doc has version-aware content (most modern docs do), find the equivalent for the new version.
25
+ - If the API was renamed/removed in the new version, the underlying decision needs re-evaluation, not just a citation patch.
26
+
27
+ ## When to check freshness
28
+
29
+ | Trigger | Check what |
30
+ |---------|-----------|
31
+ | Acting on an artifact older than 90 days | Both URL drift and version drift |
32
+ | About to ship code based on a citation | URL drift (single fetch) |
33
+ | User explicitly asks "is this still current?" | Both |
34
+ | Routine `dw-deps-audit` | Version drift for every cited dep |
35
+
36
+ Don't check on every read — that turns documentation into a trip hazard. Check at decision points: before committing, before merging, before promoting to production.
37
+
38
+ ## How to check programmatically
39
+
40
+ For URL drift:
41
+
42
+ ```bash
43
+ # Quick HEAD check — does the URL still resolve?
44
+ curl -sI "<url>" | head -1
45
+ # 200 OK → fine; 301/302 → follow; 404 → broken; 403 → paywall added
46
+
47
+ # Content drift check — fetch and grep for the original heading
48
+ curl -s "<url>" | grep -i "<expected-heading-or-section>"
49
+ ```
50
+
51
+ In an agent context: use `WebFetch` on the URL and confirm the cited section still exists. If a heading the citation referenced is gone, mark the citation as drift.
52
+
53
+ For version drift:
54
+
55
+ ```bash
56
+ # What does the manifest say now?
57
+ node -p "require('./package.json').dependencies.react"
58
+ # Compare to the cited version in the artifact
59
+ ```
60
+
61
+ In an agent context: read the manifest, parse the dep version, compare to the citation's `version` field.
62
+
63
+ ## Updating stale citations
64
+
65
+ When a citation drifts but the underlying decision still holds, update in place:
66
+
67
+ ```
68
+ Before:
69
+ [source: https://react.dev/reference/react/useEffect, version: 18.3, retrieved: 2025-09-01]
70
+
71
+ After URL drift detected (page restructured):
72
+ [source: https://react.dev/reference/react/useEffect, version: 18.3, retrieved: 2026-05-07,
73
+ superseded-by: https://react.dev/learn/synchronizing-with-effects, retrieved: 2026-05-07]
74
+
75
+ After version drift (project moved to React 19):
76
+ [source: https://react.dev/reference/react/useEffect, version: 19.0, retrieved: 2026-05-07,
77
+ previous: 18.3]
78
+ ```
79
+
80
+ The artifact records the history. Reviewers can see: "this decision was first sourced for v18.3 in Sep 2025; re-verified for v19.0 in May 2026."
81
+
82
+ ## When the underlying decision dies
83
+
84
+ Sometimes drift means the API the decision used no longer exists. Example: a decision in 2023 to use `React.useTransition` with the `pending` second tuple element. In React 18.3 that's the API; in React 19 the API shape changed.
85
+
86
+ In this case:
87
+
88
+ 1. Don't silently update the citation. The decision IS now invalid.
89
+ 2. Open an ADR or comment in the techspec: "decision X relied on API Y; API Y was changed in v<new>; need to revisit."
90
+ 3. Loop the user (or the next iteration of `dw-create-techspec`/`dw-deps-audit`) into the decision, with the new constraint.
91
+
92
+ Quietly patching a stale citation when the underlying API is gone is a subtle category of bug. Surface it.
93
+
94
+ ## Bibliography rotation in long-lived artifacts
95
+
96
+ For artifacts that live more than 6 months (long-running PRDs, ADRs, design docs), consider a "Sources last verified: YYYY-MM-DD" header at the top:
97
+
98
+ ```markdown
99
+ ---
100
+ type: techspec
101
+ schema_version: "1.0"
102
+ sources_last_verified: 2026-05-07
103
+ ---
104
+ ```
105
+
106
+ When an agent re-reads the artifact and the verification date is >90 days old, prompt: "Sources last verified <date>; re-run freshness check?"
107
+
108
+ Cheap operational discipline; prevents silent decay.
@@ -0,0 +1,146 @@
1
+ # Source priority — what counts as authoritative
2
+
3
+ Not all sources are equal. The whole point of grounded development is using authoritative sources, not the loudest ones. This file is the hierarchy.
4
+
5
+ ## Tier 1 — Authoritative
6
+
7
+ These are the only valid PRIMARY sources. Cite these for any claim about how a library, framework, or standard works.
8
+
9
+ ### 1.1 Official versioned documentation
10
+
11
+ The exact version's published docs:
12
+
13
+ - React: `react.dev/reference/react?version=<X>`
14
+ - Next.js: `nextjs.org/docs` (versioned via release page)
15
+ - Python: `docs.python.org/<X.Y>/`
16
+ - Node: `nodejs.org/api/` (version-pinned via dropdown / URL `/dist/v<X.Y.Z>/`)
17
+ - ASP.NET Core: `learn.microsoft.com/aspnet/core/` (filter by version)
18
+ - Rust: `doc.rust-lang.org/<X.Y>/` and `docs.rs/<crate>/<version>/`
19
+ - Postgres: `postgresql.org/docs/<major>/`
20
+ - AWS: `docs.aws.amazon.com/<service>/` (versioned per SDK / API)
21
+
22
+ When the URL doesn't pin version, add a query (`?v=`, `?version=`) or use the docs section that explicitly states the version. If neither exists, note in the citation: `version: latest-as-of-retrieved`.
23
+
24
+ ### 1.2 Official changelogs and migration guides
25
+
26
+ For decisions involving version transitions (upgrade from v17 to v18, etc.):
27
+
28
+ - React's `react.dev/blog` for major releases
29
+ - Next.js's `nextjs.org/docs/app/building-your-application/upgrading`
30
+ - Maintainer-published `CHANGELOG.md` in the repo root
31
+
32
+ ### 1.3 Web standards & RFCs
33
+
34
+ For cross-implementation behavior:
35
+
36
+ - W3C specs (e.g., HTML, CSS specs)
37
+ - WHATWG specs (e.g., Fetch, URL)
38
+ - IETF RFCs (e.g., RFC 7807 Problem Details, RFC 9110 HTTP Semantics)
39
+ - ECMA-262 (JavaScript spec)
40
+ - ISO standards when relevant (e.g., ISO 8601 for dates)
41
+
42
+ Cite when the question is "is this behavior portable?" or "what's the standard?"
43
+
44
+ ### 1.4 Compatibility tables
45
+
46
+ For "does X work in browser/runtime Y?":
47
+
48
+ - caniuse.com for web platform features
49
+ - MDN's Browser Compat Data (BCD) for Web APIs
50
+ - Compatibility tables published in maintainer docs (Postgres has them, Node has them)
51
+
52
+ ## Tier 2 — Acceptable as supplement, NOT primary
53
+
54
+ Cite Tier 2 ONLY in addition to a Tier 1 source — never as the sole basis for a decision.
55
+
56
+ ### 2.1 Maintainer blog posts
57
+
58
+ Examples:
59
+
60
+ - `vercel.com/blog/...` — for Vercel-published deep-dives on Next.js patterns
61
+ - `microsoft.com/devblogs/...` — for ASP.NET / .NET deep-dives
62
+ - `engineering.<company>.com` — when the company maintains the project
63
+
64
+ These are first-person from people who built the thing. Often clearer than docs. But docs are the contract; blogs are commentary.
65
+
66
+ ### 2.2 Conference talks (recorded)
67
+
68
+ Examples:
69
+
70
+ - React Conf, Next.js Conf, Pycon, Rustconf
71
+ - The talk's slides + speaker handle
72
+
73
+ When citing, name the talk + year + speaker; link the video.
74
+
75
+ ### 2.3 GitHub issues / PRs from the maintainer
76
+
77
+ Useful for understanding the WHY behind a doc statement. Cite the issue/PR number explicitly:
78
+
79
+ ```
80
+ [source: https://github.com/vercel/next.js/issues/12345, retrieved: 2026-05-07]
81
+ (maintainer thread on the rationale for App Router's caching behavior)
82
+ ```
83
+
84
+ ## Tier 3 — Discovery only, NEVER cite as primary
85
+
86
+ These help you find the right Tier 1 doc. They do NOT support a decision on their own.
87
+
88
+ ### 3.1 Stack Overflow
89
+
90
+ Frequently outdated, sometimes wrong, often not version-aware. Use to discover an answer's existence — then verify against Tier 1.
91
+
92
+ If a Stack Overflow answer points to docs, fetch the docs and cite those instead.
93
+
94
+ ### 3.2 Tutorial blogs (non-maintainer)
95
+
96
+ Most blog posts are static; the framework moved on. The author may not even remember writing it. Don't cite.
97
+
98
+ ### 3.3 LLM training data
99
+
100
+ Yours included. Treated as Tier 3 for two reasons: it's stale (months/years), and you can't link to it.
101
+
102
+ ### 3.4 README screenshots from random repos
103
+
104
+ Someone's `examples/foo` directory isn't authoritative. The framework's official docs are.
105
+
106
+ ## When sources conflict
107
+
108
+ Common scenario: the official docs say one thing, a maintainer blog says another, an issue thread says yet a third.
109
+
110
+ Resolution:
111
+
112
+ 1. **Newer doc wins** if the version is the same. Docs get corrected; old blog posts don't.
113
+ 2. **Maintainer commitment wins** if it's tracked. An issue closed with `wontfix` or a PR merged with `feat:` is binding signal.
114
+ 3. **For grey areas, surface the conflict**. Cite all three and tell the user the authoritative resolution is unclear; ask whether to consult the maintainer directly.
115
+
116
+ ## Examples in practice
117
+
118
+ ### Good — multi-source decision
119
+
120
+ > Decision: use React 19 `useActionState` for the form submission flow.
121
+ >
122
+ > Rationale: idiomatic since React 19; replaces ad-hoc `useFormState`.
123
+ >
124
+ > Sources:
125
+ > - `[source: https://react.dev/reference/react/useActionState, version: 19.0, retrieved: 2026-05-07]` — Tier 1, official API doc
126
+ > - `[source: https://react.dev/blog/2024/12/05/react-19, retrieved: 2026-05-07]` — Tier 2, maintainer blog explaining the migration
127
+
128
+ ### Bad — Stack Overflow as primary
129
+
130
+ > Decision: use `useEffect` cleanup with `AbortController` to cancel fetches.
131
+ >
132
+ > Source: a Stack Overflow answer with 1.2k upvotes.
133
+
134
+ The decision is correct, but the citation isn't authoritative. The fix:
135
+
136
+ > Source: `[source: https://react.dev/reference/react/useEffect#fetching-data-with-effects, version: 18.3, retrieved: 2026-05-07]` — same conclusion, authoritative origin.
137
+
138
+ ### Bad — version-less citation
139
+
140
+ > Decision: use `Promise.withResolvers()`.
141
+ >
142
+ > Source: `[source: developer.mozilla.org]`
143
+
144
+ `Promise.withResolvers()` is Node 22+ / browsers TC39 stage 4. The version matters — the cite is incomplete:
145
+
146
+ > Source: `[source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers, retrieved: 2026-05-07, runtime-support: Node 22+, Chrome 119+]`
@@ -177,7 +177,6 @@ This skill is invoked transparently from:
177
177
  - `/dw-bugfix` — before claiming the bug is fixed (original symptom no longer reproduces)
178
178
  - `/dw-code-review` — before emitting an APPROVED verdict
179
179
  - `/dw-generate-pr` — blocks PR creation if the session has no passing VERIFICATION REPORT post-last-edit
180
- - `/dw-quick` — before committing the one-off change
181
180
 
182
181
  Callers should mention this skill in their "Skills Complementares" section so the user sees the dependency.
183
182
 
@@ -144,3 +144,7 @@ Each rule file contains:
144
144
  ## Full Compiled Document
145
145
 
146
146
  For the complete guide with all rules expanded: `AGENTS.md`
147
+
148
+ ## References
149
+
150
+ - `references/perf-discipline.md` — workflow discipline (measure → identify → fix → verify → guard) that wraps the per-rule recipes above. Use when tackling performance work; cite the metric and tool before applying any rule. Adapted from [`addyosmani/agent-skills/performance-optimization`](https://github.com/addyosmani/agent-skills/tree/main/performance-optimization) (MIT).
@@ -0,0 +1,122 @@
1
+ # Performance discipline — measure, identify, fix, verify, guard
2
+
3
+ > Adapted from [`addyosmani/agent-skills/performance-optimization`](https://github.com/addyosmani/agent-skills/tree/main/performance-optimization) (MIT). The rules below complement the per-rule recipes in `rules/` with a workflow discipline.
4
+
5
+ The biggest performance mistake is fixing the wrong thing. The second biggest is "fixing" without measuring. This file establishes the workflow that prevents both.
6
+
7
+ ## The five-step loop
8
+
9
+ ### 1. Measure
10
+
11
+ Don't optimize what you haven't measured.
12
+
13
+ **Frontend:**
14
+ - Lighthouse / PageSpeed Insights → composite score + breakdown.
15
+ - DevTools Performance tab → flame graph, layout/paint timing.
16
+ - `web-vitals` library → LCP, FID/INP, CLS, TTFB on real users.
17
+ - Bundle analyzer (`next-bundle-analyzer`, `webpack-bundle-analyzer`) → see what's actually shipping.
18
+
19
+ **Backend:**
20
+ - Application logs with timing (`time-X-took: Yms`).
21
+ - DB query analyzer (`EXPLAIN ANALYZE`, slow query log).
22
+ - APM (Datadog, New Relic, Sentry Performance) for distributed traces.
23
+ - `top` / `htop` / process memory + CPU during load.
24
+
25
+ **Output:** a baseline number with a unit. "It's slow" is not a baseline. "P95 LCP is 4.8s" is a baseline.
26
+
27
+ ### 2. Identify
28
+
29
+ Find where the time goes. The flame graph or trace shows it; don't guess.
30
+
31
+ Common culprits:
32
+
33
+ | Symptom | Likely cause |
34
+ |---------|--------------|
35
+ | Long initial paint | Large bundle, render-blocking resources |
36
+ | Slow time-to-interactive | Heavy JS execution, hydration cost |
37
+ | Layout shift | Missing dimensions, late-loaded fonts |
38
+ | Slow API response | N+1 query, missing index, expensive computation, external call latency |
39
+ | Memory creep | Listener leak, retained closure, unbounded cache |
40
+
41
+ The cause must come from data, not pattern-matching. The same symptom can have different causes in different apps.
42
+
43
+ ### 3. Fix
44
+
45
+ Apply the smallest fix that addresses the identified cause:
46
+
47
+ - N+1 query → batch with `IN (...)`, single JOIN, or DataLoader.
48
+ - Heavy bundle → code splitting, lazy load, dynamic imports.
49
+ - Re-render storm → `useMemo`, `useCallback`, `memo`, signal-based state.
50
+ - Slow API → cache, precompute, parallelize, move work to background.
51
+ - Layout shift → reserve space (width+height attrs, CSS aspect-ratio).
52
+
53
+ The `rules/` directory in this skill has tactical recipes for each. Use them when the diagnosis points there.
54
+
55
+ **Don't apply optimizations preemptively.** `useMemo` everywhere = noise + cost. `memo` everywhere = stale prop bugs.
56
+
57
+ ### 4. Verify
58
+
59
+ Re-measure with the same instrument from step 1.
60
+
61
+ - Same scenario, same env (or as close as possible).
62
+ - Multiple runs (perf is noisy; one run is not evidence).
63
+ - Compare against baseline.
64
+
65
+ If the number didn't change meaningfully (e.g., <10% improvement is below noise floor for most metrics): you fixed the wrong thing. Revert and go back to step 2.
66
+
67
+ If the number improved but the user-perceived experience didn't: you optimized a metric, not a bottleneck. Rethink what to measure.
68
+
69
+ ### 5. Guard
70
+
71
+ Prevent regression:
72
+
73
+ - **Performance budgets in CI:** Lighthouse CI, bundle-size limits per route, P95 latency checks.
74
+ - **Regression test for the specific scenario** that was slow.
75
+ - **Monitoring in production** so future regressions surface from real users (not just CI runs that may not match prod load).
76
+ - **Document the constraint** in code comments at the boundary that must stay fast (e.g., "this loop processes the entire user list; keep it O(n)").
77
+
78
+ Without guards, every refactor risks reintroducing the bottleneck. The fix decays.
79
+
80
+ ## Frontend-specific patterns
81
+
82
+ The `rules/` directory provides recipes for: bundle size (barrel imports, dynamic imports, defer third-party), client-side perf (passive listeners, swr dedup, localStorage schema), async patterns (parallel fetches, suspense boundaries, defer awaits), and JS micro-perf. Apply when measurement points there.
83
+
84
+ **Hierarchy of impact (typical):**
85
+ 1. Bundle size — biggest impact for cold loads.
86
+ 2. Hydration cost — biggest impact for time-to-interactive.
87
+ 3. Network waterfalls — biggest impact for data-heavy pages.
88
+ 4. Re-render volume — biggest impact for interactive heavy pages.
89
+ 5. JS micro-perf — usually irrelevant unless in a hot loop.
90
+
91
+ Optimize in this order; don't jump to (5) before (1).
92
+
93
+ ## Backend-specific patterns
94
+
95
+ | Pattern | When |
96
+ |---------|------|
97
+ | Add database index | Query plan shows full table scan |
98
+ | Batch N queries into 1 | N+1 detected in trace |
99
+ | Cache (Redis, in-memory, edge) | Same expensive computation repeats |
100
+ | Precompute / materialize | Aggregation that runs per-request but updates rarely |
101
+ | Background job | Work doesn't need to block the response |
102
+ | Parallelize independent calls | Trace shows sequential awaits with no dependency |
103
+ | Move to faster runtime / region | Network or CPU is the bottleneck after other fixes |
104
+
105
+ ## When NOT to optimize
106
+
107
+ - The number isn't actually a problem. "P95 200ms" doesn't need optimization unless your SLA is tighter.
108
+ - The optimization makes the code substantially harder to maintain. A 5% gain isn't worth a 50% complexity increase.
109
+ - The optimized code can't be tested. If perf code can't be regression-tested, the next change will undo it silently.
110
+ - You're optimizing dev-mode performance, not prod. Many tools (React, Next, Vite) have very different hot paths in dev vs prod.
111
+
112
+ ## Anti-patterns
113
+
114
+ - "Looks slow, let me memo this" — without measurement, this just adds complexity.
115
+ - "Add caching to fix the slow query" — caching hides the bug; the slow query reappears for the next user.
116
+ - Profiling once, optimizing five things, never re-measuring.
117
+ - Setting `useMemo` deps wrong — silently breaks correctness for marginal perf gain.
118
+ - Treating Lighthouse score as the only metric — score can improve without UX improving.
119
+
120
+ ## Integration with dev-workflow
121
+
122
+ Use with `dw-refactoring-analysis` when flagging perf-related smells: cite the metric, the measurement tool, and the suggested rule from the `rules/` directory. Without those three, a perf "smell" is a guess.
@@ -131,3 +131,8 @@ try {
131
131
  ## Helper Functions
132
132
 
133
133
  Some helper functions are available in [`test-helper.js`](./assets/test-helper.js) to simplify common tasks like waiting for elements, capturing screenshots, and handling errors. You can import and use these functions in your tests to improve readability and maintainability.
134
+
135
+ ## References
136
+
137
+ - `references/security-boundary.md` — every byte from a browser is potentially attacker-controlled. Test that server-side authorization, validation, and CSRF protection hold even when the UI is bypassed via direct API calls or DevTools manipulation. Adapted from [`addyosmani/agent-skills/browser-devtools`](https://github.com/addyosmani/agent-skills/tree/main/browser-devtools) (MIT).
138
+ - `references/three-workflow-patterns.md` — UI bugs vs network issues vs performance investigations are three distinct testing workflows with different signals and failure modes. Pick the right workflow for the verification you actually need; don't conflate them in a single mega-test. Adapted from the same upstream skill.