Analyze an existing codebase. Maps structure, architecture, conventions, and concerns.
Analyzes existing codebases to map their structure, architecture, conventions, and concerns for informed project planning.
npx claudepluginhub sienklogic/towlineThis skill is limited to using the following tools:
templates/mapper-prompt.md.tmplYou are running the scan skill. Your job is to analyze an existing codebase and produce a comprehensive map of its structure, architecture, conventions, and concerns. This is the entry point for brownfield projects — codebases that already have code before Towline is introduced.
This skill spawns 4 parallel Task(subagent_type: "dev:towline-codebase-mapper") agents for analysis.
Reference: skills/shared/context-budget.md for the universal orchestrator rules.
Additionally for this skill:
Understand before you change. Scanning a codebase is about building a mental model of what exists. Every file produced by this skill becomes context that the planner and executor use to make informed decisions. Accuracy matters more than speed.
Check if .planning/codebase/ directory exists:
If it exists and has files:
A codebase analysis already exists (from {date based on file modification}).
Files found:
- {list of .md files in the directory}
Options:
1. Refresh the full analysis (overwrites existing)
2. Refresh a specific area (available areas depend on depth profile: quick mode only offers tech/arch)
3. Keep existing analysis
If it doesn't exist:
.planning/codebase/ directory.planning/ if it doesn't exist (scan can be run before begin)Reference: skills/shared/context-loader-task.md (Scan Reconnaissance variation) for the underlying pattern.
Before spawning agents, do a quick scan to identify what we're working with. This gives agents better context.
.planning/codebase/RECON.md with project type, scale, key directories, entry points, and quick statsRefer to the "Reconnaissance Detection Reference" section of skills/scan/templates/mapper-prompt.md.tmpl for the full detection checklists.
Resolve mapper configuration: Before spawning, resolve the depth profile:
node ${CLAUDE_PLUGIN_ROOT}/scripts/towline-tools.js config resolve-depth
Read profile["scan.mapper_count"] and profile["scan.mapper_areas"] to determine how many mappers to spawn and which focus areas to cover.
Default mappings by depth:
quick (budget): 2 mappers -- tech and arch only. Produces STACK.md, INTEGRATIONS.md, ARCHITECTURE.md, STRUCTURE.md. Skips quality and concerns analysis.standard (balanced): 4 mappers -- all areas. Full analysis.comprehensive (thorough): 4 mappers -- all areas. Full analysis.Display to the user: ◐ Spawning {mapper_count} codebase mapper(s) in parallel...
Spawn {mapper_count} parallel Task(subagent_type: "dev:towline-codebase-mapper") agents, one for each area in scan.mapper_areas. All should be spawned in a single response for maximum parallelism.
For each agent, read skills/scan/templates/mapper-prompt.md.tmpl and fill in the placeholders:
{focus_area}: one of tech, arch, quality, concerns{project_path}: the working directory{recon_data}: contents of RECON.md{scale}: detected scale from Step 2{output_path}: .planning/codebase/| Agent | Focus | Output Files | When |
|---|---|---|---|
| 1 | tech | STACK.md, INTEGRATIONS.md | Always |
| 2 | arch | ARCHITECTURE.md, STRUCTURE.md | Always |
| 3 | quality | CONVENTIONS.md, TESTING.md | standard + comprehensive |
| 4 | concerns | CONCERNS.md | standard + comprehensive |
All 4 agents run in parallel. Report progress as each completes:
Scanning codebase...
[1/4] Technology stack... done
[2/4] Architecture... done
[3/4] Code quality... done
[4/4] Concerns... done
After all agents complete, verify the expected files exist:
Required files (always):
.planning/codebase/RECON.md (created in Step 2).planning/codebase/STACK.md (tech mapper).planning/codebase/INTEGRATIONS.md (tech mapper).planning/codebase/ARCHITECTURE.md (arch mapper).planning/codebase/STRUCTURE.md (arch mapper)Required files (standard + comprehensive only):
.planning/codebase/CONVENTIONS.md (quality mapper).planning/codebase/TESTING.md (quality mapper).planning/codebase/CONCERNS.md (concerns mapper)Check only the files that correspond to the mapper areas that were actually spawned.
For any missing files, display:
╔══════════════════════════════════════════════════════════════╗
║ ERROR ║
╚══════════════════════════════════════════════════════════════╝
Missing analysis output: {filename}
Agent that failed: {focus_area} mapper
**To fix:** Re-run with `/dev:scan` and select "Refresh a specific area" → {focus_area}.
Read key findings from each file (frontmatter or first section) and display using the branded stage banner from references/ui-formatting.md:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TOWLINE ► SCAN COMPLETE ✓
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Project: {type} ({scale})
Stack: {primary language} + {framework}
Architecture: {style}
Key Stats:
- {file count} source files, {test count} test files
- {dependency count} dependencies
- {integration count} external integrations
Concerns: {critical} critical, {high} high, {medium} medium
Top concerns:
1. {most critical concern}
2. {second concern}
3. {third concern}
Full analysis: .planning/codebase/
Then use the "Next Up" routing block:
───────────────────────────────────────────────────────────────
## ▶ Next Up
**Start a project** — use the scan results to plan your work
`/dev:begin`
<sub>`/clear` first → fresh context window</sub>
───────────────────────────────────────────────────────────────
**Also available:**
- `/dev:milestone new` — create a milestone to address concerns
- `/dev:status` — see project status
───────────────────────────────────────────────────────────────
Reference: skills/shared/commit-planning-docs.md for the standard commit pattern.
If .planning/config.json exists and planning.commit_docs: true:
git add .planning/codebase/
git commit -m "docs(planning): map existing codebase"
If no config exists yet (scan before begin), use AskUserQuestion (pattern: yes-no from skills/shared/gate-prompts.md):
question: "Commit the codebase analysis to git?"
header: "Commit?"
options:
- label: "Yes" description: "Stage and commit .planning/codebase/ files"
- label: "No" description: "Skip commit — files are saved but not committed"
git add .planning/codebase/ && git commit -m "docs(planning): map existing codebase".planning/ and .planning/codebase/ if neededReference: skills/shared/universal-anti-patterns.md for rules that apply to ALL skills.
Additionally for this skill:
npm start, python app.py, etc.) — analyze staticallyActivates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
Search, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.