Skip to content
Development
Command

/tree-shake

Improve tree shaking effectiveness to reduce bundle size.

From plugin
rohitg00-claude-code-toolkit
2.5k199 skills138 agents199 commands
Install
$ npx -y skills add rohitg00/awesome-claude-code-toolkit --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/tree-shake

Context preview

What this command does when you run it.

Improve tree shaking effectiveness to reduce bundle size.

Command definition

tree-shake.md
name: tree-shake
description: Improve tree shaking effectiveness to reduce bundle size.

/tree-shake - Optimize Tree Shaking

Improve tree shaking effectiveness to reduce bundle size.

Steps

1. Analyze the current build configuration for tree shaking settings 2. Check package.json for sideEffects field configuration 3. Identify imports that prevent tree shaking: namespace imports, CommonJS requires 4. Find barrel files (index.ts re-exports) that bundle entire modules 5. Check for packages that do not support tree shaking (no ES modules) 6. Convert namespace imports to named imports where possible 7. Add sideEffects: false to package.json if all modules are pure 8. Configure the bundler to mark specific files as side-effect-free 9. Replace non-tree-shakeable packages with tree-shakeable alternatives 10. Split barrel files into direct imports for large modules 11. Rebuild and measure the size difference 12. Report: modules eliminated, size reduction, remaining issues

Rules

  • Never mark files with side effects as side-effect-free
  • Verify that tree shaking does not remove needed code
  • Prefer named imports over namespace imports for better tree shaking
  • Check that all internal packages have proper ESM exports
  • Do not break the public API of packages when restructuring exports
  • Test the application thoroughly after tree shaking changes
  • Document any sideEffects configuration with comments explaining why
Read more
Ships withrohitg00-claude-code-toolkit

The most comprehensive toolkit for Claude Code -- 135 agents, 35 curated skills (+400,000 via SkillKit), 42 commands, 176+ plugins, 20 hooks, 15 rules, 7 templates, 15 MCP configs, 26 companion apps, 53 ecosystem entries, and more.

Get the whole plugin