Agent Skillsnubjs/nub › md-toc

md-toc

GitHub

用于高效导航大型 Markdown 文件。先通过脚本生成包含精确行范围的目录,再结合 Read 工具的 offset 和 limit 参数精准读取指定章节,避免加载全文,适用于长文档或子代理任务。

.claude/skills/md-toc/SKILL.md nubjs/nub

Trigger Scenarios

需要阅读超过200行的Markdown文件中的特定章节 处理大型架构文档、状态跟踪器或长篇 Epic 文档

Install

npx skills add nubjs/nub --skill md-toc -g -y
More Options

Non-standard path

npx skills add https://github.com/nubjs/nub/tree/main/.claude/skills/md-toc -g -y

Use without installing

npx skills use nubjs/nub@md-toc

指定 Agent (Claude Code)

npx skills add nubjs/nub --skill md-toc -a claude-code -g -y

安装 repo 全部 skill

npx skills add nubjs/nub --all -g -y

预览 repo 内 skill

npx skills add nubjs/nub --list

SKILL.md

Frontmatter
{
    "name": "md-toc",
    "version": "1.0.0",
    "metadata": {
        "internal": true
    },
    "description": "Navigate large markdown files efficiently — get a complete heading TOC with exact line ranges, then Read only the section you need instead of loading the whole file."
}

md-toc — markdown navigation via line ranges

When a markdown file is large (>200 lines), don't Read the whole thing. Run the TOC script first to see every heading and its section's line range, then use Read with offset + limit to jump straight to the section you need.

Invocation

The executable is a repository tool, not a resource nested under this skill directory. Resolve the checkout root explicitly before invoking it so the command works even when the skill itself was discovered under .claude/skills/:

repo_root="$(git rev-parse --show-toplevel)"
node "$repo_root/scripts/md-toc/index.mjs" <file.md>
# or equivalently:
nub "$repo_root/scripts/md-toc/index.mjs" <file.md>

Resolve <file.md> from the task's working directory. Do not look for .claude/skills/md-toc/scripts/md-toc/index.mjs; that nested path does not exist.

Output format

One line per heading, indented by depth, with the section's line range:

L1-402    # Nub — Final-Polish Orchestration Tracker
L152-192    ## Status board
L282-367    ## Item cards
L284-292      ### A — Settle/verify env-plumbing  ·  todo

The range L152-192 means the "Status board" section occupies lines 152–192. To read it:

Read(file, offset=152, limit=41)   # limit = end - start + 1

A heading's section spans from its own line to just before the next heading of equal or higher level (or EOF). # lines inside fenced code blocks are correctly ignored (uses a real markdown AST parser, not regex).

When to use

  • Any file >200 lines where you need one section, not the whole file.
  • HANDOFF/STATUS trackers, AGENTS.md, architecture docs, long epics.
  • Before dispatching a sub-agent that needs a slice of a large doc — run the TOC yourself, embed the relevant offset/limit in the prompt so the agent Reads precisely.

Version History

  • 0615072 Current 2026-07-22 13:05

    修正了脚本调用路径,要求显式解析git仓库根目录以避免技能嵌套导致的路径错误;更新执行命令以使用仓库根路径下的scripts/md-toc/index.mjs。

  • 44d0dd0 2026-07-05 11:02

Same Skill Collection

.agents/skills/linux-vm-test/SKILL.md
.agents/skills/windows-vm-test/SKILL.md
.claude/skills/audit-thread/SKILL.md
.claude/skills/download-stats/SKILL.md
.claude/skills/git-archaeology/SKILL.md
.claude/skills/plan-thread/SKILL.md
.claude/skills/pm-perf-tracing/SKILL.md
.claude/skills/soak/SKILL.md
.claude/skills/todo/SKILL.md
skills/nub/SKILL.md
.agents/skills/agent-browser/SKILL.md
.claude/skills/ad-hoc-test/SKILL.md
.claude/skills/address-issue/SKILL.md
.claude/skills/aube-bump/SKILL.md
.claude/skills/aube-sync/SKILL.md
.claude/skills/ci-adhoc-test/SKILL.md
.claude/skills/ci-watch/SKILL.md
.claude/skills/cpu-reduction/SKILL.md
.claude/skills/dev-loop/SKILL.md
.claude/skills/impact-analysis/SKILL.md
.claude/skills/implementation-thread/SKILL.md
.claude/skills/prose-writing/SKILL.md
.claude/skills/release/SKILL.md
.claude/skills/remote-build/SKILL.md
.claude/skills/rust-build-hygiene/SKILL.md
.claude/skills/rust-build/SKILL.md
.claude/skills/visual-review/SKILL.md
.claude/skills/worktree/SKILL.md

Metadata

Files
0
Version
995b212
Hash
dcf88c04
Indexed
2026-07-05 11:02

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-31 22:48
浙ICP备14020137号-1 $Carte des visiteurs$