token-economy

Apply token optimization when writing docs, changelogs, MCP tasks. Quality

allowed_tools: Read, Edit, Grep

$ Installer

git clone https://github.com/phamhung075/4genthub-hooks /tmp/4genthub-hooks && cp -r /tmp/4genthub-hooks/skills/token-economy ~/.claude/skills/4genthub-hooks

// tip: Run this command in your terminal to install the skill


name: token-economy description: Apply token optimization when writing docs, changelogs, MCP tasks. Quality #1, Tokens #2. allowed-tools: Read, Edit, Grep

Token Economy

Optimize text for AI context: docs, changelogs, MCP tasks, subtasks.

Principle: Quality first. Never sacrifice essential info.

15 Techniques

#TechniqueUseExample
1Tables over proseComparisonsFunction params → table
2Bullets with pipesMulti-partPart1 | Part2 | Part3
3Numbered stepsWorkflows1. Step → 2. Step
4One exampleCode samplesKeep best, remove rest
5Pattern statementsRepetition**Pattern**: All X do Y
6Add "Why"Decisions**Why**: [reason]
7Concrete errorsDebugging**Error**: \exact message``
8No fluffDecorationsRemove ASCII art, emojis
9ScannableStructureHeaders, bullets, tables
10ConsolidateDuplicatesMerge similar sections
11Compact codeExamples3-5 key lines only
12Quick listsReferenceCommand/param tables
13Inverted pyramidInfo orderCritical → Details → Context
14Conditional verbosityComplexityHigh for complex, low for simple
15No teachingReferenceState facts, skip basics

Quick Workflow

  1. Identify: Prose → tables? Multiple examples → one? ASCII → numbered? Teaching → facts?
  2. Apply: Convert, consolidate, compact
  3. Check: Essential info preserved? Scannable? No fluff?

MCP Templates

Task:

Requirements: [WHAT] | Files: [PATH:LINES] (action) | Acceptance: [CRITERIA] | Why: [CONTEXT]

progress_notes: [ACTION] [WHAT]. [NEXT]

completion_summary: [DONE]. [TECH]. Files: [PATHS]. [IMPACT]

Examples

Before (prose):

This function validates user input. Takes string input_text, returns bool.
If valid returns true, otherwise false. Checks empty, special chars, length ≤100.

After (compact):

**validate_input(input_text: str) → bool**: True if valid (non-empty, no special chars, ≤100)

Before (ASCII art - 180 tokens):

┌─────────┐
│  Auth?  │
└────┬────┘
     ▼
┌─────────┐
│ Valid?  │
└──┬───┬──┘
   Y   N

After (numbered - 36 tokens):

1. Check auth
2. Valid → YES: Process | NO: Reject

Common Fixes

IssueFix
Multiple examplesKeep 1 (#4)
Prose comparisonTable (#1)
TeachingFacts only (#15)
ASCII artNumbered (#3)
No "why"Add context (#6)

See TEMPLATES.md for copy-paste templates.