Maps a codebase to produce structured analysis documents in .planning/codebase/. Use when starting work on a new codebase, onboarding to a project, or refreshing a stale codebase map. Do NOT use for task-scoped research (use /jc:research).
STACK.md + INTEGRATIONS.md. Architecture → ARCHITECTURE.md. Quality → CONVENTIONS.md + TESTING.md. Concerns → CONCERNS.md. All in .planning/codebase/.Resolve from the skill's base directory (the directory containing this SKILL.md):
| Variable | Resolved Path |
|---|---|
{plugin-docs} | {skill-base-dir}/../../docs/ |
{agents-dir} | {skill-base-dir}/../../agents/ |
Check for project indicators — any of: package manifests (package.json, Cargo.toml, go.mod, pyproject.toml, Gemfile, pom.xml, build.gradle, etc.), src/ or lib/ directories, or a build/bundler config.
If multiple project roots are plausible (e.g., monorepo sub-package with its own package.json), use the current working directory as the project root — the skill does not walk up the directory tree.
If .planning/codebase/ already exists with any files:
First, check which of the 6 expected files exist. Then use AskUserQuestion, including the file list in the question context:
If user cancels, stop and report current map paths.
Spawn 4 team-mapper agents in parallel via the Task tool. Each agent gets one focus area.
For each agent, create a task via TaskCreate with metadata, then spawn the agent with only the task ID:
| Focus Area | {focus_area} | {output_files} |
|---|---|---|
| Technology | technology | STACK.md, INTEGRATIONS.md |
| Architecture | architecture | ARCHITECTURE.md |
| Quality | quality | CONVENTIONS.md, TESTING.md |
| Concerns | concerns | CONCERNS.md |
Per agent:
TaskCreate with:
map-{focus_area}Map the {focus_area} focus area for this codebase{"focus_area": "{focus_area}", "codebase_map_dir": "{absolute_project_root}/.planning/codebase/"}Spawn agent with subagent_type: "team-mapper", prompt: Your task is {task-id-from-TaskCreate}.
Spawn all 4 agents in a single message so they run concurrently — sequential spawning would serialize the analysis and roughly quadruple wall-clock time.
After each agent completes, read results via TaskGet on the created task to confirm completion.
Use AskUserQuestion to gather key decisions:
Read {agents-dir}/team-mapper.md to obtain the output format templates. Write all 6 files directly to .planning/codebase/ as prescriptive guides based on user answers, conforming to those templates. Get the timestamp via mcp__time__get_current_time.
After all agents complete (brownfield) or docs are written (greenfield), verify all 6 files exist:
ls .planning/codebase/STACK.md .planning/codebase/INTEGRATIONS.md .planning/codebase/ARCHITECTURE.md .planning/codebase/CONVENTIONS.md .planning/codebase/TESTING.md .planning/codebase/CONCERNS.md
If any file is missing, report which files are missing. To recover, re-spawn a single team-mapper agent for the failed focus area using the same TaskCreate + Agent pattern from Step 3A with the appropriate {focus_area}. The other files are safe — mapper agents only write their own focus area's files.
Stage and commit the codebase map:
git add .planning/codebase/
git commit -m "docs(jc): map codebase"
NEVER use --no-gpg-sign. If GPG signing fails due to sandbox restrictions, exclude the git command from sandboxing. If commit fails for any other reason (lock file, dirty index, pre-commit hook, path errors), report the error, list the files written, and instruct the user to commit manually.
Report to user:
/jc:research as the next step for task-scoped work.planning/codebase/ after completion/jc:research)../../agents/team-mapper.md../../docs/agent-io-contract.md