baoyu-format-markdown
它能做什么
这项技能通过添加结构和强调,让长文字更容易浏览。适合有大段难以阅读文字的作者。
适用场景
- ✓当你有一份需要添加小标题和列表的纯文本草稿的时候。
- ✓当你希望文章中的要点便于快速浏览的时候。
- ✓当你需要为发布整理一个 Markdown 文件的时候。
技能链接
https://github.com/JimLiu/baoyu-skills/blob/main/skills/baoyu-format-markdown/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我排版这篇文章,加上小标题和加粗的要点,让它更容易浏览。”
每周 5 个新技能,1 分钟读完。
工作原理
你的智能体添加前置信息、标题、摘要、小标题和强调格式,修正明显的错别字,并将结果保存为新文件。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Markdown Formatter
Make plain text or markdown scannable so readers grasp key points and structure fast.
Core principle: Only adjust formatting and fix obvious typos. Never add, delete, or rewrite content.
User Input Tools
When this skill prompts the user, follow this tool-selection rule (priority order):
- Prefer built-in user-input tools exposed by the current agent runtime — e.g.,
AskUserQuestion,request_user_input,clarify,ask_user, or any equivalent. - Fallback: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question.
- Batching: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.
Concrete AskUserQuestion references below are examples — substitute the local equivalent in other runtimes.
Script Directory
{baseDir} = this SKILL.md's directory. ${BUN_X} = bun if installed; else npx -y bun if npx available; else suggest installing bun. Replace {baseDir} and ${BUN_X} with actual values.
| Script | Purpose |
|---|---|
scripts/main.ts |
Main entry point with CLI options (uses remark-cjk-friendly for CJK emphasis) |
scripts/quotes.ts |
Replace ASCII quotes with fullwidth quotes |
scripts/autocorrect.ts |
Add CJK/English spacing via autocorrect |
Preferences (EXTEND.md)
First one found wins:
| Priority | Path | Scope |
|---|---|---|
| 1 | .baoyu-skills/baoyu-format-markdown/EXTEND.md |
Project |
| 2 | ${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-format-markdown/EXTEND.md |
XDG |
| 3 | $HOME/.baoyu-skills/baoyu-format-markdown/EXTEND.md |
User home |
None found → use defaults (no first-time setup for this skill).
| Setting | Values | Default | Description |
|---|---|---|---|
auto_select |
true/false |
false |
Skip both title and summary selection, auto-pick best |
auto_select_title |
true/false |
false |
Skip title selection only |
auto_select_summary |
true/false |
false |
Skip summary selection only |
| Other | — | — | Default formatting options, typography preferences |
Workflow
The agent analyzes and formats (Steps 1-5), then runs the typography script (Step 6).
Step 1: Read & Detect Content Type
Read the file. It is Markdown if it has --- YAML frontmatter, #/##/### headings, or **bold**/*italic*/lists/code blocks/blockquotes; otherwise plain text.
If Markdown, ask:
Detected existing markdown formatting. What would you like to do?
1. Optimize formatting (Recommended)
- Analyze content, improve headings, bold, lists for readability
- Run typography script (spacing, emphasis fixes)
- Output: {filename}-formatted.md
2. Keep original formatting
- Preserve existing markdown structure
- Run typography script only
- Output: {filename}-formatted.md
3. Typography fixes only
- Run typography script on original file in-place
- No copy created, modifies original file directly
- Optimize → Step 2 (full workflow)
- Keep original → skip to Step 5 (copy file), then Step 6
- Typography only → skip to Step 6 on the original file
Step 2: Analyze Content (Reader's Perspective)
Read the whole text and ask what would help a reader quickly understand and remember it. Save {original-filename}-analysis.md — the blueprint for Step 4:
# Content Analysis: {filename}
## Highlights & Key Insights
- [core arguments/conclusions, surprising facts or data, counterintuitive claims, golden quotes]
## Structure Assessment
- Current flow: [describe]
- Suggested sections: [heading candidates with brief rationale; unheaded section boundaries; walls of text needing breaks]
## Reader-Important Information
- [actionable takeaways, key definitions, lists buried in prose, comparisons that should be tables]
## Formatting Issues
- [specific issues with location: heading hierarchy, mixed-topic paragraphs, parallel items as prose, unmarked code/commands/terms]
## Typos Found
- [obvious typos with corrections, or "None found"]
Step 3: Check/Create Frontmatter, Title & Summary
Create a YAML frontmatter block if missing.
| Field | Processing |
|---|---|
title |
See Title Generation |
slug |
Infer from file path or generate from title |
summary |
One-sentence |
常见问题
它会改动我的文字吗?
不会。该技能只调整格式并修正明显的错别字,从不添加或改写内容。
输出保存在哪里?
它会保存为一个带有“formatted”后缀的新文件,因此你的原文件保持不变。
它能处理中文吗?
能。它使用能处理中日韩文字强调的工具,因此支持中英混排的文字。
详情
作者的原始描述
Formats plain text or markdown files with frontmatter, titles, summaries, headings, bold, lists, and code blocks. Use when user asks to "format markdown", "beautify article", "add formatting", or improve article layout. Outputs to {filename}-formatted.md.
repo: JimLiu/baoyu-skills
热度
- GitHub 星标
- 27k
- 排名
- #9956
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …