使い方
- インストールコマンドをコピーし、自分の環境へ導入する前にソースを確認します。
- 必要なツール、認証情報、対応環境を原文で確認します。
- 入力と成果物を指定し、出力を資料と照合します。
npx skills add https://github.com/alexbruno/dev-skills --skill codebase-indexing開始前の確認
- 導入にはモデル契約、API枠、ファイルへのアクセス許可は含まれません。
- スター数や導入数は活動の指標であり、独立した品質・安全性試験ではありません。
見出し、例、コード、表、リンク、参照画像を含む原文を表示しています。
Codebase Indexing (CodeGraph + Repomix)
Maintain a dual indexing setup and use these indexed artifacts as your primary context to understand the project's full structure, architecture, and engineering before scanning individual files or running brute-force searches:
- CodeGraph (
.codegraph/) as the primary source for structural symbol lookup, call paths, and dependency graphs. - Repomix (
repomix-output.md) as the primary single-file Markdown snapshot of the repository's layout and implementation.
Always check whether each index already exists before running commands: initialize when missing, and sync/update when present.
1. CodeGraph
Pre-flight Check
Before running any CodeGraph command, verify that the codegraph executable is available in the environment (command -v codegraph).
- If `codegraph` is NOT installed:
- Alert the user immediately that CodeGraph indexing cannot be executed because the
codegraphexecutable is missing from the environment. - Provide clear installation and setup instructions:
# Install globally via npm (or run `npx @colbymchenry/codegraph` for interactive setup)
npm install -g @colbymchenry/codegraph
# Optional: configure MCP / AI agent integration
codegraph install
# Initialize and index the project
codegraph init
codegraph index- Do not silently ignore the missing binary; continue with Repomix (if available) and note that CodeGraph remains unindexed until installed.
Check & Initialize vs. Sync
Check if .codegraph/ exists at the repository root:
- If `.codegraph/` does NOT exist — initialize and build the graph database:
codegraph init
codegraph index- If `.codegraph/` already exists — always run incremental synchronization:
codegraph syncDo not re-run codegraph init or a full codegraph index when .codegraph/ is already present, unless the database is corrupted or major structural resets require a rebuild.
Querying CodeGraph
Reach for CodeGraph before running brute-force grep/find across the codebase:
- MCP tool (when available): call
codegraph_explorewith symbol names, file paths, or architectural questions. - CLI: run
codegraph explore "<symbol names or question>".
2. Repomix (Markdown Priority)
Always prioritize Markdown (--style markdown) for Repomix outputs so the snapshot is readable by both humans and LLMs. Always invoke Repomix via npx -y so it executes reliably even when not installed globally and without interactive prompts.
Check & Create vs. Update
Check if a Repomix Markdown file (e.g., repomix-output.md, or the output path configured in repomix.config.json) exists:
- If it does NOT exist — create it in Markdown format:
npx -y repomix --style markdown -o repomix-output.md- If it already exists — re-run the update command to synchronize it with the current codebase:
npx -y repomix --style markdown -o repomix-output.md(If `repomix.config.json` is present and already configured with `"style": "markdown"`, running `npx -y repomix` updates the configured output file directly.)
3. Maintenance & Verification
- Keep indexes fresh: Run
codegraph syncand update the Repomix Markdown file after significant code changes, branch switches, or merges. - Respect repository hygiene: Check
.gitignorebefore committing generated.codegraph/orrepomix-output.mdartifacts—ignore them unless the project explicitly tracks them in version control. - Verify: Confirm
.codegraph/responds tocodegraph exploreandrepomix-output.md(or the configured.mdfile) reflects the latest file tree.