Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
ideacco avatar

Baoyu Format Markdown

  • 18 installs
  • 12 repo stars
  • Updated March 4, 2026
  • ideacco/baoyu-skills-openclaw

baoyu-format-markdown is an agent skill that formats Markdown files with remark (GFM, frontmatter, CJK-friendly) and optional autocorrect for publishing-ready docs.

About

baoyu-format-markdown is an agent skill for solo builders who ship a lot of Markdown—READMEs, changelogs, skill packages, and bilingual content—and want repeatable cleanup instead of one-off editor fixes. It encodes a Node/remark stack (GFM, frontmatter, CJK-friendly rules) plus an optional autocorrect step so agent output matches publishing conventions before you merge or distribute. Use it in the Build docs lane whenever drafts look fine in chat but break lists, spacing, or frontmatter in the repo. It does not replace content strategy or SEO; it makes technical writing mechanically correct and easier to review in PRs.

  • Unified/remark pipeline with GFM, frontmatter parsing, and remark-cjk-friendly for mixed Chinese–English prose
  • Optional npx autocorrect-node --fix pass for punctuation and spacing in CJK Markdown
  • Batch-friendly file-path workflow suitable for agent-generated docs before PR or ship
  • Targets consistency in headings, lists, and YAML frontmatter without hand-editing every file

Baoyu Format Markdown by the numbers

  • 18 all-time installs (skills.sh)
  • Ranked #1,021 of 1,879 Documentation skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/ideacco/baoyu-skills-openclaw --skill baoyu-format-markdown

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs18
repo stars12
Security audit1 / 3 scanners passed
Last updatedMarch 4, 2026
Repositoryideacco/baoyu-skills-openclaw

What it does

Normalize and fix Markdown files—GFM, frontmatter, and CJK-friendly spacing—before you publish or commit agent-written docs.

Who is it for?

Best when you're maintaining bilingual docs, skill repos, or content sites and want a scripted format pass on specific file paths.

Skip if: Skip if you only need one-off rewrites in chat with no repo files, or projects with no Node toolchain when you cannot run npx remark/autocorrect locally.

When should I use this skill?

Before committing or publishing Markdown that mixes CJK and English, uses frontmatter, or needs GFM-normalized lists and headings.

What you get

You get normalized, review-ready Markdown files that pass common lint and readability expectations before commit or release notes go out.

  • Formatted Markdown files in place on disk
  • Consistent GFM and frontmatter structure

Files

SKILL.mdMarkdownGitHub ↗

Markdown Formatter

Transforms plain text or markdown files into well-structured markdown with proper frontmatter, formatting, and typography.

Script Directory

Scripts in scripts/ subdirectory. Replace ${SKILL_DIR} with this SKILL.md's directory path.

ScriptPurpose
scripts/main.tsMain entry point with CLI options (uses remark-cjk-friendly for CJK emphasis)
scripts/quotes.tsReplace ASCII quotes with fullwidth quotes
scripts/autocorrect.tsAdd CJK/English spacing via autocorrect

Preferences (EXTEND.md)

Use Bash to check EXTEND.md existence (priority order):

# Check project-level first
test -f .baoyu-skills/baoyu-format-markdown/EXTEND.md && echo "project"

# Then user-level (cross-platform: $HOME works on macOS/Linux/WSL)
test -f "$HOME/.baoyu-skills/baoyu-format-markdown/EXTEND.md" && echo "user"

┌──────────────────────────────────────────────────────────┬───────────────────┐ │ Path │ Location │ ├──────────────────────────────────────────────────────────┼───────────────────┤ │ .baoyu-skills/baoyu-format-markdown/EXTEND.md │ Project directory │ ├──────────────────────────────────────────────────────────┼───────────────────┤ │ $HOME/.baoyu-skills/baoyu-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

Usage

Claude performs content analysis and formatting (Steps 1-6), then runs the script for typography fixes (Step 7).

Workflow

Step 1: Read Source File

Read the user-specified markdown or plain text file.

Step 1.5: Detect Content Type & Confirm

Content Type Detection:

IndicatorClassification
Has --- YAML frontmatterMarkdown
Has #, ##, ### headingsMarkdown
Has **bold**, *italic*Markdown
Has - or 1. listsMarkdown
Has ``` code blocksMarkdown
Has > blockquotesMarkdown
None of abovePlain text

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:

  • Optimize: Continue to Step 2-8 (full workflow)
  • Keep original: Skip Steps 2-5, copy file → Step 6-8 (run script on copy)
  • Typography only: Skip Steps 2-6, run Step 7 on original file directly

Step 2: Analyze Content Structure

Identify:

  • Existing title (H1 #)
  • Paragraph separations
  • Keywords suitable for bold
  • Parallel content convertible to lists
  • Code snippets
  • Quotations

Step 3: Check/Create Frontmatter

Check for YAML frontmatter (--- block). Create if missing.

Meta field handling:

FieldProcessing
titleSee Step 4
slugInfer from file path (e.g., posts/2026/01/10/vibe-coding/vibe-coding) or generate from title
summaryGenerate engaging summary (100-150 characters)
coverImageCheck if imgs/cover.png exists in same directory; if so, use relative path (also accepted: featureImage)

Step 4: Title Handling

Logic: 1. If frontmatter already has title → use it, no H1 in body 2. If first line is H1 → extract to frontmatter title, remove H1 from body 3. If neither exists → generate candidate titles

Title generation flow:

1. Generate 3 candidate titles based on content 2. Use 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:

  • Concise, max 20 characters
  • Captures core message
  • Engaging, sparks reading interest
  • Accurate, avoids clickbait

Important: Once title is in frontmatter, body should NOT have H1 (avoid duplication)

Step 5: Format Processing

Formatting rules:

ElementFormat
TitlesUse #, ##, ### hierarchy
Key pointsUse **bold**
Parallel itemsConvert to - unordered or 1. ordered lists
Code/commandsUse ` inline or ``block`
Quotes/sayingsUse > blockquote
SeparatorsUse --- where appropriate

Formatting principles:

  • Preserve original content and viewpoints
  • Add formatting only, do not modify text
  • Formatting serves readability
  • Avoid over-formatting

Step 6: Save Formatted File

Save as {original-filename}-formatted.md

Examples:

  • final.mdfinal-formatted.md
  • draft-v1.mddraft-v1-formatted.md

If user chose "Keep original formatting" (from Step 1.5):

  • Copy original file to {filename}-formatted.md without modifications
  • Proceed to Step 7 for typography fixes only

Backup 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.md

Step 7: Execute Text Formatting Script

After saving, must run the formatting script:

npx -y bun ${SKILL_DIR}/scripts/main.ts {output-file-path} [options]

Script Options:

OptionShortDescriptionDefault
--quotes-qReplace ASCII quotes with fullwidth quotes "..."false
--no-quotesDo not replace quotes
--spacing-sAdd CJK/English spacing via autocorrecttrue
--no-spacingDo not add CJK/English spacing
--emphasis-eFix CJK emphasis punctuation issuestrue
--no-emphasisDo not fix CJK emphasis issues
--help-hShow help message

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): 1. Fix CJK emphasis/bold punctuation issues (default: enabled) 2. Add CJK/English mixed text spacing via autocorrect (default: enabled) 3. Replace ASCII quotes "..." with fullwidth quotes "..." (default: disabled) 4. Format frontmatter YAML (always enabled)

Step 8: Display Results

**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

Formatting Example

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.

Notes

  • Preserve original writing style and tone
  • Specify correct language for code blocks (e.g., python, javascript)
  • Maintain CJK/English spacing standards
  • Do not add content not present in original

Extension Support

Custom configurations via EXTEND.md. See Preferences section for paths and supported options.

OpenClaw Migration Notes

  • Migration mode: OpenClaw native first
  • Preserved directories:
  • scripts: yes
  • references: no
  • prompts: no
  • External dependencies: bun
  • Risk level: low
  • Environment variables (detected): HOME
  • Config compatibility: keep original .baoyu-skills/<skill>/EXTEND.md behavior and add OpenClaw-compatible path in runtime wrappers when needed.

OpenClaw Preflight Checks

  • Confirm bun is available when script examples use npx -y bun ....

Detected env vars: HOME

OpenClaw Failure Fallback

  • If runtime dependency is missing, stop execution and return exact install/setup command.

Related skills

How it compares

Use as a focused docs formatter—not a full static-site generator or SEO content skill.

FAQ

Who is baoyu-format-markdown for?

Developers using Claude Code, Cursor, or Codex who commit Markdown daily and need GFM, frontmatter, and CJK spacing fixed in the actual files.

When should I use baoyu-format-markdown?

During Build docs work before opening a PR, after an agent drafts a README or skill.md, or when polishing launch/growth content that lives in the repo as Markdown.

Is baoyu-format-markdown safe to install?

Treat it like any skill that runs local CLI (npx) on filesystem paths—review the Security Audits panel on this page and run it on copies or branches first.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.