optimize-md
Document Optimizer
Read, optimize, and rewrite markdown documents for token efficiency, structural clarity, and LLM parseability. The target file is provided as a file path argument.
Workflow
- Read the file at
$ARGUMENTS. If no path is provided, ask for one - Analyze the document for optimization opportunities using the principles below
- Rewrite the file in place with all optimizations applied
- Verify the rewritten document preserves all factual content and meaning from the original
- Report using this format:
Original: [N] lines → Optimized: [N] lines ([N]% reduction) Changes: [comma-separated list of key changes]
Optimization Principles
Token Economics
Evaluate each sentence for token value. Remove content that restates common knowledge, repeats itself, or adds no actionable value.
Remove decorative language. No "please note", "it's worth mentioning", "remember that", "importantly".
Eliminate filler transitions. "Additionally", "furthermore", "in other words", "as mentioned above".
Remove hedging. "Consider", "try to", "when possible", "generally speaking", "it depends".
Structural Optimization
| Technique | Apply When |
|---|---|
| Convert prose to tables | Comparing options, listing attributes, or mapping inputs to outputs |
| Convert prose to lists | Content contains discrete, parallel, independent items |
| Keep prose | Explaining relationships, conditional logic, or rationale |
| Merge sections | Multiple sections cover the same concept |
| Remove sections | Content restates framework docs or common knowledge |
Flatten unnecessary nesting. Collapse single-item subsections into their parent.
Place critical information first within each section. Most important content at the top.
End sections decisively. No trailing "etc.", "and so on", or "and more".
Sentence Compression
Remove filler words and passive voice:
- Before: "It is recommended that you should make sure to always validate user input"
- After: "Validate user input at API boundaries"
Combine related statements:
- Before: "Use TypeScript for all new files. Make sure to add type annotations. Enable strict mode in tsconfig."
- After: "Use TypeScript strict mode with explicit type annotations for all new files"
Remove redundant qualifiers:
- Before: "This is a very important and critical step that must always be done"
- After: "Required step"
Content Filtering
Remove Entirely
- Welcome messages, introductions, background history
- Motivational statements ("This will help you write better code!")
- Content the model already knows (framework basics, language syntax)
- Hypothetical future scenarios ("If we ever migrate to...")
- Time-sensitive references without dates
- Redundant examples that demonstrate the same concept
Preserve
- Domain-specific knowledge the model lacks
- Concrete examples demonstrating non-obvious patterns
- Decision criteria and trade-off analysis
- Exact commands, configs, and code snippets
- Constraints and prohibited actions
Formatting Cleanup
Use language-labeled code blocks. Never use unlabeled fences.
Use consistent heading hierarchy. No skipped levels (h2 -> h4).
Remove excessive emphasis. Bold only for hard constraints where violation causes failure. Limit to 10% of content.
Use one blank line between sections. Remove consecutive blank lines.
Standardize list markers within each list (all - or all *, not mixed).
Terminology Consistency
Identify synonyms used for the same concept. Choose the most precise term and use it throughout.
- Before: alternating "endpoint", "route", "URL", "path" for the same concept
- After: consistently "endpoint" throughout
Constraints
- Preserve all factual content and meaning. Compression must not alter semantics
- Preserve code blocks verbatim unless they contain obvious errors
- Preserve document title (h1 heading). Rephrase for concision only if verbose
- Do not add new content. Optimization removes and restructures; it does not invent
- Do not add commentary or annotations to the output file
- Write the optimized document directly to the source file
Scope Boundaries
Do not use for:
- Non-markdown files
- Documents requiring content creation or expansion
- Files already optimized by a previous run
- Code files or config files with markdown comments
More from jkappers/agent-skills
dotnet-dockerfile
Create optimized, secure multi-stage Dockerfiles for .NET Core and ASP.NET Core applications. Use when (1) creating a new Dockerfile for a .NET project, (2) containerizing a .NET application, (3) optimizing an existing .NET Dockerfile, (4) setting up Docker for .NET 6/7/8+ apps, or (5) user mentions .NET and Docker/container together.
38enhance-prompt
Analyzes and improves LLM prompts and agent instructions for token efficiency, determinism, and clarity. Use when (1) writing a new system prompt, skill, or CLAUDE.md file, (2) reviewing or improving an existing prompt for clarity and efficiency, (3) diagnosing why a prompt produces inconsistent or unexpected results, (4) converting natural language instructions into imperative LLM directives, or (5) evaluating prompt anti-patterns and suggesting fixes. Applies to all LLM platforms (Claude, GPT, Gemini, Llama).
32conventional-commit
Conventional Commits v1.0.0 standards for git messages. Use when (1) creating git commits, (2) writing or drafting commit messages, (3) reviewing commit message format, (4) explaining commit conventions, or (5) validating commit message compliance.
24react-dockerfile
Create optimized, secure multi-stage Dockerfiles for React applications (Vite, CRA, Next.js static). Use when (1) creating a new Dockerfile for a React project, (2) containerizing a React/Vite application, (3) optimizing an existing React Dockerfile, (4) setting up Docker for React with Nginx, or (5) user mentions React and Docker/container together.
23gap-analysis
Product and feature evaluation. Use when (1) Evaluating product/feature feasibility and market viability (2) Assessing product-market fit before investment (3) Comparing opportunities for roadmap prioritization (4) Competitive analysis to identify gaps (5) User asks "should we build X?" or "is this viable?" (6) Risk assessment for product decisions
16skill-creator
Guide for creating effective agent skills following the Agent Skills open standard. This skill should be used when users want to create a new skill (or update an existing skill) that extends agent capabilities with specialized knowledge, workflows, or tool integrations.
16