code-optimization

Implements code-level performance optimizations using caching, async patterns, and platform-specific features.

1|1|Updated May 16, 2026
One-click install
npx skills add https://github.com/vanduc2514/hackathon-lablab-ibm-bob --skill code-optimization-vanduc2514
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: code-optimization
Source: https://github.com/vanduc2514/hackathon-lablab-ibm-bob/tree/main/.bob/skills/code-optimization
Command: npx skills add https://github.com/vanduc2514/hackathon-lablab-ibm-bob --skill code-optimization-vanduc2514

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? After a migration, applications often carry performance bottlenecks such as N+1 database queries, blocking I/O, and inefficient algorithms. This Skill systematically applies code-level optimizations that improve throughput and latency while preserving existing functionality. ## Core Features & Use Cases - Bottleneck-Driven Optimization: Works from a performance analysis document to fix prioritized issues like N+1 queries, missing indexes, and inefficient data structures. - Platform Feature Adoption: Leverages target platform capabilities such as Java 21 virtual threads, Spring Boot 3 native compilation, and reactive streams. - Measured, Reversible Changes: Every optimization includes before/after code snippets, benchmark results, and rollback procedures. - Use Case: After migrating a Spring Boot application, use this Skill to fix N+1 query problems with JOIN FETCH, add response caching with @Cacheable, and switch to virtual threads, documenting measured latency improvements in an optimization report. ## Quick Start Optimize my application code based on the bottlenecks listed in optimization_performance_analysis.md and document the improvements.

Frequently Asked Questions about code-optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix N+1 query problems in Spring Boot?▼

Fix N+1 queries by replacing per-item repository calls with a single JOIN FETCH query, such as a @Query selecting orders with their items in one statement. This reduces N+1 queries to one and can cut P95 latency significantly.

How to improve Java application performance after migration?▼

Work from a performance analysis document and apply prioritized optimizations: better algorithms and data structures, query optimization, caching, and async processing. Measure each change with benchmarks and validate no functional regressions occur.

Does Java 21 virtual threads improve Spring Boot throughput?▼

Yes, replacing a fixed thread pool with Executors.newVirtualThreadPerTaskExecutor lets I/O-bound tasks scale to thousands of concurrent operations. The documented example shows throughput increasing from 300 to 500 requests per second.

What caching strategies work for REST API responses?▼

Use @Cacheable annotations with a CacheManager such as ConcurrentMapCacheManager for application-level caching, plus HTTP response caching headers and distributed caches like Redis for shared data. Always define cache invalidation strategies to maintain consistency.

When should I not optimize application code?▼

Avoid optimizing without profiling data, since evidence-based changes prevent wasted effort. Never sacrifice functionality or readability for marginal gains, and apply one optimization at a time so each impact can be measured and rolled back.