compress-prompt

Compress text content for AI consumption by applying defined rules to reduce token count.

4|3|Updated Jul 14, 2025
One-click install
npx skills add https://github.com/luan/dot-claude --skill compress-prompt-luan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compress-prompt
Source: https://github.com/luan/dot-claude/tree/main/skills/compress-prompt
Command: npx skills add https://github.com/luan/dot-claude --skill compress-prompt-luan

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill reduces the token count of text intended for AI consumption, making prompts more efficient and cost-effective.

Core Features & Use Cases

  • Token Reduction: Applies specific rules to shorten system prompts, agent instructions, and skill files.
  • Preserves Critical Data: Ensures YAML frontmatter, commands, code blocks, and keywords remain intact.
  • Use Case: Compress a lengthy system prompt to fit within model token limits or reduce the size of a skill file for faster loading.

Quick Start

Use the compress-prompt skill to shorten the text in the file named 'agent-instructions.md'.

Frequently Asked Questions about compress-prompt

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

FAQPage Schema
How do I reduce the token count of a lengthy system prompt for AI consumption?

To reduce token count for AI consumption, compress the text by applying defined rules that shorten agent instructions and skill files. This process shrinks AI prompts to fit model token limits while preserving essential elements like YAML frontmatter, commands, and code blocks.

What is the best way to compress agent instructions without losing code blocks?

The best way to compress agent instructions is by using a subagent with a 'haiku' model that applies targeted compression rules. This specifically preserves YAML frontmatter, commands, and code blocks while shortening surrounding text to reduce overall token count.

Does prompt compression preserve YAML frontmatter and commands?

Yes, prompt compression preserves YAML frontmatter, commands, and code blocks. The compression targets only the surrounding text and non-essential elements to ensure the compressed output retains all functional keywords and structural data required for AI execution.

How do I compress a skill file to make it load faster?

To compress a skill file for faster loading, pass the file to the compression utility, which processes the text content using a 'haiku' model subagent. It writes the compressed output directly to a file, reducing the size of the skill file while maintaining its core instructions.

Do I need tiktoken to shorten text for AI efficiency?

Yes, you need tiktoken as a dependency to shorten text for AI efficiency. The tiktoken library enables the subagent to accurately process and compress the prompt files by evaluating and reducing the token count before writing the final compressed output.