Agent skill
performance-optimization
Performance optimization patterns for the HMIS project. Use when optimizing slow queries, improving autocomplete performance, tuning database queries, reducing page load times, optimizing report generation, or investigating performance issues.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/performance-optimization-hmislk-hmis
SKILL.md
Performance Optimization Guide
Core Principles
- Use DTOs throughout - Avoid converting to entities until necessary
- Cache autocomplete results - Preserve full DTO data for converters
- Skip unnecessary operations - Use configuration and conditional logic
- Defer expensive operations - Move to background or later in workflow
Autocomplete Optimization (85-90% improvement)
Key pattern from Pharmacy Retail Sale (639ms -> 50ms):
- Enhance DTO with fields needed for lightweight entity creation
- Cache autocomplete results in controller for converter reuse
- Skip discount calculations when no discount scheme active
- Defer item instructions loading to later in workflow
Query Optimization
- Use DTO constructor queries instead of entity queries for display
- Always include
retired = falsein WHERE clauses - Use indexed columns in WHERE and ORDER BY
- Add pagination to limit result sets
- Use JPQL aggregation (SUM, COUNT, GROUP BY) instead of Java loops
MySQL Performance
- Enable slow query log for queries > 1 second
- Use
EXPLAINto analyze query plans - Add indexes for frequently queried columns
- Consider covering indexes for common queries
Report Optimization
- Use DTO queries for report data
- Pre-aggregate data in queries instead of Java
- Implement lazy loading for large datasets
- Cache report results when data doesn't change frequently
For detailed guides, read:
- Autocomplete Optimization
- MySQL Performance
- Performance Plan
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?