baldart 3.6.2

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 (230) hide show
  1. package/CHANGELOG.md +599 -0
  2. package/README.md +566 -0
  3. package/VERSION +1 -0
  4. package/bin/baldart.js +143 -0
  5. package/framework/.claude/agents/REGISTRY.md +169 -0
  6. package/framework/.claude/agents/api-perf-cost-auditor.md +291 -0
  7. package/framework/.claude/agents/code-reviewer.md +350 -0
  8. package/framework/.claude/agents/codebase-architect.md +391 -0
  9. package/framework/.claude/agents/coder.md +291 -0
  10. package/framework/.claude/agents/deep-human-insight.md +198 -0
  11. package/framework/.claude/agents/doc-reviewer.md +440 -0
  12. package/framework/.claude/agents/email-deliverability-architect.md +193 -0
  13. package/framework/.claude/agents/hybrid-ml-architect.md +285 -0
  14. package/framework/.claude/agents/hyper-gamification-designer.md +149 -0
  15. package/framework/.claude/agents/legal-counsel-gdpr.md +179 -0
  16. package/framework/.claude/agents/marketing-conversion-strategist.md +162 -0
  17. package/framework/.claude/agents/motion-expert.md +108 -0
  18. package/framework/.claude/agents/onboarding-architect-lead.md +230 -0
  19. package/framework/.claude/agents/plan-auditor.md +546 -0
  20. package/framework/.claude/agents/prd-card-writer.md +372 -0
  21. package/framework/.claude/agents/prd.md +744 -0
  22. package/framework/.claude/agents/qa-sentinel.md +305 -0
  23. package/framework/.claude/agents/remotion-animator-orchestrator.md +218 -0
  24. package/framework/.claude/agents/security-reviewer.md +276 -0
  25. package/framework/.claude/agents/senior-researcher.md +175 -0
  26. package/framework/.claude/agents/seo-analytics-strategist.md +156 -0
  27. package/framework/.claude/agents/skill-improver.md +61 -0
  28. package/framework/.claude/agents/ui-expert.md +191 -0
  29. package/framework/.claude/agents/visual-designer.md +190 -0
  30. package/framework/.claude/agents/website-orchestrator.md +118 -0
  31. package/framework/.claude/agents/wiki-curator.md +145 -0
  32. package/framework/.claude/commands/baldart-push.md +15 -0
  33. package/framework/.claude/commands/check.md +237 -0
  34. package/framework/.claude/commands/codexreview.md +203 -0
  35. package/framework/.claude/commands/design-review.md +11 -0
  36. package/framework/.claude/commands/issue-review.md +34 -0
  37. package/framework/.claude/commands/new.md +331 -0
  38. package/framework/.claude/commands/qa.md +257 -0
  39. package/framework/.claude/hooks/framework-edit-gate.js +208 -0
  40. package/framework/.claude/hooks/lint-before-commit.sh.template +66 -0
  41. package/framework/.claude/settings.local.json.example +32 -0
  42. package/framework/.claude/skills/api-design-principles/SKILL.md +567 -0
  43. package/framework/.claude/skills/api-design-principles/assets/api-design-checklist.md +155 -0
  44. package/framework/.claude/skills/api-design-principles/assets/rest-api-template.py +182 -0
  45. package/framework/.claude/skills/api-design-principles/references/graphql-schema-design.md +583 -0
  46. package/framework/.claude/skills/api-design-principles/references/rest-best-practices.md +408 -0
  47. package/framework/.claude/skills/baldart-push/SKILL.md +222 -0
  48. package/framework/.claude/skills/bug/SKILL.md +200 -0
  49. package/framework/.claude/skills/bug/references/logging-patterns.md +174 -0
  50. package/framework/.claude/skills/capture/SKILL.md +125 -0
  51. package/framework/.claude/skills/capture/references/synthesis-template.md +42 -0
  52. package/framework/.claude/skills/context-primer/SKILL.md +189 -0
  53. package/framework/.claude/skills/copywriting/SKILL.md +273 -0
  54. package/framework/.claude/skills/copywriting/references/copy-frameworks.md +338 -0
  55. package/framework/.claude/skills/copywriting/references/natural-transitions.md +252 -0
  56. package/framework/.claude/skills/doc-writing-for-rag/SKILL.md +119 -0
  57. package/framework/.claude/skills/doc-writing-for-rag/references/before-after-examples.md +291 -0
  58. package/framework/.claude/skills/doc-writing-for-rag/references/compact-templates.md +183 -0
  59. package/framework/.claude/skills/doc-writing-for-rag/references/frontmatter-minimal.md +112 -0
  60. package/framework/.claude/skills/doc-writing-for-rag/references/line-count-targets.md +110 -0
  61. package/framework/.claude/skills/doc-writing-for-rag/references/schemas-and-errors.md +129 -0
  62. package/framework/.claude/skills/find-skills/SKILL.md +133 -0
  63. package/framework/.claude/skills/frontend-design/LICENSE.txt +177 -0
  64. package/framework/.claude/skills/frontend-design/SKILL.md +84 -0
  65. package/framework/.claude/skills/gamification-design/SKILL.md +130 -0
  66. package/framework/.claude/skills/issue-review/SKILL.md +45 -0
  67. package/framework/.claude/skills/kie-ai/SKILL.md +262 -0
  68. package/framework/.claude/skills/kie-ai/references/models-catalog.md +272 -0
  69. package/framework/.claude/skills/kie-ai/scripts/kie_api.sh +209 -0
  70. package/framework/.claude/skills/kie-ai/scripts/remove_greenscreen.py +69 -0
  71. package/framework/.claude/skills/kie-ai/scripts/setup_api_key.sh +77 -0
  72. package/framework/.claude/skills/motion-design/LICENSE +21 -0
  73. package/framework/.claude/skills/motion-design/README.md +82 -0
  74. package/framework/.claude/skills/motion-design/SKILL.md +336 -0
  75. package/framework/.claude/skills/motion-design/director/choreography.md +93 -0
  76. package/framework/.claude/skills/motion-design/director/context-adaptation.md +83 -0
  77. package/framework/.claude/skills/motion-design/director/core-philosophy.md +53 -0
  78. package/framework/.claude/skills/motion-design/director/decision-framework.md +91 -0
  79. package/framework/.claude/skills/motion-design/director/disney-principles.md +102 -0
  80. package/framework/.claude/skills/motion-design/director/emotion-mapping.md +71 -0
  81. package/framework/.claude/skills/motion-design/director/motion-personality.md +89 -0
  82. package/framework/.claude/skills/motion-design/director/narrative-structure.md +62 -0
  83. package/framework/.claude/skills/motion-design/patterns/ambient-continuous.md +81 -0
  84. package/framework/.claude/skills/motion-design/patterns/entrance-exit.md +82 -0
  85. package/framework/.claude/skills/motion-design/patterns/multi-element.md +69 -0
  86. package/framework/.claude/skills/motion-design/patterns/state-feedback.md +96 -0
  87. package/framework/.claude/skills/motion-design/reference/property-selection.md +95 -0
  88. package/framework/.claude/skills/motion-design/reference/quality-checklist.md +67 -0
  89. package/framework/.claude/skills/motion-design/reference/timing-easing-tables.md +106 -0
  90. package/framework/.claude/skills/motion-design/reference/troubleshooting.md +73 -0
  91. package/framework/.claude/skills/new/SKILL.md +1687 -0
  92. package/framework/.claude/skills/playwright-skill/API_REFERENCE.md +652 -0
  93. package/framework/.claude/skills/playwright-skill/SKILL.md +157 -0
  94. package/framework/.claude/skills/playwright-skill/package.json +26 -0
  95. package/framework/.claude/skills/prd/SKILL.md +228 -0
  96. package/framework/.claude/skills/prd/assets/card-template.yml +232 -0
  97. package/framework/.claude/skills/prd/assets/epic-template.yml +190 -0
  98. package/framework/.claude/skills/prd/assets/prd-template.md +230 -0
  99. package/framework/.claude/skills/prd/assets/state-template.md +78 -0
  100. package/framework/.claude/skills/prd/references/api-perf-gate.md +152 -0
  101. package/framework/.claude/skills/prd/references/audit-phase.md +478 -0
  102. package/framework/.claude/skills/prd/references/backlog-phase.md +145 -0
  103. package/framework/.claude/skills/prd/references/discovery-phase.md +359 -0
  104. package/framework/.claude/skills/prd/references/impact-analysis.md +233 -0
  105. package/framework/.claude/skills/prd/references/prd-add-phase.md +214 -0
  106. package/framework/.claude/skills/prd/references/prd-writing-phase.md +145 -0
  107. package/framework/.claude/skills/prd/references/research-phase.md +216 -0
  108. package/framework/.claude/skills/prd/references/ui-design-phase.md +61 -0
  109. package/framework/.claude/skills/prd/references/validation-phase.md +72 -0
  110. package/framework/.claude/skills/prd-add/SKILL.md +222 -0
  111. package/framework/.claude/skills/prd-add/references/impact-analysis.md +233 -0
  112. package/framework/.claude/skills/remotion-best-practices/SKILL.md +48 -0
  113. package/framework/.claude/skills/remotion-best-practices/rules/3d.md +86 -0
  114. package/framework/.claude/skills/remotion-best-practices/rules/animations.md +29 -0
  115. package/framework/.claude/skills/remotion-best-practices/rules/assets/charts-bar-chart.tsx +173 -0
  116. package/framework/.claude/skills/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +100 -0
  117. package/framework/.claude/skills/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +108 -0
  118. package/framework/.claude/skills/remotion-best-practices/rules/assets.md +78 -0
  119. package/framework/.claude/skills/remotion-best-practices/rules/audio.md +169 -0
  120. package/framework/.claude/skills/remotion-best-practices/rules/calculate-metadata.md +104 -0
  121. package/framework/.claude/skills/remotion-best-practices/rules/can-decode.md +75 -0
  122. package/framework/.claude/skills/remotion-best-practices/rules/charts.md +58 -0
  123. package/framework/.claude/skills/remotion-best-practices/rules/compositions.md +141 -0
  124. package/framework/.claude/skills/remotion-best-practices/rules/display-captions.md +184 -0
  125. package/framework/.claude/skills/remotion-best-practices/rules/extract-frames.md +229 -0
  126. package/framework/.claude/skills/remotion-best-practices/rules/fonts.md +152 -0
  127. package/framework/.claude/skills/remotion-best-practices/rules/get-audio-duration.md +58 -0
  128. package/framework/.claude/skills/remotion-best-practices/rules/get-video-dimensions.md +68 -0
  129. package/framework/.claude/skills/remotion-best-practices/rules/get-video-duration.md +58 -0
  130. package/framework/.claude/skills/remotion-best-practices/rules/gifs.md +141 -0
  131. package/framework/.claude/skills/remotion-best-practices/rules/images.md +130 -0
  132. package/framework/.claude/skills/remotion-best-practices/rules/import-srt-captions.md +69 -0
  133. package/framework/.claude/skills/remotion-best-practices/rules/light-leaks.md +73 -0
  134. package/framework/.claude/skills/remotion-best-practices/rules/lottie.md +67 -0
  135. package/framework/.claude/skills/remotion-best-practices/rules/maps.md +401 -0
  136. package/framework/.claude/skills/remotion-best-practices/rules/measuring-dom-nodes.md +34 -0
  137. package/framework/.claude/skills/remotion-best-practices/rules/measuring-text.md +143 -0
  138. package/framework/.claude/skills/remotion-best-practices/rules/parameters.md +98 -0
  139. package/framework/.claude/skills/remotion-best-practices/rules/sequencing.md +118 -0
  140. package/framework/.claude/skills/remotion-best-practices/rules/subtitles.md +36 -0
  141. package/framework/.claude/skills/remotion-best-practices/rules/tailwind.md +11 -0
  142. package/framework/.claude/skills/remotion-best-practices/rules/text-animations.md +20 -0
  143. package/framework/.claude/skills/remotion-best-practices/rules/timing.md +179 -0
  144. package/framework/.claude/skills/remotion-best-practices/rules/transcribe-captions.md +70 -0
  145. package/framework/.claude/skills/remotion-best-practices/rules/transitions.md +197 -0
  146. package/framework/.claude/skills/remotion-best-practices/rules/transparent-videos.md +106 -0
  147. package/framework/.claude/skills/remotion-best-practices/rules/trimming.md +52 -0
  148. package/framework/.claude/skills/remotion-best-practices/rules/videos.md +171 -0
  149. package/framework/.claude/skills/seo-audit/SKILL.md +394 -0
  150. package/framework/.claude/skills/seo-audit/references/aeo-geo-patterns.md +279 -0
  151. package/framework/.claude/skills/seo-audit/references/ai-writing-detection.md +190 -0
  152. package/framework/.claude/skills/simplify/SKILL.md +137 -0
  153. package/framework/.claude/skills/skill-creator/LICENSE.txt +202 -0
  154. package/framework/.claude/skills/skill-creator/SKILL.md +356 -0
  155. package/framework/.claude/skills/skill-creator/references/output-patterns.md +82 -0
  156. package/framework/.claude/skills/skill-creator/references/workflows.md +28 -0
  157. package/framework/.claude/skills/skill-creator/scripts/init_skill.py +303 -0
  158. package/framework/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
  159. package/framework/.claude/skills/skill-creator/scripts/quick_validate.py +95 -0
  160. package/framework/.claude/skills/ui-design/SKILL.md +199 -0
  161. package/framework/.claude/skills/ui-design/references/component-discovery.md +54 -0
  162. package/framework/.claude/skills/ui-design/references/evaluation.md +171 -0
  163. package/framework/.claude/skills/ui-design/references/generation.md +109 -0
  164. package/framework/.claude/skills/ui-design/references/inventory.md +59 -0
  165. package/framework/.claude/skills/webapp-testing/LICENSE.txt +202 -0
  166. package/framework/.claude/skills/webapp-testing/SKILL.md +123 -0
  167. package/framework/.claude/skills/webapp-testing/examples/console_logging.py +35 -0
  168. package/framework/.claude/skills/webapp-testing/examples/element_discovery.py +40 -0
  169. package/framework/.claude/skills/webapp-testing/examples/static_html_automation.py +33 -0
  170. package/framework/.claude/skills/webapp-testing/scripts/with_server.py +106 -0
  171. package/framework/.claude/skills/worktree-manager/SKILL.md +680 -0
  172. package/framework/AGENTS.md +240 -0
  173. package/framework/agents/api-contracts.md +137 -0
  174. package/framework/agents/architecture.md +145 -0
  175. package/framework/agents/coding-standards.md +148 -0
  176. package/framework/agents/data-model.md +110 -0
  177. package/framework/agents/deployment-protocol.md +232 -0
  178. package/framework/agents/design-review.md +172 -0
  179. package/framework/agents/env-reference.md +171 -0
  180. package/framework/agents/github-issue-subagent.md +252 -0
  181. package/framework/agents/index.md +261 -0
  182. package/framework/agents/llm-wiki-methodology.md +216 -0
  183. package/framework/agents/maintenance-protocol.md +305 -0
  184. package/framework/agents/observability.md +162 -0
  185. package/framework/agents/performance.md +155 -0
  186. package/framework/agents/project-context.md +145 -0
  187. package/framework/agents/runbook.md +208 -0
  188. package/framework/agents/security.md +168 -0
  189. package/framework/agents/skills-mapping.md +286 -0
  190. package/framework/agents/testing.md +111 -0
  191. package/framework/agents/workflows.md +215 -0
  192. package/framework/docs/PROJECT-CONFIGURATION.md +336 -0
  193. package/framework/docs/references/brand-guidelines.md +170 -0
  194. package/framework/docs/references/ui-guidelines.template.md +182 -0
  195. package/framework/routines/code-review.routine.yml +46 -0
  196. package/framework/routines/doc-review.routine.yml +45 -0
  197. package/framework/routines/ds-drift.routine.yml +52 -0
  198. package/framework/routines/full-sweep.routine.yml +51 -0
  199. package/framework/routines/index.yml +70 -0
  200. package/framework/routines/skill-improve.routine.yml +50 -0
  201. package/framework/routines/wiki-review.routine.yml +45 -0
  202. package/framework/templates/baldart.config.template.yml +113 -0
  203. package/framework/templates/breaking-change-checklist.md +484 -0
  204. package/framework/templates/feature-card.template.yml +125 -0
  205. package/framework/templates/overlays/README.md +44 -0
  206. package/framework/templates/overlays/copywriting.fidelity-example.md +62 -0
  207. package/framework/templates/overlays/ui-design.fidelity-example.md +75 -0
  208. package/framework/templates/skill-project-context.snippet.md +19 -0
  209. package/framework/templates/spec.template.md +208 -0
  210. package/package.json +51 -0
  211. package/src/commands/add.js +229 -0
  212. package/src/commands/configure.js +385 -0
  213. package/src/commands/doctor.js +486 -0
  214. package/src/commands/migrate.js +185 -0
  215. package/src/commands/push.js +0 -0
  216. package/src/commands/routines.js +269 -0
  217. package/src/commands/status.js +130 -0
  218. package/src/commands/update.js +419 -0
  219. package/src/commands/version.js +88 -0
  220. package/src/utils/contamination.js +400 -0
  221. package/src/utils/git.js +181 -0
  222. package/src/utils/hooks.js +152 -0
  223. package/src/utils/routine-adapters/claude-code-cloud.js +78 -0
  224. package/src/utils/routine-adapters/cron.js +138 -0
  225. package/src/utils/routine-adapters/github-actions.js +141 -0
  226. package/src/utils/routine-adapters/index.js +21 -0
  227. package/src/utils/routines.js +166 -0
  228. package/src/utils/state.js +143 -0
  229. package/src/utils/symlinks.js +425 -0
  230. package/src/utils/ui.js +133 -0
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: playwright-skill
3
+ description: E2E browser testing with Playwright Test CLI. Write .spec.ts files in tests/e2e/, run via `npm run test:e2e`. Supports headed mode, debug, UI mode, filtering, retries, screenshots, and trace on failure. Use when user wants to test websites, automate browser interactions, validate web functionality, or perform any browser-based testing.
4
+ ---
5
+
6
+ # Playwright E2E Testing (CLI)
7
+
8
+ All browser testing uses the **Playwright Test CLI** via `playwright.config.ts` at project root. Tests live in `${paths.e2e_tests_dir}` (default convention `tests/e2e/`).
9
+
10
+ **NEVER use ad-hoc scripts to `/tmp` as a substitute.** All tests MUST be `.spec.ts` files under `${paths.e2e_tests_dir}/`.
11
+
12
+ ## Project Context
13
+
14
+ **Reads from `baldart.config.yml`:** `paths.e2e_tests_dir`, `paths.design_system`, `stack.testing.e2e`.
15
+ **Gated by features:** `features.has_design_system` (Design System Compliance section becomes BLOCKING when `true`), `features.multi_tenant_theming` (theming assertion rule activates when `true`).
16
+ **Refuses to run when** `stack.testing.e2e` is set to something other than `"playwright"` or empty (warn and ask). Empty = ask user once and persist.
17
+ **Overlay:** loads `.baldart/overlays/playwright-skill.md` if present — project-specific test URLs, auth helpers, theming pairing assertions.
18
+ **On missing/empty keys:** ask the user; do not assume defaults. See `framework/agents/project-context.md` § 3.
19
+
20
+ ## Quick Reference
21
+
22
+ | Action | Command |
23
+ |--------|---------|
24
+ | Run all e2e tests | `npm run test:e2e` |
25
+ | Run headed (visible browser) | `npm run test:e2e:headed` |
26
+ | Run with UI mode | `npm run test:e2e:ui` |
27
+ | Debug with Inspector | `npm run test:e2e:debug` |
28
+ | Run single file | `npx playwright test tests/e2e/my-test.spec.ts` |
29
+ | Run by title regex | `npx playwright test -g "login flow"` |
30
+ | Run specific project | `npx playwright test --project=chromium` |
31
+ | Show HTML report | `npm run test:e2e:report` |
32
+ | Update snapshots | `npx playwright test -u` |
33
+
34
+ ## Writing Tests
35
+
36
+ Tests go in `tests/e2e/*.spec.ts` using `@playwright/test` API:
37
+
38
+ ```typescript
39
+ import { test, expect } from '@playwright/test';
40
+
41
+ test('homepage loads correctly', async ({ page }) => {
42
+ await page.goto('/');
43
+ await expect(page).toHaveTitle(/Fidelity/);
44
+ await expect(page.getByRole('heading', { level: 1 })).toBeVisible();
45
+ });
46
+
47
+ test('login redirects to dashboard', async ({ page }) => {
48
+ await page.goto('/login');
49
+ await page.fill('input[name="email"]', 'test@example.com');
50
+ await page.fill('input[name="password"]', 'password123');
51
+ await page.click('button[type="submit"]');
52
+ await expect(page).toHaveURL(/dashboard/);
53
+ });
54
+ ```
55
+
56
+ ### Key differences from the old approach
57
+
58
+ | Old (run.js) | New (Playwright CLI) |
59
+ |-------------|---------------------|
60
+ | `const { chromium } = require('playwright')` | `import { test, expect } from '@playwright/test'` |
61
+ | `chromium.launch({ headless: false })` | Configured in `playwright.config.ts`, use `--headed` flag |
62
+ | `browser.newPage()` | `page` fixture injected automatically |
63
+ | `browser.close()` | Automatic cleanup via fixtures |
64
+ | `console.log('passed')` | `expect(locator).toBeVisible()` with auto-waiting |
65
+ | Write to `/tmp/*.js` | Write to `tests/e2e/*.spec.ts` |
66
+ | `cd $SKILL_DIR && node run.js` | `npx playwright test` |
67
+
68
+ ### Responsive testing with projects
69
+
70
+ The config defines `chromium` (desktop) and `mobile` (iPhone 14) projects. Run both:
71
+
72
+ ```bash
73
+ npx playwright test --project=chromium --project=mobile
74
+ ```
75
+
76
+ Or just mobile:
77
+
78
+ ```bash
79
+ npx playwright test --project=mobile
80
+ ```
81
+
82
+ ### Grouping with describe
83
+
84
+ ```typescript
85
+ import { test, expect } from '@playwright/test';
86
+
87
+ test.describe('Booking flow', () => {
88
+ test.beforeEach(async ({ page }) => {
89
+ await page.goto('/<project-specific-test-route>'); // see .baldart/overlays/playwright-skill.md for project routes
90
+ });
91
+
92
+ test('shows date picker on load', async ({ page }) => {
93
+ await expect(page.getByTestId('date-picker')).toBeVisible();
94
+ });
95
+
96
+ test('advances to time slot step', async ({ page }) => {
97
+ await page.getByTestId('date-picker').click();
98
+ await page.getByText('18').click();
99
+ await page.getByTestId('next-button').click();
100
+ await expect(page.getByTestId('time-slots')).toBeVisible();
101
+ });
102
+ });
103
+ ```
104
+
105
+ ## Configuration
106
+
107
+ The `playwright.config.ts` at project root manages all settings:
108
+
109
+ - **baseURL**: `http://localhost:3000` (from `BASE_URL` env var)
110
+ - **webServer**: auto-starts `npm run dev` if not already running
111
+ - **screenshot**: only on failure
112
+ - **trace**: on first retry
113
+ - **projects**: `chromium` (Desktop Chrome) + `mobile` (iPhone 14)
114
+ - **retries**: 0 locally, 2 on CI
115
+ - **headed**: visible locally, headless on CI
116
+
117
+ ## Debugging
118
+
119
+ ```bash
120
+ # Open Playwright Inspector (step-through, element picker)
121
+ npm run test:e2e:debug
122
+
123
+ # Interactive UI mode (run/rerun tests, time-travel, DOM inspector)
124
+ npm run test:e2e:ui
125
+
126
+ # Run headed with slowMo for visual debugging
127
+ npx playwright test --headed -- --slow-mo=500
128
+ ```
129
+
130
+ ## CI Integration
131
+
132
+ On CI, tests run headless with retries and produce HTML + JSON reports:
133
+
134
+ ```bash
135
+ CI=true npm run test:e2e
136
+ ```
137
+
138
+ Trace files and screenshots from failures are saved in `test-results/`.
139
+
140
+ ## Tips
141
+
142
+ - Use `data-testid` attributes for reliable selectors
143
+ - Prefer `page.getByRole()`, `page.getByText()`, `page.getByTestId()` over CSS selectors
144
+ - Use `expect(locator)` assertions — they auto-wait (no manual `waitForSelector`)
145
+ - Use `test.describe()` to group related tests with shared `beforeEach`
146
+ - Use `test.skip()` or `test.fixme()` for tests that aren't ready
147
+ - Use `--only-changed` to run only tests affected by git changes
148
+
149
+ ## Design System Compliance (UI validation)
150
+
151
+ When `features.has_design_system: true`, E2E tests that validate UI components MUST be grounded in the Design System SSOT so that assertions reflect canonical variants and states, not ad-hoc expectations:
152
+
153
+ 1. Before writing a spec that asserts visual/component behavior, read `${paths.design_system}/INDEX.md` and the relevant `${paths.design_system}/components/<Name>.md` to confirm variants, states, and required props.
154
+ 2. Assert against documented variants: e.g., `expect(button).toHaveAttribute('data-variant', 'primary')` rather than matching a specific color literal.
155
+ 3. When `features.multi_tenant_theming: true`: validate token-pair presence per the project's theming pattern doc (bg class + matching text class). The exact assertion helper is listed in `.baldart/overlays/playwright-skill.md`.
156
+ 4. Motion-sensitive flows MUST include a reduced-motion run (`test.use({ reducedMotion: 'reduce' })`) per the project's motion pattern doc — reduced-motion variants are mandatory, and tests must prove they exist.
157
+ 5. Skipping this step when the spec validates UI is a protocol violation.
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "playwright-skill",
3
+ "version": "4.1.0",
4
+ "description": "General-purpose browser automation with Playwright for Claude Code with auto-detection and smart test management",
5
+ "author": "lackeyjb",
6
+ "main": "run.js",
7
+ "scripts": {
8
+ "setup": "npm install && npx playwright install chromium",
9
+ "install-all-browsers": "npx playwright install chromium firefox webkit"
10
+ },
11
+ "keywords": [
12
+ "playwright",
13
+ "automation",
14
+ "browser-testing",
15
+ "web-automation",
16
+ "claude-skill",
17
+ "general-purpose"
18
+ ],
19
+ "dependencies": {
20
+ "playwright": "^1.57.0"
21
+ },
22
+ "engines": {
23
+ "node": ">=14.0.0"
24
+ },
25
+ "license": "MIT"
26
+ }
@@ -0,0 +1,228 @@
1
+ ---
2
+ name: prd
3
+ description: "Structured PRD creation skill. Use when the user says /prd, 'crea un prd', 'nuova funzionalita', 'pianifica feature', or wants to plan a new feature end-to-end. Also handles /prd-add, 'aggiungi requisito', 'serve anche', 'manca un endpoint' for change requests on active PRD sessions — runs ICIAS impact analysis to determine which phases need SKIP/PATCH/REDO. Produces PRD + UI design + backlog cards, all validated and committed. Multi-turn conversation: asks questions, waits for answers, iterates through discovery, design, spec writing, card creation, and validation phases."
4
+ ---
5
+
6
+ # /prd — Structured PRD Skill
7
+
8
+ Turn a feature idea into implementation-ready artifacts: PRD, UI design, and backlog
9
+ cards. Anti-drift by design — rigid step sequence, persistent state, visible progress.
10
+
11
+ ## Project Context
12
+
13
+ **Reads from `baldart.config.yml`:** `paths.prd_dir`, `paths.backlog_dir`, `paths.references_dir`, `paths.design_system`, `paths.ui_guidelines`, `identity.audience_segments`, `identity.language`.
14
+ **Gated by features:** `features.has_prd_workflow` (skill REFUSES to run when `false`), `features.has_backlog` (Step 5 BLOCKING when `true`), `features.has_design_system` (Step 3 BLOCKING reads), `features.has_adrs` (architectural decisions get logged as ADRs in `paths.adrs_dir`).
15
+ **Overlay:** loads `.baldart/overlays/prd.md` if present — project-specific terminology, card layout overrides, segment names, mandated review gates.
16
+ **On missing/empty keys:** ask the user; do not assume defaults. See `framework/agents/project-context.md` § 3.
17
+
18
+ ---
19
+
20
+ ## EXECUTION MODEL
21
+
22
+ This skill is a **multi-turn conversation**. You do NOT produce all artifacts in one
23
+ message. You ask questions, wait for answers, and iterate.
24
+
25
+ **Flow overview:**
26
+
27
+ | Step | Phase | Reference |
28
+ |------|-------|-----------|
29
+ | 0 | Context Recovery | [discovery-phase.md](references/discovery-phase.md) |
30
+ | 1 | Kickoff | [discovery-phase.md](references/discovery-phase.md) |
31
+ | 2 | Discovery Question Loop | [discovery-phase.md](references/discovery-phase.md) |
32
+ | 2→CR | Change Request (auto/manual) | [prd-add-phase.md](references/prd-add-phase.md) |
33
+ | 2.5 | Research (opzionale) | [research-phase.md](references/research-phase.md) |
34
+ | 3 | UI Design (3a-3d) | [ui-design-phase.md](references/ui-design-phase.md) |
35
+ | 4 | Write PRD | [prd-writing-phase.md](references/prd-writing-phase.md) |
36
+ | 4.5 | API Performance Gate | [api-perf-gate.md](references/api-perf-gate.md) |
37
+ | 4b | Confirm Specs | [prd-writing-phase.md](references/prd-writing-phase.md) |
38
+ | 5 | Backlog Cards | [backlog-phase.md](references/backlog-phase.md) |
39
+ | 6 | Quality Audit | [validation-phase.md](references/validation-phase.md) |
40
+ | 7 | Resolution & Commit | [validation-phase.md](references/validation-phase.md) |
41
+
42
+ **Before starting each phase, read the corresponding reference file.**
43
+
44
+ ---
45
+
46
+ ## HARD RULES
47
+
48
+ 1. Follow steps in order. NEVER skip a step or jump ahead.
49
+ 2. Every step MUST update the state file before proceeding.
50
+ 3. Every gate MUST be satisfied before moving to the next step.
51
+ 4. Use TaskCreate/TaskUpdate for ALL progress tracking.
52
+ 5. When context is compressed or session resumes: run Step 0 first.
53
+ 6. **ONE question per message during discovery. Never batch questions.**
54
+ 7. No code generation. This skill produces planning artifacts only.
55
+ 8. Use exact terminology from `agents/coding-standards.md` and the project's terminology section in `.baldart/overlays/prd.md` (audience segments come from `identity.audience_segments`; domain entities are listed in the overlay).
56
+ 9. Update `${paths.references_dir}/project-status.md` Active Code Context at session start and at commit (AGENTS.md MUST). Skip when the file does not exist in the project.
57
+ 10. **STOP means STOP.** When you see `STOP`, end your message. Do not make more tool
58
+ calls. Do not continue to the next step. Wait for the user.
59
+ 11. **Every message MUST end with the Progress Bar.** No exceptions.
60
+ 12. **Scope Expansion Detection.** During discovery (Step 2), after every user answer,
61
+ check if the response introduces NEW structural entities (endpoints, collections,
62
+ pages, roles, flows) not in the original feature description. If detected, pause
63
+ and offer to run `/prd-add` for impact analysis. See discovery-phase.md for protocol.
64
+ 13. **`canonical_docs` completeness.** Every card generated from a PRD MUST have
65
+ `canonical_docs.ssot_registry_entry` populated (exact row name from the project's SSOT registry — typically `${paths.references_dir}/ssot-registry.md` if it exists; skip when absent). Cards with `data_fields` MUST also have `canonical_docs.data_model_refs` populated with the matching `${paths.references_dir}/collections/*.md` paths (or the project's data-model docs as defined in the overlay). The `prd-card-writer` agent enforces this during Step 5. Missing `canonical_docs` = card is not DONE.
66
+ 14. **Design System SSOT alignment (UI PRDs).** During UI Design phase (Step 3), when `features.has_design_system: true`, you MUST read `${paths.design_system}/INDEX.md` (component index + authority matrix + Quick rules MUST) before generating mockups or component specs. For each UI surface in the PRD, identify the relevant component docs under `${paths.design_system}/components/<Name>.md` and cite them in PRD Section "Canonical Sources". New UI pages/components described in the PRD MUST reuse existing components when available and MUST NOT propose hardcoded hex / shadow / border values when a token contract exists. Multi-tenant theming surfaces (when `features.multi_tenant_theming: true`) MUST reference the project's theming pattern doc; motion specs MUST reference the project's motion pattern doc. Both are listed in `.baldart/overlays/prd.md`.
67
+ 15. **Backlog structure: epic + children (MANDATORY — zero tolerance).** Every PRD that
68
+ produces backlog cards MUST organize them as **1 epic + N children**, regardless of N:
69
+ - **Epic**: `${paths.backlog_dir}/FEAT-XXXX-00-<slug>-epic.yml`. Tracker only — no implementation
70
+ work. Contains AC-EPIC list, Definition of Done, business_rationale, scope,
71
+ scope_boundaries, `execution_strategy` (with parallel_groups computed from the
72
+ dependency graph), and `documentation_impact` map with `owner_card` per doc.
73
+ `group.parent` = the PRD slug string (NOT a FEAT-ID). `group.sequence: 0`.
74
+ `parallel_group: 0`. `depends_on: []`, `blocks: []`.
75
+ - **Children**: `${paths.backlog_dir}/FEAT-XXXX-NN-<sub-slug>.yml` for N=1..M. Each has
76
+ `group.parent: FEAT-XXXX-00` (the epic's actual ID), `group.sequence: N`,
77
+ and `depends_on` / `blocks` referencing sibling child IDs.
78
+
79
+ **FORBIDDEN PATTERNS** — the `prd-card-writer` agent MUST refuse and the skill
80
+ MUST halt:
81
+ - Flat cards `FEAT-XXXX-<slug>.yml` (no `-NN-` segment, no epic parent).
82
+ - `group.parent` set to a placeholder string like `TIPS-EPIC` instead of the
83
+ actual epic FEAT-XXXX-00 id.
84
+ - Skipping the epic when there is only one child card.
85
+ - Reusing the same `FEAT-XXXX` integer for unrelated work (each epic reserves
86
+ the full integer space).
87
+
88
+ **Canonical examples**: `FEAT-0875-00..08` (Survey Analytics Redesign),
89
+ `FEAT-0876-00..11` (Menu TIPS). See `assets/epic-template.yml` for the epic
90
+ structure and `assets/card-template.yml` for child structure.
91
+
92
+ ---
93
+
94
+ ## TEMPLATES
95
+
96
+ Use these templates when creating artifacts:
97
+
98
+ | Artifact | Template |
99
+ |----------|----------|
100
+ | Session state file | [assets/state-template.md](assets/state-template.md) |
101
+ | PRD document | [assets/prd-template.md](assets/prd-template.md) |
102
+ | Backlog epic (always 1) | [assets/epic-template.yml](assets/epic-template.yml) |
103
+ | Backlog child card (N≥1) | [assets/card-template.yml](assets/card-template.yml) |
104
+
105
+ **State file location:** `${paths.prd_dir}/sessions/YYYY-MM-DD-<slug>-state.md`
106
+ **PRD location:** `${paths.prd_dir}/<slug>/PRD.md`
107
+ **Design location:** `${paths.prd_dir}/<slug>/design.html`
108
+ **Cards location:**
109
+ - Epic: `${paths.backlog_dir}/FEAT-XXXX-00-<slug>-epic.yml` (mandatory when `features.has_backlog: true`)
110
+ - Children: `${paths.backlog_dir}/FEAT-XXXX-NN-<sub-slug>.yml` for N=1..M (at least 1)
111
+
112
+ ---
113
+
114
+ ## PROGRESS BAR — MANDATORY ON EVERY MESSAGE
115
+
116
+ At the END of every message (after all text, before stopping), display:
117
+
118
+ ```
119
+ ---
120
+ 📋 **Progresso PRD: <slug>**
121
+
122
+ | # | Fase | Stato |
123
+ |---|------|-------|
124
+ | 1 | Discovery & comprensione | ⬜/🔄/✅ |
125
+ | 1.5 | Ricerca best practice | ⬜/🔄/✅/⏭️ |
126
+ | 2 | Design UI & approvazione | ⬜/🔄/✅/⏭️ |
127
+ | 3 | Conferma specifiche | ⬜/🔄/✅ |
128
+ | 4 | Creazione backlog cards | ⬜/🔄/✅ |
129
+ | 5 | Validazione e commit | ⬜/🔄/✅ |
130
+
131
+ Comprensione: X% (N/M dimensioni coperte) — ISA: N punti identificati
132
+ Ricerca: ⬜ non valutata / 🔍 in corso (background) / ✅ completata / ⏭️ non necessaria
133
+ Prossimo passo: <what happens next>
134
+ ```
135
+
136
+ Legend: ⬜ = da fare, 🔄 = in corso, ✅ = completato, ⏭️ = saltato (N/A)
137
+
138
+ **If your message doesn't end with this table, you violated the skill rules.**
139
+
140
+ ---
141
+
142
+ ## CONTEXT LOADING — Before Discovery (MANDATORY)
143
+
144
+ Before entering the discovery loop, load codebase context using the **context-primer**
145
+ (`/cont`) skill. This centralizes all codebase exploration in one place.
146
+
147
+ 1. Extract 2-4 keywords from the user's feature description.
148
+ 2. Invoke the `Skill` tool with `skill: "context-primer"` passing the keywords
149
+ (e.g., `args: "prize scanning scratch card wheel"`).
150
+ 3. The context-primer launches `codebase-architect` which searches RAG, docs,
151
+ backlog, source code, and git history — returning a compact summary.
152
+ 4. Additionally, use `search_docs` MCP tool (if available) with `mode: "hybrid"` for the feature domain
153
+ to surface related PRDs, ADRs, and specs not covered by context-primer. The
154
+ active retrieval layer is Obsidian-first LightRAG; use Obsidian hits for
155
+ concept and decision context, then verify implementation and stateful claims
156
+ against repo docs/code. If MCP is unavailable, fall back to targeted
157
+ canonical docs plus `rg` over `${paths.references_dir}/`, `${paths.backlog_dir}/`, and `.claude/agents/`.
158
+ 5. Check `${paths.references_dir}/traceability-matrix.md` for source-to-doc mappings (if the project maintains one — skip when absent).
159
+
160
+ The loaded context lives in conversation history and informs ALL subsequent
161
+ discovery dimensions — avoiding redundant per-dimension agent launches.
162
+
163
+ ## QUICK REFERENCE — COMPREHENSION DIMENSIONS
164
+
165
+ The 11 dimensions to cover during discovery:
166
+
167
+ 0. **Business rationale** — why this feature, why now? (business motivation, market signal, expected impact, strategic alignment). Can be resolved from user's initial description or by explicit question (ALWAYS first in discovery loop).
168
+ 1. **Target users** — who uses this feature?
169
+ 2. **User journey** — how does the user flow work?
170
+ 3. **Data model impact** — new collections, fields, interfaces?
171
+ 4. **API impact** — new/modified endpoints?
172
+ 5. **UI impact** — new pages, components, layouts?
173
+ 6. **Permissions/roles** — access control changes?
174
+ 7. **Edge cases** — what can go wrong?
175
+ 8. **Rollout/migration** — feature flags, data migration, backwards compat?
176
+ 9. **Integration surface** — where in the existing system must reference/link to this feature?
177
+ 10. **Test strategy** — E2E needed? scenarios? credentials?
178
+
179
+ Dimension 0 is resolved first: from user's initial description (auto) or explicit question.
180
+ Dimensions 1-8 can be resolved by: context-primer context (auto), targeted codebase-architect (if needed), user answer, or N/A.
181
+ Dimension 9 uses automated codebase scan + user validation (see discovery-phase.md).
182
+ Dimension 10 uses a built-in evaluation tree (see discovery-phase.md).
183
+
184
+ ---
185
+
186
+ ## COMPLETED PROGRESS BAR (for final message)
187
+
188
+ ```
189
+ ---
190
+ 📋 **Progresso PRD: <slug>**
191
+
192
+ | # | Fase | Stato |
193
+ |---|------|-------|
194
+ | 1 | Discovery & comprensione | ✅ |
195
+ | 1.5 | Ricerca best practice | ✅/⏭️ |
196
+ | 2 | Design UI & approvazione | ✅/⏭️ |
197
+ | 3 | Conferma specifiche | ✅ |
198
+ | 4 | Creazione backlog cards | ✅ |
199
+ | 5 | Validazione e commit | ✅ |
200
+
201
+ Comprensione: 100%
202
+ Ricerca: ✅ completata / ⏭️ non necessaria
203
+ **Pronto per l'implementazione.**
204
+ ```
205
+
206
+ ---
207
+
208
+ ## Metrics Log (MANDATORY — after Phase 5 Validazione)
209
+
210
+ After cards are created and committed, log this PRD run to `docs/metrics/skill-runs.jsonl`.
211
+
212
+ **Steps:**
213
+
214
+ 1. Count from the created backlog YAML files:
215
+ - `cards_created`: total cards created in this PRD run
216
+ - `ac_coverage_ratio`: total acceptance_criteria count / total user_stories count across all cards
217
+ - `isa_count`: number of ISA items identified (from the progress bar "ISA: N punti")
218
+ - `has_test_plan_pct`: % of cards that have a `test_plan` field (even if `e2e_required: false`)
219
+ - `has_firestore_indexes_pct`: % of cards that have a `firestore_indexes` field
220
+ - `discovery_iterations`: approximate number of Q&A rounds with the user (count AskUserQuestion calls in this session, default 1 if unknown)
221
+
222
+ 2. Write ONE JSON line (append) to `docs/metrics/skill-runs.jsonl`:
223
+
224
+ ```json
225
+ {"ts":"<ISO-8601-UTC>","skill":"prd","run_id":"prd-<slug>","prd_slug":"<slug>","cards_created":0,"ac_coverage_ratio":0.0,"isa_count":0,"has_test_plan_pct":0.0,"has_firestore_indexes_pct":0.0,"discovery_iterations":1,"prd_path":"${paths.prd_dir}/<slug>/PRD.md"}
226
+ ```
227
+
228
+ **This step is NON-BLOCKING** — if it fails, do not abort. Log "Metrics Log: SKIPPED" in the progress bar.
@@ -0,0 +1,232 @@
1
+ # =============================================================================
2
+ # {{FEAT-ID}} — {{Short title}}
3
+ # =============================================================================
4
+
5
+ id: {{FEAT-ID}}
6
+ title: "{{Full descriptive title}}"
7
+ status: TODO
8
+ priority: {{HIGH|MEDIUM|LOW}}
9
+ owner_agent: claude
10
+ execution_mode: local
11
+
12
+ group:
13
+ parent: {{FEAT-EPIC-ID}}
14
+ sequence: {{N}}
15
+
16
+ git_strategy:
17
+ branch: "feat/{{FEAT-EPIC-ID}}-{{slug}}"
18
+ base: "develop"
19
+ target: "develop"
20
+
21
+ context: |
22
+ {{Background and motivation. Reference PRD sections.}}
23
+
24
+ PRD: docs/prd/{{slug}}/PRD.md ({{FR/NFR refs}})
25
+
26
+ business_rationale: |
27
+ {{2-3 righe che spiegano PERCHÉ questa feature esiste: motivazione di business +
28
+ impatto atteso. Estratto dalla sezione "Ratio Strategica" del PRD (Section 1b).
29
+ Aiuta gli agenti implementatori a comprendere l'intento strategico.}}
30
+
31
+ scope:
32
+ summary: |
33
+ {{What this card delivers in 2-3 lines.}}
34
+ users: [{{CUSTOMER|MERCHANT|SUPER_ADMIN}}]
35
+ value: {{Business value in one line.}}
36
+
37
+ # --- Scope Boundaries (OPTIONAL — include when card is part of a multi-card epic) ---
38
+ # Explicitly separates what THIS card delivers vs what sibling cards handle.
39
+ # Omit for standalone cards with no siblings.
40
+ scope_boundaries:
41
+ in_scope:
42
+ - "{{concise deliverable of THIS card}}"
43
+ out_of_scope:
44
+ - "{{what sibling card handles — reference card ID, e.g. 'UI dropdown (FEAT-XXXX-02)'}}"
45
+
46
+ requirements:
47
+ - >
48
+ {{Concrete, specific requirement.}}
49
+
50
+ # --- Existing Patterns (OPTIONAL — include when card modifies existing code) ---
51
+ # File:line references to code the agent should replicate or extend.
52
+ # "Clear patterns to replicate" is the #1 driver of agent implementation quality (Devin 2025).
53
+ # Omit for greenfield cards where all files are NEW.
54
+ existing_patterns:
55
+ - description: "{{what pattern to replicate or extend}}"
56
+ file: "{{src/path/to/file.ts}}"
57
+ line_range: "~{{start}}-{{end}}"
58
+ anchor_text: "{{short unique string from the code for fuzzy location matching}}"
59
+ note: "{{how to adapt the pattern for this card's needs}}"
60
+
61
+ # --- Anti-Patterns (OPTIONAL — include when there are known pitfalls) ---
62
+ # Explicit DO NOTs. Agents cannot reliably extract anti-patterns from prose.
63
+ # Include both technical (e.g. deprecated APIs) and scope (e.g. don't touch sibling card's files).
64
+ # Omit if no known anti-patterns apply.
65
+ anti_patterns:
66
+ - "DO NOT {{specific prohibited action — be concrete, not generic}}"
67
+
68
+ acceptance_criteria:
69
+ - "[ ] [AC-1] {{Testable criterion}}"
70
+
71
+ # --- Validation Commands (OPTIONAL — include for cards with testable outputs) ---
72
+ # Executable commands the agent runs for self-verification after implementation.
73
+ # Turns acceptance criteria into an autonomous feedback loop (PRP framework).
74
+ # Include static checks always; runtime checks only if e2e_required: true.
75
+ # Omit only for documentation-only or configuration-only cards.
76
+ validation_commands:
77
+ - cmd: "npx tsc --noEmit"
78
+ expect: "exit 0"
79
+ - cmd: "{{verification command, e.g. grep -c 'pattern' src/file.tsx}}"
80
+ expect: "{{expected: 'exit 0', '>= N', 'contains X', '== N'}}"
81
+ note: "{{what this verifies — maps to AC-N}}"
82
+
83
+ definition_of_done:
84
+ - "TypeScript compiles (npx tsc --noEmit)"
85
+ - "Lint passes (npx eslint --max-warnings=0 on changed files)"
86
+ - "{{Additional DoD items}}"
87
+
88
+ depends_on: [{{card IDs}}]
89
+ blocks: [{{card IDs}}]
90
+
91
+ estimated_complexity: {{LOW|MEDIUM|HIGH}}
92
+
93
+ # Parallelization metadata (auto-computed by /prd backlog phase)
94
+ parallel_group: {{N}} # Layer di esecuzione: 0 = prima, 1 = dopo layer 0, etc.
95
+ # Card nello stesso gruppo possono girare in parallelo
96
+
97
+ files_likely_touched:
98
+ - {{path}} ({{NEW|MODIFY}})
99
+
100
+ links:
101
+ prd: "docs/prd/{{slug}}/PRD.md"
102
+ design: "docs/prd/{{slug}}/design.html" # REQUIRED for UI cards, omit for API-only cards
103
+
104
+ # --- Canonical Docs (REQUIRED for cards generated from a PRD) ---
105
+ # Traces which SSOT documents informed this card's requirements.
106
+ # ssot_registry_entry: exact row name in ${paths.references_dir}/ssot-registry.md
107
+ # data_model_refs: collection docs consulted — REQUIRED when data_fields is present
108
+ # additional_refs: ADRs, specs, or other SSOT docs beyond the PRD (omit if none)
109
+ canonical_docs:
110
+ ssot_registry_entry: "{{Exact feature name as it appears in ssot-registry.md}}"
111
+ data_model_refs:
112
+ - "${paths.references_dir}/collections/{{collection}}.md"
113
+ additional_refs:
114
+ - "{{${paths.adrs_dir}/ADR-XXXXX.md}}"
115
+
116
+ test_plan:
117
+ e2e_required: {{true|false}}
118
+ e2e_rationale: "{{reason from evaluation tree}}"
119
+ test_scenarios:
120
+ - id: TS-1
121
+ description: "{{scenario}}"
122
+ maps_to: "US-{{N}} / AC-{{N}}"
123
+ priority: {{HIGH|MEDIUM}}
124
+ test_credentials:
125
+ persona: {{CUSTOMER|MERCHANT|SUPER_ADMIN}}
126
+ auth_method: "{{OTP|password}}"
127
+ credentials: "{{phone: 3486417303 | username/password}}"
128
+ store: "{{store name if merchant}}"
129
+ notes: "{{e.g., OTP inserito manualmente dall'utente}}"
130
+ test_data_prerequisites:
131
+ - "{{any Firestore data needed before tests}}"
132
+
133
+ integration_points:
134
+ - id: ISA-{{N}}
135
+ category: "{{NAVIGATION|PERMISSIONS|SETTINGS|SEARCH|NOTIFICATIONS|DASHBOARD|API_CONSUMERS|SHARED_STATE}}"
136
+ target_file: "{{existing file to modify}}"
137
+ action: "{{what to do}}"
138
+ risk: "{{HIGH|MEDIUM|LOW}}"
139
+
140
+ # --- Input/Output Examples (OPTIONAL — include for API or data transformation cards) ---
141
+ # Concrete examples disambiguate specs. SWE-bench: 38% of issues are underspecified.
142
+ # Omit for pure UI or documentation-only cards.
143
+ input_output_examples:
144
+ - scenario: "{{scenario name}}"
145
+ input: "{{HTTP method + path + body, or function call with args}}"
146
+ output: "{{expected response body or return value}}"
147
+
148
+ # --- Error Handling (OPTIONAL — include for cards with failure modes) ---
149
+ # Structured failure mode specs. Prevents agents from inventing alternative error handling.
150
+ # Omit for type-only or documentation-only cards.
151
+ error_handling:
152
+ - trigger: "{{what goes wrong — e.g. network error, 404, invalid input}}"
153
+ action: "{{programmatic response — e.g. set state to [], retry 3x, throw}}"
154
+ user_feedback: "{{what the user sees, or 'none' for silent fallback}}"
155
+
156
+ # --- Reuse Analysis (OPTIONAL — include for implementation cards) ---
157
+ # Components/utilities to reuse vs create. Agent checks this BEFORE creating new components.
158
+ # Supports both structured format (below) and legacy free-form text for backward compatibility.
159
+ # Omit for documentation-only or configuration-only cards.
160
+ reuse_analysis:
161
+ reuse:
162
+ - component: "{{ComponentName or utilityName}}"
163
+ from: "{{src/path/to/file.ts}}"
164
+ note: "{{how to use or extend it}}"
165
+ create:
166
+ - component: "{{NewComponentName}}"
167
+ reason: "{{why no existing component fits}}"
168
+
169
+ # --- Data Sources (MANDATORY — compile for EVERY card; use [] only for pure docs/config cards) ---
170
+ # High-level overview of every data source or destination touched by this card.
171
+ # Rules:
172
+ # type: firestore → collection name in `path`; field-level detail goes in data_fields below.
173
+ # type: file → repo-relative path, operations (READ|WRITE|APPEND|CREATE|DELETE), format.
174
+ # type: api → URL or endpoint pattern; READ=GET, WRITE=POST/PUT/PATCH, DELETE=DELETE.
175
+ # type: env → env var name; operations always [READ].
176
+ # [] → explicit empty list for cards that read/write NO data (docs, config stubs).
177
+ # NEVER omit this field silently — an empty [] signals the writer verified there are no sources.
178
+ data_sources:
179
+ - type: "{{firestore|file|api|env}}"
180
+ path: "{{collection name | repo-relative file path | API endpoint | env var name}}"
181
+ operations: [{{READ|WRITE|APPEND|CREATE|DELETE}}]
182
+ # format: "{{JSONL|YAML|JSON|markdown|binary}}" # include for file type only
183
+ # note: "{{optional: data shape, why this source}}"
184
+
185
+ # --- Environment Variables (MANDATORY se la card introduce/modifica env vars — altrimenti []) ---
186
+ # Lista di variabili d'ambiente create, modificate o rimosse da questa card.
187
+ # Il coder usa questo campo per compilare l'entry in ${paths.references_dir}/env-vars.md.
188
+ env_vars:
189
+ - name: "{{VAR_NAME}}"
190
+ action: "{{new|modified|removed}}"
191
+ scope: "{{client|server|build|script}}"
192
+ required: "{{always|production|feature:<flag>|optional}}"
193
+ default: "{{valore di default, o '—' se nessuno}}"
194
+ feature_card: "{{nome feature / ID card, es. SPU / ADR-2026-04-24}}"
195
+ note: "{{a cosa serve}}"
196
+
197
+ # --- Data Fields (MANDATORY for cards that read/write Firestore — omit for UI/docs/config only) ---
198
+ # Structured field-name registry for mechanical validation (pre-commit hook + Quality Audit).
199
+ # Field Grounding Rule: EVERY field here MUST be verified via Grep on field-registry.json
200
+ # BEFORE ts_verified is set to true. See prd-card-writer.md Field Grounding Rule.
201
+ # Fields id, createdAt, updatedAt are universal — do NOT include them here.
202
+ data_fields:
203
+ - collection: "{{collectionName}}" # exact key in ${paths.references_dir}/field-registry.json
204
+ field: "{{fieldName}}" # exact field name (verified via Grep)
205
+ type: "{{TypeScript type}}" # e.g. "string", "OccasionType", "boolean"
206
+ status: "{{existing|new|modified|deprecated_removed}}"
207
+ ts_verified: {{true|false}} # true = Grep confirmed field in registry
208
+ source: "{{src/types/booking.ts}}" # TypeScript file where interface is defined
209
+ # schema_ref: "PRD.md#schema-verification" # ONLY for status: new fields
210
+
211
+ firestore_indexes:
212
+ - collection: "{{collection name}}"
213
+ fields:
214
+ - field: "{{field1}}"
215
+ order: "{{ASC|DESC}}"
216
+ - field: "{{field2}}"
217
+ order: "{{ASC|DESC}}"
218
+ query_location: "{{file path where the query lives}}"
219
+ prd_ref: "IDX-{{N}}"
220
+ # Omit this section entirely if the card has no compound Firestore queries.
221
+ # If present, the coder MUST add these indexes to firestore.indexes.json
222
+ # in the same commit as the query code.
223
+
224
+ documentation_impact:
225
+ - "{{doc path}} — {{what to update}}"
226
+
227
+ assumptions:
228
+ - "{{assumption}}"
229
+
230
+ unknowns: []
231
+
232
+ notes: []