WT

webitrohq/token-skill

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

24 stars 质量 61 趋势 44MIT

Claude Code skill: a local code map (graphify, AST, no LLM) so Claude stops re-reading your whole project. Fewer tokens per question.

概览

token gives Claude Code a of your project and a rule to , so it stops grepping and reading file after file every time you ask "where does X happen?". The map is built locally by graphify from the AST (tree-sitter, 30 languages). Building a map takes seconds. On a code-navigation question, Claude usually explores: grep, open a file, open three more, repeat. On a mid-sized project that can easily be 100k+ tokens of raw source before it answers. A graph query returns the relevant symbols, files and line numbers in a few hundred to a few thousand tokens, and Claude then opens only those lines. Measured example (one "how does this flow work" question on a real project): with the map. Savings depend on the task. They are large for "where / what calls this / how does the flow go" questions and small for a one-line fix in a file you already have open. 1. if it's missing: uv tool install, then pipx, then a private venv in ~/.local/share/token-skill/venv. No sudo. 2.

README

以下为原文 README 节选,完整内容请查看原文。

token — a Claude Code skill that stops re-reading your whole project

token gives Claude Code a code map of your project and a rule to ask the map first, so it stops grepping and reading file after file every time you ask “where does X happen?”.

The map is built locally by graphify from the AST (tree-sitter, 30 languages). No LLM calls, no API key, nothing leaves your machine. Building a map takes seconds.

/token
map: 63 nodes · 176 edges · 8 communities · graph.json 48 KB
tokens: GRAPH_REPORT.md ≈ 651 · raw source ≈ 21551 · query output typically 0.5–4k
freshness: up to date
CLAUDE.md: token rule written → ./CLAUDE.md

Why

On a code-navigation question, Claude usually explores: grep, open a file, open three more, repeat. On a mid-sized project that can easily be 100k+ tokens of raw source before it answers. A graph query returns the relevant symbols, files and line numbers in a few hundred to a few thousand tokens, and Claude then opens only those lines.

Measured example (one “how does this flow work” question on a real project): ~169k tokens of exploration → ~2.9k tokens with the map.

Savings depend on the task. They are large for “where / what calls this / how does the flow go” questions and small for a one-line fix in a file you already have open.

What it does

Running /token in a project:

  1. Installs graphify if it’s missing: uv tool install, then pipx, then a private venv in ~/.local/share/token-skill/venv. No sudo.
  2. Builds or updates the map in graphify-out/ (AST only). Files with a code extension but an XML body (Tiled tilesets etc.) are added to .graphifyignore first, because they break parsing.
  3. Writes a rule to the project’s CLAUDE.md, in a marked, idempotent block: for code questions, run graphify query before the first grep/read, never cat the whole graph.json, and update the map after changing code.
  4. Reports real numbers: nodes/edges, the token size of the report vs. the raw source, and whether the map is stale.

Optional --strict mode installs a Claude Code PreToolUse hook that blocks the first raw file read in a session until a graph query has run.

Install

Requirements: macOS, Linux or Windows (Git Bash or WSL), bash, Python 3.10+, internet for the first install.

git clone https://github.com/WebitroHQ/token-skill.git
bash token-skill/token/scripts/install.sh

The install copies the skill to ~/.claude/skills/token/ and sets up graphify. The last line should be ready: type /token in Claude Code. Then restart Claude Code, because skills load at session start.

Check:

~/.local/bin/graphify --version && ls ~/.claude/skills/token/SKILL.md ~/.claude/skills/graphify/SKILL.md

If graphify is not found, add export PATH="$HOME/.local/bin:$PATH" to your shell profile.

Usage

In Claude Code, inside a project:

You say What happens
在 GitHub 查看完整 README

推荐工具

换一个关键词,或者移除筛选条件。

安装

npx skillfish add webitrohq/token-skill
新手?先看 mcpskill.org 教程 →