claude/skills/web-project-audit/references/report-template.md
Neil Bantoc 5201aa9bd5 Add web-frontend, web-project-audit and web-project-scaffold-containerized-python skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 16:26:33 -08:00

94 lines
7.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Report template
Write `{AUDIT_DIR}/REPORT.md` with this structure. Every table cell that names a file must be a real, project-relative path that exists. Pull content from `library/*.md`, `occurrences.tsv`, `ledger.tsv` and `audit.sh tree` output — not from memory, not from docs.
```markdown
# <Project name> — Architecture Audit
_Audited <date> from source at <project path> (<git short SHA if available>). Files in scope: N; read: N; contributed: N; redundant: N; trivial: N; skipped: N._
_Source of truth: implementation only. Documentation was not used as evidence._
## 1. At a glance
3–6 bullets: what the product is, the rendering model and framework in one line, styling approach, data layer (client fetching + backend + DB), auth, hosting, package count.
## 2. Build & toolchain
| Item | Value | Source |
|---|---|---|
| Package manager / workspaces | pnpm 9, Turborepo | `package.json`, `turbo.json` |
| Framework / bundler | Next.js 15 (Turbopack dev), React 19 | `apps/web/package.json` |
| Language | TypeScript 5.x, `strict: true`, path aliases `@/*` | `tsconfig.json` |
| Node / runtime targets | Node 20, edge runtime for middleware | `.nvmrc`, `middleware.ts` |
| Lint / format | ESLint flat config + Prettier | … |
| Env vars | validated with Zod in `env.ts`; client-exposed: `NEXT_PUBLIC_*` (names only) | … |
## 3. File tree organization
- **Scheme:** e.g. "monorepo: `apps/web` (Next.js app router), `apps/api` (Hono), `packages/ui` (design system), `packages/db` (Drizzle schema); inside `apps/web`, feature folders under `src/features/*`". State whether organization is by feature, by type, or framework-convention, with evidence.
- A trimmed tree (packages → key directories, file counts), ≤40 lines, from `audit.sh tree`.
- Package dependency direction (Mermaid `graph` or arrow list) if a monorepo.
- Naming conventions observed, and notable outliers.
## 4. Implementation summary
| Category | Implementation details | Code pointers |
|---|---|---|
| Rendering | App Router; RSC by default, 14 client components; ISR on `/blog/*` (`revalidate = 3600`) | `apps/web/src/app/layout.tsx`, `.../blog/[slug]/page.tsx` |
| Styling | Tailwind v4 with CSS-variable tokens; dark mode via `data-theme` | `apps/web/src/styles/app.css` |
| Data fetching | TanStack Query in client components; server components call `lib/api.ts` directly | … |
| … one row per category that has findings: build, architecture, routing, UI components, state, forms, API/backend, persistence, auth/security, background jobs, i18n/a11y, performance, observability, testing, deployment | | |
Rules: "Implementation details" names concrete libraries/mechanisms (+version when known) and, when a category has competing approaches, lists both with rough prevalence ("TanStack Query in 22 hooks, raw `useEffect` fetch in 5 legacy components"). "Code pointers" = 1–3 exemplar files that best show the category.
## 5. Features (user perspective)
| Feature | What it lets the user do | Entry point |
|---|---|---|
| Sign in | Sign in with email magic link or GitHub; stays signed in for 30 days | `apps/web/src/app/(auth)/login/page.tsx` |
| … | | |
Include user-perceivable background features (emails, notifications, scheduled reports, offline support, webhooks that change what the user sees). Group by area if > 15 rows.
## 6. Architecture & data flow
- Layering as implemented (page/component → hook/store → API client or server action → handler → service → DB), with one traced example end-to-end citing each file in the chain.
- Client/server boundary: what runs where.
- State management shape and caching/source of truth (server cache, client cache, URL).
- Optional Mermaid diagram.
## 7. Module interactions
How modules call each other and what data crosses each boundary, from `library/module-interactions.md` (prevalence from `occurrences.tsv`). Modules are workspace packages; in a single-package app, use top-level feature/layer directories and say so.
### 7.1 User-facing interactions
Started by a user action or feeding what's on screen, including server work done for a page request. Group rows by feature (matching §5) when there are more than ~10.
| From → To | Purpose | Mechanism | Data passed (in → out) | Trigger | Code pointers |
|---|---|---|---|---|---|
| `apps/web` checkout page → `apps/api` | Place an order | `fetch` via `lib/api.ts`, Zod-validated both sides | `CreateOrderInput` → `Order` | Submit on checkout form | `apps/web/.../CheckoutForm.tsx:58`, `apps/api/src/routes/orders.ts` |
| `apps/web` → `packages/ui` | Render controls | React components + props | `ButtonProps` → JSX | Every render | `packages/ui/src/button.tsx` |
### 7.2 Background interactions
No user waiting: cron, queue workers, webhooks, service-worker sync/push, revalidation, build-time generation, startup init.
| From → To | Purpose | Mechanism | Data passed (in → out) | Trigger | Code pointers |
|---|---|---|---|---|---|
| Stripe → `apps/api` → `packages/db` | Mark order paid | Webhook handler, signature verified, Drizzle update | `Stripe.Event` → `orders.status` row | `checkout.session.completed` webhook | `apps/api/src/webhooks/stripe.ts` |
### 7.3 Interaction map
A Mermaid `graph LR` of modules (and external services as distinct nodes), with edges labelled by purpose and data type. Draw user-facing edges solid (`-->`) and background edges dashed (`-.->`). Keep it to the edges in the tables. If there are more than ~25, draw one diagram per group.
### 7.4 Notes
- Shared state reached through more than one path (e.g. a table written by a webhook and read by a page; a store written by two features): say which module owns it.
- Package dependencies that no interaction uses (possibly dead), and layer violations (UI importing DB code, server-only code reachable from the client), with paths.
## 8. Observations
- **Inconsistencies / migrations in progress** (two ways of doing the same thing, with counts).
- **Risks & tech debt** (with paths): e.g. secrets exposed to the client bundle, unvalidated inputs, missing auth checks, heavy client dependencies.
- **Strengths** worth preserving.
## 9. Coverage & method
How many files were in scope, read, and contributed; what was excluded and why (dependencies, build output, generated code, lockfiles, translated locale files, static assets counted not read: `resource-counts.tsv`); how many subagents/batches. Location of the library: `{AUDIT_DIR}/library/`.
## 10. Usage & duration
Paste `usage.md` verbatim: wall-clock duration, per-phase durations, and the token table per harness / session kind / model, with the total row. Below it, add one line per caveat that applies:
- Tokens for writing this report fall after `finish` and are not included.
- The run was resumed across sessions, so wall clock includes idle time.
- A local model (vLLM/Ollama) reports no cache hits, so its input shows as uncached.
- Another audit or unrelated work ran in the same session during the window, so the session row includes that.
```
After writing the file, print to the terminal: section 1, the Implementation summary table, the Features table, the two Module interactions tables (or their first ~10 rows each, if long), the top 3–5 observations, the duration and token total row from §10, and the path to `REPORT.md`.