Map codebase
Skill akshay-diwadkar/skills/skills/engineering/map-codebase
Reusable engineering skills for AI coding assistants—covering codebase mapping, auditing, architecture, issue scoping, change planning, implementation, optimization, and diagramming.
npx -y skills add akshay-diwadkar/skills --skill map-codebaseAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Build and use compact repository knowledge for resolver-first code navigation. Use when starting coding work in an unfamiliar or large repository, locating likely implementation ownership, or refreshing repository knowledge after a coherent change set.
SKILL.md
8.8 KB, as published. Nobody here has run it
Map Codebase
Use compact machine-only repository knowledge to reduce exploration overhead while preserving source as authoritative.
Quick Start
For a task such as fixing retry behavior, first run status against the repository root to learn whether the existing knowledge is usable. Resolve the task at phase 1 and use the returned owner instead of broadly searching the repository. Read only that target and enough authoritative source to verify its contract. Implement the requested change once ownership is confirmed. After the coherent change set, run refresh with the changed files so the knowledge matches the source again. Finish with validate and the repository's normal verification commands.
Extractor Coverage
<!-- BEGIN EXTRACTOR COVERAGE -->| Extractor module | Inputs | Coverage | Resolver precision |
|---|---|---|---|
python.py | Python (.py) | Full AST extraction | Structured symbols, ranges, and imports provide the strongest ownership evidence. |
javascript.py | JavaScript, TypeScript, JSX, and TSX | Full dedicated extraction | Dedicated symbols and imports support normal path, symbol, and relationship ranking. |
lexical.py | Go, Rust, Java, C, and C++ | Lexical-only | Regex-discovered symbols and imports can miss complex or nested constructs, reducing resolver precision. |
configuration.py | Repository configuration files | Configuration metadata and command extraction | Known keys and commands support configuration ownership; unrecognized structures fall back to text evidence. |
Lexical-only means deterministic regex-based symbol and import discovery rather than language-aware parsing. It has lower structural confidence, so complex declarations, nesting, and unusual syntax may produce weaker or missing resolver evidence.
Core Workflow
- Resolve absolute skill and repository paths.
- Run
python scripts/cli.py status --repo-root /absolute/path/to/repo --format json. - Build only when artifacts are missing, invalid, or require a full rebuild. Otherwise refresh a safe delta or metadata-only revision.
- Resolve phase 1 and read only its returned targets. The resolver loads selected symbol shards internally.
- Verify behavior in authoritative source, then stop when the phase question is answered.
- Request phase 2 or 3 only for an explicit expansion trigger.
- Perform the coding task.
- After one coherent change set, refresh and validate.
Agent Mode Permissions
Read-side operations
status,resolve,validate, and direct reads of existing knowledge or source are read-only operations.- Read-side operations are permitted during plan mode and any other agent mode that prohibits file writes.
- Read-side operations are not gated on the freshness, presence, writability, or managed-block state of
AGENTS.mdorCLAUDE.md. - Use
resolvewith valid existing knowledge at whatever freshness state is available. - When knowledge artifacts are missing or invalid and the current mode prohibits writes, inspect authoritative source directly instead of requiring
build,refresh, orlink-docs. - Stale or missing knowledge never changes the rule that source is authoritative.
Write-side operations
buildwrites knowledge artifacts and finalizesAGENTS.mdandCLAUDE.md.refreshwrites knowledge artifacts and finalizesAGENTS.mdandCLAUDE.md.link-docswrites the managed references inAGENTS.mdandCLAUDE.md.generate-workflowwrites a managed GitHub workflow.- Run these write-side operations only when the current agent mode permits file writes.
- Importable
build_knowledge()andrefresh_knowledge()are lower-level artifact-only write APIs.
Freshness Rules
- Build when artifacts are missing, invalid, or require a full rebuild.
- Otherwise use
refreshfor a safe changed-file delta or metadata-only revision. refreshrebuilds missing, invalid, stale, and otherwise unsafe artifacts before reading a manifest.- After one coherent change set, refresh and validate.
See Worked Example for an actual partially-stale status, its refresh command, and a phase-1 resolver result.
Task Ownership Rules
- Every task has one deterministic primary owner and may have optional secondary constraints.
- Exact indexed paths and symbols take precedence over task vocabulary.
- Mixed implementation tasks remain source-first.
- Test creation, direct test maintenance, and explicit test-file work are test-owned.
Configuration Ranges and Relationships
- Configuration targets use bounded active structural ranges.
- TOML and INI targets are bounded to active sections.
- YAML and JSON targets are bounded by ancestry.
- Make targets are bounded to their active target ranges.
- All relationship evidence is directional.
- All relationship evidence is one-hop only.
Repository Scope and Untracked Files
include_untracked = falseapplies uniformly to build, status, refresh, and explicit--changed-filepaths.- The resolved knowledge directory is always excluded from repository metadata.
- The exclusion applies to the default directory and a custom
--outputdirectory. - The knowledge directory is also excluded from indexing, change detection, inventory fallback, and resolver searches.
- These exclusions apply even when the knowledge directory is not ignored by the repository.
Resolver Boundaries
- Use phase 1 first.
- Request phase 2 or 3 only when an explicit expansion trigger applies.
- Use
--phase allonly for explicit debugging or human inspection. - Do not preload repository maps or symbol shards.
- Read only the source targets returned for the active phase.
- The resolver loads selected symbol shards internally.
CLI Errors
- Expected CLI operational errors use concise stderr diagnostics.
- Expected CLI operational errors exit with a non-zero status.
statuspreserves its machine-readable zero-exit compatibility policy.
Skill Directory Resolution
- Resolve this skill directory before invoking bundled scripts.
- Use the resolved skill directory as the command base.
- Do not assume the current working directory is the skill directory.
Commands
python scripts/cli.py build --repo-root /absolute/path/to/repo
python scripts/cli.py status --repo-root /absolute/path/to/repo --format json
python scripts/cli.py resolve "<task>" --repo-root /absolute/path/to/repo --phase 1 --format json
python scripts/cli.py refresh --repo-root /absolute/path/to/repo --changed-file /absolute/path/to/repo/src/example.py
python scripts/cli.py validate --repo-root /absolute/path/to/repo
The unified CLI is the preferred interface.
Agent-Document Finalization
- Successful unified CLI
buildandrefreshcommands ensureAGENTS.mdandCLAUDE.mdeach contain one current managed repository-knowledge reference. - Successful standalone
scripts/build_knowledge.pyandscripts/refresh_knowledge.pyexecutions provide the same finalization. - Importable
build_knowledge()andrefresh_knowledge()remain lower-level artifact-only APIs and do not finalize instruction files. - Missing
AGENTS.mdandCLAUDE.mdfiles are created. - User content outside the managed block is preserved.
- Custom
--outputpaths are reflected in the managed reference. - Add
<!-- OPT-OUT MAP-CODEBASE -->to either existing file to skip only that file. - Changed instruction files are atomically replaced per file.
- A failed two-file commit rolls back both instruction files to their pre-operation state.
- Knowledge artifacts remain available when instruction-file finalization fails.
link-docsexplicitly repairs or reapplies the references.link-docsalways creates missing supported files.link-docs --create-missingremains accepted as a compatibility no-op.
Workflow Generation
To explicitly add a managed GitHub refresh workflow, provide an immutable runtime revision:
python scripts/cli.py generate-workflow --repo-root /absolute/path/to/repo \
--revision <40-character-commit-sha>
- Workflow generation is opt-in.
- Normal knowledge commands never create or modify workflows.
Common Mistakes
- Do not preload symbol shards; the resolver loads selected shards internally.
- Do not run
--phase alloutside explicit debugging or human inspection. - Do not treat a stale instruction-file reference as a reason to block
status,resolve, or source reads. - Do not force a write in plan or read-only mode when knowledge is missing; fall back to authoritative source.
- Do not skip refresh after edits; stale knowledge silently reduces resolver accuracy.