graft
できること
このスキルは、AIが事前に作られた地図を使って、リポジトリの部分がどう動くかを調べるのを助けます。コードを見つけ、変更が何に影響するかを知りたい開発者向けです。
使う場面
- ✓リポジトリのどこに機能や関数があるかを知りたいとき。
- ✓編集する前に、変更が何に影響しうるかを見たいとき。
- ✓コードのある部分が、どう動くかを理解したいとき。
スキルのリンク
https://github.com/trailhq/Trail-Code/blob/main/.claude/skills/graft/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“このリポジトリのレート制限はどこで処理され、何がそれを呼び出していますか。”
毎週5つの新しいスキル。1分で読めます。
仕組み
AIはグラフツールに質問をし、ファイル名と行番号、短いコードの抜粋とともに、最も関連するコードの場所を得ます。これは、多くの完全なソースファイルを読むよりも速いです。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
graft
graft/ holds a graph of this repo: small markdown nodes that each explain one
part in prose and name the exact file:line spans they cover, plus a wiring
graph of who-calls-what. Querying a node costs a few hundred tokens; rebuilding
that understanding by reading source costs thousands, and misses the edges.
Every command below is $0, needs no API key, and returns in under a second.
There are six of them. Pick the one that fits the task, run it, act on the
answer; don't chain tools hoping for more. Most tasks need one call.
The tools
1 · graft ask "<question>" --source: locate + understand (the default)
Ranked retrieval over the graph, routed automatically between prose nodes and
the wiring graph, returning the top hits with exact file:line.
--sourceinlines the code at each hit, the ≤8-line crux of each definition, so the result IS the code you need, no follow-up file read. Add--fullonly when the crux is too small to act on.--in <path>narrows to a subtree before ranking;-n Ncaps results (default 8).- Use it when the question is conceptual or locational: "how does auth work", "where is rate-limiting handled", "what assembles the request pipeline".
- One ask usually answers. A genuinely multi-part question needs one ask per distinct sub-aspect, never the same question reworded. Few or weak hits mean switch tool (grep / skeleton / callers), don't re-ask.
2 · graft grep "<pattern>": exhaustive find
Regex (or --fixed for a literal) over every indexed file, hits grouped by
enclosing symbol and ranked by coupling; it also reports files it couldn't read.
- Use it when you need every occurrence: all call sites, all uses of a
constant, all providers.
askis ranked top-N and will miss instances; grep won't. One grep replaces a spray of asks. - Search a short symbol name or literal, not a full guessed signature: an
over-specific regex (
func (s *Server) GenerateHandler) returns nothing even when the code is indexed. If a grep misses, loosen it (drop the receiver and signature, keep the bare name) and retrygraft grep— do NOT switch to rawgrep -rn, which is slower and unranked. -icase-insensitive;--in <path>scopes to a subtree. Rawgrep -rnis only for files graft genuinely doesn't index (docs, configs, brand-new files).
3 · graft skeleton <file>: a file's API at a glance
Signatures-only view of one file (every function / method / type with its span) in ~200 tokens, ~10x cheaper than reading the file.
- Use it when you need "what's in this file / what can I call here" before
editing or wiring into it. One skeleton is the whole answer for a file; don't
re-skeleton the same file, and don't skeleton every file
mapalready named.
4 · graft callers <symbol>: the exact edges
Precomputed call/reference edges, not a text search. Symbol can be bare
(Foo), qualified (Class.method), or package-qualified (pkg.Fn).
- default
--direction in: who calls/references this; run before you rename, delete, or change its signature. --direction out: what this symbol itself calls/depends on (the oldcallees).--depth N: walk transitively N hops for the full blast radius (the oldimpact);--depth 2is the usual "what breaks if I touch this".--depth all: the entire connected closure — every source reachable through the edges. Reach for this before a refactor, rename, or any multi-file change: it surfaces the sibling and downstream files (platform variants, a module you must split out) that a single-file edit would miss.
5 · graft map: orientation for an unfamiliar repo or area
A token-budgeted tour: directory clusters, per-directory hubs, and global hotspots, straight from the wiring graph.
- Use it when you land in a repo cold or are asked for "the architecture".
mapalone is the answer: read the hub cards it names; do NOT then skeleton or ask your way through every subsystem it lists.--max-dirs Nwidens it.
6 · Lifecycle: graft build / graft check
Every tool above refreshes the graph itself before answering, so what those tools
return always describes the code as it is right now — including edits you just made
and have not committed. You do not need to run build after editing.
One caveat, if you grep the markdown under graft/ directly: those cards are a
projection, rebuilt at the end of the turn rather than
よくある質問
APIキーが必要ですか?
いいえ。このスキルは、そのコマンドにAPIキーは不要で、ローカルで動くと明記しています。
コードを読む作業の代わりになりますか?
まず対象を絞った文脈を与えるので、AIが読むべき完全なファイルを減らせます。
コマンドはどれくらい速いですか?
スキルは、各コマンドが一秒未満で返ると記しています。
詳細
作者による元の説明
This repo is indexed by graft/. For ANY task here, whether understanding how something works, finding where code lives, tracing what calls a symbol or what a change breaks, or scoping an edit, get your context from graft before grepping or reading source files.
repo: trailhq/Trail-Code
人気
- GitHubのスター
- 11k
- ランキング
- #11832
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。