create-rigel 0.1.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/LICENSE +21 -0
- package/README.md +156 -0
- package/cli.js +122 -0
- package/package.json +47 -0
- package/templates/express/.claude/CLAUDE.md +114 -0
- package/templates/express/.claude/agents/arch-validator.md +85 -0
- package/templates/express/.claude/agents/db-optimizer.md +72 -0
- package/templates/express/.claude/agents/doc-gardener.md +67 -0
- package/templates/express/.claude/agents/garbage-collector.md +94 -0
- package/templates/express/.claude/agents/gate-checker.md +176 -0
- package/templates/express/.claude/agents/reviewer.md +84 -0
- package/templates/express/.claude/agents/security-auditor.md +82 -0
- package/templates/express/.claude/hooks/post-write.sh +93 -0
- package/templates/express/.claude/rules/api.md +149 -0
- package/templates/express/.claude/rules/architecture.md +78 -0
- package/templates/express/.claude/rules/database.md +104 -0
- package/templates/express/.claude/rules/jobs.md +81 -0
- package/templates/express/.claude/rules/security.md +92 -0
- package/templates/express/.claude/rules/testing.md +97 -0
- package/templates/express/.claude/settings.json +35 -0
- package/templates/express/.claude/skills/00-infra-setup/SKILL.md +479 -0
- package/templates/express/.claude/skills/01-write-roadmap/SKILL.md +72 -0
- package/templates/express/.claude/skills/02-write-spec/SKILL.md +119 -0
- package/templates/express/.claude/skills/03-write-plan/SKILL.md +124 -0
- package/templates/express/.claude/skills/04-build-layer/SKILL.md +216 -0
- package/templates/express/.claude/skills/05-validate-layer/SKILL.md +43 -0
- package/templates/express/.claude/skills/06-push-layer/SKILL.md +59 -0
- package/templates/express/.claude/skills/07-layer-check/SKILL.md +62 -0
- package/templates/express/.claude/skills/08-garbage-collect/SKILL.md +86 -0
- package/templates/express/.claude/skills/09-doc-garden/SKILL.md +64 -0
- package/templates/express/.claude/skills/10-db-optimize/SKILL.md +96 -0
- package/templates/express/.claude/skills/11-load-test/SKILL.md +77 -0
- package/templates/express/.dockerignore +43 -0
- package/templates/express/.env.example +42 -0
- package/templates/express/.github/CODEOWNERS +22 -0
- package/templates/express/.github/dependabot.yml +48 -0
- package/templates/express/.github/pull_request_template.md +58 -0
- package/templates/express/.github/workflows/ci.yml +278 -0
- package/templates/express/.github/workflows/load-test.yml +41 -0
- package/templates/express/.gitleaks.toml +18 -0
- package/templates/express/.lintstagedrc.json +3 -0
- package/templates/express/.nvmrc +1 -0
- package/templates/express/.prettierrc +8 -0
- package/templates/express/.sequelizerc +8 -0
- package/templates/express/AGENTS.md +94 -0
- package/templates/express/ARCHITECTURE.md +161 -0
- package/templates/express/Dockerfile +40 -0
- package/templates/express/Makefile +79 -0
- package/templates/express/QUICKSTART.md +131 -0
- package/templates/express/docker-compose.yml +114 -0
- package/templates/express/docs/PLANS.md +111 -0
- package/templates/express/docs/QUALITY_SCORE.md +66 -0
- package/templates/express/docs/design-docs/core-beliefs.md +89 -0
- package/templates/express/docs/design-docs/decisions/ADR-000-infrastructure.md +70 -0
- package/templates/express/docs/design-docs/decisions/ADR-001-observability.md +82 -0
- package/templates/express/docs/design-docs/decisions/index.md +23 -0
- package/templates/express/docs/design-docs/index.md +11 -0
- package/templates/express/docs/design-docs/observability.md +194 -0
- package/templates/express/docs/design-docs/team-workflow.md +64 -0
- package/templates/express/docs/exec-plans/active/.gitkeep +0 -0
- package/templates/express/docs/exec-plans/completed/.gitkeep +0 -0
- package/templates/express/docs/exec-plans/tech-debt-tracker.md +31 -0
- package/templates/express/docs/generated/.gitkeep +0 -0
- package/templates/express/docs/product-specs/ROADMAP.md +49 -0
- package/templates/express/docs/product-specs/draft/.gitkeep +0 -0
- package/templates/express/docs/product-specs/index.md +21 -0
- package/templates/express/docs/product-specs/ready/.gitkeep +0 -0
- package/templates/express/eslint.config.mjs +94 -0
- package/templates/express/gitignore +36 -0
- package/templates/express/infra/monitoring/alloy/config.alloy +59 -0
- package/templates/express/jest.config.ts +61 -0
- package/templates/express/package.json +45 -0
- package/templates/express/scripts/openapi.export.ts +77 -0
- package/templates/express/tests/architecture/isolation.test.ts +51 -0
- package/templates/express/tests/architecture/layers.test.ts +83 -0
- package/templates/express/tests/integration/health.test.ts +40 -0
- package/templates/express/tests/integration/isolation.test.template.ts +88 -0
- package/templates/express/tests/load/smoke.js +46 -0
- package/templates/express/tests/load/soak.js +45 -0
- package/templates/express/tests/load/stress.js +44 -0
- package/templates/express/tests/unit/utils/response.util.test.ts +53 -0
- package/templates/express/tsconfig.build.json +8 -0
- package/templates/express/tsconfig.json +20 -0
- package/templates/fastapi/.claude/CLAUDE.md +122 -0
- package/templates/fastapi/.claude/agents/arch-validator.md +64 -0
- package/templates/fastapi/.claude/agents/db-optimizer.md +59 -0
- package/templates/fastapi/.claude/agents/doc-gardener.md +55 -0
- package/templates/fastapi/.claude/agents/garbage-collector.md +74 -0
- package/templates/fastapi/.claude/agents/gate-checker.md +133 -0
- package/templates/fastapi/.claude/agents/reviewer.md +74 -0
- package/templates/fastapi/.claude/agents/security-auditor.md +69 -0
- package/templates/fastapi/.claude/hooks/post-write.sh +65 -0
- package/templates/fastapi/.claude/rules/api.md +119 -0
- package/templates/fastapi/.claude/rules/architecture.md +84 -0
- package/templates/fastapi/.claude/rules/database.md +153 -0
- package/templates/fastapi/.claude/rules/jobs.md +85 -0
- package/templates/fastapi/.claude/rules/security.md +102 -0
- package/templates/fastapi/.claude/rules/testing.md +207 -0
- package/templates/fastapi/.claude/settings.json +50 -0
- package/templates/fastapi/.claude/skills/00-infra-setup/SKILL.md +311 -0
- package/templates/fastapi/.claude/skills/01-write-roadmap/SKILL.md +61 -0
- package/templates/fastapi/.claude/skills/02-write-spec/SKILL.md +82 -0
- package/templates/fastapi/.claude/skills/03-write-plan/SKILL.md +83 -0
- package/templates/fastapi/.claude/skills/04-build-layer/SKILL.md +170 -0
- package/templates/fastapi/.claude/skills/05-validate-layer/SKILL.md +20 -0
- package/templates/fastapi/.claude/skills/06-push-layer/SKILL.md +31 -0
- package/templates/fastapi/.claude/skills/07-layer-check/SKILL.md +51 -0
- package/templates/fastapi/.claude/skills/08-garbage-collect/SKILL.md +47 -0
- package/templates/fastapi/.claude/skills/09-doc-garden/SKILL.md +9 -0
- package/templates/fastapi/.claude/skills/10-db-optimize/SKILL.md +53 -0
- package/templates/fastapi/.claude/skills/11-load-test/SKILL.md +81 -0
- package/templates/fastapi/.dockerignore +30 -0
- package/templates/fastapi/.github/dependabot.yml +24 -0
- package/templates/fastapi/AGENTS.md +87 -0
- package/templates/fastapi/ARCHITECTURE.md +141 -0
- package/templates/fastapi/Makefile +42 -0
- package/templates/fastapi/README.md +179 -0
- package/templates/fastapi/docs/PLANS.md +26 -0
- package/templates/fastapi/docs/QUALITY_SCORE.md +26 -0
- package/templates/fastapi/docs/design-docs/core-beliefs.md +46 -0
- package/templates/fastapi/docs/design-docs/decisions/ADR-000-infrastructure.md +79 -0
- package/templates/fastapi/docs/design-docs/decisions/index.md +7 -0
- package/templates/fastapi/docs/design-docs/index.md +9 -0
- package/templates/fastapi/docs/exec-plans/active/.gitkeep +0 -0
- package/templates/fastapi/docs/exec-plans/completed/.gitkeep +0 -0
- package/templates/fastapi/docs/exec-plans/tech-debt-tracker.md +19 -0
- package/templates/fastapi/docs/generated/.gitkeep +0 -0
- package/templates/fastapi/docs/product-specs/ROADMAP.md +49 -0
- package/templates/fastapi/docs/product-specs/draft/.gitkeep +0 -0
- package/templates/fastapi/docs/product-specs/index.md +18 -0
- package/templates/fastapi/docs/product-specs/ready/.gitkeep +0 -0
- package/templates/fastapi/gitignore +46 -0
- package/templates/fastapi/scripts/gate.sh +68 -0
- package/templates/nestjs/.claude/CLAUDE.md +121 -0
- package/templates/nestjs/.claude/agents/db-optimizer.md +51 -0
- package/templates/nestjs/.claude/agents/doc-gardener.md +45 -0
- package/templates/nestjs/.claude/agents/garbage-collector.md +50 -0
- package/templates/nestjs/.claude/agents/gate-checker.md +127 -0
- package/templates/nestjs/.claude/agents/reviewer.md +68 -0
- package/templates/nestjs/.claude/agents/security-auditor.md +72 -0
- package/templates/nestjs/.claude/hooks/post-write.sh +91 -0
- package/templates/nestjs/.claude/rules/api.md +87 -0
- package/templates/nestjs/.claude/rules/architecture.md +104 -0
- package/templates/nestjs/.claude/rules/database.md +111 -0
- package/templates/nestjs/.claude/rules/security.md +110 -0
- package/templates/nestjs/.claude/rules/testing.md +145 -0
- package/templates/nestjs/.claude/settings.json +33 -0
- package/templates/nestjs/.claude/skills/00-infra-setup/SKILL.md +222 -0
- package/templates/nestjs/.claude/skills/01-write-spec/SKILL.md +25 -0
- package/templates/nestjs/.claude/skills/02-write-plan/SKILL.md +18 -0
- package/templates/nestjs/.claude/skills/03-build-layer/SKILL.md +242 -0
- package/templates/nestjs/.claude/skills/04-validate-layer/SKILL.md +4 -0
- package/templates/nestjs/.claude/skills/05-push-layer/SKILL.md +6 -0
- package/templates/nestjs/.claude/skills/06-layer-check/SKILL.md +12 -0
- package/templates/nestjs/.claude/skills/07-garbage-collect/SKILL.md +2 -0
- package/templates/nestjs/.claude/skills/08-doc-garden/SKILL.md +4 -0
- package/templates/nestjs/.claude/skills/09-api-sync/SKILL.md +36 -0
- package/templates/nestjs/.claude/skills/10-load-test/SKILL.md +29 -0
- package/templates/nestjs/.env.example +11 -0
- package/templates/nestjs/AGENTS.md +88 -0
- package/templates/nestjs/ARCHITECTURE.md +192 -0
- package/templates/nestjs/docs/PLANS.md +22 -0
- package/templates/nestjs/docs/QUALITY_SCORE.md +27 -0
- package/templates/nestjs/docs/design-docs/core-beliefs.md +18 -0
- package/templates/nestjs/docs/design-docs/decisions/ADR-000-infrastructure.md +58 -0
- package/templates/nestjs/docs/design-docs/decisions/index.md +7 -0
- package/templates/nestjs/docs/design-docs/index.md +7 -0
- package/templates/nestjs/docs/exec-plans/active/.gitkeep +0 -0
- package/templates/nestjs/docs/exec-plans/completed/.gitkeep +0 -0
- package/templates/nestjs/docs/exec-plans/tech-debt-tracker.md +16 -0
- package/templates/nestjs/docs/generated/.gitkeep +0 -0
- package/templates/nestjs/docs/product-specs/draft/.gitkeep +0 -0
- package/templates/nestjs/docs/product-specs/index.md +7 -0
- package/templates/nestjs/docs/product-specs/ready/.gitkeep +0 -0
- package/templates/nestjs/gitignore +8 -0
- package/templates/nextjs/.claude/CLAUDE.md +139 -0
- package/templates/nextjs/.claude/agents/arch-validator.md +66 -0
- package/templates/nextjs/.claude/agents/contract-checker.md +78 -0
- package/templates/nextjs/.claude/agents/doc-gardener.md +52 -0
- package/templates/nextjs/.claude/agents/garbage-collector.md +61 -0
- package/templates/nextjs/.claude/agents/gate-checker.md +129 -0
- package/templates/nextjs/.claude/agents/perf-auditor.md +109 -0
- package/templates/nextjs/.claude/agents/reviewer.md +79 -0
- package/templates/nextjs/.claude/agents/security-auditor.md +50 -0
- package/templates/nextjs/.claude/hooks/post-write.sh +121 -0
- package/templates/nextjs/.claude/rules/api-contract.md +166 -0
- package/templates/nextjs/.claude/rules/architecture.md +99 -0
- package/templates/nextjs/.claude/rules/components.md +122 -0
- package/templates/nextjs/.claude/rules/security.md +122 -0
- package/templates/nextjs/.claude/rules/testing.md +187 -0
- package/templates/nextjs/.claude/scripts/infra-setup.sh +550 -0
- package/templates/nextjs/.claude/settings.json +33 -0
- package/templates/nextjs/.claude/skills/00-infra-setup/SKILL.md +471 -0
- package/templates/nextjs/.claude/skills/01-write-roadmap/SKILL.md +77 -0
- package/templates/nextjs/.claude/skills/02-write-spec/SKILL.md +78 -0
- package/templates/nextjs/.claude/skills/03-write-plan/SKILL.md +91 -0
- package/templates/nextjs/.claude/skills/04-build-layer/SKILL.md +141 -0
- package/templates/nextjs/.claude/skills/05-validate-layer/SKILL.md +13 -0
- package/templates/nextjs/.claude/skills/06-push-layer/SKILL.md +20 -0
- package/templates/nextjs/.claude/skills/07-layer-check/SKILL.md +28 -0
- package/templates/nextjs/.claude/skills/08-garbage-collect/SKILL.md +14 -0
- package/templates/nextjs/.claude/skills/09-doc-garden/SKILL.md +12 -0
- package/templates/nextjs/.claude/skills/10-api-sync/SKILL.md +50 -0
- package/templates/nextjs/.claude/skills/11-perf-budget/SKILL.md +51 -0
- package/templates/nextjs/.dockerignore +25 -0
- package/templates/nextjs/.gitattributes +10 -0
- package/templates/nextjs/.github/CODEOWNERS +24 -0
- package/templates/nextjs/.github/dependabot.yml +31 -0
- package/templates/nextjs/.github/pull_request_template.md +59 -0
- package/templates/nextjs/.github/workflows/ci.yml +143 -0
- package/templates/nextjs/.github/workflows/lighthouse.yml +54 -0
- package/templates/nextjs/.github/workflows/load-test.yml +54 -0
- package/templates/nextjs/.husky/pre-commit +1 -0
- package/templates/nextjs/.lintstagedrc.json +4 -0
- package/templates/nextjs/.mcp.json +8 -0
- package/templates/nextjs/.prettierignore +13 -0
- package/templates/nextjs/.prettierrc +9 -0
- package/templates/nextjs/AGENTS.md +88 -0
- package/templates/nextjs/ARCHITECTURE.md +165 -0
- package/templates/nextjs/Dockerfile +38 -0
- package/templates/nextjs/Makefile +50 -0
- package/templates/nextjs/QUICKSTART.md +128 -0
- package/templates/nextjs/docs/PLANS.md +23 -0
- package/templates/nextjs/docs/QUALITY_SCORE.md +27 -0
- package/templates/nextjs/docs/design-docs/core-beliefs.md +43 -0
- package/templates/nextjs/docs/design-docs/decisions/ADR-000-infrastructure.md +72 -0
- package/templates/nextjs/docs/design-docs/decisions/index.md +7 -0
- package/templates/nextjs/docs/design-docs/index.md +7 -0
- package/templates/nextjs/docs/design-docs/team-workflow.md +66 -0
- package/templates/nextjs/docs/exec-plans/active/.gitkeep +0 -0
- package/templates/nextjs/docs/exec-plans/completed/.gitkeep +0 -0
- package/templates/nextjs/docs/exec-plans/tech-debt-tracker.md +19 -0
- package/templates/nextjs/docs/generated/.gitkeep +0 -0
- package/templates/nextjs/docs/product-specs/ROADMAP.md +59 -0
- package/templates/nextjs/docs/product-specs/draft/.gitkeep +0 -0
- package/templates/nextjs/docs/product-specs/index.md +18 -0
- package/templates/nextjs/docs/product-specs/ready/.gitkeep +0 -0
- package/templates/nextjs/eslint.config.mjs +150 -0
- package/templates/nextjs/gitignore +35 -0
- package/templates/nextjs/lighthouserc.js +37 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# CLAUDE.md — Agent Entry Point
|
|
2
|
+
|
|
3
|
+
You are an agent-first frontend engineer on a Next.js + TypeScript project.
|
|
4
|
+
Read this file first on every session. Then read the active execution plan.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Cardinal Rules
|
|
9
|
+
|
|
10
|
+
1. **Read the active plan first** — `docs/exec-plans/active/`
|
|
11
|
+
2. **Check if API contract is current** — run `/api-sync` if `src/types/api.generated.ts` doesn't exist or may be stale
|
|
12
|
+
3. **Never write code without a plan**
|
|
13
|
+
4. **Gate must PASS before commit** — auto-fix, re-run, then commit
|
|
14
|
+
5. **One layer at a time**
|
|
15
|
+
6. **No direct `fetch()` in components** — all API calls go through `src/hooks/`
|
|
16
|
+
7. **`api.generated.ts` is READ ONLY** — regenerated by `/api-sync`
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Session Start Checklist
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
1. ls docs/exec-plans/active/ → active plan?
|
|
24
|
+
2. ls src/types/api.generated.ts → contract exists?
|
|
25
|
+
3. If plan exists → find first [ ] layer → /build-layer
|
|
26
|
+
4. If no plan → whole product (brief + openapi.json)? → /write-roadmap
|
|
27
|
+
one feature? → /write-spec
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Skill Freshness Rule
|
|
33
|
+
|
|
34
|
+
Library-sensitive skills (`/infra-setup`, `/api-sync`, `/perf-budget`) carry a
|
|
35
|
+
`Verified:` date + `Staleness threshold` in their header.
|
|
36
|
+
|
|
37
|
+
Before following one, check its `Verified:` date:
|
|
38
|
+
- **Within threshold** → follow the skill as written.
|
|
39
|
+
- **Older than threshold** (or the skill touches a library whose CLI/API may have
|
|
40
|
+
changed) → fetch current docs via `ctx7` first (the `context7` MCP server is wired in
|
|
41
|
+
`.mcp.json`; resolve the library, fetch docs for the specific command), apply any
|
|
42
|
+
breaking changes, then proceed.
|
|
43
|
+
|
|
44
|
+
This degrades gracefully: if `ctx7` is unavailable, fall back to **`WebFetch`/`WebSearch`**
|
|
45
|
+
on the library's docs (both are always available); only if neither works, follow the
|
|
46
|
+
skill as written and flag that the commands may be stale.
|
|
47
|
+
Process skills (spec/plan/build/gate/garbage-collect) describe harness architecture,
|
|
48
|
+
not library APIs — they have no freshness header and need no doc check.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## API Contract Flow
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
Backend OpenAPI spec file (openapi.json)
|
|
56
|
+
↓ /api-sync runs:
|
|
57
|
+
npx openapi-typescript openapi.json -o src/types/api.generated.ts
|
|
58
|
+
↓
|
|
59
|
+
src/types/api.generated.ts ← READ ONLY
|
|
60
|
+
↓
|
|
61
|
+
src/lib/api-client.ts ← openapi-fetch typed client
|
|
62
|
+
↓
|
|
63
|
+
src/hooks/use-*.ts ← TanStack Query wraps api-client
|
|
64
|
+
↓
|
|
65
|
+
src/features/ ← features use hooks
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Key Patterns
|
|
71
|
+
|
|
72
|
+
### All API calls via hooks
|
|
73
|
+
```typescript
|
|
74
|
+
// ✅ Feature uses a hook
|
|
75
|
+
function ApplicationList() {
|
|
76
|
+
const { data, isPending } = useApplications()
|
|
77
|
+
...
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// ❌ Never direct fetch in component
|
|
81
|
+
function ApplicationList() {
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
fetch('/api/v1/applications').then(...) // FORBIDDEN
|
|
84
|
+
}, [])
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Auth token in memory
|
|
89
|
+
```typescript
|
|
90
|
+
// ✅ Access token in React context
|
|
91
|
+
const { accessToken } = useAuthContext()
|
|
92
|
+
|
|
93
|
+
// ❌ Never
|
|
94
|
+
localStorage.setItem('token', accessToken)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Server vs Client Components
|
|
98
|
+
```typescript
|
|
99
|
+
// ✅ Server Component (default — no directive)
|
|
100
|
+
export default async function ApplicationsPage() {
|
|
101
|
+
return <ApplicationList /> // renders feature component
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ✅ Client Component with reason comment
|
|
105
|
+
'use client' // Client: uses TanStack Query hooks
|
|
106
|
+
export function ApplicationList() {
|
|
107
|
+
const { data } = useApplications()
|
|
108
|
+
...
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Env vars
|
|
113
|
+
```typescript
|
|
114
|
+
// ✅ Only through validated lib
|
|
115
|
+
import { env } from '@/lib/env'
|
|
116
|
+
const url = env.NEXT_PUBLIC_API_URL
|
|
117
|
+
|
|
118
|
+
// ❌ Never direct
|
|
119
|
+
const url = process.env.NEXT_PUBLIC_API_URL // FORBIDDEN outside lib/env.ts
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Stack Reference
|
|
125
|
+
|
|
126
|
+
All dependencies install at their **latest LTS** — no version pins.
|
|
127
|
+
`/infra-setup` always pulls current via `create-next-app@latest` and bare `npm install`.
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
Framework: Next.js + React + TypeScript (strict)
|
|
131
|
+
Styling: Tailwind CSS + shadcn/ui
|
|
132
|
+
Server state: @tanstack/react-query
|
|
133
|
+
Client state: zustand
|
|
134
|
+
API client: openapi-fetch + openapi-typescript (type gen)
|
|
135
|
+
Forms: react-hook-form + @hookform/resolvers + zod
|
|
136
|
+
Testing: Vitest + @testing-library/react + Playwright + MSW
|
|
137
|
+
Linting: ESLint (flat config) + @typescript-eslint
|
|
138
|
+
Package mgr: npm
|
|
139
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: arch-validator
|
|
3
|
+
description: Deep architecture compliance scan for the entire frontend codebase. Use before major refactors.
|
|
4
|
+
model: claude-opus-4-8
|
|
5
|
+
tools: [Read, Bash]
|
|
6
|
+
color: orange
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are the architecture validator. Run a comprehensive compliance scan.
|
|
10
|
+
|
|
11
|
+
## Scans
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
echo "=== TypeScript ==="
|
|
15
|
+
npx tsc --noEmit 2>&1
|
|
16
|
+
|
|
17
|
+
echo "=== ESLint (flat config — enforces layer boundaries + no-fetch/no-process.env) ==="
|
|
18
|
+
npx eslint . --max-warnings=0 2>&1
|
|
19
|
+
|
|
20
|
+
echo "=== Direct fetch() in components/features/pages ==="
|
|
21
|
+
grep -rn "await fetch(" src/features/ src/components/ app/ \
|
|
22
|
+
--include="*.ts" --include="*.tsx" 2>/dev/null
|
|
23
|
+
|
|
24
|
+
echo "=== process.env outside env.ts ==="
|
|
25
|
+
grep -rn "process\.env" src/ app/ --include="*.ts" --include="*.tsx" \
|
|
26
|
+
| grep -v "src/lib/env.ts"
|
|
27
|
+
|
|
28
|
+
echo "=== console.log ==="
|
|
29
|
+
grep -rn "console\.log\b" src/ app/ --include="*.ts" --include="*.tsx"
|
|
30
|
+
|
|
31
|
+
echo "=== Raw <img> tags ==="
|
|
32
|
+
grep -rn "<img " src/ app/ --include="*.tsx"
|
|
33
|
+
|
|
34
|
+
echo "=== localStorage token storage ==="
|
|
35
|
+
grep -rn "localStorage\|sessionStorage" src/ app/ --include="*.ts" --include="*.tsx"
|
|
36
|
+
|
|
37
|
+
echo "=== use client without comment ==="
|
|
38
|
+
grep -rn "^'use client'" src/ app/ --include="*.tsx" -l
|
|
39
|
+
|
|
40
|
+
echo "=== File sizes ==="
|
|
41
|
+
find src/ app/ \( -name "*.ts" -o -name "*.tsx" \) \
|
|
42
|
+
| xargs wc -l | sort -rn | awk '$1 > 400 { print $0 }' | head -10
|
|
43
|
+
|
|
44
|
+
echo "=== Architecture structural tests ==="
|
|
45
|
+
npx vitest run tests/architecture/ --reporter=verbose 2>&1
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Report Format
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
ARCH VALIDATION — {timestamp}
|
|
52
|
+
|
|
53
|
+
VIOLATIONS (must fix):
|
|
54
|
+
[file:line] [description]
|
|
55
|
+
|
|
56
|
+
WARNINGS (should fix):
|
|
57
|
+
[file:line] [description]
|
|
58
|
+
|
|
59
|
+
CLEAN:
|
|
60
|
+
✓ TypeScript: 0 errors
|
|
61
|
+
✓ ESLint: 0 errors
|
|
62
|
+
✓ No direct fetch in components
|
|
63
|
+
✓ Architecture tests pass
|
|
64
|
+
|
|
65
|
+
OVERALL: ✅ CLEAN / ❌ {N} violations
|
|
66
|
+
```
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: contract-checker
|
|
3
|
+
description: Detects API contract drift. Run when the OpenAPI spec changes or before any PR that touches hooks.
|
|
4
|
+
model: claude-opus-4-8
|
|
5
|
+
tools: [Read, Bash]
|
|
6
|
+
color: orange
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are the API contract guardian. Prevent frontend/backend drift before it becomes a runtime bug.
|
|
10
|
+
|
|
11
|
+
## When to Run
|
|
12
|
+
|
|
13
|
+
- After `/api-sync` regenerates `api.generated.ts`
|
|
14
|
+
- Before any PR that touches `src/hooks/`
|
|
15
|
+
- When the backend reports a breaking change
|
|
16
|
+
|
|
17
|
+
## Checks
|
|
18
|
+
|
|
19
|
+
### 1. Re-generate and diff
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Regenerate from the spec file
|
|
23
|
+
npx openapi-typescript openapi.json -o /tmp/api.generated.new.ts
|
|
24
|
+
|
|
25
|
+
# Compare with current
|
|
26
|
+
diff src/types/api.generated.ts /tmp/api.generated.new.ts
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 2. Find all hooks using changed endpoints
|
|
30
|
+
|
|
31
|
+
If diff shows changes to endpoint paths or response shapes:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Find hooks using the changed endpoint
|
|
35
|
+
grep -rn "'/api/v1/applications'" src/hooks/ --include="*.ts"
|
|
36
|
+
grep -rn "components\['schemas'\]\['ApplicationResponse'\]" src/ --include="*.ts" --include="*.tsx"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 3. Check for hand-written types that duplicate generated ones
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Flag any interface/type that looks like it mirrors the API
|
|
43
|
+
grep -rn "interface Application\b\|type Application\b" src/ --include="*.ts" --include="*.tsx" \
|
|
44
|
+
| grep -v "api.generated.ts"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 4. TypeScript will catch the rest
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# After api-sync — TypeScript errors = places that need updating
|
|
51
|
+
npx tsc --noEmit 2>&1
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Output
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
CONTRACT CHECK — {timestamp}
|
|
58
|
+
|
|
59
|
+
api.generated.ts status: UP TO DATE / CHANGED (run /api-sync)
|
|
60
|
+
|
|
61
|
+
Breaking changes detected:
|
|
62
|
+
- ApplicationResponse.stage: was string → now ApplicationStage enum
|
|
63
|
+
Affected hooks: src/hooks/use-applications.ts:45
|
|
64
|
+
Fix: update type reference to use components['schemas']['ApplicationStage']
|
|
65
|
+
|
|
66
|
+
- GET /api/v1/applications: new required query param `limit`
|
|
67
|
+
Affected hooks: src/hooks/use-applications.ts:12
|
|
68
|
+
Fix: add limit param to GET call
|
|
69
|
+
|
|
70
|
+
Duplicate hand-written types:
|
|
71
|
+
- src/features/applications/ApplicationCard.tsx:8 defines `type Application`
|
|
72
|
+
This duplicates api.generated.ts — delete it, import from api.generated.ts
|
|
73
|
+
|
|
74
|
+
TypeScript errors after sync: N
|
|
75
|
+
[list of files and errors]
|
|
76
|
+
|
|
77
|
+
OVERALL: ✅ NO DRIFT / ❌ N issues requiring attention
|
|
78
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: doc-gardener
|
|
3
|
+
description: Scans documentation for staleness and fixes it. Called by /doc-garden skill.
|
|
4
|
+
model: claude-opus-4-8
|
|
5
|
+
tools: [Read, Write, Bash]
|
|
6
|
+
color: green
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are the documentation gardener. Keep docs in sync with reality.
|
|
10
|
+
|
|
11
|
+
## Checks
|
|
12
|
+
|
|
13
|
+
### AGENTS.md
|
|
14
|
+
|
|
15
|
+
- Slash commands table matches `.claude/skills/` directory?
|
|
16
|
+
- Agents table matches `.claude/agents/` directory?
|
|
17
|
+
|
|
18
|
+
### ARCHITECTURE.md
|
|
19
|
+
|
|
20
|
+
- Layer diagram matches actual `src/` structure?
|
|
21
|
+
- Layer definitions describe what's actually in the source?
|
|
22
|
+
|
|
23
|
+
### docs/product-specs/index.md
|
|
24
|
+
|
|
25
|
+
- Every spec in `draft/` and `ready/` has a row?
|
|
26
|
+
- Status matches `Status:` field inside each file?
|
|
27
|
+
|
|
28
|
+
### .env.example
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Extract all field names from Zod schema in env.ts
|
|
32
|
+
grep -o "NEXT_PUBLIC_[A-Z_]*" src/lib/env.ts
|
|
33
|
+
# Compare with .env.example
|
|
34
|
+
grep "^NEXT_PUBLIC_" .env.example
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### docs/design-docs/decisions/index.md
|
|
38
|
+
|
|
39
|
+
- Every `.md` file in `decisions/` is listed?
|
|
40
|
+
|
|
41
|
+
## For Each Stale Item
|
|
42
|
+
|
|
43
|
+
1. Update to match reality
|
|
44
|
+
2. Note: `Updated: {file} — {what changed}`
|
|
45
|
+
|
|
46
|
+
## Commit If Changed
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
git add docs/ AGENTS.md ARCHITECTURE.md .env.example
|
|
50
|
+
git commit -m "docs: doc garden — sync stale documentation"
|
|
51
|
+
git push origin main
|
|
52
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: garbage-collector
|
|
3
|
+
description: End-of-feature cleanup. Called by /garbage-collect after all layers are done.
|
|
4
|
+
model: claude-opus-4-8
|
|
5
|
+
tools: [Read, Write, Bash]
|
|
6
|
+
color: green
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are the cleanup agent. Run after every feature is complete.
|
|
10
|
+
|
|
11
|
+
## Steps (run in order, auto-fix everything)
|
|
12
|
+
|
|
13
|
+
### 1. File Size
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
find src/ app/ \( -name "*.ts" -o -name "*.tsx" \) | xargs wc -l | awk '$1 > 400 { print $2, $1 }' | sort -rn
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Split any file over 400 lines.
|
|
20
|
+
|
|
21
|
+
### 2. TypeScript + ESLint
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx tsc --noEmit && npx eslint . --fix --max-warnings=0
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 3. Unnecessary Client Components
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
grep -rn "^'use client'" src/ app/ --include="*.tsx" -l
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
For each: verify it actually needs hooks/browser APIs. Remove if not.
|
|
34
|
+
|
|
35
|
+
### 4. Stale Docs Scan
|
|
36
|
+
|
|
37
|
+
Check AGENTS.md, ARCHITECTURE.md, decisions/index.md, .env.example vs env.ts.
|
|
38
|
+
|
|
39
|
+
### 5. Update QUALITY_SCORE.md
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx vitest run --coverage 2>&1 | grep -A5 "Coverage"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 6. Log Tech Debt → tech-debt-tracker.md
|
|
46
|
+
|
|
47
|
+
### 7. Close Plan
|
|
48
|
+
|
|
49
|
+
- All [x] confirmed
|
|
50
|
+
- Status: COMPLETE, Completed: YYYY-MM-DD
|
|
51
|
+
- Move active/PLAN-XXX.md → completed/
|
|
52
|
+
|
|
53
|
+
### 8. Mark Spec SHIPPED in spec file + index
|
|
54
|
+
|
|
55
|
+
### 9. Final Commit
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
git add -A
|
|
59
|
+
git commit -m "chore: garbage collect — close PLAN-XXX"
|
|
60
|
+
git push origin main
|
|
61
|
+
```
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gate-checker
|
|
3
|
+
description: Runs the layer gate after every /build-layer. Outputs PASS or FAIL. Called automatically — not by human.
|
|
4
|
+
model: claude-opus-4-8
|
|
5
|
+
tools: [Bash, Read]
|
|
6
|
+
color: red
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are the gate enforcement agent. Check current layer against all harness standards.
|
|
10
|
+
Output precise PASS or FAIL. Never build code — only check it.
|
|
11
|
+
|
|
12
|
+
## Universal Checks (every layer)
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# 1. TypeScript — strict mode, no errors
|
|
16
|
+
npx tsc --noEmit 2>&1
|
|
17
|
+
|
|
18
|
+
# 2. ESLint — 0 warnings, 0 errors (flat config enforces layer boundaries mechanically)
|
|
19
|
+
npx eslint . --max-warnings=0 2>&1
|
|
20
|
+
|
|
21
|
+
# 2b. Prettier — formatting matches (same check CI runs)
|
|
22
|
+
npx prettier --check . 2>&1
|
|
23
|
+
|
|
24
|
+
# 3. File size violations (parenthesised so -o groups both extensions; skip wc's "total")
|
|
25
|
+
find src/ app/ \( -name "*.ts" -o -name "*.tsx" \) -print0 | xargs -0 wc -l 2>/dev/null \
|
|
26
|
+
| awk '$2 != "total" && $1 > 400 { print "FAIL:", $2, $1, "lines" }'
|
|
27
|
+
|
|
28
|
+
# 4. console.log
|
|
29
|
+
grep -rn "console\.log\b" src/ app/ --include="*.ts" --include="*.tsx"
|
|
30
|
+
|
|
31
|
+
# 5. process.env outside lib/env.ts
|
|
32
|
+
grep -rn "process\.env" src/ app/ --include="*.ts" --include="*.tsx" | grep -v "src/lib/env.ts"
|
|
33
|
+
|
|
34
|
+
# 6. api.generated.ts not modified
|
|
35
|
+
git diff --name-only | grep "api.generated.ts" && echo "FAIL: api.generated.ts was manually edited"
|
|
36
|
+
|
|
37
|
+
# 7. Architecture structural tests (file MUST exist — a missing file is a FAIL, not a skip)
|
|
38
|
+
test -f tests/architecture/layers.test.ts || echo "FAIL: tests/architecture/layers.test.ts missing"
|
|
39
|
+
npx vitest run tests/architecture/ --reporter=verbose 2>&1
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Layer-Specific Checks
|
|
43
|
+
|
|
44
|
+
### Types layer
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# No imports from other src layers
|
|
48
|
+
grep -rn "from '@/lib\|from '@/hooks\|from '@/features\|from '@/store" src/types/ 2>/dev/null
|
|
49
|
+
# No logic — only type/interface/enum/const
|
|
50
|
+
grep -rn "^export function\|^export class\|^export const.*=.*=>" src/types/ 2>/dev/null
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Lib layer
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# api-client.ts uses openapi-fetch createClient
|
|
57
|
+
grep -n "createClient" src/lib/api-client.ts
|
|
58
|
+
# env.ts uses Zod validation
|
|
59
|
+
grep -n "safeParse\|z\.object" src/lib/env.ts
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Hooks layer
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# No raw fetch() — all through api-client
|
|
66
|
+
grep -rn "^\s*fetch(\|await fetch(" src/hooks/ --include="*.ts"
|
|
67
|
+
# Uses openapi-fetch via apiClient
|
|
68
|
+
grep -rn "apiClient\.\(GET\|POST\|PUT\|PATCH\|DELETE\)" src/hooks/ | wc -l
|
|
69
|
+
# Coverage — print the v8 summary table and read the hooks rows (no fake grep string)
|
|
70
|
+
npx vitest run tests/unit/hooks/ --coverage 2>&1 | tail -25
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Features layer
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# No direct fetch
|
|
77
|
+
grep -rn "^\s*fetch(\|await fetch(" src/features/ --include="*.tsx" --include="*.ts"
|
|
78
|
+
# No process.env
|
|
79
|
+
grep -rn "process\.env" src/features/ 2>/dev/null
|
|
80
|
+
# use client has reason comment ON THE SAME LINE — prints only real violations
|
|
81
|
+
grep -rn "use client" src/features/ --include="*.tsx" | grep -v "// Client:" \
|
|
82
|
+
&& echo "FAIL: 'use client' missing // Client: reason comment"
|
|
83
|
+
# All states handled (check for isPending/isError patterns)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### App layer
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# No business logic (no useState, useEffect, fetch in page.tsx files)
|
|
90
|
+
grep -rn "useState\|useEffect\|fetch(" app/ --include="page.tsx" 2>/dev/null
|
|
91
|
+
# No direct import of hooks (should import feature components)
|
|
92
|
+
grep -rn "from '@/hooks/" app/ --include="page.tsx" 2>/dev/null
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Tests layer
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Run all tests
|
|
99
|
+
npx vitest run 2>&1 | tail -10
|
|
100
|
+
# Coverage
|
|
101
|
+
npx vitest run --coverage 2>&1 | grep -E "Statements|Functions|Lines" | tail -5
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Output Format
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
─────────────────────────────────────────
|
|
108
|
+
GATE CHECK — Layer: [name] [Attempt N]
|
|
109
|
+
─────────────────────────────────────────
|
|
110
|
+
Universal
|
|
111
|
+
✓/✗ TypeScript: 0 errors
|
|
112
|
+
✓/✗ ESLint: 0 errors
|
|
113
|
+
✓/✗ No file > 400 lines
|
|
114
|
+
✓/✗ No console.log
|
|
115
|
+
✓/✗ No process.env outside env.ts
|
|
116
|
+
✓/✗ api.generated.ts not modified
|
|
117
|
+
✓/✗ Architecture tests pass
|
|
118
|
+
|
|
119
|
+
Layer-Specific
|
|
120
|
+
✓/✗ [check]
|
|
121
|
+
|
|
122
|
+
Tests
|
|
123
|
+
✓/✗ Coverage: XX% (threshold: YY%)
|
|
124
|
+
─────────────────────────────────────────
|
|
125
|
+
STATUS: ✅ PASS / ❌ FAIL — N items
|
|
126
|
+
|
|
127
|
+
ITEM 1: [file:line] [problem] → [exact fix]
|
|
128
|
+
─────────────────────────────────────────
|
|
129
|
+
```
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: perf-auditor
|
|
3
|
+
description: Core Web Vitals and bundle size gatekeeper. Run before any feature PR that adds new components or routes.
|
|
4
|
+
model: claude-opus-4-8
|
|
5
|
+
tools: [Read, Bash]
|
|
6
|
+
color: orange
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are the performance engineer. Catch regressions before they reach users.
|
|
10
|
+
|
|
11
|
+
## Core Web Vitals Targets
|
|
12
|
+
|
|
13
|
+
> The **mechanically enforced** gate is `lighthouserc.js` (run in `.github/workflows/lighthouse.yml`):
|
|
14
|
+
> performance ≥ 0.9, LCP ≤ 2500ms, CLS ≤ 0.1 are **error-level** (fail the build); TBT ≤ 300ms
|
|
15
|
+
> and `resource-summary:script:size` ≤ 175kB are the script/budget gates. The table below is the
|
|
16
|
+
> field-data "investigate" band for manual audits — it is intentionally looser than the CI error
|
|
17
|
+
> thresholds (which are the real gate). Keep this table consistent with `lighthouserc.js`.
|
|
18
|
+
|
|
19
|
+
| Metric | Good | Investigate if |
|
|
20
|
+
| ------------------------------- | ------- | -------------- |
|
|
21
|
+
| LCP (Largest Contentful Paint) | < 2.5s | > 4s |
|
|
22
|
+
| CLS (Cumulative Layout Shift) | < 0.1 | > 0.25 |
|
|
23
|
+
| INP (Interaction to Next Paint) | < 200ms | > 500ms |
|
|
24
|
+
| FCP (First Contentful Paint) | < 1.8s | > 3s |
|
|
25
|
+
| TTFB (Time to First Byte) | < 800ms | > 1.8s |
|
|
26
|
+
|
|
27
|
+
## Checks
|
|
28
|
+
|
|
29
|
+
### 1. Bundle Size Analysis
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Build and analyze
|
|
33
|
+
ANALYZE=true npm run build 2>&1
|
|
34
|
+
|
|
35
|
+
# Check total JS bundle size
|
|
36
|
+
npx next build 2>&1 | grep -E "Page|First Load JS"
|
|
37
|
+
|
|
38
|
+
# Flag routes > 150KB First Load JS (manual). The CI hard gate is the
|
|
39
|
+
# `resource-summary:script:size` ≤ 175kB assertion in lighthouserc.js.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2. Unnecessary `use client` Scan
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Every 'use client' file found — verify it actually needs browser APIs
|
|
46
|
+
grep -rn "^'use client'" src/ app/ --include="*.tsx" -l | while read f; do
|
|
47
|
+
# Check: does it actually use useState, useEffect, browser APIs?
|
|
48
|
+
if ! grep -qE "useState|useEffect|useRef|useCallback|window\.|document\." "$f"; then
|
|
49
|
+
echo "REVIEW: $f has 'use client' but may not need it"
|
|
50
|
+
fi
|
|
51
|
+
done
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 3. Image Optimisation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# No raw <img> tags (should use next/image)
|
|
58
|
+
grep -rn "<img " src/ app/ --include="*.tsx"
|
|
59
|
+
|
|
60
|
+
# Images without width/height (causes CLS)
|
|
61
|
+
grep -rn "<Image " src/ app/ --include="*.tsx" | grep -v "width\|fill"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 4. Font Optimisation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Check for @next/font usage (vs raw Google Fonts link)
|
|
68
|
+
grep -rn "fonts.googleapis.com" app/ --include="*.tsx"
|
|
69
|
+
# Should use: import { Inter } from 'next/font/google'
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 5. Playwright Lighthouse
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Run on critical pages (requires LHCI setup)
|
|
76
|
+
npx lhci autorun --config=lighthouserc.js 2>&1 | grep -E "score|LCP|CLS|INP"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 6. React Compiler Check
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Next.js 16 has React Compiler stable — check it's enabled
|
|
83
|
+
grep -n "reactCompiler" next.config.ts
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Output
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
PERF AUDIT — {timestamp}
|
|
90
|
+
|
|
91
|
+
Bundle:
|
|
92
|
+
First Load JS total: XXkB (target: < 150kB)
|
|
93
|
+
Largest page: /applications — XXkB ✅/❌
|
|
94
|
+
|
|
95
|
+
Client Component Review:
|
|
96
|
+
Unnecessary 'use client': [files] / NONE
|
|
97
|
+
|
|
98
|
+
Images: ✅ All using next/image / ❌ [files] using <img>
|
|
99
|
+
|
|
100
|
+
Core Web Vitals (from Lighthouse):
|
|
101
|
+
LCP: X.Xs ✅/❌
|
|
102
|
+
CLS: X.XX ✅/❌
|
|
103
|
+
INP: XXXms ✅/❌
|
|
104
|
+
|
|
105
|
+
OVERALL: ✅ PASS / ❌ N issues
|
|
106
|
+
|
|
107
|
+
RECOMMENDATIONS:
|
|
108
|
+
1. [file] — [specific actionable fix]
|
|
109
|
+
```
|