samibajwaisking/Token-Optimizer-Skill
token-optimizer
VerifiedMaximize Claude's output quality while minimizing input token usage. Use this skill whenever a user wants to compress prompts, reduce token consumption, extract maximum output from Claude, write high-density instructions, optimize system prompts, or improve AI communication efficiency. Trigger on phrases like "optimize my prompt", "too many tokens", "make this shorter but better", "get more from Claude", "compress this prompt", "write a better system prompt", "token efficient", or any request to improve how someone communicates with Claude or any LLM. Also trigger when building AI-powered tools, chatbots, agents, or any system where prompt cost or quality matters.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.5 KB |
| assets/banner.png | binary | 48.5 KB |
| examples/before-after.md | markdown | 9.7 KB |
| references/compression-patterns.md | markdown | 4.9 KB |
| references/context-management.md | markdown | 5.4 KB |
| references/one-shot-examples.md | markdown | 5.7 KB |
| references/output-formats.md | markdown | 3.7 KB |
| references/system-prompt-templates.md | markdown | 6.1 KB |
examples/before-after.md
View on GitHub# Before & After — 20 Real Prompt Comparisons
Each example shows an unoptimized prompt, the optimized version, and the token savings.
Token counts are approximate (measured with cl100k_base tokenizer).
---
## Example 1 — Code Debugging
**Before (53 tokens):**
```
I have this Python code that I wrote and it's not working properly. Could you
please look at it and tell me what's wrong with it and also how I should fix it?
[code]
```
**After (8 tokens):**
```
debug+fix: [code]
```
**Savings: 85% | Same output quality: ✓**
---
## Example 2 — Blog Post Request
**Before (44 tokens):**
```
Can you please write me a detailed and informative blog post about the benefits
of using AI tools for small businesses? Make it engaging and professional.
```
**After (18 tokens):**
```
blog-post: AI tools for small businesses
tone: professional, engaging
length: 600 words
no intro filler, start with hook
```
**Savings: 59% | Output quality: Improved (more specific) ✓**
---
## Example 3 — Data Extraction
**Before (49 tokens):**
```
Please read through this customer review and extract all the important information
from it such as the customer name, the product they bought, their rating, and any
specific complaints or compliments they mentioned.
```
**After (19 tokens):**
```
extract from review:
fields: name, product, rating, complaints, compliments
format: JSON
[review text]
```
**Savings: 61% | Output quality: More consistent ✓**
---
## Example 4 — Email Draft
**Before (58 tokens):**
```
I need you to help me write a professional email to send to my client explaining
that the project delivery will be delayed by one week because we ran into some
technical issues. Please make it apologetic but confident.
```
**After (22 tokens):**
```
email: project delay notice (1 week, technical issues)
tone: apologetic but confident
to: client
max: 120 words, include rescheduled date placeholder
```
**Savings: 62% | Output quality: ✓**
---
## Example 5 — Code Generation
**Before (41 tokens):**
```
Can you write me a JavaScript function that takes an array of objects and filters
them based on a property value that I pass in, and returns the filtered array?
```
**After (14 tokens):**
```
fn (JS): filter array of objects by property+value
return: filtered array
include: TypeScript types, JSDoc
```
**Savings: 66% | Output: More complete (types added) ✓**
---
## Example 6 — Summary Request
**Before (46 tokens):**
```
I just had a really long meeting and I have the transcript here. Can you please
summarize the most important points from the meeting and also list any action
items that were mentioned along with who is responsible?
```
**After (16 tokens):**
```
from transcript:
1. key decisions (bullets, max 5)
2. action items (owner + deadline)
no other content
[transcript]
```
**Savings: 65% | Output quality: More structured ✓**
---
## Example 7 — Explanation Request
**Before (35 tokens):**
```
Can you explain to me what machine learning is and how it works in simple terms
that someone without a technical background could understand?
```
**After (12 tokens):**
```
explain: machine learning
level: ELI5 (no tech background)
max: 150 words
use analogy
```
**Savings: 66% | Output quality: ✓**
---
## Example 8 — Social Media Content
**Before (51 tokens):**
```
I need you to write some Instagram captions for my new product launch. The product
is a handmade leather wallet. Please make them catchy and engaging and include
relevant hashtags at the end of each one.
```
**After (20 tokens):**
```
captions(3): handmade leather wallet launch
style: catchy, benefit-driven
end each with: 5 relevant hashtags
max: 60 words each
```
**Savings: 61% | Output: 3 variations without asking ✓**
---
## Example 9 — Comparison Request
**Before (42 tokens):**
```
Can you compare React and Vue.js for me and tell me which one would be better for
a beginner to learn and why? I want to understand the differences between them.
```
**After (15 tokens):**
```
compare: React vs Vue.js
format: table (Learning Curve, Community, Job Market, Use Case)
conclude: which for beginner (1 sentence)
```
**Savings: 64% | Output: More scannable ✓**
---
## Example 10 — Proofreading
**Before (37 tokens):**
```
Can you please proofread the following text that I wrote and fix any grammar or
spelling mistakes you find, and also improve the flow where it seems awkward?
```
**After (10 tokens):**
```
proofread+improve-flow: [text]
track changes: [original → correction]
```
**Savings: 73% | Output: More useful with tracked changes ✓**
---
## Example 11 — System Prompt (API)
**Before (87 tokens):**
```
You are a helpful assistant that helps users with their customer service questions.
You should always be polite and professional. You should try your best to answer
their questions and if you don't know the answer, you should let them know that
you will escalate their issue. You should keep your responses relatively concise
and to the point and not ramble on unnecessarily.
```
**After (48 tokens):**
```
You are a customer support agent for [Company].
Rules: polite, professional, concise (under 80 words).
If unresolvable: apologize in 1 sentence + "I'll escalate this for you."
Never say "I don't know" — offer a next step instead.
```
**Savings: 45% | More actionable rules ✓**
---
## Example 12 — Translation
**Before (38 tokens):**
```
Please translate the following text from English to Urdu. Try to make it sound
natural and not like a direct word for word translation.
```
**After (9 tokens):**
```
translate: English → Urdu (natural, idiomatic)
[text]
```
**Savings: 76% | Output quality: ✓**
---
## Example 13 — Idea Generation
**Before (34 tokens):**
```
I need some ideas for content I could create for my social media about artificial
intelligence. Can you give me some creative and engaging ideas?
```
**After (13 tokens):**
```
ideas(10): AI content for social media
format: numbered, one-liner each
bias toward: controversial, curiosity-driven
```
**Savings: 62% | More targeted output ✓**
---
## Example 14 — Document Review
**Before (41 tokens):**
```
Can you review this proposal document I wrote and let me know what's missing and
what could be improved to make it more persuasive and professional?
```
**After (15 tokens):**
```
review proposal:
1. missing sections
2. weak arguments (with fix suggestions)
3. persuasion score /10
[document]
```
**Savings: 63% | Structured, actionable output ✓**
---
## Example 15 — Research Brief
**Before (39 tokens):**
```
Can you research and give me an overview of the current state of electric vehicles
in Pakistan and what the challenges and opportunities are in that market?
```
**After (14 tokens):**
```
brief: EV market Pakistan 2025
sections: current state | challenges | opportunities
length: max 400 words
cite key stats where available
```
**Savings: 64% | Better structured output ✓**
---
## Example 16 — Chart/Table Generation
**Before (44 tokens):**
```
Can you create a table for me that shows the different Claude AI models available
from Anthropic and compares them based on their capabilities and pricing?
```
**After (12 tokens):**
```
table: Claude models comparison
columns: Model | Context | Best For | Price tier
no intro, table only
```
**Savings: 73% | ✓**
---
## Example 17 — Cover Letter
**Before (51 tokens):**
```
I need to write a cover letter for a job application. The job is for a digital
marketing manager position. I have 3 years of experience in social media and I'm
good at content creation and data analysis. Please make it professional.
```
**After (24 tokens):**
```
cover-letter: Digital Marketing Manager role
experience: 3 yrs social media, content creation, data analysis
tone: confident, professional
length: max 250 words
no clichés ("I am writing to apply...")
```
**Savings: 53% | Output avoids clichés ✓**
---
## Example 18 — API Integration Help
**Before (47 tokens):**
```
I'm trying to connect to the OpenAI API using Python and I want to send a message
and get a response back. Can you show me how to do this with a simple example that
I can understand and use as a starting point?
```
**After (16 tokens):**
```
code (Python): OpenAI API — send message, get response
include: error handling, env var for key
format: complete runnable script with comments
```
**Savings: 66% | More complete output ✓**
---
## Example 19 — Product Naming
**Before (42 tokens):**
```
I need some name ideas for my new mobile app that helps people track their daily
habits and build routines. Please give me some creative and memorable name options.
```
**After (16 tokens):**
```
names(10): habit tracking mobile app
criteria: short (max 2 words), memorable, domain-friendly
format: name + 1-line reason
```
**Savings: 62% | Criteria-filtered output ✓**
---
## Example 20 — Full Project Briefing
**Before (unoptimized, sprawling — 180+ tokens across multiple messages)**
**After (single structured prompt — 65 tokens):**
```xml
<project>
type: e-commerce website
business: shoe store, Sargodha Pakistan
stack: HTML/CSS/JS (no backend)
features: product listing, cart, WhatsApp checkout, admin panel
design: mobile-first, dark theme, fast loading
language: English + Urdu labels
output: single deployable HTML file
</project>
Build complete. Start with homepage.
```
**Savings: 64%+ | Claude starts immediately with full context ✓**
---
## Summary Stats
| Metric | Average |
|---|---|
| Token savings across 20 examples | **65%** |
| Cases where output quality improved | 14/20 (70%) |
| Cases where output quality was same | 6/20 (30%) |
| Cases where output quality dropped | 0/20 |
**Conclusion:** Optimized prompts consistently deliver equal or better output at
65% fewer input tokens.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 469k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |