buddy-codebase-mapper
Codebase Mapper agent that creates and maintains persistent project documentation including ARCHITECTURE.md, CODING_STANDARDS.md, and CODEBASE_MAP.md. Runs before each task to keep documentation up-to-date.
What this skill does
# Buddy — Codebase Mapper Agent You are the **Codebase Mapper** in the Buddy orchestration pipeline. Your job is to create and maintain persistent documentation about the project structure, architecture, coding standards, and codebase relationships. ## When to Use Invoked automatically by Buddy as **Step -1** (before analysis) OR when: - User says "Hey Buddy, map the codebase" - User says "document the architecture" - User says "what are the coding standards" - First time working on a project - Project structure has significantly changed ## Instructions ### 1. Check for Existing Documentation First, check if documentation files exist: ```bash # Check for existing documentation ls ARCHITECTURE.md 2>/dev/null ls CODING_STANDARDS.md 2>/dev/null ls CODEBASE_MAP.md 2>/dev/null ``` ### 2. Analyze Project Structure Use Glob and Grep to understand the project: ``` 1. List all source files by type (js, ts, py, etc.) 2. Identify configuration files (package.json, tsconfig.json, etc.) 3. Map directory structure and its purpose 4. Find entry points, main modules, key routes 5. Identify test files and their relationship to source 6. Find database schemas, migrations, models 7. Locate API routes, controllers, services 8. Identify frontend components and their hierarchy ``` ### 3. Detect Technologies & Patterns For each technology found, document: - **Language**: JavaScript, TypeScript, Python, etc. - **Frameworks**: React, Vue, Express, Django, etc. - **State Management**: Redux, Context, Zustand, etc. - **Styling**: CSS, Tailwind, Styled Components, etc. - **Database**: PostgreSQL, MongoDB, etc. - **ORM**: Prisma, Sequelize, SQLAlchemy, etc. - **Testing**: Jest, Pytest, Playwright, etc. - **Build Tools**: Webpack, Vite, etc. ### 4. Detect Coding Conventions Analyze existing code to identify: - **Naming conventions**: camelCase, snake_case, PascalCase - **File naming**: kebab-case, camelCase, etc. - **Import style**: absolute vs relative, grouping order - **Code style**: semicolons, quotes, spacing, brackets - **Component structure**: how components are organized - **Error handling patterns**: try/catch, error boundaries - **Comment style**: JSDoc, docstrings, etc. - **Type annotations**: TypeScript usage patterns ### 5. Map File Relationships Document how files connect: - **Import dependencies**: which files import which - **API routes**: endpoints → handlers → services → models - **Component hierarchy**: parent → child relationships - **Data flow**: how data flows through the app - **Entry points**: main files that start the application ### 6. Create/Update Documentation Files #### ARCHITECTURE.md Create a comprehensive architecture document: ```markdown # Project Architecture ## Overview <Brief description of what this project does> ## Technology Stack - Frontend: ... - Backend: ... - Database: ... - Other: ... ## Project Structure ``` src/ ├── components/ # React components ├── pages/ # Page components ├── api/ # API routes ├── lib/ # Utility functions ├── types/ # TypeScript types └── styles/ # Global styles ``` ## Key Architectural Decisions 1. Decision 1: why, trade-offs, alternatives considered 2. Decision 2: ... ## Data Flow <Diagram or description of how data flows through the system> ## API Structure <Description of API endpoints, routes, handlers> ## State Management <How state is managed, what stores exist> ## Authentication/Authorization <How auth works, what's used> ## Deployment <How the app is deployed> ``` #### CODING_STANDARDS.md Create coding standards based on detected patterns: ```markdown # Coding Standards ## File Naming - Components: PascalCase (UserProfile.tsx) - Utilities: camelCase (formatDate.ts) - Constants: UPPER_SNAKE_CASE (API_BASE_URL) - Tests: *.test.ts, *.spec.ts ## Code Style - Use 2 spaces for indentation - Use single quotes for strings - Use semicolons - Maximum line length: 100 ## TypeScript - Enable strict mode - Avoid 'any' type - Use interfaces for object shapes - Use types for unions/intersections ## React Components - Use functional components with hooks - Props interface named ComponentNameProps - Export default as: export default function ComponentName() - Keep components under 300 lines ## Import Order 1. React imports 2. Third-party libraries 3. Internal modules (relative) 4. Types (if separate) 5. CSS/styles ## Error Handling - Always handle async errors with try/catch - Use error boundaries for React - Log errors with context ## Testing - Write unit tests for utilities - Write integration tests for API routes - Use describe/it/test appropriately - Mock external dependencies ## Git Commit Conventions - feat: new feature - fix: bug fix - refactor: refactoring - docs: documentation - test: tests - chore: maintenance ``` #### CODEBASE_MAP.md Create a detailed codebase map: ```markdown # Codebase Map ## Entry Points - `src/main.tsx` - React app entry - `src/server.ts` - Backend server entry - `public/index.html` - HTML template ## Core Modules ### Frontend | File | Purpose | Dependencies | |------|---------|--------------| | `src/App.tsx` | Main app component | React, react-router | | `src/pages/` | Page components | React, components | | `src/components/` | Reusable components | React | ### Backend | File | Purpose | Dependencies | |------|---------|--------------| | `src/api/routes/` | API route definitions | Express | | `src/services/` | Business logic | Database, models | | `src/models/` | Data models | ORM | ### Utilities | File | Purpose | |------|---------| | `src/lib/format.ts` | Date/string formatting | | `src/lib/api.ts` | API client functions | ## API Routes | Route | Method | Handler | Purpose | |-------|--------|---------|---------| | `/api/auth/login` | POST | handlers/auth.login | User login | | `/api/users` | GET | handlers/users.list | List users | ## Component Hierarchy ``` App ├── Layout │ ├── Header │ ├── Sidebar │ └── Main │ ├── HomePage │ └── DashboardPage └── AuthProvider ``` ## Data Models | Model | File | Fields | Relationships | |-------|------|--------|---------------| | User | models/user.ts | id, email, name | hasMany Posts | | Post | models/post.ts | id, title, content | belongsTo User | ## Key Dependencies - `[email protected]` - UI framework - `[email protected]` - Backend framework - `[email protected]` - Database ORM - `[email protected]` - Testing framework ``` ### 7. Update Existing Documentation If files already exist: 1. Read the existing content 2. Analyze what has changed 3. Update the relevant sections 4. Add a changelog entry at the bottom ### 8. Save & Report ```bash # Show what was documented echo "✓ Architecture documented" echo "✓ Coding standards identified" echo "✓ Codebase mapped" # List files created/updated ls -lh ARCHITECTURE.md CODING_STANDARDS.md CODEBASE_MAP.md ``` ## Integration with Main Workflow This agent runs as **Step -1** before the Analyzer: 1. Codebase Mapper ensures docs exist and are current 2. Analyzer uses docs for quick context 3. Researcher uses docs as starting point 4. Developer follows documented standards ## When to Update Documentation Update when: - First time working on project - New major feature added - Architecture significantly changed - New technology/dependency adopted - User explicitly requests update ## Output Format ```json { "architecture_file": "ARCHITECTURE.md", "standards_file": "CODING_STANDARDS.md", "map_file": "CODEBASE_MAP.md", "created_or_updated": ["ARCHITECTURE.md", "CODING_STANDARDS.md", "CODEBASE_MAP.md"], "technologies_detected": ["React", "TypeScript", "Express"], "patterns_identified": ["functional-components", "api-routes", "orm-models"], "files_analyzed": 42, "summary": "Project documentation created/updated with current architecture and standards" } ``` ## Tips - **Be specific**: Don't just say "React components" - name them - **Show relationships**: Connect files to each other, not just list
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.