token-formatter

Compress Markdown and text into token-efficient formats with Python scripts.

27|9|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/georgekhananaev/claude-skills-vault --skill token-formatter
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: token-formatter
Source: https://github.com/georgekhananaev/claude-skills-vault/tree/main/.claude/skills/token-formatter
Command: npx skills add https://github.com/georgekhananaev/claude-skills-vault --skill token-formatter

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires tiktoken, and includes scripts (resource) components.

What problem does it solve?

It reduces token usage by compressing verbose content into token-efficient formats.

Core Features & Use Cases

  • Token reduction: compress long docs, READMEs, and guides while preserving essential meaning.
  • Flexible transformations: apply rules for abbreviations, symbols, and structured data (lists, parameters).
  • Use Case: load large documentation into an LLM context or chatbot prompt and generate concise summaries or extract key data.

Quick Start

Use the token-formatter to compress a document:

  • Run: python .claude/skills/token-formatter/scripts/compress.py input.md > compressed.md
  • Pipe: cat input.md | python .claude/skills/token-formatter/scripts/compress.py --level 2
  • Check: python .claude/skills/token-formatter/scripts/count_tokens.py input.md

Frequently Asked Questions about token-formatter

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

FAQPage Schema
How do I reduce token usage when loading large Markdown documentation into an LLM prompt?

To reduce token usage for LLM prompts, you can compress verbose Markdown documentation into token-efficient formats. This process applies configurable compression rules and abbreviations while preserving the essential meaning needed for context window optimization.

Can I check token counts for a document using tiktoken before compressing it?

Yes, you can check token counts using a Python script with optional tiktoken-based counting. Running the provided count_tokens.py script on your input file calculates the exact token count, helping you decide if compression is necessary for your LLM context window.

What is the best way to compress a verbose README for an LLM context window without losing key data?

The best way to compress a verbose README for an LLM context window is applying configurable compression levels that transform structured data, lists, and parameters into token-smart formats. This preserves essential meaning while applying abbreviations and symbols to minimize token usage.

Does the token compression work with standard Python scripts and pipe operations?

Yes, token compression works with standard Python scripts and pipe operations. You can run the compress.py script directly on an input Markdown file or pipe content into it using standard command-line operations with configurable compression levels.

What compression levels are available for token-efficient formatting of documentation?

Configurable compression levels are available for token-efficient formatting of documentation, allowing you to control the intensity of verbose content reduction. You can specify a level, such as level 2, when running the Python script to balance token savings against the preservation of essential meaning.

When should I not use token compression on Markdown files for LLM prompts?

You should avoid token compression on Markdown files when the uncompressed text is already within your LLM context window limits, or when maximum detail and original phrasing are strictly required. Aggressive compression levels might alter structured data or parameters, risking the loss of nuanced meaning.