Add Anchor logo

Add Anchor

Community
bd-dxg
add-anchor

为 Markdown 文件的标题添加英文自定义锚点 {#my-anchor}。当用户要求为 Markdown 标题添加锚点、处理 TOC 锚点、或需要标题可跳转链接时使用此命令。支持单文件或整个目录批量处理。

Overview

Publisherbd-dxg
Repositoryskills
Skill nameadd-anchor
Stars
32
Forks
4
Bundled files
Instructions only
LicenseAGPL-3.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by bd-dxg on GitHub. Read the source before you install it.

Installation

Install the Add Anchor AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/bd-dxg/skills/tree/main/add-anchor
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/bd-dxg/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/add-anchor .claude/skills/add-anchor
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Add Anchor in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Add Anchor on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Add Anchor is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

add-anchor

为 Markdown 文件的所有标题(h1 ~ h6)添加英文自定义锚点 {#anchor-id},用于目录跳转或跨文档引用。

使用方式

处理单个文件

/add-anchor path/to/file.md

批量处理目录下所有 Markdown 文件

/add-anchor path/to/dir/

锚点生成规则

格式

  • 全小写字母
  • 单词间用连字符 - 连接
  • 示例:## 📋 今日目标 → ## 📋 今日目标 {#today-target}

具体步骤

对每个标题,按以下步骤生成锚点:

  1. 提取标题文本:去除 # 前缀和空格,得到纯标题文字
  2. 检查已有锚点:如果标题末尾已有 {#...},则跳过该标题(不修改)
  3. 移除不需要的字符:
    • 移除所有 emoji(如 📋、🎯、✨ 等)
    • 移除中文标点(如:、。,、!?「」【】()等)
    • 移除数学符号(如 +、=、>、< 等)
    • 移除引号(单引号、双引号)
    • 保留英文连字符 - 和撇号 '
  4. 翻译中文为英文:将提取出的中文部分翻译为简短的关键词,而非完整句子。例如"系统信息收集器"→system-info,而非`system-information-collector"
  5. 转为锚点格式:
    • 将英文翻译转为小写
    • 空格替换为连字符 -
    • 连续多个连字符合并为一个
    • 首尾连字符去除
  6. 追加到标题末尾:在标题末尾添加 {#generated-anchor}

锚点文本去重

如果同一文件内生成相同的锚点,在末尾添加数字后缀:

  • 第一个 → {#my-anchor}
  • 第二个 → {#my-anchor-2}
  • 第三个 → {#my-anchor-3}

示例

原始标题生成的锚点
## 📋 今日目标## 📋 今日目标 {#today-target}
### 安装与配置### 安装与配置 {#installation-and-configuration}
# 快速开始# 快速开始 {#quick-start}
## 用户管理 API## 用户管理 API {#user-management-api}
### 常见问题 (FAQ)### 常见问题 (FAQ) {#faq}
## 错误处理## 错误处理 {#error-handling}
## 错误处理 {#error-handling}跳过(已有锚点)
### 练习 1:系统信息收集器### 练习 1:系统信息收集器 {#exercise-1}
## 📋 今日目标## 📋 今日目标 {#goals}

处理边界

需要处理的标题

  • 纯中文标题:## 用户管理
  • 中英文混合:## 用户管理 API
  • 含 emoji 的标题:## 📋 今日目标
  • 含特殊符号的标题:### 常见问题 (FAQ)
  • 含链接的标题:## [快速开始](url) → 提取纯文本 快速开始

跳过不处理的情况

  • 标题末尾已有 {#...} 锚点(保留原锚点)
  • 不在标题行中的 #(如代码块中的 # 注释)
  • 空标题(只有 # 没有文字)
  • 锚点引用(## 标题 {#existing-anchor} 中的锚点部分)

工作流程

步骤 1:确认文件范围

  • 如果是单个文件路径,直接处理该文件
  • 如果是目录路径,使用 Glob 工具查找目录下所有 *.md 文件(递归)
  • 如果未提供路径,默认扫描当前工作目录下的 *.md 文件,并提示用户确认

步骤 2:读取文件内容

使用 Read 工具读取文件内容,确认文件是有效的 Markdown 格式。

步骤 3:逐行扫描处理

逐行扫描文件,找到所有匹配 ^(#{1,6})\s+(.+)$ 的标题行。对每个匹配的标题行:

  1. 检查是否已有 {#...} 锚点 → 有则跳过
  2. 提取纯文本(去除 markdown 链接语法,只保留文本)
  3. 移除 emoji 和不需要的字符,保留下划线、连字符和撇号
  4. 翻译中文为英文
  5. 生成锚点 ID
  6. 检查锚点是否重复
  7. 用 Edit 工具替换原标题行

步骤 4:使用 Edit 工具修改

每次修改一个标题行,使用 Edit 工具的精确字符串替换功能。

步骤 5:报告结果

处理完成后,向用户报告:

  • 处理的文件总数
  • 每个文件的标题总数、添加锚点数、跳过的标题数
  • 特殊情况的说明(如有)

重点原则

  • 只修改标题行,不修改文件其他内容
  • 保留原始格式,包括空格、emoji 的显示位置
  • 不覆盖已有锚点,尊重用户手动添加的锚点
  • 锚点要简短:锚点应是简短的关键词,而非完整翻译。例如"今日目标"→{#goals},"系统信息收集器"→{#system-info},而非完整句子翻译
  • 翻译要准确简洁,不要过度翻译英文部分
  • 对于纯英文标题,直接使用原文生成锚点(无需翻译)
  • 对于中英文混合标题,只翻译中文部分,保留英文原词

Frequently asked questions

What does the Add Anchor AI skill do?

为 Markdown 文件的标题添加英文自定义锚点 {#my-anchor}。当用户要求为 Markdown 标题添加锚点、处理 TOC 锚点、或需要标题可跳转链接时使用此命令。支持单文件或整个目录批量处理。

Why use Add Anchor on TypingMind?

Because you install it once and use it with any model. Add Anchor is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Add Anchor in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/bd-dxg/skills/tree/main/add-anchor. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Add Anchor?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Add Anchor?

As many as you like. As long as a model supports skills, you can use Add Anchor with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Add Anchor AI skill free?

Yes. It is published on GitHub by bd-dxg under the AGPL-3.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇