From dev-playbook
Use when exploring, studying, or porting an unfamiliar legacy codebase. Triggers when the user says "explore this project", "understand this code", "I need to port this", "how does this app work", "document this codebase", "study this code", or any request to deeply understand an existing project they did not write. Also triggers when onboarding to a new repo or preparing migration/rewrite plans.
How this skill is triggered — by the user, by Claude, or both
Slash command
/dev-playbook:drive-to-legacyThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
A 6-phase systematic approach to fully understand an unfamiliar codebase, producing a comprehensive architecture document with mermaid diagrams that both humans and AI can use for porting, migration, or onboarding.
A 6-phase systematic approach to fully understand an unfamiliar codebase, producing a comprehensive architecture document with mermaid diagrams that both humans and AI can use for porting, migration, or onboarding.
Core principle: Explore wide before deep. Map the full territory first, then drill into each layer. Every finding goes into a living ARCHITECTURE.md with diagrams.
When NOT to use:
Follow these phases in order. Each phase builds on the previous. Use parallel Explore agents where possible to speed up discovery.
Goal: Describe WHAT the app does from the user's perspective. This comes first because it answers "why does this app exist?" — the context that makes all technical details meaningful.
package.json / README.md to understand the app's purposeWrite to ARCHITECTURE.md:
sequenceDiagram showing the interactionTemplate per story:
### US-XX: Story Title
AS A [role]
I WANT TO [action]
SO THAT [outcome]
(mermaid sequence diagram)
Goal: Know the tech stack, file layout, and component tree.
vite.config.ts, webpack.config.js, tsconfig.json, etc.)**/*.tsx, **/*.ts, **/*.vue, etc.Write to ARCHITECTURE.md:
graph TD diagram)Goal: Understand every entity, type, and relationship.
Capture:
Write to ARCHITECTURE.md:
erDiagram with field lists)Goal: Extract every rule, validation, cascade, and conditional behavior.
This is the deepest phase. Read line by line through:
Write to ARCHITECTURE.md:
flowchart TD for decision treesGoal: Document every data query with exact parameters, filters, joins, and purpose.
CRITICAL RULE: Every API endpoint MUST have a Why row. The Why explains the business reason the data is needed - not just "fetches X from Y" but why the application cannot function without this call. Without Why, a developer porting the code cannot tell which APIs are essential vs. nice-to-have, or what would break if the API were removed or changed.
For each service method / API call:
The Why row must answer: "What business goal does this query serve? What breaks or becomes impossible without it?"
Good Why examples:
Bad Why examples:
Write to ARCHITECTURE.md:
| Property | Value |
|---|---|
| Called by | Component or function name |
| API method | The actual call pattern |
| Entity | Table/endpoint queried |
| Parameters | Input values |
| When | Trigger condition |
| Why | Business reason this data is needed |
Also document inline queries - queries defined inside components (not just in the service layer). These are easy to miss.
Goal: Know how to run, build, and ship.
Write to ARCHITECTURE.md:
graph TD from dev to production)The final document should follow this reading order (user stories first — they answer "why does this app exist?" and make everything else meaningful):
# Project Name - Architecture Reference
> One-paragraph summary
## Table of Contents (clickable anchor links)
## Part 1: User Stories
- One subsection per story with sequence diagrams
## Part 2: Overview and Project Structure
- What This App Does
- Tech Stack and Key Dependencies
- File-to-Responsibility Map
- Key Constants and Option Set Values
- Component Hierarchy (diagram)
- Entity Relationship Diagram
- State Management Overview (diagram)
## Part 3: Application Flow
- Bootstrap / initialization sequence
- Main user flows as sequence diagrams
- Save / submit flow
## Part 4: Business Logic and Rules
- Subsection per rule domain with flowcharts
- Validation rules
- Cascade logic
- Conditional rendering rules
- Auto-population rules
- Nullability and silent fallbacks
## Part 5: Data Model and Field Mapping
- TypeScript-to-database field mapping (diagram)
- Conditional field mapping rules
## Part 6: API Reference
- Overview of query patterns used
- One subsection per endpoint (properties table + exact query + why)
- Inline component queries
- API call map by user action (diagram)
## Part 7: Technical Components
- Reusable components worth understanding
- Build and deploy pipeline
&, --, /, *, () in headings (they break anchor generation).---) between Parts for visual separation.Use multiple Explore agents in parallel to speed up Phase 1-3:
Agent 1: Read entry points, config, types, UI flows → Phase 1 + Phase 2
Agent 2: Read all types, service layer, entity references → Phase 3
Agent 3: Read service layer, extract all queries → Phase 5
Then do Phase 4 (business logic) sequentially — it requires understanding from all previous phases.
| Mistake | Fix |
|---|---|
| Starting with business logic before understanding structure | Follow phases in order. Phase 1-3 first. |
| Missing inline queries in components | Grep for query patterns in component files, not just service files |
| Writing "what" without "why" in API docs | Every API endpoint MUST have a Why row explaining the business reason, not just technical description. "Fetches data" is not a Why. |
| Why row says "fetches X" or "returns Y" | That describes What, not Why. Ask: "What breaks without this call? What business goal does it serve?" |
| Headings with special characters breaking TOC | Use only alphanumeric, spaces, and hyphens in headings |
| Enormous single-pass exploration | Use parallel agents. Split by concern. |
| Documenting only the happy path | Include error handling, fallbacks, and nullability chains |
| Skipping the user stories | User stories provide the "why" context that makes technical docs useful |
npx claudepluginhub thodsaphonsonthiphin/dev-playbook --plugin dev-playbookProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.