safe-markdown-auto-fix

safe-markdown-auto-fix is a skill for Claude Code, Codex from chen3feng/agent-skills. It costs 26 tokens per session (875 once invoked), scanned A, original, Apache-2.0.

A Markdown text fixer that changes prose while protecting code blocks, inline code, links, and HTML. Markdown is a plain-text format commonly used for documentation.

In plain words
What is it for?
Safely applying spacing, typography, and terminology corrections to Markdown files.
Why use it?
It prevents automatic wording or spacing fixes from breaking code, URLs, or markup embedded in documentation.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Safely applying spacing, typography, and terminology corrections to Markdown files.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/chen3feng/agent-skills/safe-markdown-auto-fix
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add chen3feng/agent-skills --skill safe-markdown-auto-fix
Clone the repo
git clone --depth 1 https://github.com/chen3feng/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for safe-markdown-auto-fix

README.md
[![agentmods](https://agentmods.dev/badge/skills/chen3feng/agent-skills/safe-markdown-auto-fix.svg)](https://agentmods.dev/skills/chen3feng/agent-skills/safe-markdown-auto-fix)
Your own site
<a href="https://agentmods.dev/skills/chen3feng/agent-skills/safe-markdown-auto-fix"><img src="https://agentmods.dev/badge/skills/chen3feng/agent-skills/safe-markdown-auto-fix.svg" alt="Measured on agentmods" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 875 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00026 $0.00875
Opus 5 $0.00013 $0.00438
Sonnet 5 $0.00005 $0.00175
Haiku 4.5 $0.00003 $0.00088

Measured 7d ago against content hash c2b9a322f12b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

safe-markdown-auto-fix scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

skills/safe-markdown-auto-fix/SKILL.md · 100 lines

How it starts

The opening of the file, as written. The whole thing — 100 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Safe Markdown auto-fix

When to use

You're writing (or reviewing) a regex-based fixer for Markdown — spacing rules, typography, terminology normalization. Applies to any lint-and-fix tool, including the cndocstyle package shipped with cn-doc-style-guide.

Problem

A naive re.sub over the whole file will cheerfully mangle:

  • Fenced code blocks ( ): inserting "helpful" spaces in the middle of a Python string breaks the program.
  • Inline code spans (`foo_bar`): adding space around _ ruins identifiers.
  • Link URLs ([text](https://…)): even reading URLs as prose produces false positives like "space between CJK and ASCII" inside a percent-encoded path.
  • HTML tags / comments: <img alt="你好World"> is prose inside HTML, but the tag itself must stay intact.

Solution

Always tokenize the file into "protected" and "prose" regions before applying any substitution. A minimal protection list:

PROTECT = [
    # fenced code blocks, greedy across lines
    re.compile(r"```[\s\S]*?```", re.MULTILINE),
    # indented code blocks (4+ leading spaces at start of line)
    re.compile(r"(?:^|\n)(?: {4,}|\t).+", re.MULTILINE),
    # inline code
    re.compile(r"`[^`\n]+`"),
    # link / image URLs — keep the URL, allow fixing the text
    re.compile(r"\]\([^)\n]+\)"),
    # raw HTML tags and comments
    re.compile(r"<!--[\s\S]*?-->"),
    re.compile(r"<[a-zA-Z/][^>]*>"),
]

Then:

  1. Walk the text, carving out every match into a placeholder (e.g. \x00PROTECT_N\x00) and storing the original.
  2. Run your prose-level substitutions on the placeholder-laced text.
  3. Restore placeholders.

For a fixer it's also important to:

  • Default to dry-run. Print a unified diff; require --apply to write.
  • Be idempotent. Running the tool twice must not change output.
  • Fail closed. If in doubt (ambiguous context, mixed-script identifiers), leave the text untouched and log a warning rather than silently "correcting" it.

Read the full file on GitHub · 100 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 100 lines · 26 tokens per session scan A c2b9a322f12b

Subscribe to this mod's changes

safe-markdown-auto-fix is a skill published in the GitHub repository chen3feng/agent-skills (5 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 26 tokens to every session and 875 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

regex-mastery

Use this skill when writing regular expressions, debugging pattern matching,optimizing regex performance, or implementing text validation. Triggers on regex, regular expressions, pattern matching, lookahead, lookbehind, named groups, capture groups, backreferences, and any task requiring text pattern matching.

alibaba/anolisa · 60 tokens

processing-markdown

Processes Markdown files using mq, a jq-like query language for Markdown. Use when the user mentions Markdown processing, content extraction, document transformation, or mq queries.

harehare/mq · 36 tokens

web-scraping

Fetches web pages and extracts structured data using mq's toolchain (mq-crawl for fetching/crawling/JS rendering, mq for HTML-to-Markdown selector-based extraction, http() for in-query requests). Use when the user wants to scrape a URL, pull structured data out of a webpage, crawl a site, or turn HTML into…

harehare/mq · 89 tokens

[object Object]

Read, search, and open notes in the user's "{{GRAPHNAME}}" Reflect graph via the reflect CLI. Use when the user asks about their notes, daily notes, journal, or anything they may have written down in Reflect.

team-reflect/reflect-open · 51 tokens

validate

Check that an Open Knowledge Format (OKF) bundle is conformant with the v0.2 spec (§11). Use when asked to validate, lint, or check an OKF bundle, or before committing changes to one. Runs a deterministic Python checker — not an eyeball pass. Also migrates a v0.1 bundle to v0.2 in place with --migrate.

scaccogatto/okf-skills · 82 tokens

re0-merge

Review and land an external contribution the way this suite does: gate it against the thesis, land it with the author's credit intact, complete a new skill rather than merging it raw, then approve, credit, and explain before closing. Use when reviewing a pull request, as any collaborator or maintainer, not only the…

LilMGenius/paperthin · 70 tokens