@majordigital/create-acorn 1.6.7 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/bin/create-acorn.mjs +39 -1
- package/package.json +1 -1
- package/template/.claude/commands/audit-accessibility-motion.md +161 -0
- package/template/.claude/commands/audit-analytics-conversion.md +149 -0
- package/template/.claude/commands/audit-code-maintainability.md +149 -0
- package/template/.claude/commands/audit-documentation-onboarding.md +172 -0
- package/template/.claude/commands/audit-edge-api-resilience.md +156 -0
- package/template/.claude/commands/audit-headless-cms.md +241 -0
- package/template/.claude/commands/audit-i18n-localization.md +173 -0
- package/template/.claude/commands/audit-performance-metrics.md +176 -0
- package/template/.claude/commands/audit-security-compliance.md +144 -0
- package/template/.claude/commands/audit-seo-semantic.md +214 -0
- package/template/scripts/check-links.mjs +7 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Run a Documentation & Onboarding audit on the current project (Module 10)"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Audit: Documentation & Onboarding
|
|
6
|
+
|
|
7
|
+
**Role:** Technical Writer & Developer Experience (DX) Lead
|
|
8
|
+
|
|
9
|
+
**Objective:** Perform an exhaustive audit of knowledge transfer quality, developer onboarding experience, and documentation completeness. Do not limit yourself to the items listed — explore the file structure dynamically to find deep-seated gaps.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Audit Workflow
|
|
14
|
+
|
|
15
|
+
You MUST follow all phases in order. **Do NOT implement any fixes before the Stop & Review stage.**
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
### Phase 1: Static Analysis
|
|
20
|
+
|
|
21
|
+
Inspect the codebase using Grep, Glob, and Read tools. Discover files dynamically — do not assume locations.
|
|
22
|
+
|
|
23
|
+
**1. README Integrity**
|
|
24
|
+
- Read the `README.md` (if present). Evaluate whether it clearly covers:
|
|
25
|
+
- Project overview and purpose
|
|
26
|
+
- Prerequisites (Node version, package manager, required accounts)
|
|
27
|
+
- Setup instructions (clone, install, environment variables, first run)
|
|
28
|
+
- CMS setup and content editing workflow (Prismic Slice Machine)
|
|
29
|
+
- Available npm scripts with descriptions
|
|
30
|
+
- Deployment notes
|
|
31
|
+
- Any known gotchas or setup friction
|
|
32
|
+
- Flag any section that is missing, outdated, or insufficient for a new developer to get started in under 30 minutes.
|
|
33
|
+
|
|
34
|
+
**2. Environment Variable Documentation**
|
|
35
|
+
- Check for `.env.example` (or `.env.local.example`). Verify:
|
|
36
|
+
- Every required environment variable is listed with a placeholder value
|
|
37
|
+
- Each variable has an inline comment explaining what it's for and where to get it
|
|
38
|
+
- No real credentials or secrets are in the example file
|
|
39
|
+
- The list matches all variables actually used in the codebase (check `process.env.` usage)
|
|
40
|
+
- Flag any variable used in code but missing from `.env.example`.
|
|
41
|
+
|
|
42
|
+
**3. CLAUDE.md / AI Context Files**
|
|
43
|
+
- Check if a `CLAUDE.md` exists. Verify it covers:
|
|
44
|
+
- Tech stack overview
|
|
45
|
+
- Project-specific commands and workflows
|
|
46
|
+
- Key architectural patterns (slice pattern, theme system, etc.)
|
|
47
|
+
- Naming conventions
|
|
48
|
+
- Key files and their purposes
|
|
49
|
+
- This file directly impacts AI-assisted development quality — flag any major gaps.
|
|
50
|
+
|
|
51
|
+
**4. Complex Code Documentation**
|
|
52
|
+
- Search for non-obvious code patterns that lack explanatory comments:
|
|
53
|
+
- Custom hooks with complex logic
|
|
54
|
+
- Utility functions with non-obvious inputs/outputs (e.g., `toSlug()`, `getThemeClass()`, `fetchKnowledge()`)
|
|
55
|
+
- Workarounds or browser-specific fixes (these especially need a "why" comment)
|
|
56
|
+
- Third-party integration patterns (Zoho OAuth, Prismic preview mode)
|
|
57
|
+
- Standard code (simple components, straightforward CRUD) does NOT need comments — flag only non-obvious logic.
|
|
58
|
+
|
|
59
|
+
**5. CMS Slice / Architecture Guide**
|
|
60
|
+
- Determine if a guide exists explaining how to:
|
|
61
|
+
- Create or extend a new Prismic slice
|
|
62
|
+
- Follow the variation pattern (`switch(toSlug(variation))`)
|
|
63
|
+
- Apply the theme system
|
|
64
|
+
- Register a new slice in the slice registry
|
|
65
|
+
- This guide is critical for onboarding CMS developers and content engineers.
|
|
66
|
+
- Flag if no such guide exists (in README, CLAUDE.md, or a separate doc).
|
|
67
|
+
|
|
68
|
+
**6. Type Definitions & Self-Documentation**
|
|
69
|
+
- Scan `src/types/` for shared type definitions.
|
|
70
|
+
- Verify exported types have clear names that are self-explanatory.
|
|
71
|
+
- Flag any complex union types or utility types that lack a JSDoc comment explaining their purpose.
|
|
72
|
+
|
|
73
|
+
**7. Deployment & Operations Docs**
|
|
74
|
+
- Verify documentation exists (in README or a separate doc) covering:
|
|
75
|
+
- How to deploy the project
|
|
76
|
+
- How ISR revalidation works (Prismic webhooks → `/api/revalidate`)
|
|
77
|
+
- How to rotate Zoho CRM OAuth tokens
|
|
78
|
+
- How Prismic preview mode is configured
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### Phase 2: Research (Run in Parallel)
|
|
83
|
+
|
|
84
|
+
**First**, read `.agents/patterns/documentation-onboarding.md` if it exists. Use it as a baseline — skip re-researching topics already covered unless the file is older than 3 months.
|
|
85
|
+
|
|
86
|
+
Launch a research subagent to fetch current best practices. The subagent should search for:
|
|
87
|
+
- Developer onboarding documentation best practices (2025–2026)
|
|
88
|
+
- README standards for Next.js projects
|
|
89
|
+
- JSDoc best practices for TypeScript projects
|
|
90
|
+
- AI-assisted development context files (CLAUDE.md, Copilot instructions) standards
|
|
91
|
+
|
|
92
|
+
Compile findings as a reference list with URLs.
|
|
93
|
+
|
|
94
|
+
**Then**, create or update `.agents/patterns/documentation-onboarding.md` with any new research findings, best practices, code examples, and reference URLs. Pattern files should be refreshed every 3 months to stay current with evolving standards.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### Phase 3: Findings & Checklist
|
|
99
|
+
|
|
100
|
+
Combine Phase 1 and Phase 2 results. For every issue found:
|
|
101
|
+
- Assign a severity: **CRITICAL** / **HIGH** / **MEDIUM** / **LOW**
|
|
102
|
+
- Include the exact file path (or "Missing — no file found")
|
|
103
|
+
- State the recommended fix or content to add
|
|
104
|
+
|
|
105
|
+
Save the full audit report to `.agents/audits/documentation-onboarding-{YYYY-MM-DD}.md`.
|
|
106
|
+
|
|
107
|
+
Also create a condensed implementation checklist at `.agents/checklist/documentation-onboarding-{YYYY-MM-DD}.md` — group items by severity tier with commit-and-review gates between each tier. After implementing each tier: stage all changes (`git add`) but do **NOT** commit. Tell the user the changes are staged for review, and **wait for explicit approval** before proceeding to the next tier. The user will review the diff, commit themselves, and tell the agent when to continue. Reference existing files in `.agents/checklist/` for the pattern.
|
|
108
|
+
|
|
109
|
+
Save the full audit report to `.agents/audits/documentation-onboarding-{YYYY-MM-DD}.md`:
|
|
110
|
+
|
|
111
|
+
```markdown
|
|
112
|
+
# Documentation & Onboarding Audit — {date}
|
|
113
|
+
|
|
114
|
+
## Summary
|
|
115
|
+
Brief overview of documentation coverage and key findings.
|
|
116
|
+
|
|
117
|
+
## Research References
|
|
118
|
+
- [Source](url) — why it's relevant
|
|
119
|
+
|
|
120
|
+
## Findings Checklist
|
|
121
|
+
|
|
122
|
+
- [ ] **[CRITICAL]** No .env.example file — new developers have no reference for required variables
|
|
123
|
+
- Fix: Create `.env.example` listing all `process.env.*` variables used in the codebase
|
|
124
|
+
- [ ] **[HIGH]** README missing CMS setup instructions for Prismic Slice Machine
|
|
125
|
+
- Fix: Add section explaining `npm run slicemachine` and how to create/edit slices
|
|
126
|
+
- [ ] **[MEDIUM]** `fetchKnowledge()` utility has no JSDoc — its parameters and return type are non-obvious — `src/lib/utils.ts:142`
|
|
127
|
+
- Fix: Add JSDoc comment explaining the function's purpose, parameters, and return shape
|
|
128
|
+
|
|
129
|
+
## Command Outputs
|
|
130
|
+
- .env.example check: {exists / missing}
|
|
131
|
+
- README word count and sections found: {result}
|
|
132
|
+
- CLAUDE.md check: {exists / missing}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### 🛑 STOP & REVIEW
|
|
138
|
+
|
|
139
|
+
**Do not proceed past this point until the user explicitly approves.**
|
|
140
|
+
|
|
141
|
+
Present to the user:
|
|
142
|
+
1. The full documentation gap report
|
|
143
|
+
2. Each proposed fix — note that most fixes are documentation additions, not code changes
|
|
144
|
+
3. Research references used
|
|
145
|
+
|
|
146
|
+
Then ask:
|
|
147
|
+
> "I've completed the Documentation & Onboarding audit. The checklist has been saved to `.agents/audits/documentation-onboarding-{date}.md`. Shall I proceed with implementing the fixes above?"
|
|
148
|
+
|
|
149
|
+
**Wait for explicit confirmation before continuing.**
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
### Phase 4: Implementation
|
|
154
|
+
|
|
155
|
+
After user approval, implement each approved fix in priority order. For each fix:
|
|
156
|
+
- Make the change using Edit tools
|
|
157
|
+
- Run `npm run check` after every meaningful change
|
|
158
|
+
- Do not rewrite entire files — make targeted, focused additions
|
|
159
|
+
- **Update the checklist immediately** — mark completed items with `[x]` in `.agents/checklist/documentation-onboarding-{YYYY-MM-DD}.md` as each item is implemented, not at the end
|
|
160
|
+
- If the user skips or rejects an item, add it to the **Skipped / Rejected Changes** section at the bottom of the checklist using a heading + bullet format per item (e.g., `### #N — Item name` with `- **Status:**` and `- **Reason:**`)
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### Phase 5: Update Checklist
|
|
165
|
+
|
|
166
|
+
After all tiers are complete:
|
|
167
|
+
- Verify every item is accounted for: completed `[x]`, deferred `[ ]` with reason, or logged in the Skipped / Rejected Changes section
|
|
168
|
+
- Update the status line:
|
|
169
|
+
```
|
|
170
|
+
## Status: {Complete / Partially Complete — N items deferred, M items skipped}
|
|
171
|
+
```
|
|
172
|
+
- If any items were skipped or rejected, save the Skipped / Rejected Changes section to `.agents/checklist/skipped/documentation-onboarding-{YYYY-MM-DD}.md` so future audits don't re-suggest rejected changes
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Run an Edge & API Resilience audit on the current project (Module 8)"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Audit: Edge & API Resilience
|
|
6
|
+
|
|
7
|
+
**Role:** Site Reliability Engineer (SRE) & API Architect
|
|
8
|
+
|
|
9
|
+
**Objective:** Perform an exhaustive audit of caching strategy, error boundaries, loading states, and infrastructure resilience. Do not limit yourself to the items listed — explore the file structure dynamically and run terminal commands to find deep-seated issues.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Audit Workflow
|
|
14
|
+
|
|
15
|
+
You MUST follow all phases in order. **Do NOT implement any fixes before the Stop & Review stage.**
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
### Phase 1: Static Analysis
|
|
20
|
+
|
|
21
|
+
Inspect the codebase using Grep, Glob, and Read tools. Discover files dynamically — do not assume locations.
|
|
22
|
+
|
|
23
|
+
**1. Caching Strategy**
|
|
24
|
+
- Search all `fetch()` calls in server components and API routes. For each:
|
|
25
|
+
- Identify whether `force-cache`, `no-store`, or `revalidate` is set
|
|
26
|
+
- Verify CMS data fetches use appropriate ISR revalidation (not `no-store` unnecessarily)
|
|
27
|
+
- Confirm static assets use `force-cache`
|
|
28
|
+
- Flag any CMS fetch without a `next: { tags: [...] }` revalidation tag (required for on-demand ISR)
|
|
29
|
+
- Check for a webhook revalidation endpoint (`/api/revalidate`). Verify it uses `revalidateTag()` or `revalidatePath()` correctly.
|
|
30
|
+
|
|
31
|
+
**2. Error Boundaries**
|
|
32
|
+
- Search for `error.tsx` files across `src/app/`. Verify:
|
|
33
|
+
- A root-level `error.tsx` exists as a global fallback
|
|
34
|
+
- Key route segments (products, knowledge, etc.) have their own `error.tsx` for scoped error handling
|
|
35
|
+
- The error component renders a meaningful message (not a blank screen or raw error dump)
|
|
36
|
+
- The error component includes a recovery mechanism (e.g., "Try again" button using `reset()`)
|
|
37
|
+
- Search for `not-found.tsx`. Verify a custom 404 page exists and is appropriately designed.
|
|
38
|
+
|
|
39
|
+
**3. Loading States & Suspense**
|
|
40
|
+
- Search for `loading.tsx` files. Verify they exist for heavy data-fetching routes.
|
|
41
|
+
- Search for `<Suspense>` boundaries in server components and page files. Verify:
|
|
42
|
+
- Heavy data-fetching sections are wrapped in Suspense with a meaningful `fallback`
|
|
43
|
+
- No route renders a completely blank page while data loads ("white-screen" flash)
|
|
44
|
+
- Check for streaming: are large pages using `generateStaticParams` or streaming to progressively render?
|
|
45
|
+
|
|
46
|
+
**4. API Route Resilience**
|
|
47
|
+
- Inspect all files in `src/app/api/`. For each route handler, verify:
|
|
48
|
+
- External API calls (Zoho CRM, Prismic, etc.) have try/catch error handling
|
|
49
|
+
- Timeouts are set for external fetch calls (or a default Next.js timeout is configured)
|
|
50
|
+
- Error responses return meaningful HTTP status codes (not always 200 with an error body)
|
|
51
|
+
- No sensitive information (stack traces, API keys) is leaked in error responses
|
|
52
|
+
|
|
53
|
+
**5. Edge Middleware**
|
|
54
|
+
- Inspect `middleware.ts` (if it exists). Verify:
|
|
55
|
+
- No heavy computation runs at the Edge (database queries, large data processing)
|
|
56
|
+
- Middleware is scoped to only the routes it needs (use `matcher` config)
|
|
57
|
+
- Any logic that could be moved to a server component or API route is flagged
|
|
58
|
+
|
|
59
|
+
**6. Third-Party Service Fallbacks**
|
|
60
|
+
- Identify all third-party dependencies (Prismic CMS, Zoho CRM, external configurator, analytics).
|
|
61
|
+
- For each, check:
|
|
62
|
+
- What happens if the service is unavailable? Does the site degrade gracefully?
|
|
63
|
+
- Is there a fallback UI for the external configurator iframe?
|
|
64
|
+
- Do form submissions fall back to Netlify Forms if Zoho CRM is unavailable?
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### Phase 2: Research (Run in Parallel)
|
|
69
|
+
|
|
70
|
+
**First**, read `.agents/patterns/edge-api-resilience.md` if it exists. Use it as a baseline — skip re-researching topics already covered unless the file is older than 3 months.
|
|
71
|
+
|
|
72
|
+
Launch a research subagent to fetch current best practices. The subagent should search for:
|
|
73
|
+
- Next.js 15 App Router caching and ISR best practices (2025–2026)
|
|
74
|
+
- Next.js error.tsx and Suspense patterns for resilient UIs
|
|
75
|
+
- Edge Middleware performance guidelines for Next.js
|
|
76
|
+
- API resilience patterns: timeouts, fallbacks, circuit breakers
|
|
77
|
+
|
|
78
|
+
Compile findings as a reference list with URLs.
|
|
79
|
+
|
|
80
|
+
**Then**, create or update `.agents/patterns/edge-api-resilience.md` with any new research findings, best practices, code examples, and reference URLs. Pattern files should be refreshed every 3 months to stay current with evolving standards.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
### Phase 3: Findings & Checklist
|
|
85
|
+
|
|
86
|
+
Combine Phase 1 and Phase 2 results. For every issue found:
|
|
87
|
+
- Assign a severity: **CRITICAL** / **HIGH** / **MEDIUM** / **LOW**
|
|
88
|
+
- Include the exact file path and line number
|
|
89
|
+
- State the recommended fix
|
|
90
|
+
|
|
91
|
+
Save the full audit report to `.agents/audits/edge-api-resilience-{YYYY-MM-DD}.md`.
|
|
92
|
+
|
|
93
|
+
Also create a condensed implementation checklist at `.agents/checklist/edge-api-resilience-{YYYY-MM-DD}.md` — group items by severity tier with commit-and-review gates between each tier. After implementing each tier: stage all changes (`git add`) but do **NOT** commit. Tell the user the changes are staged for review, and **wait for explicit approval** before proceeding to the next tier. The user will review the diff, commit themselves, and tell the agent when to continue. Reference existing files in `.agents/checklist/` for the pattern.
|
|
94
|
+
|
|
95
|
+
Save the full audit report to `.agents/audits/edge-api-resilience-{YYYY-MM-DD}.md`:
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
# Edge & API Resilience Audit — {date}
|
|
99
|
+
|
|
100
|
+
## Summary
|
|
101
|
+
Brief overview of audit scope — routes checked, third-party dependencies identified, key findings.
|
|
102
|
+
|
|
103
|
+
## Research References
|
|
104
|
+
- [Source](url) — why it's relevant
|
|
105
|
+
|
|
106
|
+
## Findings Checklist
|
|
107
|
+
|
|
108
|
+
- [ ] **[CRITICAL]** No error.tsx at root level — entire site crashes on unhandled error
|
|
109
|
+
- Fix: Create `src/app/error.tsx` with a recovery UI and `reset()` button
|
|
110
|
+
- [ ] **[HIGH]** Zoho CRM API call has no timeout — `src/app/api/zoho-lead/route.ts:34`
|
|
111
|
+
- Fix: Add `signal: AbortSignal.timeout(5000)` to the fetch call
|
|
112
|
+
|
|
113
|
+
## Command Outputs
|
|
114
|
+
- Error boundary coverage: {files found}
|
|
115
|
+
- Loading state coverage: {files found}
|
|
116
|
+
- Middleware inspection: {result}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### 🛑 STOP & REVIEW
|
|
122
|
+
|
|
123
|
+
**Do not proceed past this point until the user explicitly approves.**
|
|
124
|
+
|
|
125
|
+
Present to the user:
|
|
126
|
+
1. The full findings checklist including all Single Points of Failure identified
|
|
127
|
+
2. Each proposed fix with file and line reference
|
|
128
|
+
3. Research references used
|
|
129
|
+
|
|
130
|
+
Then ask:
|
|
131
|
+
> "I've completed the Edge & API Resilience audit. The checklist has been saved to `.agents/audits/edge-api-resilience-{date}.md`. Shall I proceed with implementing the fixes above?"
|
|
132
|
+
|
|
133
|
+
**Wait for explicit confirmation before continuing.**
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### Phase 4: Implementation
|
|
138
|
+
|
|
139
|
+
After user approval, implement each approved fix in priority order. For each fix:
|
|
140
|
+
- Make the change using Edit tools
|
|
141
|
+
- Run `npm run check` after every meaningful change
|
|
142
|
+
- For new files (error.tsx, loading.tsx), verify the Next.js App Router picks them up correctly
|
|
143
|
+
- **Update the checklist immediately** — mark completed items with `[x]` in `.agents/checklist/edge-api-resilience-{YYYY-MM-DD}.md` as each item is implemented, not at the end
|
|
144
|
+
- If the user skips or rejects an item, add it to the **Skipped / Rejected Changes** section at the bottom of the checklist using a heading + bullet format per item (e.g., `### #N — Item name` with `- **Status:**` and `- **Reason:**`)
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### Phase 5: Update Checklist
|
|
149
|
+
|
|
150
|
+
After all tiers are complete:
|
|
151
|
+
- Verify every item is accounted for: completed `[x]`, deferred `[ ]` with reason, or logged in the Skipped / Rejected Changes section
|
|
152
|
+
- Update the status line:
|
|
153
|
+
```
|
|
154
|
+
## Status: {Complete / Partially Complete — N items deferred, M items skipped}
|
|
155
|
+
```
|
|
156
|
+
- If any items were skipped or rejected, save the Skipped / Rejected Changes section to `.agents/checklist/skipped/edge-api-resilience-{YYYY-MM-DD}.md` so future audits don't re-suggest rejected changes
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Run a Headless CMS Standards & SEO audit on the current project (Module 2)"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Audit: Headless CMS Standards
|
|
6
|
+
|
|
7
|
+
**Role:** Headless CMS Expert & Technical SEO Strategist
|
|
8
|
+
|
|
9
|
+
**Objective:** Perform an exhaustive, multi-layered audit of the project's headless CMS integration. Do not limit yourself to the items listed — explore the file structure dynamically and run terminal commands to find deep-seated issues.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Pre-Flight: CMS Detection
|
|
14
|
+
|
|
15
|
+
Read the project's `package.json` and detect which headless CMS is in use:
|
|
16
|
+
|
|
17
|
+
| CMS | Detection Key(s) |
|
|
18
|
+
|-----|-------------------|
|
|
19
|
+
| **Storyblok** | `@storyblok/react`, `storyblok-js-client` |
|
|
20
|
+
| **Prismic** | `@prismicio/next`, `@prismicio/client`, `@prismicio/react` |
|
|
21
|
+
| **DatoCMS** | `react-datocms`, `datocms-client`, `@datocms/cda-client` |
|
|
22
|
+
|
|
23
|
+
If **none** of the above are found, notify the user that this audit module does not apply and stop.
|
|
24
|
+
|
|
25
|
+
If a CMS is detected, announce which CMS was found and proceed to the matching section below.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Audit Workflow
|
|
30
|
+
|
|
31
|
+
You MUST follow all phases in order. **Do NOT implement any fixes before the Stop & Review stage.**
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
### Phase 1: Static Analysis
|
|
36
|
+
|
|
37
|
+
Inspect the codebase using Grep, Glob, and Read tools. Do not assume file locations — discover them dynamically.
|
|
38
|
+
|
|
39
|
+
Run the CMS-specific checks below based on what was detected in Pre-Flight, **plus** the shared checks that apply to all CMS integrations.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
#### Shared Checks (All CMS Integrations)
|
|
44
|
+
|
|
45
|
+
**1. Metadata API Audit**
|
|
46
|
+
- Locate all `layout.tsx` and `page.tsx` files across `src/app/`.
|
|
47
|
+
- For each file, verify:
|
|
48
|
+
- `export const metadata` or `export async function generateMetadata()` is implemented
|
|
49
|
+
- `title` and `description` fields are populated (not empty strings or undefined)
|
|
50
|
+
- `openGraph` object includes `title`, `description`, `images`, and `url`
|
|
51
|
+
- Twitter card metadata is present
|
|
52
|
+
- Check root `layout.tsx` for `title.template` to ensure consistent site-wide title branding.
|
|
53
|
+
|
|
54
|
+
**2. JSON-LD Structured Data**
|
|
55
|
+
- Search for JSON-LD `<script type="application/ld+json">` blocks across page files.
|
|
56
|
+
- Verify Schema.org markup is dynamically populated from CMS content (not hardcoded).
|
|
57
|
+
- Flag pages that likely need structured data but don't have it (product pages, articles, events).
|
|
58
|
+
|
|
59
|
+
**3. Preview / Draft Mode**
|
|
60
|
+
- Verify preview API routes exist and are correctly implemented.
|
|
61
|
+
- Check that the preview/draft client is only initialized in preview environments (not leaked into production builds).
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
#### Storyblok-Specific Checks
|
|
66
|
+
|
|
67
|
+
**1. Bridge & Visual Editor**
|
|
68
|
+
- Verify `@storyblok/react` is initialized correctly (check `storyblokInit` call).
|
|
69
|
+
- Ensure the Storyblok bridge script is only loaded in draft/preview mode, not in production.
|
|
70
|
+
- Check that `StoryblokStory` or equivalent live-editing wrapper is used on preview pages.
|
|
71
|
+
|
|
72
|
+
**2. Image Handling**
|
|
73
|
+
- Scan all `.tsx` and `.jsx` files for Storyblok image usage.
|
|
74
|
+
- Verify images use the Storyblok Image Service URL transforms (e.g., `/m/` filters for size/quality) or `next/image` with proper optimization.
|
|
75
|
+
- Ensure `alt` text is pulled from Storyblok asset metadata — not hardcoded.
|
|
76
|
+
- Flag any raw `<img>` tags displaying Storyblok-hosted images without optimization.
|
|
77
|
+
|
|
78
|
+
**3. Component Mapping (Bloks)**
|
|
79
|
+
- Locate the component-to-blok mapping file (e.g., `bloks.ts` or `StoryblokProvider`).
|
|
80
|
+
- Verify all registered bloks have corresponding components.
|
|
81
|
+
- Spot-check 5 components and verify:
|
|
82
|
+
- Missing or empty Storyblok fields are handled gracefully (no runtime errors from undefined access)
|
|
83
|
+
- Nested bloks are rendered via `StoryblokComponent` or equivalent
|
|
84
|
+
- Rich text fields use `storyblok-rich-text-react-renderer` or `renderRichText` correctly
|
|
85
|
+
|
|
86
|
+
**4. Content Fetching**
|
|
87
|
+
- Audit data fetching functions for correct use of `storyblokApi.get()` or equivalent.
|
|
88
|
+
- Verify `cv` (cache version) parameter is used appropriately.
|
|
89
|
+
- Check that `version: 'draft'` is only used in preview/draft mode.
|
|
90
|
+
|
|
91
|
+
**5. Link Handling**
|
|
92
|
+
- Scan for Storyblok link fields being rendered.
|
|
93
|
+
- Verify internal links resolve correctly (multilinks, story links).
|
|
94
|
+
- Flag any manual URL construction from Storyblok slugs that could break with nested paths.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
#### Prismic-Specific Checks
|
|
99
|
+
|
|
100
|
+
**1. Image Component Compliance**
|
|
101
|
+
- Scan all `.tsx` and `.jsx` files for image usage.
|
|
102
|
+
- **Strict Policy:** Every Prismic image field must use `<PrismicNextImage>`. Flag any instance where:
|
|
103
|
+
- A raw `<img>` tag is used for a Prismic image field
|
|
104
|
+
- `next/image` `<Image>` is used directly instead of `<PrismicNextImage>`
|
|
105
|
+
- The `alt` prop is manually overridden (it must come from Prismic asset metadata — do not hardcode)
|
|
106
|
+
- Note: `alt=""` is acceptable only for decorative images with no meaningful content.
|
|
107
|
+
|
|
108
|
+
**2. Link Component Compliance**
|
|
109
|
+
- Scan for all CMS-sourced links (fields from Prismic documents).
|
|
110
|
+
- Verify they use `<PrismicNextLink>` — not a raw `<a>` tag or Next.js `<Link>` directly.
|
|
111
|
+
- Flag every instance of `<a href={...}>` where the `href` value comes from a Prismic link field.
|
|
112
|
+
|
|
113
|
+
**3. Slice & Component Patterns**
|
|
114
|
+
- Inspect `src/slices/index.ts` (or equivalent) for the slice registry.
|
|
115
|
+
- Spot-check 5 slices and verify:
|
|
116
|
+
- Each handles the `default` variation case
|
|
117
|
+
- Missing or empty Prismic fields are handled gracefully (no runtime errors from undefined access)
|
|
118
|
+
- `SliceComponentProps` typing is used correctly
|
|
119
|
+
|
|
120
|
+
**4. Preview Mode**
|
|
121
|
+
- Verify Prismic preview API routes (`/api/preview`, `/api/exit-preview`) exist and are correctly implemented.
|
|
122
|
+
- Check that the preview client is only initialized in draft/preview environments.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
#### DatoCMS-Specific Checks
|
|
127
|
+
|
|
128
|
+
**1. Image Handling**
|
|
129
|
+
- Verify all DatoCMS images use `<Image />` from `react-datocms` (not raw `<img>` or `next/image` directly).
|
|
130
|
+
- Check that `responsiveImage` GraphQL fragment is used to get optimized srcSet, sizes, and blur-up placeholders.
|
|
131
|
+
- Ensure `alt` text comes from the DatoCMS asset metadata — not hardcoded.
|
|
132
|
+
|
|
133
|
+
**2. Structured Text Rendering**
|
|
134
|
+
- Verify `<StructuredText />` from `react-datocms` is used for Structured Text fields.
|
|
135
|
+
- Check that custom renderers are provided for inline records, blocks, and link-to-records within Structured Text.
|
|
136
|
+
- Flag any manual parsing of Structured Text DAST nodes.
|
|
137
|
+
|
|
138
|
+
**3. GraphQL Query Patterns**
|
|
139
|
+
- Audit GraphQL queries for efficiency — flag missing `first`/`skip` pagination or overly broad queries.
|
|
140
|
+
- Verify `_allMeta` count queries are used for pagination where applicable.
|
|
141
|
+
- Check that draft content queries use the preview endpoint with proper authorization.
|
|
142
|
+
|
|
143
|
+
**4. Preview / Web Previews**
|
|
144
|
+
- Verify DatoCMS Web Previews or draft mode API routes are correctly configured.
|
|
145
|
+
- Check that the preview token/endpoint is only used in draft environments.
|
|
146
|
+
|
|
147
|
+
**5. SEO Fields**
|
|
148
|
+
- Verify `_seoMetaTags` GraphQL fragment is used and rendered via `<Head />` or Next.js Metadata API.
|
|
149
|
+
- Check that `faviconMetaTags` from the global `_site` query are included in the root layout.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
### Phase 2: Research (Run in Parallel)
|
|
154
|
+
|
|
155
|
+
**First**, read `.agents/patterns/headless-cms-standards.md` if it exists. Use it as a baseline — skip re-researching topics already covered unless the file is older than 3 months.
|
|
156
|
+
|
|
157
|
+
Launch a research subagent to fetch current best practices for the **detected CMS**. The subagent should search for:
|
|
158
|
+
- Latest documentation and migration notes for the detected CMS SDK (2025–2026)
|
|
159
|
+
- Correct image and link component usage patterns
|
|
160
|
+
- Next.js 15 Metadata API best practices with the detected CMS
|
|
161
|
+
- Schema.org structured data for the site's content type
|
|
162
|
+
|
|
163
|
+
Compile findings as a reference list with URLs.
|
|
164
|
+
|
|
165
|
+
**Then**, create or update `.agents/patterns/headless-cms-standards.md` with any new research findings, best practices, code examples, and reference URLs. Pattern files should be refreshed every 3 months to stay current with evolving standards.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### Phase 3: Findings & Checklist
|
|
170
|
+
|
|
171
|
+
Combine Phase 1 and Phase 2 results. For every issue found:
|
|
172
|
+
- Assign a severity: **CRITICAL** / **HIGH** / **MEDIUM** / **LOW**
|
|
173
|
+
- Include the exact file path and line number where possible
|
|
174
|
+
- State the recommended fix
|
|
175
|
+
|
|
176
|
+
Save the full audit report to `.agents/audits/headless-cms-{YYYY-MM-DD}.md`.
|
|
177
|
+
|
|
178
|
+
Also create a condensed implementation checklist at `.agents/checklist/headless-cms-{YYYY-MM-DD}.md` — group items by severity tier with commit-and-review gates between each tier. After implementing each tier: stage all changes (`git add`) but do **NOT** commit. Tell the user the changes are staged for review, and **wait for explicit approval** before proceeding to the next tier. The user will review the diff, commit themselves, and tell the agent when to continue. Reference existing files in `.agents/checklist/` for the pattern.
|
|
179
|
+
|
|
180
|
+
Save the full audit report to `.agents/audits/headless-cms-{YYYY-MM-DD}.md`:
|
|
181
|
+
|
|
182
|
+
```markdown
|
|
183
|
+
# Headless CMS Audit ({CMS Name}) — {date}
|
|
184
|
+
|
|
185
|
+
## Summary
|
|
186
|
+
Brief overview of audit scope and key findings.
|
|
187
|
+
|
|
188
|
+
## CMS Detected
|
|
189
|
+
{CMS Name} — detected via `{package}` in package.json
|
|
190
|
+
|
|
191
|
+
## Research References
|
|
192
|
+
- [Source](url) — why it's relevant
|
|
193
|
+
|
|
194
|
+
## Findings Checklist
|
|
195
|
+
|
|
196
|
+
- [ ] **[HIGH]** Description — `file/path:line`
|
|
197
|
+
- Fix: ...
|
|
198
|
+
- [ ] **[MEDIUM]** Description — `file/path:line`
|
|
199
|
+
- Fix: ...
|
|
200
|
+
|
|
201
|
+
## Command Outputs
|
|
202
|
+
- Component mapping check: {result}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
### 🛑 STOP & REVIEW
|
|
208
|
+
|
|
209
|
+
**Do not proceed past this point until the user explicitly approves.**
|
|
210
|
+
|
|
211
|
+
Present to the user:
|
|
212
|
+
1. The full findings checklist
|
|
213
|
+
2. Each proposed fix with file and line reference
|
|
214
|
+
3. Research references used
|
|
215
|
+
|
|
216
|
+
Then ask:
|
|
217
|
+
> "I've completed the Headless CMS audit (detected: {CMS Name}). The checklist has been saved to `.agents/audits/headless-cms-{date}.md`. Shall I proceed with implementing the fixes above?"
|
|
218
|
+
|
|
219
|
+
**Wait for explicit confirmation before continuing.**
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
### Phase 4: Implementation
|
|
224
|
+
|
|
225
|
+
After user approval, implement each approved fix in priority order. For each fix:
|
|
226
|
+
- Make the change using Edit tools
|
|
227
|
+
- Run `npm run check` after every meaningful change
|
|
228
|
+
- **Update the checklist immediately** — mark completed items with `[x]` in `.agents/checklist/headless-cms-{YYYY-MM-DD}.md` as each item is implemented, not at the end
|
|
229
|
+
- If the user skips or rejects an item, add it to the **Skipped / Rejected Changes** section at the bottom of the checklist using a heading + bullet format per item (e.g., `### #N — Item name` with `- **Status:**` and `- **Reason:**`)
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
### Phase 5: Update Checklist
|
|
234
|
+
|
|
235
|
+
After all tiers are complete:
|
|
236
|
+
- Verify every item is accounted for: completed `[x]`, deferred `[ ]` with reason, or logged in the Skipped / Rejected Changes section
|
|
237
|
+
- Update the status line:
|
|
238
|
+
```
|
|
239
|
+
## Status: {Complete / Partially Complete — N items deferred, M items skipped}
|
|
240
|
+
```
|
|
241
|
+
- If any items were skipped or rejected, save the Skipped / Rejected Changes section to `.agents/checklist/skipped/headless-cms-{YYYY-MM-DD}.md` so future audits don't re-suggest rejected changes
|