重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
tuzi-format-markdown by tuziapi/tuzi-skills
npx skills add https://github.com/tuziapi/tuzi-skills --skill tuzi-format-markdown将纯文本或 Markdown 文件转换为结构良好、具有适当 Frontmatter、格式和排版的 Markdown 文档。
脚本位于 scripts/ 子目录中。请将 ${SKILL_DIR} 替换为此 SKILL.md 文件的目录路径。
| 脚本 | 用途 |
|---|---|
scripts/main.ts | 主入口点,包含 CLI 选项(使用 remark-cjk-friendly 处理 CJK 强调) |
scripts/quotes.ts | 将 ASCII 引号替换为全角引号 |
scripts/autocorrect.ts | 通过 autocorrect 添加 CJK/英文间距 |
使用 Bash 检查 EXTEND.md 是否存在(优先级顺序):
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 首先检查项目级别
test -f .tuzi-skills/tuzi-format-markdown/EXTEND.md && echo "project"
# 然后检查用户级别(跨平台:$HOME 在 macOS/Linux/WSL 上均适用)
test -f "$HOME/.tuzi-skills/tuzi-format-markdown/EXTEND.md" && echo "user"
┌──────────────────────────────────────────────────────────┬───────────────────┐ │ 路径 │ 位置 │ ├──────────────────────────────────────────────────────────┼───────────────────┤ │ .tuzi-skills/tuzi-format-markdown/EXTEND.md │ 项目目录 │ ├──────────────────────────────────────────────────────────┼───────────────────┤ │ $HOME/.tuzi-skills/tuzi-format-markdown/EXTEND.md │ 用户主目录 │ └──────────────────────────────────────────────────────────┴───────────────────┘
┌───────────┬───────────────────────────────────────────────────────────────────────────┐ │ 结果 │ 操作 │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ 找到 │ 读取、解析、应用设置 │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ 未找到 │ 使用默认值 │ └───────────┴───────────────────────────────────────────────────────────────────────────┘
EXTEND.md 支持 : 默认格式化选项 | 摘要长度偏好
Claude 执行内容分析和格式化(步骤 1-6),然后运行脚本进行排版修复(步骤 7)。
读取用户指定的 Markdown 或纯文本文件。
内容类型检测:
| 指示器 | 分类 |
|---|---|
包含 --- YAML Frontmatter | Markdown |
包含 #、##、### 标题 | Markdown |
包含 **粗体**、*斜体* | Markdown |
包含 - 或 1. 列表 | Markdown |
| 包含 ```` 代码块 | Markdown |
包含 > 引用块 | Markdown |
| 以上皆无 | 纯文本 |
决策流程:
┌─────────────────┬────────────────────────────────────────────────┐ │ 内容类型 │ 操作 │ ├─────────────────┼────────────────────────────────────────────────┤ │ 纯文本 │ 继续步骤 2(格式化为 Markdown) │ ├─────────────────┼────────────────────────────────────────────────┤ │ Markdown │ 使用 AskUserQuestion 工具确认优化 │ └─────────────────┴────────────────────────────────────────────────┘
如果检测到 Markdown,询问用户:
检测到现有的 Markdown 格式。您希望做什么?
1. 优化格式(推荐)
- 添加/改进 Frontmatter、标题、粗体、列表
- 运行排版脚本(间距、强调修复)
- 输出:{filename}-formatted.md
2. 保持原始格式
- 保留现有的 Markdown 结构
- 运行排版脚本(间距、强调修复)
- 输出:{filename}-formatted.md
3. 仅进行排版修复
- 直接在原始文件上运行排版脚本
- 不创建副本,直接修改原始文件
根据用户选择:
识别:
#)检查是否存在 YAML Frontmatter(--- 块)。如果缺失则创建。
元字段处理:
| 字段 | 处理 |
|---|---|
title | 参见步骤 4 |
slug | 从文件路径推断(例如 posts/2026/01/10/vibe-coding/ → vibe-coding)或根据标题生成 |
summary | 生成吸引人的摘要(100-150 个字符) |
coverImage | 检查同一目录中是否存在 imgs/cover.png;如果存在,则使用相对路径(也接受 featureImage) |
逻辑:
title → 使用它,正文中不添加 H1title,并从正文中移除 H1标题生成流程:
AskUserQuestion 工具:请选择一个标题:
1. [标题 A](推荐)
2. [标题 B]
3. [标题 C]
3. 如果几秒内未选择,则使用推荐选项(选项 1)
标题原则:
重要: 一旦标题在 Frontmatter 中,正文中不应再有 H1(避免重复)
格式化规则:
| 元素 | 格式 |
|---|---|
| 标题 | 使用 #、##、### 层级结构 |
| 关键点 | 使用 **粗体** |
| 平行项目 | 转换为 - 无序列表或 1. 有序列表 |
| 代码/命令 | 使用 行内代码 或 代码块 |
| 引用/名言 | 使用 > 引用块 |
| 分隔符 | 在适当位置使用 --- |
格式化原则:
保存为 {原始文件名}-formatted.md
示例:
final.md → final-formatted.mddraft-v1.md → draft-v1-formatted.md如果用户选择“保持原始格式”(来自步骤 1.5):
{filename}-formatted.md,不做修改备份现有文件:
如果 {filename}-formatted.md 已存在,则在覆盖前备份:
# 检查格式化文件是否存在
if [ -f "{filename}-formatted.md" ]; then
# 使用时间戳备份
mv "{filename}-formatted.md" "{filename}-formatted.backup-$(date +%Y%m%d-%H%M%S).md"
fi
示例:
final-formatted.md 存在 → 备份为 final-formatted.backup-20260128-143052.md保存后,必须运行格式化脚本:
npx -y bun ${SKILL_DIR}/scripts/main.ts {输出文件路径} [选项]
脚本选项:
| 选项 | 短选项 | 描述 | 默认值 |
|---|---|---|---|
--quotes | -q | 将 ASCII 引号替换为全角引号 "..." | false |
--no-quotes | 不替换引号 | ||
--spacing | -s | 通过 autocorrect 添加 CJK/英文间距 | true |
--no-spacing | 不添加 CJK/英文间距 | ||
--emphasis | -e | 修复 CJK 强调标点问题 | true |
--no-emphasis | 不修复 CJK 强调问题 | ||
--help | -h | 显示帮助信息 |
示例:
# 默认:间距 + 强调启用,引号禁用
npx -y bun ${SKILL_DIR}/scripts/main.ts article.md
# 启用所有功能,包括引号替换
npx -y bun ${SKILL_DIR}/scripts/main.ts article.md --quotes
# 仅修复强调问题,跳过间距
npx -y bun ${SKILL_DIR}/scripts/main.ts article.md --no-spacing
# 禁用所有处理,仅保留 Frontmatter 格式化
npx -y bun ${SKILL_DIR}/scripts/main.ts article.md --no-spacing --no-emphasis
脚本执行(基于选项):
"..." 替换为全角引号 "..."(默认:禁用)**格式化完成**
文件:posts/2026/01/09/example/final-formatted.md
更改:
- 添加了标题:[标题内容]
- 添加了 X 个粗体标记
- 添加了 X 个列表
- 添加了 X 个代码块
之前:
This is plain text. First point is efficiency improvement. Second point is cost reduction. Third point is experience optimization. Use npm install to install dependencies.
之后:
---
title: 三大核心优势
slug: three-core-advantages
summary: 探索推动现代项目成功的三个关键优势。
---
This is plain text.
**主要优势:**
- 效率提升
- 成本降低
- 体验优化
Use `npm install` to install dependencies.
python、javascript)通过 EXTEND.md 进行自定义配置。有关路径和支持的选项,请参见偏好设置部分。
每周安装次数
70
仓库
GitHub 星标数
24
首次出现
2026年3月5日
安全审计
安装于
openclaw54
opencode43
gemini-cli43
github-copilot43
amp43
cline43
Transforms plain text or markdown files into well-structured markdown with proper frontmatter, formatting, and typography.
Scripts in scripts/ subdirectory. Replace ${SKILL_DIR} with this SKILL.md's directory path.
| 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 |
Use Bash to check EXTEND.md existence (priority order):
# Check project-level first
test -f .tuzi-skills/tuzi-format-markdown/EXTEND.md && echo "project"
# Then user-level (cross-platform: $HOME works on macOS/Linux/WSL)
test -f "$HOME/.tuzi-skills/tuzi-format-markdown/EXTEND.md" && echo "user"
┌──────────────────────────────────────────────────────────┬───────────────────┐ │ Path │ Location │ ├──────────────────────────────────────────────────────────┼───────────────────┤ │ .tuzi-skills/tuzi-format-markdown/EXTEND.md │ Project directory │ ├──────────────────────────────────────────────────────────┼───────────────────┤ │ $HOME/.tuzi-skills/tuzi-format-markdown/EXTEND.md │ User home │ └──────────────────────────────────────────────────────────┴───────────────────┘
┌───────────┬───────────────────────────────────────────────────────────────────────────┐ │ Result │ Action │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ Found │ Read, parse, apply settings │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ Not found │ Use defaults │ └───────────┴───────────────────────────────────────────────────────────────────────────┘
EXTEND.md Supports : Default formatting options | Summary length preferences
Claude performs content analysis and formatting (Steps 1-6), then runs the script for typography fixes (Step 7).
Read the user-specified markdown or plain text file.
Content Type Detection:
| Indicator | Classification |
|---|---|
Has --- YAML frontmatter | Markdown |
Has #, ##, ### headings | Markdown |
Has **bold**, *italic* | Markdown |
Has - or 1. lists |
Decision Flow:
┌─────────────────┬────────────────────────────────────────────────┐ │ Content Type │ Action │ ├─────────────────┼────────────────────────────────────────────────┤ │ Plain text │ Proceed to Step 2 (format to markdown) │ ├─────────────────┼────────────────────────────────────────────────┤ │ Markdown │ Use AskUserQuestion to confirm optimization │ └─────────────────┴────────────────────────────────────────────────┘
If Markdown detected, ask user:
Detected existing markdown formatting. What would you like to do?
1. Optimize formatting (Recommended)
- Add/improve frontmatter, headings, bold, lists
- Run typography script (spacing, emphasis fixes)
- Output: {filename}-formatted.md
2. Keep original formatting
- Preserve existing markdown structure
- Run typography script (spacing, emphasis fixes)
- Output: {filename}-formatted.md
3. Typography fixes only
- Run typography script on original file in-place
- No copy created, modifies original file directly
Based on user choice:
Identify:
#)Check for YAML frontmatter (--- block). Create if missing.
Meta field handling:
| Field | Processing |
|---|---|
title | See Step 4 |
slug | Infer from file path (e.g., posts/2026/01/10/vibe-coding/ → vibe-coding) or generate from title |
summary | Generate engaging summary (100-150 characters) |
coverImage | Check if imgs/cover.png exists in same directory; if so, use relative path (also accepted: ) |
Logic:
title → use it, no H1 in bodytitle, remove H1 from bodyTitle generation flow:
AskUserQuestion tool:Select a title:
1. [Title A] (Recommended)
2. [Title B]
3. [Title C]
3. If no selection within a few seconds, use recommended (option 1)
Title principles:
Important: Once title is in frontmatter, body should NOT have H1 (avoid duplication)
Formatting rules:
| Element | Format |
|---|---|
| Titles | Use #, ##, ### hierarchy |
| Key points | Use **bold** |
| Parallel items | Convert to - unordered or 1. ordered lists |
| Code/commands | Use inline or block |
Formatting principles:
Save as {original-filename}-formatted.md
Examples:
final.md → final-formatted.mddraft-v1.md → draft-v1-formatted.mdIf user chose "Keep original formatting" (from Step 1.5):
{filename}-formatted.md without modificationsBackup existing file:
If {filename}-formatted.md already exists, backup before overwriting:
# Check if formatted file exists
if [ -f "{filename}-formatted.md" ]; then
# Backup with timestamp
mv "{filename}-formatted.md" "{filename}-formatted.backup-$(date +%Y%m%d-%H%M%S).md"
fi
Example:
final-formatted.md exists → backup to final-formatted.backup-20260128-143052.mdAfter saving, must run the formatting script:
npx -y bun ${SKILL_DIR}/scripts/main.ts {output-file-path} [options]
Script Options:
| Option | Short | Description | Default |
|---|---|---|---|
--quotes | -q | Replace ASCII quotes with fullwidth quotes "..." | false |
--no-quotes | Do not replace quotes | ||
--spacing | -s | Add CJK/English spacing via autocorrect |
Examples:
# Default: spacing + emphasis enabled, quotes disabled
npx -y bun ${SKILL_DIR}/scripts/main.ts article.md
# Enable all features including quote replacement
npx -y bun ${SKILL_DIR}/scripts/main.ts article.md --quotes
# Only fix emphasis issues, skip spacing
npx -y bun ${SKILL_DIR}/scripts/main.ts article.md --no-spacing
# Disable all processing except frontmatter formatting
npx -y bun ${SKILL_DIR}/scripts/main.ts article.md --no-spacing --no-emphasis
Script performs (based on options):
"..." with fullwidth quotes "..." (default: disabled)**Formatting complete**
File: posts/2026/01/09/example/final-formatted.md
Changes:
- Added title: [title content]
- Added X bold markers
- Added X lists
- Added X code blocks
Before:
This is plain text. First point is efficiency improvement. Second point is cost reduction. Third point is experience optimization. Use npm install to install dependencies.
After:
---
title: Three Core Advantages
slug: three-core-advantages
summary: Discover the three key benefits that drive success in modern projects.
---
This is plain text.
**Main advantages:**
- Efficiency improvement
- Cost reduction
- Experience optimization
Use `npm install` to install dependencies.
python, javascript)Custom configurations via EXTEND.md. See Preferences section for paths and supported options.
Weekly Installs
70
Repository
GitHub Stars
24
First Seen
Mar 5, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
openclaw54
opencode43
gemini-cli43
github-copilot43
amp43
cline43
GitHub Actions 官方文档查询助手 - 精准解答 CI/CD 工作流问题
47,200 周安装
| Markdown |
| Has ``` code blocks | Markdown |
Has > blockquotes | Markdown |
| None of above | Plain text |
featureImage| Quotes/sayings | Use > blockquote |
| Separators | Use --- where appropriate |
| true |
--no-spacing | Do not add CJK/English spacing |
--emphasis | -e | Fix CJK emphasis punctuation issues | true |
--no-emphasis | Do not fix CJK emphasis issues |
--help | -h | Show help message |