trim-md

Optimize markdown files for LLM consumption by removing token waste and normalizing structure.

56|5|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/diegomarino/claude-toolshed --skill trim-md
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: trim-md
Source: https://github.com/diegomarino/claude-toolshed/tree/main/plugins/trim-md/skills/trim-md
Command: npx skills add https://github.com/diegomarino/claude-toolshed --skill trim-md

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill streamlines markdown files by removing token waste and normalizing structure, making them more efficient for Large Language Models (LLMs) and AI agents to process.

Core Features & Use Cases

  • Token Optimization: Reduces the number of tokens required to represent markdown content by removing unnecessary whitespace, blank lines, and other non-semantic elements.
  • Structure Normalization: Ensures consistent heading hierarchies and formatting for better parsing by AI models.
  • Selective Exclusion: Allows specific sections of markdown files to be excluded from trimming using a simple comment (<!-- trim-md:disable -->).
  • Use Case: Before feeding a large markdown documentation file into an LLM for summarization, use trim-md to reduce its token count, potentially saving costs and improving processing speed without losing critical information.

Quick Start

Use the trim-md skill to optimize the markdown file named 'README.md' in the current directory.

Frequently Asked Questions about trim-md

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce token count in markdown files before feeding them to an LLM?

Reduce markdown token count for LLMs by stripping unnecessary whitespace, blank lines, and non-semantic elements. This process normalizes structure and compacts tables to lower costs and improve processing speed without losing critical information.

What is markdown optimization for AI agents and when should I apply it?

Markdown optimization for AI agents is the process of normalizing heading hierarchies and removing token waste to improve parsing. Apply it to documentation or READMEs before AI processing to ensure efficient context consumption.

How do I exclude specific sections of documentation from token reduction?

Exclude specific markdown sections from token reduction by inserting a simple comment tag. Using the disable comment prevents the optimization process from trimming that specific block of documentation content.

Does this markdown optimization approach work with large documentation files?

Yes, markdown optimization works with large documentation files by applying rule-based cleaning and table compaction. It streamlines large READMEs for AI processing by reducing the number of tokens required to represent the content.

What is the best way to normalize markdown structure for AI processing?

The best way to normalize markdown structure for AI processing is using rule-based cleaning tools like markdownlint-cli2. This ensures consistent heading hierarchies and formatting while compacting tables for efficient parsing.