AgentSkillsCN

format-md

使用 @takazudo/mdx-formatter npm 包格式化 markdown (.md) 与 MDX (.mdx) 文件。当用户:(1) 希望格式化 markdown 文件;(2) 提及“格式化 md”、“美化 markdown”或“修复 markdown 格式”;(3) 用户拥有需要统一格式化的 markdown/MDX 文件时,可使用此技能。功能包括:基于 remark 的 AST 格式化、MDX 支持(JSX、导入/导出)、日文文本处理、HTML 转 markdown、保留 Docusaurus 的 admonitions、以及 GFM 特性(表格、删除线、任务列表)。

SKILL.md
--- frontmatter
name: format-md
description: >-
  Format markdown (.md) and MDX (.mdx) files using @takazudo/mdx-formatter npm package. Use when:
  (1) User wants to format markdown files, (2) User mentions 'format md', 'prettify markdown', or
  'fix markdown formatting', (3) User has markdown/MDX files that need consistent formatting.
  Features: remark-based AST formatting, MDX support (JSX, imports/exports), Japanese text handling,
  HTML to markdown conversion, Docusaurus admonitions preservation, GFM features (tables,
  strikethrough, task lists).

Format Markdown/MDX Files

Format the specified markdown or MDX file(s) using @takazudo/mdx-formatter.

Usage

The user can specify:

  • A specific file path (e.g., README.md, docs/guide.md)
  • Multiple files (e.g., docs/*.md)
  • If no file is specified, ask the user which file(s) they want to format

Formatter Details

  • npm package: @takazudo/mdx-formatter
  • Command: npx @takazudo/mdx-formatter --write <file-path>

Instructions

  1. If the user provided a file path or pattern, use it directly
  2. If no file was specified, ask the user which file(s) they want to format
  3. Run the formatter using the Bash tool:
    bash
    npx @takazudo/mdx-formatter --write <file-path>
    
  4. Report the results to the user

Examples

bash
# Format a single file
npx @takazudo/mdx-formatter --write README.md

# Format multiple files with glob pattern
npx @takazudo/mdx-formatter --write "docs/**/*.md"

Features

The formatter provides:

  • AST-based formatting with remark
  • MDX support (JSX components, imports/exports)
  • Japanese text handling
  • HTML to markdown conversion
  • Docusaurus admonitions preservation
  • GFM features (tables, strikethrough, task lists)