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.
- package/CHANGELOG.md +599 -0
- package/README.md +566 -0
- package/VERSION +1 -0
- package/bin/baldart.js +143 -0
- package/framework/.claude/agents/REGISTRY.md +169 -0
- package/framework/.claude/agents/api-perf-cost-auditor.md +291 -0
- package/framework/.claude/agents/code-reviewer.md +350 -0
- package/framework/.claude/agents/codebase-architect.md +391 -0
- package/framework/.claude/agents/coder.md +291 -0
- package/framework/.claude/agents/deep-human-insight.md +198 -0
- package/framework/.claude/agents/doc-reviewer.md +440 -0
- package/framework/.claude/agents/email-deliverability-architect.md +193 -0
- package/framework/.claude/agents/hybrid-ml-architect.md +285 -0
- package/framework/.claude/agents/hyper-gamification-designer.md +149 -0
- package/framework/.claude/agents/legal-counsel-gdpr.md +179 -0
- package/framework/.claude/agents/marketing-conversion-strategist.md +162 -0
- package/framework/.claude/agents/motion-expert.md +108 -0
- package/framework/.claude/agents/onboarding-architect-lead.md +230 -0
- package/framework/.claude/agents/plan-auditor.md +546 -0
- package/framework/.claude/agents/prd-card-writer.md +372 -0
- package/framework/.claude/agents/prd.md +744 -0
- package/framework/.claude/agents/qa-sentinel.md +305 -0
- package/framework/.claude/agents/remotion-animator-orchestrator.md +218 -0
- package/framework/.claude/agents/security-reviewer.md +276 -0
- package/framework/.claude/agents/senior-researcher.md +175 -0
- package/framework/.claude/agents/seo-analytics-strategist.md +156 -0
- package/framework/.claude/agents/skill-improver.md +61 -0
- package/framework/.claude/agents/ui-expert.md +191 -0
- package/framework/.claude/agents/visual-designer.md +190 -0
- package/framework/.claude/agents/website-orchestrator.md +118 -0
- package/framework/.claude/agents/wiki-curator.md +145 -0
- package/framework/.claude/commands/baldart-push.md +15 -0
- package/framework/.claude/commands/check.md +237 -0
- package/framework/.claude/commands/codexreview.md +203 -0
- package/framework/.claude/commands/design-review.md +11 -0
- package/framework/.claude/commands/issue-review.md +34 -0
- package/framework/.claude/commands/new.md +331 -0
- package/framework/.claude/commands/qa.md +257 -0
- package/framework/.claude/hooks/framework-edit-gate.js +208 -0
- package/framework/.claude/hooks/lint-before-commit.sh.template +66 -0
- package/framework/.claude/settings.local.json.example +32 -0
- package/framework/.claude/skills/api-design-principles/SKILL.md +567 -0
- package/framework/.claude/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.claude/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.claude/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.claude/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.claude/skills/baldart-push/SKILL.md +222 -0
- package/framework/.claude/skills/bug/SKILL.md +200 -0
- package/framework/.claude/skills/bug/references/logging-patterns.md +174 -0
- package/framework/.claude/skills/capture/SKILL.md +125 -0
- package/framework/.claude/skills/capture/references/synthesis-template.md +42 -0
- package/framework/.claude/skills/context-primer/SKILL.md +189 -0
- package/framework/.claude/skills/copywriting/SKILL.md +273 -0
- package/framework/.claude/skills/copywriting/references/copy-frameworks.md +338 -0
- package/framework/.claude/skills/copywriting/references/natural-transitions.md +252 -0
- package/framework/.claude/skills/doc-writing-for-rag/SKILL.md +119 -0
- package/framework/.claude/skills/doc-writing-for-rag/references/before-after-examples.md +291 -0
- package/framework/.claude/skills/doc-writing-for-rag/references/compact-templates.md +183 -0
- package/framework/.claude/skills/doc-writing-for-rag/references/frontmatter-minimal.md +112 -0
- package/framework/.claude/skills/doc-writing-for-rag/references/line-count-targets.md +110 -0
- package/framework/.claude/skills/doc-writing-for-rag/references/schemas-and-errors.md +129 -0
- package/framework/.claude/skills/find-skills/SKILL.md +133 -0
- package/framework/.claude/skills/frontend-design/LICENSE.txt +177 -0
- package/framework/.claude/skills/frontend-design/SKILL.md +84 -0
- package/framework/.claude/skills/gamification-design/SKILL.md +130 -0
- package/framework/.claude/skills/issue-review/SKILL.md +45 -0
- package/framework/.claude/skills/kie-ai/SKILL.md +262 -0
- package/framework/.claude/skills/kie-ai/references/models-catalog.md +272 -0
- package/framework/.claude/skills/kie-ai/scripts/kie_api.sh +209 -0
- package/framework/.claude/skills/kie-ai/scripts/remove_greenscreen.py +69 -0
- package/framework/.claude/skills/kie-ai/scripts/setup_api_key.sh +77 -0
- package/framework/.claude/skills/motion-design/LICENSE +21 -0
- package/framework/.claude/skills/motion-design/README.md +82 -0
- package/framework/.claude/skills/motion-design/SKILL.md +336 -0
- package/framework/.claude/skills/motion-design/director/choreography.md +93 -0
- package/framework/.claude/skills/motion-design/director/context-adaptation.md +83 -0
- package/framework/.claude/skills/motion-design/director/core-philosophy.md +53 -0
- package/framework/.claude/skills/motion-design/director/decision-framework.md +91 -0
- package/framework/.claude/skills/motion-design/director/disney-principles.md +102 -0
- package/framework/.claude/skills/motion-design/director/emotion-mapping.md +71 -0
- package/framework/.claude/skills/motion-design/director/motion-personality.md +89 -0
- package/framework/.claude/skills/motion-design/director/narrative-structure.md +62 -0
- package/framework/.claude/skills/motion-design/patterns/ambient-continuous.md +81 -0
- package/framework/.claude/skills/motion-design/patterns/entrance-exit.md +82 -0
- package/framework/.claude/skills/motion-design/patterns/multi-element.md +69 -0
- package/framework/.claude/skills/motion-design/patterns/state-feedback.md +96 -0
- package/framework/.claude/skills/motion-design/reference/property-selection.md +95 -0
- package/framework/.claude/skills/motion-design/reference/quality-checklist.md +67 -0
- package/framework/.claude/skills/motion-design/reference/timing-easing-tables.md +106 -0
- package/framework/.claude/skills/motion-design/reference/troubleshooting.md +73 -0
- package/framework/.claude/skills/new/SKILL.md +1687 -0
- package/framework/.claude/skills/playwright-skill/API_REFERENCE.md +652 -0
- package/framework/.claude/skills/playwright-skill/SKILL.md +157 -0
- package/framework/.claude/skills/playwright-skill/package.json +26 -0
- package/framework/.claude/skills/prd/SKILL.md +228 -0
- package/framework/.claude/skills/prd/assets/card-template.yml +232 -0
- package/framework/.claude/skills/prd/assets/epic-template.yml +190 -0
- package/framework/.claude/skills/prd/assets/prd-template.md +230 -0
- package/framework/.claude/skills/prd/assets/state-template.md +78 -0
- package/framework/.claude/skills/prd/references/api-perf-gate.md +152 -0
- package/framework/.claude/skills/prd/references/audit-phase.md +478 -0
- package/framework/.claude/skills/prd/references/backlog-phase.md +145 -0
- package/framework/.claude/skills/prd/references/discovery-phase.md +359 -0
- package/framework/.claude/skills/prd/references/impact-analysis.md +233 -0
- package/framework/.claude/skills/prd/references/prd-add-phase.md +214 -0
- package/framework/.claude/skills/prd/references/prd-writing-phase.md +145 -0
- package/framework/.claude/skills/prd/references/research-phase.md +216 -0
- package/framework/.claude/skills/prd/references/ui-design-phase.md +61 -0
- package/framework/.claude/skills/prd/references/validation-phase.md +72 -0
- package/framework/.claude/skills/prd-add/SKILL.md +222 -0
- package/framework/.claude/skills/prd-add/references/impact-analysis.md +233 -0
- package/framework/.claude/skills/remotion-best-practices/SKILL.md +48 -0
- package/framework/.claude/skills/remotion-best-practices/rules/3d.md +86 -0
- package/framework/.claude/skills/remotion-best-practices/rules/animations.md +29 -0
- package/framework/.claude/skills/remotion-best-practices/rules/assets/charts-bar-chart.tsx +173 -0
- package/framework/.claude/skills/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +100 -0
- package/framework/.claude/skills/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +108 -0
- package/framework/.claude/skills/remotion-best-practices/rules/assets.md +78 -0
- package/framework/.claude/skills/remotion-best-practices/rules/audio.md +169 -0
- package/framework/.claude/skills/remotion-best-practices/rules/calculate-metadata.md +104 -0
- package/framework/.claude/skills/remotion-best-practices/rules/can-decode.md +75 -0
- package/framework/.claude/skills/remotion-best-practices/rules/charts.md +58 -0
- package/framework/.claude/skills/remotion-best-practices/rules/compositions.md +141 -0
- package/framework/.claude/skills/remotion-best-practices/rules/display-captions.md +184 -0
- package/framework/.claude/skills/remotion-best-practices/rules/extract-frames.md +229 -0
- package/framework/.claude/skills/remotion-best-practices/rules/fonts.md +152 -0
- package/framework/.claude/skills/remotion-best-practices/rules/get-audio-duration.md +58 -0
- package/framework/.claude/skills/remotion-best-practices/rules/get-video-dimensions.md +68 -0
- package/framework/.claude/skills/remotion-best-practices/rules/get-video-duration.md +58 -0
- package/framework/.claude/skills/remotion-best-practices/rules/gifs.md +141 -0
- package/framework/.claude/skills/remotion-best-practices/rules/images.md +130 -0
- package/framework/.claude/skills/remotion-best-practices/rules/import-srt-captions.md +69 -0
- package/framework/.claude/skills/remotion-best-practices/rules/light-leaks.md +73 -0
- package/framework/.claude/skills/remotion-best-practices/rules/lottie.md +67 -0
- package/framework/.claude/skills/remotion-best-practices/rules/maps.md +401 -0
- package/framework/.claude/skills/remotion-best-practices/rules/measuring-dom-nodes.md +34 -0
- package/framework/.claude/skills/remotion-best-practices/rules/measuring-text.md +143 -0
- package/framework/.claude/skills/remotion-best-practices/rules/parameters.md +98 -0
- package/framework/.claude/skills/remotion-best-practices/rules/sequencing.md +118 -0
- package/framework/.claude/skills/remotion-best-practices/rules/subtitles.md +36 -0
- package/framework/.claude/skills/remotion-best-practices/rules/tailwind.md +11 -0
- package/framework/.claude/skills/remotion-best-practices/rules/text-animations.md +20 -0
- package/framework/.claude/skills/remotion-best-practices/rules/timing.md +179 -0
- package/framework/.claude/skills/remotion-best-practices/rules/transcribe-captions.md +70 -0
- package/framework/.claude/skills/remotion-best-practices/rules/transitions.md +197 -0
- package/framework/.claude/skills/remotion-best-practices/rules/transparent-videos.md +106 -0
- package/framework/.claude/skills/remotion-best-practices/rules/trimming.md +52 -0
- package/framework/.claude/skills/remotion-best-practices/rules/videos.md +171 -0
- package/framework/.claude/skills/seo-audit/SKILL.md +394 -0
- package/framework/.claude/skills/seo-audit/references/aeo-geo-patterns.md +279 -0
- package/framework/.claude/skills/seo-audit/references/ai-writing-detection.md +190 -0
- package/framework/.claude/skills/simplify/SKILL.md +137 -0
- package/framework/.claude/skills/skill-creator/LICENSE.txt +202 -0
- package/framework/.claude/skills/skill-creator/SKILL.md +356 -0
- package/framework/.claude/skills/skill-creator/references/output-patterns.md +82 -0
- package/framework/.claude/skills/skill-creator/references/workflows.md +28 -0
- package/framework/.claude/skills/skill-creator/scripts/init_skill.py +303 -0
- package/framework/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
- package/framework/.claude/skills/skill-creator/scripts/quick_validate.py +95 -0
- package/framework/.claude/skills/ui-design/SKILL.md +199 -0
- package/framework/.claude/skills/ui-design/references/component-discovery.md +54 -0
- package/framework/.claude/skills/ui-design/references/evaluation.md +171 -0
- package/framework/.claude/skills/ui-design/references/generation.md +109 -0
- package/framework/.claude/skills/ui-design/references/inventory.md +59 -0
- package/framework/.claude/skills/webapp-testing/LICENSE.txt +202 -0
- package/framework/.claude/skills/webapp-testing/SKILL.md +123 -0
- package/framework/.claude/skills/webapp-testing/examples/console_logging.py +35 -0
- package/framework/.claude/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/framework/.claude/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/framework/.claude/skills/webapp-testing/scripts/with_server.py +106 -0
- package/framework/.claude/skills/worktree-manager/SKILL.md +680 -0
- package/framework/AGENTS.md +240 -0
- package/framework/agents/api-contracts.md +137 -0
- package/framework/agents/architecture.md +145 -0
- package/framework/agents/coding-standards.md +148 -0
- package/framework/agents/data-model.md +110 -0
- package/framework/agents/deployment-protocol.md +232 -0
- package/framework/agents/design-review.md +172 -0
- package/framework/agents/env-reference.md +171 -0
- package/framework/agents/github-issue-subagent.md +252 -0
- package/framework/agents/index.md +261 -0
- package/framework/agents/llm-wiki-methodology.md +216 -0
- package/framework/agents/maintenance-protocol.md +305 -0
- package/framework/agents/observability.md +162 -0
- package/framework/agents/performance.md +155 -0
- package/framework/agents/project-context.md +145 -0
- package/framework/agents/runbook.md +208 -0
- package/framework/agents/security.md +168 -0
- package/framework/agents/skills-mapping.md +286 -0
- package/framework/agents/testing.md +111 -0
- package/framework/agents/workflows.md +215 -0
- package/framework/docs/PROJECT-CONFIGURATION.md +336 -0
- package/framework/docs/references/brand-guidelines.md +170 -0
- package/framework/docs/references/ui-guidelines.template.md +182 -0
- package/framework/routines/code-review.routine.yml +46 -0
- package/framework/routines/doc-review.routine.yml +45 -0
- package/framework/routines/ds-drift.routine.yml +52 -0
- package/framework/routines/full-sweep.routine.yml +51 -0
- package/framework/routines/index.yml +70 -0
- package/framework/routines/skill-improve.routine.yml +50 -0
- package/framework/routines/wiki-review.routine.yml +45 -0
- package/framework/templates/baldart.config.template.yml +113 -0
- package/framework/templates/breaking-change-checklist.md +484 -0
- package/framework/templates/feature-card.template.yml +125 -0
- package/framework/templates/overlays/README.md +44 -0
- package/framework/templates/overlays/copywriting.fidelity-example.md +62 -0
- package/framework/templates/overlays/ui-design.fidelity-example.md +75 -0
- package/framework/templates/skill-project-context.snippet.md +19 -0
- package/framework/templates/spec.template.md +208 -0
- package/package.json +51 -0
- package/src/commands/add.js +229 -0
- package/src/commands/configure.js +385 -0
- package/src/commands/doctor.js +486 -0
- package/src/commands/migrate.js +185 -0
- package/src/commands/push.js +0 -0
- package/src/commands/routines.js +269 -0
- package/src/commands/status.js +130 -0
- package/src/commands/update.js +419 -0
- package/src/commands/version.js +88 -0
- package/src/utils/contamination.js +400 -0
- package/src/utils/git.js +181 -0
- package/src/utils/hooks.js +152 -0
- package/src/utils/routine-adapters/claude-code-cloud.js +78 -0
- package/src/utils/routine-adapters/cron.js +138 -0
- package/src/utils/routine-adapters/github-actions.js +141 -0
- package/src/utils/routine-adapters/index.js +21 -0
- package/src/utils/routines.js +166 -0
- package/src/utils/state.js +143 -0
- package/src/utils/symlinks.js +425 -0
- package/src/utils/ui.js +133 -0
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
# Quality Audit Phase (Step 6)
|
|
2
|
+
|
|
3
|
+
**Precondition:** Backlog cards created (Step 5 complete). Card IDs available from Step 5.
|
|
4
|
+
|
|
5
|
+
> **YOLO MODE**: All agents spawned via the Task tool MUST use `mode: "bypassPermissions"`. No exceptions.
|
|
6
|
+
|
|
7
|
+
This phase coordinates parallel audit agents on backlog cards **before development starts** to catch issues early. Each audit agent runs as an independent teammate with its own context window (prevents context saturation).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Step 6.1 — Identify Cards
|
|
12
|
+
|
|
13
|
+
Use the card IDs produced by Step 5 (prd-card-writer output). No user prompt needed — cards are a mechanical derivation from the approved PRD.
|
|
14
|
+
|
|
15
|
+
Read each card from `${paths.backlog_dir}/*.yml` to understand scope, requirements, acceptance criteria, and planned changes.
|
|
16
|
+
|
|
17
|
+
## Step 6.2 — Signal Detection: Security (AUTOMATIC)
|
|
18
|
+
|
|
19
|
+
Scan each card for security signals to decide whether the `security-reviewer` agent joins the audit.
|
|
20
|
+
|
|
21
|
+
**Triggered if ANY card meets ONE OR MORE conditions:**
|
|
22
|
+
|
|
23
|
+
| Signal | Where to look |
|
|
24
|
+
|--------|---------------|
|
|
25
|
+
| **New or modified API route** | `files_likely_touched` contains `route.ts`, `api/`, or requirements mention new endpoints |
|
|
26
|
+
| **Authentication/authorization changes** | Requirements/files mention `withAuth`, `checkPermission`, `permissions`, login, session, token, JWT, OAuth |
|
|
27
|
+
| **Firestore security rules** | `files_likely_touched` contains `firestore.rules` or requirements mention rule changes |
|
|
28
|
+
| **External integrations** | Requirements mention webhooks, third-party APIs, payment, SMS, email providers, or external callbacks |
|
|
29
|
+
| **File upload or media handling** | Requirements mention upload, image, file, media, or `files_likely_touched` contains upload/media paths |
|
|
30
|
+
| **User input processing** | Requirements mention forms, search, filters, or query parameters that flow into DB queries or server logic |
|
|
31
|
+
| **Multi-tenant data access** | Requirements mention cross-store, cross-merchant, or data visible to multiple tenants |
|
|
32
|
+
| **Sensitive data handling** | Requirements mention PII, credentials, tokens, secrets, or personal data |
|
|
33
|
+
|
|
34
|
+
**How to assess**: Read each card's `requirements`, `acceptance_criteria`, `files_likely_touched`, `areas`, `existing_patterns`, `anti_patterns`, `validation_commands`, `error_handling`, and `scope_boundaries` fields. This is a deterministic check — no LLM judgment calls needed.
|
|
35
|
+
|
|
36
|
+
**Output**: Set internal flag `security_review_needed: true/false`. If ANY card triggers → include `security-reviewer` for ALL cards.
|
|
37
|
+
|
|
38
|
+
**Transparency**: Inform the user:
|
|
39
|
+
- If triggered: "Security review attivato — rilevate superfici esposte: [list signals]."
|
|
40
|
+
- If not: "Security review non necessario — nessuna superficie esposta rilevata."
|
|
41
|
+
|
|
42
|
+
## Step 6.3 — Signal Detection: Performance (AUTOMATIC)
|
|
43
|
+
|
|
44
|
+
Scan each card for performance signals to decide whether the `api-perf-cost-auditor` agent joins.
|
|
45
|
+
|
|
46
|
+
**Triggered if ANY card meets ONE OR MORE conditions:**
|
|
47
|
+
|
|
48
|
+
| Signal | Where to look |
|
|
49
|
+
|--------|---------------|
|
|
50
|
+
| **New or modified API route** | `files_likely_touched` contains `route.ts`, `api/`, or requirements mention new endpoints |
|
|
51
|
+
| **Firestore read/write operations** | Requirements mention collection, query, document, write, transaction, batch, listener, onSnapshot |
|
|
52
|
+
| **List/search/filter endpoints** | Requirements mention listing, searching, filtering, sorting, pagination, or "show all" |
|
|
53
|
+
| **Background/batch processing** | Requirements mention cron, batch, import, export, bulk, queue, or scheduled tasks |
|
|
54
|
+
| **Real-time/live updates** | Requirements mention real-time, live, auto-update, listener, onSnapshot, subscription |
|
|
55
|
+
| **File upload/download** | Requirements mention upload, download, file, media, image processing, or signed URL |
|
|
56
|
+
| **Caching decisions** | Requirements mention cache, revalidate, freshness, or card lacks caching strategy for read-heavy endpoints |
|
|
57
|
+
| **Cost-sensitive operations** | Requirements mention counters, aggregations, analytics, or denormalization |
|
|
58
|
+
|
|
59
|
+
**Output**: Set internal flag `perf_review_needed: true/false`. If ANY card triggers → include `api-perf-cost-auditor` for ALL cards.
|
|
60
|
+
|
|
61
|
+
**Transparency**: Inform the user:
|
|
62
|
+
- If triggered: "Performance audit attivato — rilevate superfici con impatto costi/performance: [list signals]."
|
|
63
|
+
- If not: "Performance audit non necessario — nessuna superficie API/data rilevata."
|
|
64
|
+
|
|
65
|
+
## Step 6.4 — Adjacent Card Retrieval (dependency detection)
|
|
66
|
+
|
|
67
|
+
> Source: Arora 2023 — LLMs miss 60-70% of implicit dependencies without retrieval. With adjacent context, miss rate drops to ~30%.
|
|
68
|
+
|
|
69
|
+
To detect implicit dependencies, gather adjacent context:
|
|
70
|
+
|
|
71
|
+
1. For each card being audited, check its `depends_on` field for referenced cards → read those cards.
|
|
72
|
+
2. Read ALL cards in `${paths.backlog_dir}/` that share the same `epic:` or `parent:` field as the audited cards.
|
|
73
|
+
3. Read ALL cards whose `files_likely_touched` overlaps with any audited card's files.
|
|
74
|
+
4. Build a summary for each adjacent card: `{id, title, status, requirements (first 3 lines), files_likely_touched}`.
|
|
75
|
+
5. Include these summaries in each audit agent's task description (Step 6.6) under `## Adjacent Cards`.
|
|
76
|
+
|
|
77
|
+
This enables agents to detect:
|
|
78
|
+
- File conflicts between cards planned for parallel execution
|
|
79
|
+
- Missing `depends_on` entries where Card A modifies a file Card B reads
|
|
80
|
+
- Duplicated requirements across sibling cards
|
|
81
|
+
- Ordering constraints not captured in the dependency graph
|
|
82
|
+
|
|
83
|
+
## Step 6.5 — Gather Context (lightweight)
|
|
84
|
+
|
|
85
|
+
Gather **only metadata** to build agent prompts — do NOT read full file contents into your own context:
|
|
86
|
+
|
|
87
|
+
1. Read the backlog card(s) YAML — store the raw text for each card.
|
|
88
|
+
2. If the card has `files_likely_touched` → note the file paths (do NOT read the files yourself).
|
|
89
|
+
3. If the card has `links.prd` → note the PRD path (do NOT read it yourself).
|
|
90
|
+
4. If the card references parent/child cards → note their paths.
|
|
91
|
+
|
|
92
|
+
**The audit agents will read files themselves in their own context windows.**
|
|
93
|
+
|
|
94
|
+
## Step 6.6 — Create Agent Team & Launch Audits
|
|
95
|
+
|
|
96
|
+
### 6.6a. Create the team
|
|
97
|
+
|
|
98
|
+
Use `TeamCreate` with name `check-audit` and description based on the cards being reviewed.
|
|
99
|
+
|
|
100
|
+
### 6.6b. Create tasks
|
|
101
|
+
|
|
102
|
+
Use `TaskCreate` to create one task per audit agent per card:
|
|
103
|
+
|
|
104
|
+
- For **N cards × M agents**, create **N × M tasks** (excluding Codex plan-audit — see 6.6d).
|
|
105
|
+
- Each task subject: `[CARD-ID] <agent-type> audit`
|
|
106
|
+
- Each task description: full card YAML + adjacent card summaries + file paths + PRD path + instructions.
|
|
107
|
+
|
|
108
|
+
**IMPORTANT**: Embed the full card YAML directly in the task description. For source files and PRDs, only provide paths — agents read those themselves.
|
|
109
|
+
|
|
110
|
+
### 6.6c. Launch teammate agents in parallel
|
|
111
|
+
|
|
112
|
+
For each audit agent type (except plan-auditor), spawn ONE teammate using the `Task` tool with `team_name: "check-audit"`.
|
|
113
|
+
|
|
114
|
+
**Agent type mapping:**
|
|
115
|
+
|
|
116
|
+
| Audit Role | `subagent_type` | Name | Condition |
|
|
117
|
+
|------------|-----------------|------|-----------|
|
|
118
|
+
| ~~plan-auditor~~ | — | — | **Replaced by Codex adversarial audit (Step 6.6d)** |
|
|
119
|
+
| code-reviewer | `code-reviewer` | `code-reviewer` | Always |
|
|
120
|
+
| doc-reviewer | `doc-reviewer` | `doc-reviewer` | Always |
|
|
121
|
+
| api-perf-cost-auditor | `api-perf-cost-auditor` | `perf-auditor` | `perf_review_needed: true` |
|
|
122
|
+
| security-reviewer | `general-purpose` | `security-reviewer` | `security_review_needed: true` |
|
|
123
|
+
|
|
124
|
+
**Note**: security-reviewer uses `subagent_type: "general-purpose"` — load its prompt from `.claude/agents/security-reviewer.md`.
|
|
125
|
+
|
|
126
|
+
Launch ALL applicable teammates in a single message (parallel tool calls).
|
|
127
|
+
|
|
128
|
+
### 6.6d. Codex Adversarial Plan Audit (replaces plan-auditor)
|
|
129
|
+
|
|
130
|
+
> **Why Codex**: Cross-model validation — GPT-5.4 reviews artifacts produced by Claude,
|
|
131
|
+
> providing genuine diversity of perspective. Codex reads files directly from the filesystem.
|
|
132
|
+
|
|
133
|
+
Launch **in parallel** with the teammate agents (6.6c). Use `Bash` with `run_in_background: true` so Claude can launch teammate agents concurrently:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
AUDIT_FILE="/tmp/codex-plan-audit-$(date +%Y-%m-%d).md" && \
|
|
137
|
+
CODEX_SCRIPT="$(ls -d ~/.claude/plugins/marketplaces/openai-codex/plugins/codex/scripts/codex-companion.mjs ~/.claude/plugins/cache/openai-codex/codex/*/scripts/codex-companion.mjs 2>/dev/null | sort -V | tail -1)" && \
|
|
138
|
+
[ -z "$CODEX_SCRIPT" ] && echo "CODEX_NOT_FOUND" && exit 1; \
|
|
139
|
+
node "$CODEX_SCRIPT" task --wait "
|
|
140
|
+
<task>
|
|
141
|
+
Perform an adversarial plan audit of the following backlog cards as a pre-development quality gate.
|
|
142
|
+
Your job is to find the strongest reasons these cards are NOT ready for implementation.
|
|
143
|
+
Default to skepticism. Assume each card can fail in subtle, high-cost ways.
|
|
144
|
+
Do not give credit for good intent or likely follow-up work.
|
|
145
|
+
|
|
146
|
+
Cards to audit (read each file):
|
|
147
|
+
${CARD_PATHS}
|
|
148
|
+
|
|
149
|
+
PRD reference: ${PRD_PATH}
|
|
150
|
+
Data model reference: ${paths.references_dir}/data-model.md
|
|
151
|
+
API reference: ${paths.api_index}
|
|
152
|
+
Adjacent cards context: ${ADJACENT_CARD_PATHS}
|
|
153
|
+
</task>
|
|
154
|
+
|
|
155
|
+
<attack_surface>
|
|
156
|
+
INVEST criteria violations:
|
|
157
|
+
- Independent: hidden dependencies on in-flight cards not in depends_on
|
|
158
|
+
- Negotiable: requirements too rigid or too vague for implementation
|
|
159
|
+
- Valuable: card does not deliver user-visible or system-critical value
|
|
160
|
+
- Estimable: scope unclear, cannot estimate effort
|
|
161
|
+
- Small: card too large for one dev session
|
|
162
|
+
- Testable: acceptance criteria not binary pass/fail
|
|
163
|
+
|
|
164
|
+
Requirements smell detection:
|
|
165
|
+
- Ambiguous pronouns without clear antecedent
|
|
166
|
+
- Passive voice hiding the actor
|
|
167
|
+
- Unbounded scope (all, every, any) without limits
|
|
168
|
+
- Missing error/failure paths (happy path only)
|
|
169
|
+
- Implicit ordering assumptions
|
|
170
|
+
- Conflicting constraints
|
|
171
|
+
- Missing units or thresholds
|
|
172
|
+
- Compound requirements covering multiple behaviors
|
|
173
|
+
- Dependency shadows: implicit deps not in depends_on
|
|
174
|
+
|
|
175
|
+
Firestore-specific (this project uses Firestore):
|
|
176
|
+
- Unbounded reads without .limit()
|
|
177
|
+
- Offset-based pagination instead of cursor-based
|
|
178
|
+
- getDoc() in loops instead of batch reads
|
|
179
|
+
- Missing composite index declarations
|
|
180
|
+
- Transaction hotspot risks
|
|
181
|
+
|
|
182
|
+
Card structure:
|
|
183
|
+
- files_likely_touched missing entries or conflicting across cards
|
|
184
|
+
- areas field incomplete
|
|
185
|
+
- git_strategy set to TBD
|
|
186
|
+
- acceptance_criteria not binary testable
|
|
187
|
+
- definition_of_done missing items
|
|
188
|
+
- existing_patterns with stale line_range or missing anchor_text
|
|
189
|
+
- validation_commands missing for cards with testable outputs
|
|
190
|
+
- anti_patterns empty for cards modifying shared state
|
|
191
|
+
- scope_boundaries missing for multi-card epics
|
|
192
|
+
- error_handling missing for cards with network calls or user input
|
|
193
|
+
- reuse_analysis missing for cards creating new components
|
|
194
|
+
</attack_surface>
|
|
195
|
+
|
|
196
|
+
<grounding_rules>
|
|
197
|
+
Every finding MUST quote the exact YAML field or PRD text it references.
|
|
198
|
+
Do not invent issues without evidence from the card files.
|
|
199
|
+
If a conclusion depends on inference, state that explicitly and keep confidence honest.
|
|
200
|
+
Prefer one strong finding over several weak ones. Do not dilute with filler.
|
|
201
|
+
</grounding_rules>
|
|
202
|
+
|
|
203
|
+
<structured_output_contract>
|
|
204
|
+
For each card return:
|
|
205
|
+
|
|
206
|
+
### [CARD-ID] — Adversarial Plan Findings
|
|
207
|
+
|
|
208
|
+
- [ ] **Finding title** — Description. (Severity: HIGH/MEDIUM/LOW) [Target: <field>]
|
|
209
|
+
> **Evidence:** exact quote from card YAML or PRD
|
|
210
|
+
> **Source:** file path or field name
|
|
211
|
+
> **Recommendation:** concrete fix
|
|
212
|
+
|
|
213
|
+
Target tags: requirements, acceptance_criteria, definition_of_done, files_likely_touched, depends_on, areas, git_strategy, unknowns, notes.
|
|
214
|
+
|
|
215
|
+
Severity rules:
|
|
216
|
+
- HIGH: data loss, security bypass, breaking change, or unbounded read
|
|
217
|
+
- MEDIUM: missing dep, vague AC, incomplete files_likely_touched
|
|
218
|
+
- LOW: informational only
|
|
219
|
+
|
|
220
|
+
End with a one-line ship/no-ship assessment per card.
|
|
221
|
+
Suppress findings where the strongest false-positive argument is convincing.
|
|
222
|
+
</structured_output_contract>
|
|
223
|
+
" 2>&1 | tee "$AUDIT_FILE"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Variable interpolation** (build the command string before execution):
|
|
227
|
+
- `${CARD_PATHS}`: newline-separated list of `- backlog/FEAT-XXXX-*.yml` paths from Step 5
|
|
228
|
+
- `${PRD_PATH}`: the PRD file path from the session state
|
|
229
|
+
- `${ADJACENT_CARD_PATHS}`: newline-separated list from Step 6.4
|
|
230
|
+
|
|
231
|
+
**Timeout**: Set `timeout: 300000` (5 minutes) on the Bash call.
|
|
232
|
+
|
|
233
|
+
**Output handling**: The `tee` in the command persists output to `$AUDIT_FILE` (`/tmp/codex-plan-audit-{YYYY-MM-DD}.md`) as it streams. This ensures findings survive regardless of foreground/background execution or stdout truncation.
|
|
234
|
+
1. Read findings from `/tmp/codex-plan-audit-{YYYY-MM-DD}.md` (always available — written by `tee`).
|
|
235
|
+
2. If the file is empty or missing, fall back to `plan-auditor` subagent.
|
|
236
|
+
3. Merge into the consolidated report at Step 6.7 under `### Codex Plan Audit Findings`.
|
|
237
|
+
|
|
238
|
+
**Fallback**: If Codex is unavailable (not installed, not authenticated, or timeout), fall back to the `plan-auditor` subagent with `subagent_type: "plan-auditor"`. Log the fallback reason in the audit report.
|
|
239
|
+
|
|
240
|
+
### 6.6d. Teammate prompt template
|
|
241
|
+
|
|
242
|
+
Each teammate receives this prompt:
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
## Identity
|
|
246
|
+
|
|
247
|
+
You are a SKEPTICAL auditor for a pre-development audit team ("check-audit").
|
|
248
|
+
Your default stance is that the card is NOT ready for implementation.
|
|
249
|
+
Do not rationalize away issues. Do not give benefit of the doubt.
|
|
250
|
+
If something COULD be a problem, flag it. The challenge pass (later) will filter false positives.
|
|
251
|
+
Your job is RECALL, not precision — catch everything, filter later.
|
|
252
|
+
|
|
253
|
+
## Your Workflow
|
|
254
|
+
|
|
255
|
+
1. Call `TaskList` to see your assigned tasks.
|
|
256
|
+
2. For each task (in ID order):
|
|
257
|
+
a. Call `TaskGet` to read the full task description (card YAML + adjacent cards + file paths).
|
|
258
|
+
b. Mark task as `in_progress` via `TaskUpdate`.
|
|
259
|
+
c. Read any source files or PRDs referenced in the task (use Read tool).
|
|
260
|
+
d. Perform your audit (see instructions below).
|
|
261
|
+
e. Run the Challenge Pass on your findings (see below).
|
|
262
|
+
f. Run Severity Calibration on surviving findings (see below).
|
|
263
|
+
g. **Write findings into the task description** via `TaskUpdate` — append a `## FINDINGS` section.
|
|
264
|
+
h. Send a brief notification to orchestrator via `SendMessage` (task ID + one-line summary only).
|
|
265
|
+
i. Mark task as `completed` via `TaskUpdate`.
|
|
266
|
+
3. After all tasks: send "all tasks complete" to orchestrator.
|
|
267
|
+
|
|
268
|
+
**IMPORTANT**: Always write findings to task description (step g) before notification (step h). Task description is durable; message is just a ping.
|
|
269
|
+
|
|
270
|
+
## Audit Instructions
|
|
271
|
+
|
|
272
|
+
{AGENT_SPECIFIC_INSTRUCTIONS}
|
|
273
|
+
|
|
274
|
+
## Output Format (mandatory evidence quotes)
|
|
275
|
+
|
|
276
|
+
For each card, return findings as:
|
|
277
|
+
|
|
278
|
+
### [CARD-ID] — {Agent Role} Findings
|
|
279
|
+
|
|
280
|
+
- [ ] **Finding title** — Description of the issue, risk, or gap. (Severity: HIGH/MEDIUM/LOW) [Target: <field>]
|
|
281
|
+
> **Evidence:** "<exact quote from the card YAML, PRD, or source file>"
|
|
282
|
+
> **Source:** `<file path or field name>`
|
|
283
|
+
|
|
284
|
+
**MANDATORY**: Every finding MUST include an evidence quote — a direct excerpt that grounds it. Findings without quotable evidence MUST be discarded. State: "Considered but discarded — no quotable evidence found."
|
|
285
|
+
|
|
286
|
+
If no findings: "No issues found for [CARD-ID]."
|
|
287
|
+
|
|
288
|
+
### `[Target: <field>]` tag reference (mandatory on every finding)
|
|
289
|
+
|
|
290
|
+
| Target tag | When to use |
|
|
291
|
+
|---|---|
|
|
292
|
+
| `[Target: requirements]` | Missing or wrong requirement text |
|
|
293
|
+
| `[Target: acceptance_criteria]` | Missing AC, vague AC needing rewrite |
|
|
294
|
+
| `[Target: definition_of_done]` | Missing DoD checkbox |
|
|
295
|
+
| `[Target: files_likely_touched]` | Missing file path |
|
|
296
|
+
| `[Target: depends_on]` | Missing dependency card ID |
|
|
297
|
+
| `[Target: areas]` | Missing area entry (api, docs, data, ui) |
|
|
298
|
+
| `[Target: git_strategy]` | `git_strategy: TBD` or wrong value |
|
|
299
|
+
| `[Target: unknowns]` | Unresolved unknown to surface |
|
|
300
|
+
| `[Target: existing_patterns]` | Missing or stale pattern reference |
|
|
301
|
+
| `[Target: validation_commands]` | Missing verification command |
|
|
302
|
+
| `[Target: anti_patterns]` | Missing DO NOT constraint |
|
|
303
|
+
| `[Target: scope_boundaries]` | Missing scope boundary item |
|
|
304
|
+
| `[Target: input_output_examples]` | Missing or incorrect I/O example |
|
|
305
|
+
| `[Target: error_handling]` | Missing failure mode spec |
|
|
306
|
+
| `[Target: reuse_analysis]` | Missing reuse opportunity or wrong path |
|
|
307
|
+
| `[Target: notes]` | LOW severity only — informational |
|
|
308
|
+
|
|
309
|
+
## Challenge Pass (mandatory before reporting)
|
|
310
|
+
|
|
311
|
+
After generating initial findings, challenge EACH one:
|
|
312
|
+
|
|
313
|
+
"What is the strongest argument that this is a false positive?"
|
|
314
|
+
|
|
315
|
+
Consider:
|
|
316
|
+
- Is this already handled elsewhere in the codebase?
|
|
317
|
+
- Is this a convention in this project I'm unfamiliar with?
|
|
318
|
+
- Is the card intentionally deferring this to a later card?
|
|
319
|
+
- Am I applying a generic best practice that doesn't fit this context?
|
|
320
|
+
|
|
321
|
+
**Suppress the finding if the FP argument is convincing.** Record suppressed findings:
|
|
322
|
+
|
|
323
|
+
<details>
|
|
324
|
+
<summary>Suppressed findings (N items — challenge pass)</summary>
|
|
325
|
+
- **Finding title** — FP argument: <why suppressed>
|
|
326
|
+
</details>
|
|
327
|
+
|
|
328
|
+
## Severity Calibration (after challenge pass)
|
|
329
|
+
|
|
330
|
+
After challenge pass, rank ALL surviving findings relative to each other by impact:
|
|
331
|
+
|
|
332
|
+
1. List all surviving findings in order of impact (most impactful first).
|
|
333
|
+
2. Assign severity based on position:
|
|
334
|
+
- Top 20% → HIGH (must apply)
|
|
335
|
+
- Middle 40% → MEDIUM (should apply)
|
|
336
|
+
- Bottom 40% → LOW (notes only)
|
|
337
|
+
3. Exception: data loss, security bypass, or breaking change = automatically HIGH regardless of position.
|
|
338
|
+
|
|
339
|
+
### Severity Calibration Examples
|
|
340
|
+
|
|
341
|
+
**HIGH** (must fix before implementation):
|
|
342
|
+
- "acceptance_criteria says 'user can see bookings' but doesn't specify pagination → unbounded Firestore read"
|
|
343
|
+
> Evidence: "AC-2: Il merchant visualizza le prenotazioni" — no limit/pagination mentioned
|
|
344
|
+
|
|
345
|
+
**MEDIUM** (should fix, skip if ambiguous):
|
|
346
|
+
- "files_likely_touched missing the API route doc update"
|
|
347
|
+
> Evidence: files_likely_touched lists "src/app/api/v1/<domain>/route.ts" but not "${paths.references_dir}/api/<domain>.md"
|
|
348
|
+
|
|
349
|
+
**LOW** (note only):
|
|
350
|
+
- "Card title could be more descriptive"
|
|
351
|
+
> Evidence: title is "Booking API" — functional but generic
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### Agent-specific instructions
|
|
355
|
+
|
|
356
|
+
**plan-auditor**: **Handled by Codex adversarial audit (Step 6.6d).** Not included in the teammate agent team. If Codex is unavailable, the fallback plan-auditor uses INVEST criteria, DoR checks, and requirements smell detection — see Step 6.6d attack_surface for the full checklist.
|
|
357
|
+
|
|
358
|
+
**code-reviewer**: Read existing files in `files_likely_touched` and assess: conflicts with existing patterns? Architectural concerns? Alignment with conventions (per `identity.design_philosophy`, project lint/type-check rules, `identity.language`)? Existing utilities the card should reuse but doesn't mention? Check `## Adjacent Cards` for parallel file modifications.
|
|
359
|
+
|
|
360
|
+
**doc-reviewer**: Check documentation links, PRD references are valid and aligned, planned changes requiring doc updates not mentioned. Verify `files_likely_touched` includes doc files. Check `areas` completeness. Flag `git_strategy: TBD`. Include Obsidian trigger assessment (section H) in findings -- evaluate whether the planned docs will require KB sync per `.claude/skills/doc-reviewer-support/references/obsidian-integration.md`.
|
|
361
|
+
|
|
362
|
+
**api-perf-cost-auditor** (only when `perf_review_needed: true`): Apply the 5-gate protocol from `.claude/agent-memory/senior-researcher/api-perf-cost-audit-protocol.md`. Read referenced source files. Check: unbounded reads, N+1 queries, fan-out writes, missing pagination, offset pagination, missing GET Route Handler caching, listener vs polling costs, 4.5MB payload limits, transaction hotspots.
|
|
363
|
+
|
|
364
|
+
**security-reviewer** (only when `security_review_needed: true`): Read `.claude/agents/security-reviewer.md` for full methodology. Focus on: auth gaps, input validation, multi-tenant isolation, Firestore rules alignment, sensitive data exposure, webhook validation, rate limiting, IDOR risks.
|
|
365
|
+
|
|
366
|
+
## Step 6.7 — Collect & Merge Findings
|
|
367
|
+
|
|
368
|
+
Wait for all teammates AND Codex to complete, then:
|
|
369
|
+
1. **Read teammate findings from the task store** (not `SendMessage`). Use `TaskList` to check all tasks are `completed`, then `TaskGet` on each to read the `## FINDINGS` section.
|
|
370
|
+
2. **Read Codex plan audit findings** from `/tmp/codex-plan-audit-{YYYY-MM-DD}.md` (persisted by `tee` in Step 6.6d). If the file is empty or missing, note "Codex audit unavailable — fallback to plan-auditor" and invoke the `plan-auditor` subagent.
|
|
371
|
+
|
|
372
|
+
Consolidate into a single report:
|
|
373
|
+
|
|
374
|
+
```
|
|
375
|
+
# Pre-Dev Audit Report — YYYY-MM-DD
|
|
376
|
+
|
|
377
|
+
## [CARD-ID-1] — Card Title
|
|
378
|
+
|
|
379
|
+
### Codex Plan Audit Findings (GPT-5.4)
|
|
380
|
+
- [ ] Finding 1...
|
|
381
|
+
|
|
382
|
+
### Code Review Findings
|
|
383
|
+
- [ ] Finding 1...
|
|
384
|
+
|
|
385
|
+
### Doc Review Findings
|
|
386
|
+
- [ ] Finding 1...
|
|
387
|
+
|
|
388
|
+
### Performance Findings (if applicable)
|
|
389
|
+
- [ ] Finding 1...
|
|
390
|
+
|
|
391
|
+
### Security Findings (if applicable)
|
|
392
|
+
- [ ] Finding 1...
|
|
393
|
+
|
|
394
|
+
## [CARD-ID-2] — Card Title
|
|
395
|
+
...
|
|
396
|
+
|
|
397
|
+
## Audit Engine Summary
|
|
398
|
+
- Plan audit: Codex GPT-5.4 (cross-model) | Fallback: Claude plan-auditor
|
|
399
|
+
- Code review: Claude code-reviewer
|
|
400
|
+
- Doc review: Claude doc-reviewer
|
|
401
|
+
- Performance: Claude api-perf-cost-auditor (if triggered)
|
|
402
|
+
- Security: Claude security-reviewer (if triggered)
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
**CRITICAL — Persist report to file before proceeding.** Write to `/tmp/check-audit-report-{YYYY-MM-DD}.md` using the Write tool. This ensures findings survive context compaction.
|
|
406
|
+
|
|
407
|
+
Present the consolidated report to the user.
|
|
408
|
+
|
|
409
|
+
## Step 6.8 — Cleanup Team
|
|
410
|
+
|
|
411
|
+
Use `SendMessage` with `type: "shutdown_request"` to shut down all teammates, then `TeamDelete`.
|
|
412
|
+
|
|
413
|
+
## Step 6.9 — Apply Findings to Cards
|
|
414
|
+
|
|
415
|
+
**Goal**: Transform each card from "audited" to "implementation-ready" by editing YAML fields directly.
|
|
416
|
+
|
|
417
|
+
**Read findings from the persisted report file** (`/tmp/check-audit-report-{YYYY-MM-DD}.md`).
|
|
418
|
+
|
|
419
|
+
### Field mapping rules
|
|
420
|
+
|
|
421
|
+
| Target tag | Card field | Action |
|
|
422
|
+
|---|---|---|
|
|
423
|
+
| `[Target: requirements]` | `requirements` | Append missing requirement or rewrite existing one |
|
|
424
|
+
| `[Target: acceptance_criteria]` | `acceptance_criteria` | Append new `"[ ] [AC-N] ..."` item or rewrite vague AC |
|
|
425
|
+
| `[Target: definition_of_done]` | `definition_of_done` | Append new `"[ ] ..."` item |
|
|
426
|
+
| `[Target: files_likely_touched]` | `files_likely_touched` | Append missing path (no duplicates) |
|
|
427
|
+
| `[Target: depends_on]` | `depends_on` | Append missing card ID |
|
|
428
|
+
| `[Target: areas]` | `areas` | Add missing area key/value |
|
|
429
|
+
| `[Target: git_strategy]` | `git_strategy` | Replace `TBD` with `feat/<CARD-ID>-<slug> from develop` |
|
|
430
|
+
| `[Target: unknowns]` | `unknowns` | Append new `[U-N] UNKNOWN: ...` entry |
|
|
431
|
+
| `[Target: existing_patterns]` | `existing_patterns` | Append missing pattern reference or fix stale line_range/anchor_text |
|
|
432
|
+
| `[Target: validation_commands]` | `validation_commands` | Append missing verification command |
|
|
433
|
+
| `[Target: anti_patterns]` | `anti_patterns` | Append missing DO NOT constraint |
|
|
434
|
+
| `[Target: scope_boundaries]` | `scope_boundaries` | Add missing in_scope or out_of_scope item |
|
|
435
|
+
| `[Target: input_output_examples]` | `input_output_examples` | Append missing scenario or fix incorrect example |
|
|
436
|
+
| `[Target: error_handling]` | `error_handling` | Append missing failure mode or fix incorrect action |
|
|
437
|
+
| `[Target: reuse_analysis]` | `reuse_analysis` | Add missing reuse opportunity or correct file path |
|
|
438
|
+
| `[Target: notes]` | `notes` | Audit trail only (Step 6.9c) |
|
|
439
|
+
|
|
440
|
+
### Severity policy
|
|
441
|
+
|
|
442
|
+
- **HIGH**: MUST apply. Card cannot be safely implemented without these.
|
|
443
|
+
- **MEDIUM**: SHOULD apply. Skip only if human judgment needed (mark `[MANUAL]`).
|
|
444
|
+
- **LOW**: Do NOT edit structured fields. Audit trail note only.
|
|
445
|
+
|
|
446
|
+
### Audit trail in `notes`
|
|
447
|
+
|
|
448
|
+
After applying all edits, append to `notes`:
|
|
449
|
+
|
|
450
|
+
```yaml
|
|
451
|
+
## Applied by quality audit — YYYY-MM-DD
|
|
452
|
+
Applied N findings to structured fields (H high, M medium).
|
|
453
|
+
Manual review needed: [list [MANUAL] items, or "none"].
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### Per-card workflow
|
|
457
|
+
|
|
458
|
+
For each card:
|
|
459
|
+
1. Read persisted report → collect all findings for this card ID.
|
|
460
|
+
2. Read current card YAML.
|
|
461
|
+
3. Apply HIGH findings first, then MEDIUM, then write audit trail.
|
|
462
|
+
4. Write updated card YAML.
|
|
463
|
+
5. Re-read to verify edits landed correctly.
|
|
464
|
+
|
|
465
|
+
**Note**: No separate commit here — the validation-phase.md Step 7 handles committing all PRD artifacts together.
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## Maintenance Note
|
|
470
|
+
|
|
471
|
+
> Source: Anthropic "Harness Design for Long-Running Apps" — capability-boundary adaptation principle.
|
|
472
|
+
|
|
473
|
+
Every component in this audit encodes an assumption about what the model can't do alone. Periodically (every 2-3 months or on major model upgrade), stress-test each component:
|
|
474
|
+
|
|
475
|
+
- Remove one component at a time, measure audit quality delta.
|
|
476
|
+
- If delta < 5%, remove permanently.
|
|
477
|
+
- **Current load-bearing assumptions**: challenge pass, adjacent card retrieval, evidence quotes, adversarial evaluator tuning.
|
|
478
|
+
- **Assumptions to re-test**: agent team separation (could single-agent handle N cards?), relative severity ranking (does absolute assignment work with better models?).
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Backlog Cards Phase (Step 5)
|
|
2
|
+
|
|
3
|
+
**Precondition:** PRD specs confirmed by user.
|
|
4
|
+
|
|
5
|
+
Mark task 4 as `in_progress`.
|
|
6
|
+
|
|
7
|
+
## MANDATORY Card Structure (zero tolerance — read first)
|
|
8
|
+
|
|
9
|
+
Every PRD generates **1 epic card + N children**, regardless of N. The
|
|
10
|
+
`prd-card-writer` agent enforces this; the skill MUST verify it post-generation
|
|
11
|
+
and HALT if violated.
|
|
12
|
+
|
|
13
|
+
- **Epic**: `backlog/FEAT-XXXX-00-<slug>-epic.yml` — tracker only (no code work);
|
|
14
|
+
contains AC-EPIC, execution_strategy with parallel groups, documentation_impact
|
|
15
|
+
map.
|
|
16
|
+
- **Children**: `backlog/FEAT-XXXX-NN-<sub-slug>.yml` for N=1..M — atomic
|
|
17
|
+
implementation cards. `group.parent: FEAT-XXXX-00`, `group.sequence: N`.
|
|
18
|
+
|
|
19
|
+
**Forbidden** (post-write verification: skill MUST `ls backlog/FEAT-XXXX-*.yml`
|
|
20
|
+
and confirm a `-00-...-epic.yml` exists, plus at least one `-NN-` child):
|
|
21
|
+
|
|
22
|
+
- Flat cards `FEAT-XXXX-<slug>.yml` (no `-NN-` segment).
|
|
23
|
+
- `group.parent` as placeholder string (e.g. `TIPS-EPIC`) instead of the
|
|
24
|
+
epic's actual `FEAT-XXXX-00` id.
|
|
25
|
+
- Epic missing when N=1.
|
|
26
|
+
|
|
27
|
+
If the agent returns flat cards: re-invoke with explicit correction prompt. Do
|
|
28
|
+
NOT commit flat cards.
|
|
29
|
+
|
|
30
|
+
Reference examples: `FEAT-0875-00..08` (Survey Analytics), `FEAT-0876-00..11`
|
|
31
|
+
(Menu TIPS).
|
|
32
|
+
|
|
33
|
+
Templates: `.claude/skills/prd/assets/epic-template.yml` for the epic,
|
|
34
|
+
`.claude/skills/prd/assets/card-template.yml` for children.
|
|
35
|
+
|
|
36
|
+
## Specialist Audits (conditional, before cards)
|
|
37
|
+
|
|
38
|
+
Invoke mandatory specialist agents when the feature qualifies:
|
|
39
|
+
|
|
40
|
+
- **`hyper-gamification-designer`** — MUST invoke if the feature touches B2C rewards,
|
|
41
|
+
loyalty, engagement, progression, points, referrals, or retention loops. Integrate
|
|
42
|
+
findings into requirements and risk sections of the PRD.
|
|
43
|
+
- **`api-perf-cost-auditor`** — already executed at Step 4.5 (API Performance Gate)
|
|
44
|
+
if the PRD contained API/data surfaces. Do NOT re-invoke here unless the card
|
|
45
|
+
introduces NEW API patterns not covered in the PRD (e.g., card splits a single
|
|
46
|
+
endpoint into multiple, or adds a caching layer not in the original design).
|
|
47
|
+
If re-invoked, scope the audit to card-specific additions only.
|
|
48
|
+
|
|
49
|
+
If neither applies, note "Specialist audits: N/A" in the state file.
|
|
50
|
+
|
|
51
|
+
## Complexity Gate (pre-write)
|
|
52
|
+
|
|
53
|
+
Before delegating to `prd-card-writer`, check each logical card boundary:
|
|
54
|
+
|
|
55
|
+
1. Count expected `files_likely_touched` — flag if **> 12**.
|
|
56
|
+
2. Count expected `acceptance_criteria` — flag if **> 5**.
|
|
57
|
+
|
|
58
|
+
**If flagged:**
|
|
59
|
+
|
|
60
|
+
- Warn: `"COMPLEXITY: [scope] has [N] files / [M] ACs — consider splitting by layer (API/UI) or by flow."`
|
|
61
|
+
- **Advisory, not blocking.** User can confirm to proceed. Log override in state file.
|
|
62
|
+
|
|
63
|
+
**If clean:** proceed silently.
|
|
64
|
+
|
|
65
|
+
## Card Writing — Delegated to `prd-card-writer` Agent
|
|
66
|
+
|
|
67
|
+
This phase is delegated to the **`prd-card-writer`** agent (`subagent_type: "prd-card-writer"`)
|
|
68
|
+
to free main context and ensure high-precision card generation under `effort: high`.
|
|
69
|
+
|
|
70
|
+
**DO NOT use `EnterPlanMode`/`ExitPlanMode`.** This skill manages its own multi-turn
|
|
71
|
+
approval flow. Plan mode risks context loss if the user accidentally accepts
|
|
72
|
+
"clear context and accept plan", destroying the entire skill session.
|
|
73
|
+
|
|
74
|
+
### Invocation
|
|
75
|
+
|
|
76
|
+
Launch the agent with all necessary context in the prompt:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
Agent(
|
|
80
|
+
subagent_type: "prd-card-writer",
|
|
81
|
+
prompt: """
|
|
82
|
+
Generate backlog cards from the approved PRD.
|
|
83
|
+
|
|
84
|
+
PRD path: <prd_path>
|
|
85
|
+
State file path: <state_file_path>
|
|
86
|
+
Card template: .claude/skills/prd/assets/card-template.yml
|
|
87
|
+
Feature slug: <slug>
|
|
88
|
+
|
|
89
|
+
The PRD has been approved by the user. Read it in full, read the state file
|
|
90
|
+
for discovery context, and produce atomic cards following your instructions.
|
|
91
|
+
|
|
92
|
+
The card template includes 7 agent-optimization fields (existing_patterns,
|
|
93
|
+
validation_commands, anti_patterns, scope_boundaries, input_output_examples,
|
|
94
|
+
error_handling, reuse_analysis). Populate them per your field-mapping instructions.
|
|
95
|
+
Use Grep/Glob to verify file paths and line numbers for existing_patterns and reuse_analysis.
|
|
96
|
+
|
|
97
|
+
Write all card YAML files to backlog/.
|
|
98
|
+
Update the state file ## Backlog Cards section with card list and traceability matrices.
|
|
99
|
+
Return the Parallel Execution Map summary.
|
|
100
|
+
""",
|
|
101
|
+
mode: "bypassPermissions"
|
|
102
|
+
)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### What the agent handles
|
|
106
|
+
|
|
107
|
+
The `prd-card-writer` agent owns the entire card writing pipeline:
|
|
108
|
+
- Card atomicity and splitting
|
|
109
|
+
- All required fields per card (27+ fields from template, including 7 agent-optimization fields)
|
|
110
|
+
- business_rationale field (extracted from PRD Section 1b — 2-3 line summary per card)
|
|
111
|
+
- `existing_patterns` with codebase-verified file:line references (requires Grep during card generation)
|
|
112
|
+
- `validation_commands` derived from acceptance criteria and definition_of_done
|
|
113
|
+
- `anti_patterns` extracted from PRD constraints and cross-card scope boundaries
|
|
114
|
+
- `scope_boundaries` with explicit in/out of scope and sibling card references
|
|
115
|
+
- `input_output_examples` from PRD API contracts (Section 5)
|
|
116
|
+
- `error_handling` from PRD failure modes and edge cases (Sections 5, 11)
|
|
117
|
+
- `reuse_analysis` with codebase-verified component references (requires Grep/Glob during generation)
|
|
118
|
+
- FR/NFR traceability matrix
|
|
119
|
+
- ISA traceability matrix (if PRD has section 15)
|
|
120
|
+
- UI Element traceability matrix (if PRD has UI Element Inventory)
|
|
121
|
+
- Parallel group computation (dependency graph + file-conflict map)
|
|
122
|
+
- `execution_strategy` block on epic parent card
|
|
123
|
+
- State file update with card list and matrices
|
|
124
|
+
- `env_vars` field: per ogni card che introduce/modifica/rimuove env vars (rilevabile da PRD Section 6 o da requirements che menzionano `process.env`, segreti, API keys, feature flags), popola il campo con `action: new|modified|removed`, `scope`, `required`, `note`. Se la card non tocca env vars, scrivi `env_vars: []`.
|
|
125
|
+
|
|
126
|
+
### What stays in the main context
|
|
127
|
+
|
|
128
|
+
- Specialist audit invocations (above) — they may modify the PRD before cards are generated
|
|
129
|
+
- Presenting results to the user (the agent returns summary, main context displays it)
|
|
130
|
+
- Proceeding to Step 6 (validation phase)
|
|
131
|
+
|
|
132
|
+
## Present and Proceed
|
|
133
|
+
|
|
134
|
+
Present the plan to the user (traceability matrix + parallel execution map) for
|
|
135
|
+
visibility, then **proceed immediately** — no approval gate needed at this stage.
|
|
136
|
+
The PRD specs were already confirmed in Step 4b; card creation is a mechanical
|
|
137
|
+
derivation from approved specs, so a second approval would be redundant.
|
|
138
|
+
|
|
139
|
+
Mark task 4 as `completed`. Update state file `## Backlog Cards` with card list.
|
|
140
|
+
|
|
141
|
+
**MANDATORY: Immediately proceed to Step 6 in the SAME turn.** Read
|
|
142
|
+
[validation-phase.md](validation-phase.md) and execute the quality audit protocol
|
|
143
|
+
from [audit-phase.md](audit-phase.md) with the card IDs. Do NOT display the progress
|
|
144
|
+
bar and stop. Do NOT wait for user input. Do NOT ask the user if they want to skip
|
|
145
|
+
the audit. Just run it.
|