Uses CodeMaps MCP as the default architectural brain for project understanding, debugging, refactors, reviews, and migration campaigns. Invoke whenever CodeMaps is connected.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Codemaps Agent Autopilot?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/zilk102-codemaps-agent-autopilot)
---
name: 'codemaps-agent-autopilot'
description: 'Uses CodeMaps MCP as the default architectural brain for project understanding, debugging, refactors, reviews, and migration campaigns. Invoke whenever CodeMaps is connected.'
---
# CodeMaps Agent Autopilot
Use this skill whenever the workspace has the `codemaps` MCP server available.
## Goal
Treat CodeMaps as the primary architectural intelligence layer before editing code.
Do not wait until after file inspection to use it.
## MCP Server
- Server name: `codemaps`
- MCP endpoint: `http://127.0.0.1:3005/mcp`
## First Contact
Call `setup_project` once per project, before anything else, with `projectPath` set to your current working directory (it is required). It is idempotent and cheap: it reports `upToDate` when nothing needs to change. It detects the stack and your agent, writes the guardrails (AGENTS.md section, agent rules, this skill, the edit hook, `.codemaps/config.json`) and freezes the findings the project already has in `.codemaps/baseline.json`, so nobody has to configure anything by hand. Read its `nextSteps` and `warnings`, and tell the user to commit `.codemaps/` and the agent files.
## Default Flow
1. If the project is not analyzed yet, call `analyze_project`.
2. For any natural-language user request, call `prepare_task_context` first.
3. If CodeMaps routes the task to a campaign-level change, use `prepare_change_campaign`.
4. If CodeMaps routes the task to a single-target code change, use `prepare_change_context`.
5. If CodeMaps routes the task to diagnostics, review, architecture, or stabilization, use `prepare_review_context`.
6. Use low-level tools only as fallback when the composite context explicitly leaves ambiguity.
## Routing Rules
- Bug, incident, regression, "not working", "broken":
Start with `prepare_task_context`. Use `get_semantic_skeleton` on large files to save tokens while exploring.
- Code cleanup, refactoring monoliths, removing slop, fixing God classes, resolving duplication:
Start with `analyze_decomposition` (pass `filePath` for a specific file) to get actionable refactoring targets and `splitPlans`: the file's symbols already grouped into clusters with a suggested file each. Follow the clusters instead of reading the whole file, keep `sharedHelpers` and `orchestrators` where they are, then use `prepare_change_context` on the chosen targets.
- Duplicated or copy-pasted code, "remove duplication":
Call `find_duplicates` (pass `filePath` to focus on one file). Each group lists the copies with line ranges, `parameters` (how many values differ, i.e. the arguments of the function to extract), sample `differences` and a `suggestion` with the action and a target file. Extract the shared code there, then call `find_duplicates` again to confirm the group is gone.
- Writing or changing code in any language:
Follow the Documentation Rules below, then call `check_documentation`.
- Broad migration, replace SDK/library everywhere, cross-cutting refactor:
Start with `prepare_task_context` and follow `prepare_change_campaign` if selected.
- Localized feature/refactor with a clear code area:
Start with `prepare_task_context`, then follow `prepare_change_context`.
- Review, architecture audit, security review, stabilization:
Start with `prepare_task_context`, then follow `prepare_review_context`.
## Documentation Rules
- Open every new or changed file with a header comment, and put a doc comment above every exported symbol and every function of 10 or more lines.
- State the purpose, the contract (inputs, result, failures) and why the code exists. Never repeat the name ("Gets the user" above `getUser`), and never leave commented-out code behind.
- Call `check_documentation` (pass `filePath` to focus on the files you touched) and fix every symbol it lists; each item has a `hint` saying what its comment must state. `validate_architecture_changes` also reports `missing_documentation` for the files you changed.
## Legacy Code and the Ratchet
- `.codemaps/baseline.json` freezes the findings the project already had when `setup_project` ran. Only new or worsened findings are reported (`legacyDebt` summarizes the rest), so fix what you introduced and leave old debt alone unless the task is to pay it down.
- Never edit the baseline by hand and never add to it. After paying debt down, call `validate_architecture_changes` with `refreshBaseline: true`, which only ever shrinks it, and tell the user to commit the smaller file.
- CI enforces the same rules: pull requests run `codemaps-guard` (`.github/workflows/codemaps-guard.yml` or `.codemaps/ci/`), which fails on new or worsened findings and when the baseline grows. A clean `validate_architecture_changes` and `check_documentation` run keeps it green.
- `.codemaps/config.json` holds the project's rules (`mode`, `exclude`, `thresholds`, `documentation`). Change it only when the user asks.
## Refactoring Legacy Code
- Start with `analyze_decomposition` on the worst file to get split plans, and `find_duplicates` to see what can be extracted.
- For a migration or any change that touches many files, call `prepare_change_campaign` and work wave by wave instead of editing ad hoc.
- Validate after every wave with `validate_architecture_changes`; a finished refactor leaves fewer findings than it started with.
## Token Efficiency
- Read the structure of a large file with `get_semantic_skeleton` before opening it, and find declarations with `search_signatures` instead of grepping.
- Prefer one `prepare_*` call over several low-level calls. Responses are size-bounded: when `_compaction` is present some lists were cut, so raise `limit` (up to 50) or use a low-level tool for the omitted part.
- Pass `filePath` or `changedFiles` so tools look at your change instead of the whole project.
## Mandatory Behavior
- Use CodeMaps before making non-trivial code decisions.
- Prefer CodeMaps composite contexts over raw graph tools.
- Do not guess target files when CodeMaps cannot resolve them confidently.
- If the project is not loaded in CodeMaps, call `analyze_project` with the ABSOLUTE path of the project. Never assume CodeMaps knows the workspace directory.
- For large changes, work in waves from `prepare_change_campaign` instead of editing many files ad hoc.
- Re-check CodeMaps after meaningful edits if the architectural context may have changed.
- BEFORE telling the user a non-trivial change is finished, run `validate_architecture_changes` and fix every violation it reports (cycles, God classes, clones, broken layer boundaries).
- Before writing new code that resembles existing code, call `find_duplicates` (with `filePath` of the similar file) and reuse or extract instead of copy-pasting; after a refactor, call it again to confirm the duplication is gone.
## Low-Level Fallback Tools
Use these only if the selected composite context is insufficient:
- `search_graph`
- `get_node_dependencies`
- `get_blast_radius`
- `get_architecture_overview`
- `get_health_score`
- `detect_patterns`
- `analyze_decomposition`
- `find_duplicates` (copy-pasted code with how to extract it: parameters, differences and a target file)
- `check_documentation` (documentation coverage with a hint per undocumented symbol)
- `run_security_scan`
- `search_signatures`
- `get_semantic_skeleton` (read a file's structure without bodies, to save tokens)
- `validate_architecture_changes` (checks only the files you changed, returns problems with fix hints)
## Expected Outcome
The agent should behave like it has a project-aware architectural map:
- understand the system before editing,
- choose the right scope automatically,
- avoid blind file-by-file wandering,
- treat CodeMaps as the default brain for project structure and impact analysis.