360 Secure SkillHub
360 安全技能中心

Markdown TOC

该 Skill 用于为 Markdown 文档生成目录:读取目标 .md 文件,通过本地 Python 脚本 scripts/gen_toc.py 扫描各级 # 标题,输出按层级缩进的 GitHub 风格锚点链接列表,并说明可在标题或前置信息后选择性地插入该 TOC,同时保持原有标题不变。

terrycarter1985
terrycarter1985
热度 42.41
最近更新 2026-08-18 07:29:06
分类:效率依赖:代码执行 / 读写文件应用场景:工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add terrycarter1985/markdown-toc
Metadata
name
markdown-toc
description
Generate a table of contents (TOC) for a Markdown file by extracting its headers. Use when asked to create, update, or insert a TOC into a Markdown document, or to summarize the heading structure of a .md file.

Markdown TOC

Generate a table of contents from a Markdown file's headers.

Steps

  1. Read the target Markdown file.

  2. Run the generator script to produce a TOC block:

    python3 scripts/gen_toc.py <path/to/file.md>
    

    The script prints a fenced TOC block listing each #-prefixed header as a GitHub-style anchor link, indented by heading level.

  3. Optionally insert the TOC into the file (place it after the title or front matter). Keep the original headers unchanged.

Output

A Markdown list like:

- [Introduction](#introduction)
  - [Goals](#goals)
- [Usage](#usage)