Optimize Build
$ npx claude-code-templates@latest --command="performance/optimize-build" --yesRequires Claude Code. The command adds this command to your project's .claudedirectory — nothing runs on ToolZip's servers.
What's inside this command
Component source
Optimize Build Command
Optimize build processes and speed
Instructions
Follow this systematic approach to optimize build performance: $ARGUMENTS
- Build System Analysis
- Review build configuration files and settings
- Analyze current build times and output sizes
- Map the complete build pipeline and dependencies
- Performance Baseline
- Clean build (from scratch)
- Incremental build (with cache)
- Development vs production builds
- Document bundle sizes and asset sizes
- Identify the slowest parts of the build process
- Dependency Optimization
- Remove unused dependencies from build process
- Update build tools to latest stable versions
- Consider alternative, faster build tools
- Caching Strategy
- Configure persistent cache for CI/CD
- Set up shared cache for team development
- Implement incremental compilation where possible
- Bundle Analysis
- Identify large dependencies and duplicates
- Use bundle analyzers specific to your build tool
- Look for opportunities to split bundles
- Code Splitting and Lazy Loading
- Set up route-based splitting for SPAs
- Configure vendor chunk separation
- Optimize chunk sizes and loading strategies
- Asset Optimization
- Minify CSS and JavaScript
- Configure tree shaking to remove dead code
- Implement asset compression (gzip, brotli)
- Development Build Optimization
- Use development-specific optimizations
- Configure source maps for better debugging
- Optimize development server settings
- Production Build Optimization
- Configure dead code elimination
- Set up proper minification and compression
- Optimize for smaller bundle sizes
- Parallel Processing
- Configure worker threads for build tasks
- Optimize for multi-core systems
- Use parallel compilation for TypeScript/Babel
- File System Optimization
- Configure proper include/exclude patterns
- Use efficient file loaders and processors
- Minimize file I/O operations
- CI/CD Build Optimization
- Implement proper caching strategies for CI
- Use build matrices efficiently
- Configure parallel CI jobs where beneficial
- Memory Usage Optimization
- Configure heap sizes for build tools
- Identify and fix memory leaks in build process
- Use memory-efficient compilation options
- Output Optimization
- Optimize file naming and hashing strategies
- Set up proper asset manifests
- Implement efficient asset serving
- Monitoring and Profiling
- Use build profiling tools to identify bottlenecks
- Track bundle size changes over time
- Monitor build performance regressions
- Tool-Specific Optimizations
For Webpack:
- Configure optimization.splitChunks
- Use thread-loader for parallel processing
- Enable optimization.usedExports for tree shaking
- Configure resolve.modules and resolve.extensions
For Vite:
- Configure build.rollupOptions
- Use esbuild for faster transpilation
- Optimize dependency pre-bundling
- Configure build.chunkSizeWarningLimit
For TypeScript:
- Use incremental compilation
- Configure project references
- Optimize tsconfig.json settings
- Use skipLibCheck when appropriate
- Environment-Specific Configuration
- Use environment variables for build optimization
- Configure feature flags for conditional builds
- Optimize for target environments
- Testing Build Optimizations
- Verify all optimizations work in target environments
- Check for any breaking changes from optimizations
- Measure and document performance improvements
- Documentation and Maintenance
- Create build performance monitoring dashboard
- Set up alerts for build performance regressions
- Regular review and updates of build configuration
Focus on the optimizations that provide the biggest impact for your specific project and team workflow. Always measure before and after to quantify improvements.
Related Claude Code Commands
Optimize Database Performance
Optimize database queries, indexing, and performance for improved response times and scalability
Performance Audit
Comprehensive performance audit with metrics, bottleneck identification, and optimization recommendations
Optimize Bundle Size
Reduce and optimize bundle sizes through analysis, configuration, and code splitting strategies
Optimize Api Performance
Comprehensive API performance optimization with response time reduction, throughput improvement, and scalability enhancements
Implement Caching Strategy
Design and implement comprehensive caching solutions for improved performance and scalability
Optimize Memory Usage
Comprehensive memory usage optimization with leak detection, garbage collection tuning, and memory profiling
Catalog data and component content are sourced from the open-source davila7/claude-code-templates project (MIT license). ToolZip curates the listing and writes original descriptions; every component links back to its original source. Claude Code is a product of Anthropic. ToolZip is an independent catalog and is not affiliated with or endorsed by Anthropic.