Meta-skill for distilling a complete project codebase into a comprehensive, maintainable SKILL.md document. Use after a major project update, when onboarding a new team, or when you need to create a single-source-of-truth reference for future AI coding agents working on this codebase.
Installation
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Meta-skill for distilling a complete project codebase into a comprehensive, maintainable SKILL.md document. Use after a major project update, when onboarding a new team, or when you need to create a single-source-of-truth reference for future AI coding agents working on this codebase.
Purpose: Guide any coding agent to produce a comprehensive, production-grade SKILL.md for modern web application codebases (React, Vue, Svelte, Angular, etc.) by following a structured, six-phase validation and distillation process.
When to use: After completing a major project update, security remediation, architectural overhaul, or whenever the codebase has accumulated enough hard-won knowledge that a single reference document would prevent repeated mistakes.
Output: A PROJECT_NAME_SKILL.md file (or updated version) containing every design decision, anti-pattern, debugging procedure, and lesson learned that a future agent needs to work effectively with the codebase.
Read .env.example or the env validation schema (Zod, Joi, etc.)
Map the directory structure: find src -type f | head -100
Identify the framework and version (e.g., "Next.js 16 App Router, not Pages Router")
Determine the rendering strategy: static, dynamic, hybrid, edge, etc.
Identify the data layer: Drizzle, Prisma, raw SQL, Firebase, etc.
Identify the auth layer: Auth.js, Clerk, Firebase Auth, custom JWT, etc.
Identify the deployment target: Vercel, AWS, Docker, etc.
Deliverable: A one-paragraph "Project Identity" summary and a table of locked versions.
Phase 2: PLAN — Structured Outline
Goal: Create a detailed outline before writing any prose.
Tasks:
Map each of the 20 sections to actual files in the codebase
Identify which sections have code-specific content (e.g., §4 Design System maps to globals.css) vs. knowledge-specific content (e.g., §12 Lessons maps to git history, PR comments, incident docs)
For code-specific sections, plan which file(s) to read for each subsection
For knowledge-specific sections, plan which issues/PRs/conversations to reference
Identify gaps — sections where the codebase has implicit knowledge not yet documented anywhere
Deliverable: A numbered checklist like the example below.
§1 Design Philosophy → Read: README.md, PRD.md, marketing spec
§2 Tech Stack → Read: package.json, root configs
§3 Bootstrapping → Read: package.json scripts, Dockerfile, CI workflows
§4 Design System → Read: globals.css, tailwind.config.*, any @theme block
§5 Components → Read: src/components/**, count client vs server components
§6 Hooks → Read: src/lib/hooks/** or src/hooks/**
§7 Content → Read: src/lib/data/**, CMS config, API integrations
§8 A11y → Read: globals.css (focus styles), components for aria patterns
§9 Anti-Patterns → Synthesize from §10's Issues + git blame on hot files
§10 Debugging → Read: existing issues, error logs, troubleshooting runbooks
§11 Pre-Ship → Read: CI workflows, .husky/pre-commit, package.json scripts
§12 Lessons → Synthesize from git log, PR descriptions, incident post-mortems
§13 Pitfalls → Synthesize from §9 + §12
§14 Best Practices → Synthesize from codebase conventions + lint rules
§15 Patterns → Read: representative files from each feature module
§16 Anti-Patterns → Inverse of §15; read for "don't do this" examples
§17 Breakpoints → Read: tailwind config or media query usage
§18 Z-Index → Read: all z-* class usage, portal components
§19 Colors → Read: globals.css @theme, any design token files
§20 Interfaces → Read: src/types/**, schema definitions, API types
Appendices → Read: ADR docs, architecture diagrams, runbooks
Phase 3: VALIDATE — Explicit Confirmation
Goal: Before writing, confirm the plan with the user or your own understanding.
Tasks:
Summarize the Phase 1 findings in 3–5 sentences
Present the Phase 2 outline
Highlight any gaps where information is missing or ambiguous
Ask: "Does this plan cover everything a future agent would need?" (if user is present)
If no user, validate against the codebase: can every section be populated with real content?
Deliverable: A brief confirmation document. If gaps exist, list them explicitly.
Goal: Present the final document with clear context.
Deliverable:
The PROJECT_NAME_SKILL.md file, written to disk
A summary of what was added vs. what existed before (if updating)
A list of intentional omissions (things you chose NOT to include, with rationale)
A brief "how to use this document" guide at the top of the file
(Optional) A version number and date stamp in the header
3. Section Specifications
This section prescribes the exact content for each of the 20 standard sections. Adapt as needed for your project's domain (e.g., mobile apps, backend services, data pipelines), but maintain the same rigor.
§1 Project Identity & Design Philosophy
Purpose: Set the tone. A future agent needs to know what this project IS before they can extend it correctly.
Required content:
One-sentence project description (what + who + why)
The design thesis or aesthetic philosophy (e.g., "luxury-dark cinematic")
Non-negotiable design rules (e.g., "no purple gradients except on example cards")
The CTA hierarchy (if applicable)
The anti-generic mandate (what visual clichés are explicitly rejected)
Verification: Does this section prevent an agent from adding generic Bootstrap-style components? If yes, it's good.
§2 Tech Stack & Environment
Purpose: Prevent version drift and dependency confusion.
Required content:
Column
Description
Layer
Frontend, Backend, Database, AI, etc.
Technology
Exact package name
Version
Locked version from package.json
Critical Note
Why this version matters, any gotchas
Verification: Run npm list --depth=0 or pnpm list --depth=0 and verify every major dependency appears in the table with the correct version.
§3 Bootstrapping & Configuration
Purpose: Enable rapid environment recreation.
Required content:
pnpm create next-app@... or equivalent scaffolding command
Verification: These should be enforceable by lint rules or code review. If a practice can't be enforced, document how to verify it.
§15 Coding Patterns
Purpose: Provide copy-pasteable templates.
Required content:
Server Action pattern (auth → validate → business → response)
API route pattern (force-dynamic, auth, owner check)
Domain function pattern (pure, no framework imports)
Idempotent operation pattern (ON CONFLICT DO NOTHING + row lock)
SSE pattern (slot management, reconnect logic)
Webhook idempotency pattern (pre-check → side effects → INSERT)
Env module pattern (build-context fallback)
Source-reading test pattern
Verification: Every pattern should compile in the actual project without modification.
§16 Coding Anti-Patterns
Purpose: Show what NOT to do, with correct alternatives.
Required content:
TypeScript anti-patterns (any vs unknown, default exports)
React anti-patterns (<a> vs <Link>, r2.ts in client components)
Tailwind anti-patterns (amber-400 vs primary, tailwind.config.ts)
Pipeline anti-patterns (debit before insert, missing try/catch)
Verification: Every anti-pattern should have a corresponding test that fails if violated.
§17 Responsive Breakpoint Reference
Purpose: Prevent breakpoint inconsistency.
Required content:
Tailwind default breakpoints (no custom config)
Usage patterns per section (Hero, Features, etc.)
Mobile testing recommendations
§18 Z-Index Layer Map
Purpose: Prevent z-index wars.
Required content:
All z-index layers with element, location, and purpose
Radix/shadcn portal z-index details
Conflict resolution rules
§19 Color Reference (Complete)
Purpose: Prevent color drift.
Required content:
All semantic tokens (name, hex, RGB, Tailwind class, usage)
Chart palette (if applicable)
Opacity variants (common usage patterns)
Forbidden colors (enforced by tests)
The singular exception (if any)
Verification: Every hex in this section must EXACTLY match the @theme block. A single mismatch is a bug.
§20 The Complete TypeScript Interface Reference
Purpose: Serve as the API contract reference.
Required content:
Marketing interfaces (all from src/types/index.ts)
Pipeline domain interfaces (in src/features/*/domain/)
Billing interfaces (in src/features/billing/)
Pipeline queries interfaces
Auth interfaces
SSE/Progress interfaces
Storage interfaces
Environment interface (all env vars with descriptions)
Verification: Copy-paste each interface into the actual source file and verify it compiles.
Appendices
Appendix A: ADRs (Architecture Decision Records)
Table of ADRs with decision and rationale
Appendix B: Pipeline/Workflow Costs
If applicable, a table of operations with costs (credits, time, etc.)
Appendix C: Audit History
For each audit: date, findings, fixes, test progression
Appendix D: Post-Deploy Live-Site Validation
Smoke test scripts
agent-browser E2E methodology
What live-site testing catches that CI cannot
4. Validation Checklist
Before declaring a SKILL.md complete, verify ALL of the following:
Accuracy
Every version number matches package.json exactly
Every test count matches pnpm test output
Every file path exists (spot-check 10 random paths)
Every hex color matches the actual CSS
Every interface compiles in the actual project
Completeness
All 20 core sections are present
Table of Contents matches all headings
No "TODO" or "FIXME" remains
No placeholder text ("example.com", "placeholder")
All appendices are referenced from the main body
Usability
A new agent could recreate the environment from §3 alone
A new agent could extend a component correctly from §5
A new agent could debug a failed build from §10
A new agent could ship safely by following §11
Anti-Generic Quality
No generic advice ("use TypeScript strict mode" without specific flags)
No copy-pasted framework docs (only project-specific conventions)
Every claim traces to an actual file, test, or command
5. Anti-Patterns for SKILL.md Authors
§5.1 What NOT to Include
Generic framework tutorials — Link to official docs instead
Speculative future work — "We might switch to X" — not useful
Personal opinions without evidence — "I think X is better" needs a test or metric
Duplicated content — If the README covers it, reference the README
Placeholder version numbers — "next": "^16.x" is useless; lock the exact version
Unverifiable claims — Every claim must be checkable against the codebase
§5.2 What NOT to Do
Don't write the whole document at once — section by section, with verification between each
Don't copy from old docs without re-verifying — code drifts
Don't skip the "why" — every rule needs a rationale (e.g., "CSS-only animation for Lighthouse ≥95")
Don't forget the negative space — document what you DON'T do (e.g., "no Framer Motion")
Don't make non-commitments — "We might add i18n later" → just say "no i18n currently"
6. Skill Maintenance & Evolution
A SKILL.md is not "write once, read forever." It must evolve with the codebase. Without maintenance, it becomes a liability — outdated instructions that mislead more than help.
§6.1 When to Update
Trigger
Action
New sprint completed
Append lessons to §12; add new anti-patterns to §9 if bugs were found
Dependency major upgrade
Update §2 versions; document any breaking changes in §3 or §10
New feature shipped
Update §5 component inventory; add any new hooks to §6; update §7 data files
Security audit completed
Add findings to §9; remediation steps to §10; hardening to §14
Build/test pipeline changed
Update §11 pre-ship checklist; §3 bootstrapping if commands changed
Team member onboarding confusion
If someone asked "how do I...?", that section needs expansion
Sprint 3+ without update
Schedule dedicated "doc maintenance" half-day
§6.2 Version Numbering
Use semantic versioning for the SKILL.md itself:
v1.0.0 Initial release — covers MVP scope
v1.1.0 Minor — added new sections (e.g., Appendix D)
v1.1.1 Patch — corrected test counts, fixed file paths
v2.0.0 Major — dependency upgrade (e.g., Next.js 15 → 16) changed patterns
Rule: Bump the minor version on every sprint. Bump the major version on framework upgrades.
§6.3 Drift Detection
Run this monthly to detect when the codebase has outpaced the docs:
#!/bin/bash# skill-drift-check.sh — Add to CI or run manually
ERRORS=0
# 1. Verify test counts match
UNIT_TESTS=$(pnpm test 2>&1 | grep "Tests" | awk '{print $2}')
SKILL_UNIT=$(grep "Tests.*pass" docs/SKILL.md | head -1 | grep -oP '\d+(?=\s+unit)')
if [ "$UNIT_TESTS" != "$SKILL_UNIT" ]; thenecho"⚠ SKILL.md claims $SKILL_UNIT unit tests; actual: $UNIT_TESTS"
ERRORS=$((ERRORS+1))
fi# 2. Verify no new components are unlisted
COMPONENT_COUNT=$(find src/components -name "*.tsx" | wc -l)
SKILL_COMPONENTS=$(grep -oP '\d+(?=\s+components)' docs/SKILL.md | head -1)
if [ "$COMPONENT_COUNT" != "$SKILL_COMPONENTS" ]; thenecho"⚠ SKILL.md claims $SKILL_COMPONENTS components; actual: $COMPONENT_COUNT"
ERRORS=$((ERRORS+1))
fi# 3. Verify env var count matches
ENV_COUNT=$(grep -c "^env\." src/lib/env/index.ts 2>/dev/null || echo"0")
SKILL_ENV=$(grep -oP '\d+(?=\s+env vars)' docs/SKILL.md | head -1 || echo"0")
if [ "$ENV_COUNT" != "$SKILL_ENV" ]; thenecho"⚠ SKILL.md claims $SKILL_ENV env vars; actual: $ENV_COUNT"
ERRORS=$((ERRORS+1))
fi# 4. Verify no TODO/FIXME remain
TODO_COUNT=$(grep -c "TODO\|FIXME" docs/SKILL.md || echo"0")
if [ "$TODO_COUNT" -gt 0 ]; thenecho"⚠ Found $TODO_COUNT TODO/FIXME in SKILL.md"
ERRORS=$((ERRORS+1))
fiif [ $ERRORS -eq 0 ]; thenecho"✅ SKILL.md drift check passed"elseecho"❌ Found $ERRORS discrepancy(s). Update SKILL.md."exit 1
fi
---
## 7. Appendix: Example Section Templates### Template: §2 Tech Stack Table
```markdown
| Layer | Technology | Version | Critical Note |
|---|---|---|---|
| Framework | Next.js (App Router, hybrid) | `^16.2.0` | Turbopack dev; `proxy.ts` replaces `middleware.ts` |
| UI Runtime | React (strict TypeScript) | `^19.2.3` | ⚠️ CVE-2025-55182 floor — never downgrade |
| Styling | Tailwind CSS (CSS-first `@theme`) | `^4.3.0` | No `tailwind.config.ts` — all tokens in `globals.css` |
Template: §9 Anti-Pattern Entry
### Bug: [Short Name] ([Severity])**Symptom:** [What the user sees]
**Root cause:** [Technical explanation]
**Fix:** [Link to PR or specific code change]
**Lesson:** [What to do differently next time]
Template: §12 Lesson Entry
[##]. **[Lesson title]** — [Context]
[Detailed explanation of what happened, why it mattered, and how to avoid it.
Include the specific fix references like (T1), (NF-6) if applicable.]
End of meta-skill. This document itself was produced by following the Six-Phase Distillation Process on a Next.js 16 + React 19 + Tailwind v4 + Drizzle ORM + Inngest codebase. For the resulting skill file, see storyintovideo_SKILL.md.