agentleFS
weiweimhyweiweimhy/agent-skills/markdown/SKILL.md

markdown

Skill0 starsChanged 5 months agoMITView on GitHub

Markdown writing and lint guidance for README files, docs, tables, code blocks, headings, links, changelogs, and GitHub-flavored Markdown. Use when writing, formatting, or reviewing Markdown documents.

8 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

Skill: Markdown

Markdown 编写规范和最佳实践,确保所有 Markdown 文件符合 markdownlint 规范。

🎯 Purpose

确保项目中所有 Markdown 文件格式统一、结构清晰、符合 markdownlint 规范,提升文档可读性和可维护性。

🎯 触发条件

当用户说:

  • "检查 markdown 格式"
  • "这个 md 文件有什么问题"
  • "帮我格式化 markdown"
  • "表格/代码块怎么写"

👉 自动启用本 Skill

🧩 Capabilities

  • Markdownlint 规则:核心规则解读与应用
  • 文档结构规范:标题层级、段落组织
  • 组件规范:表格、代码块、链接、列表的正确写法
  • 格式化最佳实践:空行、缩进、换行规则

🧠 Usage

  • 在编写或审阅 Markdown 文档时使用。
  • 在 README、设计文档或说明文档出现格式漂移时使用。
  • 在需要解释 markdownlint 规则或规范示例时使用。

📥 Input

  • Markdown 文件内容或片段。
  • 目标平台和 lint 规范要求。
  • 需要修复的格式问题或错误提示。

📤 Output

  • 格式化建议与修复方向。
  • 可直接复用的表格、代码块和链接示例。
  • 文档结构与可读性改进建议。

📏 Markdownlint 核心规则

标题规则

规则说明示例
MD001标题层级只能递增 1 级# → ## → ### ✅ # → ### ❌
MD003标题风格统一使用 ATX 风格 # 而非 Setext
MD018# 后必须有空格# Title ✅ #Title ❌
MD022标题前后需有空行标题与正文间空一行
MD024避免重复标题同级标题不能重名
MD025文档只能有一个 H1顶级标题唯一
MD041首行应为 H1 标题文件以 # 开头

空白与格式规则

规则说明示例
MD009行尾不能有空格除非用于换行
MD010不能使用 Tab 缩进使用空格代替
MD012连续空行最多 1 行避免多个空行
MD047文件末尾需有空行确保以换行符结尾

列表规则

规则说明示例
MD004无序列表符号统一全部使用 -
MD005列表缩进一致同级列表对齐
MD007列表缩进使用 2 空格默认 2 空格
MD030列表符号后有空格- item ✅ -item ❌
MD032列表前后需有空行与正文分隔

代码块规则

规则说明示例
MD014命令行不需要 $除非展示输出
MD031代码块前后需有空行与正文分隔
MD040代码块需指定语言```go 而非 ```
MD046代码块风格统一使用 fenced 风格

链接与图片规则

规则说明示例
MD034URL 应使用链接语法[link](https://example.com) 而非裸 URL
MD042链接不能为空[text]() ❌
MD045图片需有 alt 文本![alt text](https://example.com/img.png)

📝 组件规范写法

表格

| Column 1 | Column 2 | Column 3 |
| :--- | :--- | :--- |
| Left align | Left align | Left align |

[!TIP] 使用 :--- 左对齐,---: 右对齐,:---: 居中

代码块

\`\`\`go
func main() {
    fmt.Println("Hello")
}
\`\`\`

[!IMPORTANT] 始终指定语言标识符

链接

[显示文本](https://example.com)
[相对路径](../README.md)
[锚点链接](#section-name)

列表

- 无序列表项 1
- 无序列表项 2
  - 嵌套项(2 空格缩进)

1. 有序列表项 1
2. 有序列表项 2

✅ Best Practices

  1. 单一 H1:每个文档只有一个顶级标题
  2. 标题层级:严格按 1 → 2 → 3 递增,不跳级
  3. 空行分隔:标题、代码块、列表前后各留一空行
  4. 一致风格:全文统一使用 - 作为无序列表符号
  5. 代码语言:所有代码块都指定语言
  6. 链接格式:避免裸 URL,使用 [text](https://example.com) 格式
  7. 行长控制:建议每行不超过 80-120 字符

❌ Common Mistakes

错误正确
### 直接跟在 # 后# → ## → ###
#Title 无空格# Title
代码块不指定语言```python
行尾有多余空格删除尾随空格
连续多个空行最多一个空行
裸 URL使用链接语法包裹

⚠️ Constraints

  • 不牺牲可读性去机械迎合格式。
  • 不使用与仓库约定冲突的标题、列表或代码块风格。
  • 不把无法解释的排版规则当成黑盒结论。

🔍 能力溯源 (Source Mapping)

能力来源说明
Lint 规则markdownlint v0.38.0✅ 官方规范
结构最佳实践documentation-templates (外部)✅ 整合文档结构原则
组件规范新建✅ 基于 CommonMark 规范

📚 参考资料 (References)

🔗 Related Skills

  • doc-generator: 文档生成时应遵循本规范
  • code-review: 代码审查包含文档质量检查

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.