‹ 首页

tldr

@darkroomengineering · 收录于 昨天 · 上游提交 昨天

TLDR code analysis — call graphs, semantic search, impact, dataflow; ~95% token savings vs raw reads. Use for "who calls X", "what affects X", before large file reads or refactors.

适合你,如果经常需要阅读和理解大型代码库

/ 通过 npx 安装 校验哈希
npx oh-my-skill add darkroomengineering/cc-settings/tldr
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- darkroomengineering/cc-settings/tldr
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify darkroomengineering/cc-settings/tldr
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
40GitHub stars
~1.6K上下文体积 · 单文件
索引托管

怎么用

商店整理自技能原文 · 版本 fa04efc · 表述以原文为准
它做什么

安装后,Claude 在分析代码时可以使用 tldr 工具获取调用关系、数据流、影响范围等摘要,而不必直接读取整个文件,从而节省约95%的 token。

什么时候触发

当你询问谁调用了某个函数、什么会影响某个函数,或在进行大文件读取或重构之前触发。

装好后可以这样说
返回调用链
进行影响分析
返回架构概览
技能原文 SKILL.md作者撰写 · MIT · fa04efc

TLDR Code Analysis

Token-efficient codebase analysis behind the tldr MCP server. ~95% fewer tokens than reading raw files.

The engine is provisioned by cc-settings. The tool names below are the stable contract; only the engine behind them changes. Select with CC_CODE_INTEL_ENGINE.

Default: native-ts — a zero-dependency TypeScript-compiler codemap. TS/JS only. Implements structure, tree, extract, arch, imports, importers, calls, context, impact, change_impact. Everything else returns unsupported-by-native-engine, which means the analysis did not run — fall back to Grep, never report it as an empty finding.

Opt-in: CC_CODE_INTEL_ENGINE=llm-tldr — multi-language, plus semantic, dead, diagnostics, slice, cfg, dfg, search. Use it on Rust/Python/Go repos. Selecting it means re-running setup.sh with the variable set (see Prerequisites), not just exporting it. Two caveats, both measured 2026-07-27:

1. language does NOT auto-detect — it defaults to python. On a TS repo, omitting it returns {"status":"ok"} with an EMPTY result rather than an error, so a wrong answer is indistinguishable from a true negative. Always pass language explicitly (typescript, go, rust, … or all). The MCP impact and semantic tools expose no language parameter at all, so they cannot be fixed this way — cross-check with Grep. 2. Upstream is archived (parcadei/llm-tldr, 2026-07-13). Neither caveat will be fixed upstream.
Quick Reference

| Task | Command | |------|---------| | "How does X work?" | semantic† → context | | "Who calls X?" | impact | | "What would break?" | impact + change_impact | | "Why is X null here?" | slice† (backward) | | "What does X affect?" | slice† (forward) | | "Project structure?" | arch + structure | | "Find auth code" | semantic "authentication"† | | "Data flow in function" | dfg† | | "Control flow" | cfg† | | "Find dead code" | dead† | | "Type errors?" | diagnostics† | | "File tree" | tree | | "Regex search" | search† |

† Not implemented by the default native-ts engine — returns unsupported-by-native-engine unless you opt into llm-tldr. Treat that as "did not run", not "found nothing", and fall back to Grep.

Commands
Semantic Search (Natural Language)

Find code by meaning, not exact text. Uses 5-layer embeddings (AST + call graph + CFG + DFG + PDG):

mcp__tldr__semantic { "project": ".", "query": "user authentication flow" }
mcp__tldr__semantic { "project": ".", "query": "error handling" }
Function Context (95% Token Savings)

Get LLM-ready summary instead of reading entire file:

mcp__tldr__context { "project": ".", "entry": "handleLogin", "depth": 2 }
Impact Analysis (Before Refactoring)

Find all callers - critical before changing any function:

mcp__tldr__impact { "project": ".", "function": "useAuth" }
Architecture Overview

Understand project layers and dependencies:

mcp__tldr__arch { "project": "." }
Program Slice (Debugging)

What affects a specific line (backward) or what it affects (forward):

mcp__tldr__slice {
  "file": "src/auth.ts",
  "function": "login",
  "line": 42,
  "direction": "backward",
  "variable": "user"
}
Call Graph

Cross-file function call relationships (pass language explicitly):

mcp__tldr__calls { "project": "." }
Data Flow Graph

Variable references and def-use chains:

mcp__tldr__dfg { "file": "src/auth.ts", "function": "validateToken" }
Control Flow Graph

Basic blocks and branching:

mcp__tldr__cfg { "file": "src/auth.ts", "function": "handleRequest" }
Change Impact (Affected Tests)

Find tests affected by changed files (auto-detects from git diff):

mcp__tldr__change_impact { "project": "." }
Dead Code Detection

Find unreachable code (pass language explicitly):

mcp__tldr__dead { "project": "." }
Import Analysis

Parse imports or find importers:

mcp__tldr__imports { "file": "src/utils.ts" }
mcp__tldr__importers { "project": ".", "module": "auth" }
Diagnostics (Type/Lint)

Type checking and linting:

mcp__tldr__diagnostics { "path": "src/" }
File Tree

Quick project structure overview:

mcp__tldr__tree { "project": "." }
mcp__tldr__tree { "project": "src/", "extensions": [".ts", ".tsx"] }
Regex Search

Search files by regex pattern:

mcp__tldr__search { "project": ".", "pattern": "TODO|FIXME|HACK" }
Structure Overview

Functions, classes, methods per file (pass language explicitly):

mcp__tldr__structure { "project": ".", "max_results": 50 }
Full File Extract

Complete code structure from a single file (imports, functions, classes, call graph):

mcp__tldr__extract { "file": "src/auth.ts" }
Daemon Status

Check uptime and cache statistics:

mcp__tldr__status { "project": "." }
Prerequisites

The engine behind tldr is provisioned automatically by cc-settings (setup.sh). Default engine: native-ts — no Python, no daemon, nothing to install. See src/lib/code-intel-engine.ts.

Opt into llm-tldr for non-TS/JS repos or the analysis tools native-ts lacks. Exporting the variable alone is not enough — the tldr entry in ~/.claude.json is written at install time, so a shell-only export leaves the hooks on llm-tldr while the MCP server stays on native-ts. Re-run the installer with the variable set, then restart Claude Code:

CC_CODE_INTEL_ENGINE=llm-tldr bash setup.sh   # rewrites the MCP entry
pipx install llm-tldr        # only if provisioning manually
tldr daemon start            # background service (~100ms queries)
tldr semantic index . --lang typescript   # per-language; the default index is empty
CRITICAL RULES
  1. ALWAYS pass the language param — it defaults to python and silently returns empty results for every other language. There is no auto-detection. This rule comes first because it invalidates every rule below when broken.
  2. Reach for context/structure/calls BEFORE reading large files — with an explicit language.
  3. Before refactoring, do NOT trust an empty impact. On non-Python code it returns {"status":"ok","callers":[]} whether or not callers exist, and it has no language parameter to fix that. Confirm with Grep or mcp__tldr__calls (explicit language) before concluding nothing calls a symbol.
  4. semantic needs an index built with the right language (tldr semantic index . --lang <lang>) and still ranks poorly on this repo — treat its hits as candidates to verify, not answers.
  5. Use grep for exact string matching — and as the cross-check whenever a tldr result is empty.
Output

Return findings with:

  • Relevant code: Key functions/files found
  • Call chain: How things connect
  • Recommendations: Next steps based on analysis
  • Store as learning if discovering non-obvious patterns
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。