Codebase Analysis AI
Keep repository documentation aligned with implementation changes while minimizing repository reads and repeated analysis.
Select one mode
Choose exactly one mode before reading additional references.
setup: Install the skill, persistent agent rules, deterministic runtime, Git hooks, or GitHub Action. Require an explicit setup request. Readreferences/setup-mode.mdandreferences/automation.md.bootstrap: Create a complete documentation system from scratch. Require an explicit request to scan the full repository. Readreferences/bootstrap-mode.md,references/project-taxonomy.md,references/document-style.md, andreferences/subagent-contract.md.update: Update existing documentation from current Git changes, a commit, or a commit range. This is the default synchronization mode. Readreferences/update-mode.md,references/change-detection.md,references/impact-resolution.md, andreferences/document-style.md.audit: Inspect documentation accuracy, readability, language consistency, and link consistency without changing files. Readreferences/audit-mode.md,references/quality-rules.md, andreferences/document-style.md.migrate: Index and normalize existing documentation that has no Codebase Analysis AI metadata. Readreferences/migrate-mode.md,references/documentation-schema.md,references/naming-conventions.md, andreferences/document-style.md.
Do not read references for unrelated modes.
Guardrails
- Never perform a full repository scan unless
bootstrapis explicit. - If
docs/is missing and bootstrap was not explicit, ask whether to initialize complete documentation or stop. - If
docs/exists butdocs/_meta/documentation-map.jsondoes not, usemigrate; do not silently rebuild all documentation. - In
update, inspect only changed files, mapped documents, and directly related first-level documents. Do not traverse related links recursively. - Treat
scripts/codebase_analysis_ai.py checkas a deterministic gate. Treatauditas an agent-led read-only review. Do not conflate them. - Do not invent commands, architecture, dependencies, active functionality, or planned work. Ground every claim in repository evidence.
- Never expose secrets, credentials, tokens, certificates, connection strings, or personal data in generated documentation.
- Write in the repository's established documentation language. During bootstrap, ask the user when no reliable language evidence exists; do not infer language from source code or author location.
- Preserve technical precision while making prose understandable to an engineer unfamiliar with the repository. Define uncommon or domain-specific acronyms at first use.
- Preserve manual content outside managed sections.
- Do not overwrite existing hooks, workflows, or agent instructions without a safe managed-block update. Stop on an unrecognized conflict.
- Do not commit, push, merge, or enable branch protection unless the user explicitly requests that external action.
Common execution contract
- Resolve the repository root and current Git state.
- Select one mode.
- Load only the references required for that mode.
- Run deterministic scripts before agent analysis whenever possible.
- Use parallel subagents only for independent macro-areas and only when the host supports them. Otherwise execute the same report contract sequentially.
- Validate names, links, source mappings, hashes, and managed sections before completion.
- Report changed documentation, checked direct relationships, unresolved evidence, and validation results.
Deterministic entry point
Use scripts/codebase_analysis_ai.py for change collection, impact resolution, hash checks, link validation, project setup, and metadata refresh. Run python scripts/codebase_analysis_ai.py --help for available commands.