| name | fixing-markdown |
| description | Validate and fix markdown formatting in files and folders. Use when the user wants to check formatting, validate markdown, fix lint errors, revisar formato, validar notas, comprobar markdown, arregla el formato, arreglar markdown, limpiar markdown, or clean up files. |
/fixing-markdown — Validate and Fix Markdown
IMPORTANT: Before starting execution, inform the user: "ESTOY EJECUTANDO EL SKILL /fixing-markdown"
Run markdownlint-cli2 + fix_md_extra.py + prettier to auto-fix markdown formatting issues.
CRITICAL: Execution Requirements
ALWAYS run ALL tools in sequence, regardless of exit codes.
- markdownlint-cli2 may exit with code 1 if it finds errors it cannot auto-fix. This is expected behavior—proceed anyway.
- fix_md_extra.py fixes issues markdownlint cannot auto-fix (MD040, MD025).
- prettier must ALWAYS run after the previous steps.
- After all tools complete, verify with a final markdownlint check.
Correct flow:
markdownlint-cli2 --fix → fix_md_extra.py → prettier --write → markdownlint-cli2 (verify)
Wrong flow (DO NOT DO THIS):
markdownlint-cli2 --fix → (sees exit code 1) → STOP
Usage
/fixing-markdown <target>
Arguments:
target (Required):
- File path: Single file (e.g.,
src/content/posts/example.md)
- Folder path: All .md files recursively (e.g.,
src/content/posts)
No argument = show this usage.
Exclusions
NEVER modify files under .agent/ directory.
The .agent/ directory (git-ignored) contains Antigravity Kit 2.0—optional tooling for Antigravity IDE users. These files are managed externally and have their own formatting conventions. This skill must:
- Reject any target that is
.agent/ or starts with .agent/
- Exclude
.agent/ when target is . or root directory
- Skip any file path containing
/.agent/ or \.agent\
If user requests .agent/ formatting, respond:
Skipping .agent/ — this directory is managed externally (Antigravity Kit).
Use Antigravity's own formatting tools if needed.
Environment Setup
This skill uses zero-footprint dependency management:
- JavaScript CLI tools (
markdownlint-cli2, prettier): Executed via pnpm dlx — no package.json or node_modules needed
- Python scripts: Executed via
uv run with PEP 723 inline metadata — no requirements.txt or .venv needed
Prerequisites (must be installed on the system):
No per-project setup required. Dependencies are cached globally and resolved on first run.
Commands
Replace <plugin-path> with the actual path to this plugin's installation directory.
Single File
pnpm dlx markdownlint-cli2 --config <plugin-path>/skills/fixing-markdown/.markdownlint-cli2.jsonc --fix "path/to/file.md"
uv run <plugin-path>/skills/fixing-markdown/scripts/fix_md_extra.py "path/to/file.md"
pnpm dlx prettier --config <plugin-path>/skills/fixing-markdown/.prettierrc --write "path/to/file.md"
pnpm dlx markdownlint-cli2 --config <plugin-path>/skills/fixing-markdown/.markdownlint-cli2.jsonc "path/to/file.md"
Folder (recursive)
pnpm dlx markdownlint-cli2 --config <plugin-path>/skills/fixing-markdown/.markdownlint-cli2.jsonc --fix "path/to/folder/**/*.md" "#.agent"
uv run <plugin-path>/skills/fixing-markdown/scripts/fix_md_extra.py "path/to/folder"
pnpm dlx prettier --config <plugin-path>/skills/fixing-markdown/.prettierrc --write "path/to/folder/**/*.md" --ignore-pattern ".agent/**"
pnpm dlx markdownlint-cli2 --config <plugin-path>/skills/fixing-markdown/.markdownlint-cli2.jsonc "path/to/folder/**/*.md" "#.agent"
Root Directory (.)
When target is . or root, always exclude .agent/:
pnpm dlx markdownlint-cli2 --config <plugin-path>/skills/fixing-markdown/.markdownlint-cli2.jsonc --fix "**/*.md" "#.agent"
uv run <plugin-path>/skills/fixing-markdown/scripts/fix_md_extra.py "."
pnpm dlx prettier --config <plugin-path>/skills/fixing-markdown/.prettierrc --write "**/*.md" --ignore-pattern ".agent/**"
pnpm dlx markdownlint-cli2 --config <plugin-path>/skills/fixing-markdown/.markdownlint-cli2.jsonc "**/*.md" "#.agent"
Examples
/fixing-markdown src/content/posts/example.md
-> Fixes and formats specific file
/fixing-markdown src/content/posts
-> Fixes and formats all .md files in posts/ recursively
/fixing-markdown docs
-> Fixes and formats all .md files in docs/ recursively
Output Format
Clean File
Fixing: src/content/posts/example.md
markdownlint: 0 errors
fix_md_extra: no changes
prettier: formatted
Done
With Issues Fixed
Fixing: src/content/posts/example.md
markdownlint: 2 errors fixed
fix_md_extra: added language to 1 code block
prettier: formatted
Done
Tools
| Tool | Purpose |
|---|
| markdownlint-cli2 | Structural fixes (headings, lists, code blocks, blank lines) |
| fix_md_extra.py | Fixes MD040 (code block language) and MD025 (multiple H1) |
| prettier | Visual formatting (table alignment, consistent spacing) |
Rules Enforced
markdownlint-cli2 (.markdownlint-cli2.jsonc)
| Rule | Description | Auto-fixable |
|---|
| MD001 | Heading levels increment by one | No |
| MD003 | ATX style headings (##) | Yes |
| MD004 | Dash (-) for unordered lists | Yes |
| MD009 | No trailing whitespace | Yes |
| MD010 | No hard tabs | Yes |
| MD012 | Max 1 consecutive blank line | Yes |
| MD022 | Blank lines around headings | Yes |
| MD025 | Single H1 heading | Yes (via script) |
| MD031 | Blank lines around code blocks | Yes |
| MD032 | Blank lines around lists | Yes |
| MD040 | Code blocks have language | Yes (via script) |
| MD047 | File ends with newline | Yes |
fix_md_extra.py (scripts/)
- MD040: Adds
text as default language to code blocks without one
- MD025: Demotes duplicate H1 headings to H2
prettier (.prettierrc)
- Table column alignment
- Consistent spacing
- Prose wrap preserved (no line breaking)
Behavior
- Check argument: If no target provided, show usage and exit
- Check exclusions: If target is
.agent/ or inside it, show warning and exit
- Detect target type: file or folder
- Run markdownlint-cli2 with --fix: Fix structural issues (always exclude
.agent/). IGNORE exit code—proceed regardless.
- Run fix_md_extra.py: Fix MD040 and MD025 issues that markdownlint cannot auto-fix.
- Run prettier: Format visual appearance (always exclude
.agent/). ALWAYS run this step.
- Run markdownlint-cli2 without --fix: Verify no remaining errors
- Report: Show results from all tools
Notes
- Config files:
.markdownlint-cli2.jsonc, .prettierrc (in skill folder)
- Requires:
pnpm and uv installed on system
- markdownlint exit code 1 is normal when there are unfixable errors—do not stop execution
- No
node_modules or .venv created—dependencies cached globally by pnpm/uv