
Practical guide to reduce token consumption, lower AI costs, and improve Claude Code performance through file organization, context management, and strategic model selection. Backed by real experiment data. Use when user mentions "optimize tokens", "reduce costs", "Claude is slow", "too many tokens", "token budget", "context window full", "organize codebase for AI", or "reduce token consumption". Do NOT use for general coding questions, debugging, or performance optimization unrelated to AI token usage.
Analyzes and migrates barrel export patterns in TypeScript/React projects to reduce bundle size. Detects barrel files (index.ts re-exports), checks for side effects, measures bundle impact, and safely rewrites imports to direct paths. Proven to reduce page chunks by up to 19x in Next.js apps. Use when user mentions "analyze barrels", "check barrel exports", "migrate barrels", "fix barrel exports", "bundle size too big", "tree-shaking not working", "index.ts re-exports", or "optimize imports". Do NOT use for general import/export questions or ESM/CJS migration.