Codebase Mapのロゴ

Codebase Map

コミュニティ
dotslashsimran
codebase-map

Understand an unfamiliar codebase fast, the way senior engineers do. Reads the orientation signals (README, manifests, CI, Dockerfiles, routes, migrations), mines git history for hotspots, hidden coupling and ownership, builds the import graph to find layers, cycles, load-bearing and dead code, then traces one real request or command end to end by actually running it. Writes MAP.md with a one-paragraph purpose, a Mermaid architecture diagram, the traced path as file:line hops, hotspot and coupling tables, a glossary, gotchas and first tasks, plus an optional SVG. Use when the user says "explain this codebase", "I'm new to this repo", "map the architecture", "onboard me", "where does X happen", "how is this project structured", or joins a new team or project.

概要

公開者dotslashsimran
リポジトリsimcraft
スキル名codebase-map
スター
362
フォーク
25
同梱ファイル
8
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 8個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    dotslashsimranがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルCodebase MapをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/dotslashsimran/simcraft/tree/main/skills/coding/codebase-map
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/dotslashsimran/simcraft.git /tmp/simcraft
mkdir -p .claude/skills
cp -r /tmp/simcraft/skills/coding/codebase-map .claude/skills/codebase-map
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでCodebase Mapを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にCodebase Mapを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Codebase Mapは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Codebase map

Reading files top to bottom is the slow way in. Senior engineers ask four questions instead, in this order: what does it do, how is it run, where does the important work happen, and what path does one real request take. The first three come from cheap signals (manifests, CI, git history, imports). The fourth only comes from running the code. Everything ends up in one file, MAP.md, that a new person can read in ten minutes.

Work read-only on the repo. Put every output in a temp folder (out=$(mktemp -d)) unless the user asks for MAP.md in the repo. Never run migrations, deploys or anything that touches a shared database or real credentials.

Scripts are in scripts/, Python 3.9+ standard library and git only. S=~/simcraft/skills/coding/codebase-map/scripts.

0. Ask one thing

"Is there a specific thing you need to do here (fix a bug, own an area, review a change), or a general map?" A goal decides which path to trace. If there is no answer, map the whole repo and trace its most important user action.

1. Orient (15 minutes)

python3 $S/entrypoints.py <repo> > $out/entry.md

It lists docs to read first, build and run commands (package.json scripts, console scripts, Makefile, Procfile, Dockerfile CMD, compose services), CI pipelines and the commands they run, mains, servers, CLI commands, HTTP routes, background jobs, the data model, environment variables (with a flag when the .env template is missing one), and tests. Every hit is file:line.

Then read, in this order: README and contributor docs, the CI file (it is the only build recipe that is known to work), the main manifest, the entrypoint files. Write the one-paragraph purpose now, before reading more code: who uses it, what goes in, what comes out, what it talks to.

2. The data model is the backbone

Read the schema before the logic. Migrations (oldest shows the original core, newest shows where the product is going), ORM models, Prisma or SQL files, or, if there is no database, the main data shapes (pydantic models, TS types, JSON files on disk). Write down the 3 to 7 core entities and how they relate. Most business logic is "load these, change them, save them", so knowing the nouns makes the code readable.

3. Structure from imports

python3 $S/deps.py <repo> --json $out/deps.json --mermaid $out/deps.mmd --svg $out/deps.svg > $out/deps.md

Read: the layers (level 0 is the foundation, top is entry code), folder cycles (tangled modules, with the cheapest edge to cut), load-bearing files (most importers: change carefully), possibly dead files (no importers), and the main external packages. If one folder holds most of the code, run again with --under <that folder> to see inside it.

4. History: where the work and the risk are

python3 $S/hotspots.py <repo> --deps $out/deps.json > $out/hot.md
  • Hotspots (changes x complexity): the few files where most bugs and most of your future work will be.
  • Change coupling: files that change in the same commits. A pair with import link = NO is a hidden dependency, for example two copies of the same logic, or a client and server that share a format. These are the best gotchas.
  • Ownership and knowledge at risk: who to ask about each area, and complex files whose main author has gone quiet.
  • Bug magnets, frozen code and new code.

Add --anonymize if the map will be shared outside the team. Under about 30 commits, git signals are weak: say so and lean on steps 3 and 5.

5. Trace one real path by running it

This is the step that turns guesses into knowledge. Pick one real user action (the one the top hotspots serve, or the user's goal). Get it running using the CI steps. Then either:

  • find the sink (the DB write, the HTTP response, the output file), put a stack dump or breakpoint there (breakpoint(), traceback.print_stack(), console.trace(), debug.PrintStack()), trigger the action once, and read the stack bottom-up; or
  • for Python, run it under the tracer: python3 $S/trace_py.py --repo <repo> --out $out/trace.txt -- <script or -m module> <args>. It prints every repo function the run touched, by depth, as file:line.

If the path calls paid or external services, stub them at the edge (patch the HTTP call to return a canned response) instead of using real keys. Record each hop as file:line what happens here, and mark anything surprising.

6. Load-bearing vs dead

Load-bearing = many importers, on the traced path, or a hotspot. Dead candidates = no importers and frozen for a year. Before calling anything dead, grep for its name as a string (plugin registries, getattr, dynamic imports, config files, framework conventions). Say "probably dead, because..." rather than "dead".

7. Write MAP.md

Use the template in reference.md: purpose, how to run it, architecture diagram (Mermaid, drawn from what you learned, not just the raw import graph), the traced path, data model, hotspots, coupling pairs, who knows what, glossary, gotchas, first tasks. Mark each claim ran (you saw it happen) or read (from the code). Then check every reference:

python3 $S/check_map.py $out/MAP.md <repo>

Fix every broken one. Finish with a five-line summary in chat and the path to MAP.md (and the SVG if made).

Rules

  • Never claim a hop you did not see in code or in a run. A wrong map is worse than none.
  • Explain jargon the first time it appears, and put every project-specific term in the glossary.
  • First tasks must be small, real and safe: a test to add for a hotspot, a log line on the traced path, a dead file to confirm.
  • Depth, per-language tracing recipes, heuristics and their limits: reference.md. A real example: examples/MAP.md.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Codebase Map」では何ができますか?

Understand an unfamiliar codebase fast, the way senior engineers do. Reads the orientation signals (README, manifests, CI, Dockerfiles, routes, migrations), mines git history for hotspots, hidden coupling and ownership, builds the import graph to find layers, cycles, load-bearing and dead code, then traces one real request or command end to end by actually running it. Writes MAP.md with a one-paragraph purpose, a Mermaid architecture diagram, the traced path as file:line hops, hotspot and coupling tables, a glossary, gotchas and first tasks, plus an optional SVG. Use when the user says "exp...

TypingMindでCodebase Mapを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Codebase Mapはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにCodebase Mapをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/dotslashsimran/simcraft/tree/main/skills/coding/codebase-mapを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Codebase Mapを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Codebase Mapは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもCodebase Mapを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Codebase Map」は無料ですか?

はい。dotslashsimranがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇