Step-by-step skill execution:
1SENSE — Discovery and context collection
Scan repository structure and identify all entrypoints
Collect existing performance data (PageSpeed URL, Lighthouse JSON, or user-provided metrics)
Detect stack: `cat package.json | grep -E '"next|express|fastify|hono|nestjs"'`
Map services: `ls -la` on `docker-compose.yml`, `k8s/`, `services/` directories
Read CDN config if present: `vercel.json`, `cloudflare.toml`, `_headers`, `nginx.conf`
2CONTEXTUALIZE — Architecture mapping
Build a service map: which services exist, what databases they use, how they communicate
Identify the rendering strategy per Next.js route:
```ts
// SSG: export const dynamic = 'force-static'
// ISR: export const revalidate = 60
// SSR: export const dynamic = 'force-dynamic'
// Edge: export const runtime = 'edge'
```
Check image delivery: are images served via `<Image>` (Next.js) / Nuxt Image / plain `<img>`?
Verify cache headers: `curl -I https://yourdomain.com/api/products | grep cache-control`
3HYPOTHESIZE — Multi-axis analysis
Run CUPID checklist against top-3 core modules
Evaluate data flow for CQRS candidates:
```
read:write ratio > 50:1 → CQRS candidate
write involves > 3 services → Saga/Outbox candidate
state must be auditable → Event Sourcing candidate
```
Check Core Web Vitals against 2026 thresholds:
```
LCP: < 2.0s ✅ / 2.0-4.0s 🟠 / > 4.0s 🔴
INP: < 200ms ✅ / 200-500ms 🟠 / > 500ms 🔴
CLS: < 0.08 ✅ / 0.08-0.25 🟠 / > 0.25 🔴
```
4EVALUATE — Score computation
Calculate dimension scores with available evidence
Compute CAPS = (CWV×0.25) + (CUPID×0.20) + (Data×0.20) + (CDN×0.15) + (Rendering×0.10) + (Assets×0.10)
Classify all findings with severity labels
Rank recommendations by effort-to-impact score
5RECOMMEND & ACT — Generate deliverables
Produce `ARCH-PERF-AUDIT-REPORT.md`:
```markdown
# Architecture & Performance Audit — [Project Name]
CAPS Score: 67/100 🟠
Executive Summary
Dimension Scores
Critical Findings (must fix)
High-Priority Improvements
Code Examples
Migration Roadmap
```
Generate code fix examples for each critical finding:
```ts
// BEFORE (CDN miss — no cache headers):
export async function GET() {
const data = await db.products.findMany();
return Response.json(data);
}
// AFTER (CDN-cacheable at edge, 60s revalidation):
export async function GET() {
const data = await db.products.findMany();
return Response.json(data, {
headers: { 'Cache-Control': 's-maxage=60, stale-while-revalidate=300' }
});
}
```
Generate Lighthouse CI config:
```json
{
"ci": {
"assert": {
"assertions": {
"categories:performance": ["error", {"minScore": 0.85}],
"largest-contentful-paint": ["error", {"maxNumericValue": 2000}],
"total-blocking-time": ["warn", {"maxNumericValue": 150}]
}
}
}
}
```
6REFLECT — Validation and telemetry
Verify all code examples match the detected stack version
Confirm CAPS score methodology is transparent in the report
Report execution via MCP SkillsChain
Schedule next audit date in the report footer