fix-markdown-fences

fix-markdown-fences is a skill for Claude Code from rjmurillo/ai-agents. It costs 72 tokens per session (4,404 once invoked), scanned A, original, MIT.

A Markdown checker that finds and repairs broken closing lines for fenced code blocks. It handles problems such as missing closings or closings that incorrectly include a language name.

In plain words
What is it for?
Use it to scan Markdown files, validate code-block fences, and repair malformed or unfinished code blocks.
Why use it?
Broken fences can make code blocks run into the surrounding text or hide the rest of a document. This fixes the Markdown structure so the document renders as intended.

Skill for Claude Code

Written for Claude Code: ${CLAUDE_PLUGIN_ROOT variable. Also seen: model in frontmatter.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the project-toolkit plugin — 125 skills, 25 commands, 33 agents, 5 hooks shipped together

Good fit Use it to scan Markdown files, validate code-block fences, and repair malformed or unfinished code blocks.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add rjmurillo/ai-agents
Claude Code
/plugin install project-toolkit

Made for: Claude Code.

Or install project-toolkit, the plugin that ships this one along with the rest of its 125 skills, 25 commands, 33 agents, 5 hooks.

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 fix-markdown-fences

README.md
[![agentmods](https://agentmods.dev/badge/skills/rjmurillo/ai-agents/fix-markdown-fences/github.svg)](https://agentmods.dev/skills/rjmurillo/ai-agents/fix-markdown-fences)
Your own site
<a href="https://agentmods.dev/skills/rjmurillo/ai-agents/fix-markdown-fences"><img src="https://agentmods.dev/badge/skills/rjmurillo/ai-agents/fix-markdown-fences/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for fix-markdown-fences

Your own site · 80×15
<a href="https://agentmods.dev/skills/rjmurillo/ai-agents/fix-markdown-fences"><img src="https://agentmods.dev/badge/skills/rjmurillo/ai-agents/fix-markdown-fences.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 72 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,404 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.00072 $0.04404
Opus 5.5 $0.00029 $0.01762
Sonnet 5.5 $0.00014 $0.00881
Haiku 4.5 $0.00007 $0.00440

Measured 4d ago against content hash 390e3aaa0381, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

fix-markdown-fences 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 4d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/fence_write_guard.py, scripts/fix_fences.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

.claude/skills/fix-markdown-fences/SKILL.md · 336 lines

How it starts

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

Fix Markdown Code Fence Closings

Scan and repair malformed closing fences in markdown files. Closing fences must never contain language identifiers.

Triggers

Trigger Phrase Operation
fix markdown fences Scan and repair malformed fence closings
repair code block closings Fix closing fences with language identifiers
markdown rendering broken Diagnose and fix fence issues
code blocks bleeding into content Fix unclosed or malformed fences
validate markdown code blocks Check all fences for correctness

Quick Reference

Symptom Cause Fix
Code block bleeds into text Closing fence has language identifier Insert a bare closing fence above it; the line then opens the next block
Nested blocks render wrong Missing closing fence before new opening Insert closing fence
Content cut off at end of file Unclosed code block Append closing fence

When to Use

Use this skill when:

  • Markdown code blocks render incorrectly or bleed into surrounding content
  • Closing fences have language identifiers (e.g., ```python instead of ```)
  • Validating markdown documentation before committing

Use manual editing instead when:

  • The issue is indentation or content inside the code block (not the fences)
  • You need to change the language identifier on opening fences

Process

Do not walk the file by hand. Fence tracking is a state machine, and fix_fences.py runs it.

  1. Report. Run the script over the target path. It prints every defect as FILE:LINE: KIND: TEXT and exits 1 when it finds any.
python3 "${COPILOT_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-.claude}}/skills/fix-markdown-fences/scripts/fix_fences.py" FILE_OR_DIR
  1. Read the report. Two kinds appear:
    • malformed_closing: a closing fence carries a language identifier, so the block bleeds into the following prose.
    • unclosed_block: the file ends with a block still open.

Read the full file on GitHub · 336 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 4d ago Changed · +46 lines 390e3aaa0381
  2. 22d ago Changed · +6 lines 3c07aa11882c
  3. 1mo ago First seen · 284 lines · 72 tokens per session scan A da1471c97fd2

Subscribe to this mod's changes

fix-markdown-fences is a skill published in the GitHub repository rjmurillo/ai-agents (48 stars, last pushed today), licensed MIT. It adds 72 tokens to every session and 4,404 once invoked, about $0.0003 per session on Opus 5.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-09-03.