Skip to content

qingfengyu153781-star/claude-code-toolkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code Toolkit

Stop wasting tokens. Start shipping. 6 battle-tested rules that cut Claude Code token usage by 50%+.

Stars License Rules Savings


The Problem

You use Claude Code daily. But have you noticed:

Round 1:  Read file_a.md     ← OK
Round 2:  Read file_b.md     ← should've been parallel
Round 3:  Write file_a.html  ← should've been parallel  
Round 4:  Write file_b.html  ← 1 round wasted
Round 5:  Re-read file_a.md  ← was in system-reminder cache!
Round 6:  Fix bug #1, restart training
Round 7:  Fix bug #2, restart training  ← should've collected all bugs first
Round 8:  Fix bug #3, restart training
...
Round 15: Finally done. $12 in tokens. 40 minutes gone.

This isn't the model's fault. It's an execution problem. Claude doesn't know your efficiency preferences unless you tell it.

The Solution

A drop-in CLAUDE.md ruleset that tells your agent how to execute, not what to do.

# 30 seconds. One command. Then forget about it.
curl -fsSL https://raw.githubusercontent.com/qingfengyu153781-star/claude-code-toolkit/main/scripts/install.sh | bash

Next session, your agent automatically:

  • Reads files in parallel
  • Writes files in parallel
  • Checks cache before re-reading
  • Collects ALL errors before restarting
  • Includes all 6 required elements in prompts
  • Validates disk state before reporting

Before / After

Scenario Before Toolkit After Toolkit Savings
Edit 10 HTML templates 12-15 rounds 2-3 rounds ~80%
Launch ML training 8 restarts, 2 hours 1 restart, 15 min ~87%
Generate image prompts 3-5 iterations each 1-2 iterations each ~50%
Resume session after break Re-survey entire project Read cache, continue ~30%
Fix environment issues 10+ blind attempts 2 rounds max ~70%

What's Inside

6 modular rules. Use all of them, or pick what you need.
# Rule One-liner Impact
01 Token Efficiency Never re-read cached files; batch by default; diagnose before 3rd attempt -40%
02 Batch Operations N independent files = N parallel writes. Done in 2 rounds. -60%
03 Session Management Disk is truth. Check cache before reading. Validate before exit. -30%
04 Prompt Checklist 6-element self-check before ANY image/video prompt output -50%
05 ML Training API check first → venv first → all errors at once → one restart -85%
06 Environment Setup GPU compatibility pre-check → 2-round give-up → pip before compile -70%

Quick Demo

User: "帮我批量改写10个HTML模板的配色方案"
                    │
                    ▼
    WITHOUT TOOLKIT                 WITH TOOLKIT
    ────────────────                ────────────
    Read template_01                Read all 10 templates (parallel)
    Write template_01               ┃
    Read template_02                Establish 1 design pattern
    Write template_02               ┃
    ... (×10)                       Write all 10 templates (parallel)
                                    ls verify → Done
    Total: 12-15 rounds             Total: 2-3 rounds
    Time:  ~8 minutes               Time:  ~1 minute

Who Needs This

  • Heavy Claude Code users — if you run 50+ rounds/day, this saves $20-50/month
  • Teams — consistent agent behavior across all team members
  • Beginners — skip the "learn by wasting tokens" phase entirely
  • Anyone who's ever thought "why did Claude just re-read that file?"

Real Stories

📊 "8 training restarts → 1" — LoRA fine-tuning session

8 sequential failures (HF symlink → transformers version → API change → dtype mismatch → ...), each requiring a restart that wasted 5-10 minutes of GPU idle time. With the toolkit: read full traceback, list all 8 errors, fix all at once, one restart. 2 hours → 15 minutes.

📊 "Prompt checklist eliminated our regeneration loops" — AI video production

Before: every image prompt was missing something — negative prompt, reference image path, model settings — requiring 3-5 iterations to get right. After: 6-element checklist enforced before output. 3-5 iterations → 1-2 iterations.

📊 "10 templates, 1 round" — Resume batch editing

Rewriting 10 HTML resume templates used to be 10 sequential operations. With batch rules: all 10 read in parallel, all 10 written in parallel, one ls to verify. 40 minutes → 3 minutes.

How It Works (for your Agent)

Your CLAUDE.md is the agent's "system prompt". When you add these rules:

Your CLAUDE.md
    └── <!-- claude-code-toolkit START -->
        ├── Token Efficiency: "read cache before Read()"
        ├── Batch Operations: "N files → N parallel Write()"  
        ├── Session Management: "ls before status report"
        ├── Prompt Checklist: "count 1→6 before output"
        ├── ML Training: "all errors → all fixes → one restart"
        └── Environment: "2 rounds → ask user"
        <!-- claude-code-toolkit END -->

The agent reads these at session start and follows them. No configuration, no plugins, no API keys. Just rules.

Install

# Quick: one-command install
curl -fsSL https://raw.githubusercontent.com/qingfengyu153781-star/claude-code-toolkit/main/scripts/install.sh | bash

# Or: clone and pick what you want
git clone https://github.com/qingfengyu153781-star/claude-code-toolkit.git
cd claude-code-toolkit
python scripts/install.py --global    # install to ~/.claude/CLAUDE.md
python scripts/install.py --project   # install to ./CLAUDE.md
python scripts/install.py --all       # both

# Or: zero-dependency manual install
# Copy claude.md → paste into your CLAUDE.md. Done.

Documentation

Document Language Content
Quick Start EN 2-minute setup
Operation Manual 中文 Full guide with examples
Examples EN 5 real case studies
claude.md The actual rules (what gets installed)

Contributing

Every rule in this repo exists because someone made a real mistake, then wrote a rule to prevent it.

Have a token-wasting pattern to report? Open an issue with:

  1. What happened (the mistake)
  2. How many rounds/tokens it wasted
  3. What rule would prevent it

Want to add a rule? Fork → add to rules/ → PR with before/after comparison.

Why Star This?

  • Save money — every rule saves real API costs
  • Save time — fewer rounds = faster results
  • Help others — stars push this to more Claude Code users
  • It's free — MIT license, no strings attached

Built from 200+ hours of Claude Code.
Every rule has a scar. Every scar saved someone else.

Releases

No releases published

Packages

 
 
 

Contributors