diff --git a/.cursor/rules/100-java-cursor-rules-list.md b/.cursor/rules/100-java-system-prompt-java-list.md similarity index 93% rename from .cursor/rules/100-java-cursor-rules-list.md rename to .cursor/rules/100-java-system-prompt-java-list.md index 7c7f77af..10e8e138 100644 --- a/.cursor/rules/100-java-cursor-rules-list.md +++ b/.cursor/rules/100-java-system-prompt-java-list.md @@ -2,7 +2,7 @@ author: Juan Antonio Breña Moral version: 0.12.0-SNAPSHOT --- -# Create a Checklist with all Java steps to use with cursor rules for Java +# Create a Checklist with all Java steps to use with system prompts for Java ## Role @@ -12,7 +12,7 @@ You are a Senior software engineer with extensive experience in Java software de Your task is to create a comprehensive step-by-step guide that follows the exact format and structure defined in the embedded template below. Create a markdown file named -`CURSOR-RULES-JAVA.md` with the following content: +`SYSTEM-PROMPTS-JAVA.md` with the following content: ```markdown # Cursor rules Java @@ -80,8 +80,9 @@ Use the following collection of System prompts of Java to improve your Java deve |----|----|-----|----| | [161-java-profiling-detect](.cursor/rules/161-java-profiling-detect.md) | Profile your development in runtime and collect evidences to be analyzed later. | **Prompt:** `My Java application has performance issues - help me set up comprehensive profiling process using @161-java-profiling-detect and use the location YOUR-DEVELOPMENT/profiler` **Note:** Replace YOUR-DEVELOPMENT with your actual development path. Example: examples/spring-boot-memory-leak-demo/profiler | Non conversational cursor rule. The Cursor rule will generate 2 scripts. One script designed to run your development with the right JVM flags for profiling and the second scripts will ask few questions about what problem do you want to solve/analyze over one particular PID. **Step 1:** execute `./run-with-profiler.sh --help` **Step2:** execute `./run-jmeter.sh --help` **Step 3:** execute `./profiler/scripts/java-profile.sh` | | [162-java-profiling-analyze](.cursor/rules/162-java-profiling-analyze.md) | Analyze results from previous step and generate reports with the analysis results.| **Prompt:** `Analyze the results located in YOUR-DEVELOPMENT/profiler and use the cursor rule @162-java-profiling-analyze` **Note:** Replace YOUR-DEVELOPMENT with your actual development path. Example: examples/spring-boot-memory-leak-demo/profiler | Non conversational cursor rule. | +| [163-java-profiling-refactor](.cursor/rules/163-java-profiling-refactor.md) | Refactor code based on profiling analysis findings to fix performance bottlenecks | **Prompt:** `Apply refactoring from profiling analysis using @163-java-profiling-refactor` **Note:** Review `docs/profiling-problem-analysis-YYYYMMDD.md` and `docs/profiling-solutions-YYYYMMDD.md` before refactoring. Replace YYYYMMDD with the analysis date. | Step 3 of profiling workflow. Non conversational. Verifies changes with `./mvnw clean verify`. | | - | Code Refactoring from suggestions from analysis | `Can you apply the solutions from @profiling-solutions-yyyymmdd.md in @/info to mitigate bottlenecks` | Make a refactoring with the notes from the analysis | -| [164-java-profiling-compare](.cursor/rules/164-java-profiling-compare.md) | Compare results comparing results before and after applying changes in the code | **Prompt:** `Review if the problems was solved with last refactoring using the reports located in @/results with the cursor rule @164-java-profiling-compare` **Note:** Put in the context the folder with the results | This cursor rule is applied automatically without any interaction with the Software engineer. | +| [164-java-profiling-verify](.cursor/rules/164-java-profiling-verify.md) | Compare results comparing results before and after applying changes in the code | **Prompt:** `Review if the problems was solved with last refactoring using the reports located in @/results with the cursor rule @164-java-profiling-verify` **Note:** Put in the context the folder with the results | This cursor rule is applied automatically without any interaction with the Software engineer. | ## Documentation rules @@ -109,6 +110,6 @@ Use the following collection of System prompts of Java to improve your Java deve ## Output Format -- **File Creation**: Generate the complete markdown file named `CURSOR-RULES-JAVA.md` in the project root directory +- **File Creation**: Generate the complete markdown file named `SYSTEM-PROMPTS-JAVA.md` in the project root directory - **Template Adherence**: Follow the embedded template structure and content exactly - no additions, modifications, or omissions -- **File Handling**: If `CURSOR-RULES-JAVA.md` already exists, overwrite it completely with the new generated content \ No newline at end of file +- **File Handling**: If `SYSTEM-PROMPTS-JAVA.md` already exists, overwrite it completely with the new generated content \ No newline at end of file diff --git a/.cursor/rules/163-java-profiling-refactor.md b/.cursor/rules/163-java-profiling-refactor.md new file mode 100644 index 00000000..5e08c60d --- /dev/null +++ b/.cursor/rules/163-java-profiling-refactor.md @@ -0,0 +1,30 @@ +--- +author: Juan Antonio Breña Moral +version: 0.12.0-SNAPSHOT +--- +# Java Profiling Workflow / Step 3 / Refactor code to fix issues + +## Role + +You are a Senior software engineer with extensive experience in Java software development + +## Goal + +This cursor rule provides a systematic approach to refactoring Java code based on profiling analysis findings. It serves as the third step in the structured profiling workflow, focusing on implementing targeted fixes to resolve performance issues and improve application efficiency. + +The rule establishes a comprehensive refactoring framework that guides users through systematically analyzing profiling data, identifying specific performance bottlenecks, and implementing targeted code changes to address them. + +## Instructions + +### Step 1: Review notes from the analysis step + +Review the notes from the analysis step to identify the specific performance bottlenecks. + +The files to review are: `docs/profiling-problem-analysis-YYYYMMDD.md` and `docs/profiling-solutions-YYYYMMDD.md` +### Step 2: Refactor the code to fix the performance bottlenecks + +Refactor the code to fix the performance bottlenecks. + +## Safeguards + +- Verify that changes pass all tests with `./mvnw clean verify` or `mvn clean verify` \ No newline at end of file diff --git a/.cursor/rules/164-java-profiling-verify.md b/.cursor/rules/164-java-profiling-verify.md new file mode 100644 index 00000000..cb1b9786 --- /dev/null +++ b/.cursor/rules/164-java-profiling-verify.md @@ -0,0 +1,343 @@ +--- +author: Juan Antonio Breña Moral +version: 0.12.0-SNAPSHOT +--- +# Java Profiling Workflow / Step 4 / Verify results + +## Role + +You are a Senior software engineer with extensive experience in Java software development + +## Goal + +This cursor rule provides a comprehensive methodology for comparing Java profiling results before and after performance optimizations or refactoring efforts. It serves as the fourth step in the structured profiling workflow, focusing on quantifying the effectiveness of performance improvements and validating that optimizations achieved their intended goals. + +The rule establishes a rigorous comparison framework that ensures accurate measurement of performance changes by maintaining consistent testing conditions, measurement techniques, and analysis criteria. It provides systematic approaches for generating post-refactoring profiling data and comparing it against baseline measurements to quantify improvements. + +Key capabilities include: +- **Baseline Validation**: Ensures proper baseline profiling data collection before implementing changes +- **Controlled Re-testing**: Standardized process for generating comparable post-refactoring profiling data under identical conditions +- **Quantitative Comparison**: Structured metrics for measuring performance improvements across CPU usage, memory allocation, GC pressure, and threading efficiency +- **Visual Analysis Framework**: Systematic approach to comparing flamegraphs side-by-side to identify resolved hotspots and remaining issues +- **Documentation Templates**: Standardized formats for documenting comparison results, including before/after metrics, visual evidence, and improvement validation +- **Regression Detection**: Methods for identifying unintended performance regressions introduced during optimization efforts +- **Success Validation**: Clear criteria for determining whether performance optimization goals were achieved + +The rule ensures that performance optimization efforts are properly validated through rigorous before/after comparison, providing quantifiable evidence of improvements and identifying areas that may require additional attention or follow-up optimization work. + +### Project Organization + +The profiling setup uses a clean folder structure with everything contained in the profiler directory: + +``` +your-project/ +└── profiler/ # All profiling-related files +├── scripts/ # Profiling scripts and tools +│ └── java-profile.sh # Main profiling script +├── results/ # Generated profiling output +│ ├── *.html # Flamegraph files +│ ├── *.jfr # JFR recording files +│ ├── *.log # Garbage Collection Log files +│ └── *.txt # Thread Dump files +├── docs/ # Analysis documentation +│ ├── profiling-comparison-analysis-YYYYMMDD.md +│ └── profiling-final-results-YYYYMMDD.md +├── current/ # Symlink to current profiler version +└── async-profiler-*/ # Downloaded profiler binaries +``` + +## Instructions + +### Step Pre-Refactoring Baseline (Already Done) + +Ask the user if they have captured baseline results yet. +For this purpose use the script `profiler/run-with-profiler.sh` to run the application with the right JVM flags for profiling. + +**Example:** +```bash +cd profiler +./run-with-profiler.sh --mode (cpu, alloc, wall, lock) +``` + +After this task, send load to the application to capture the new behavior afte the refactoring. +### Step Post-Refactoring Report Generation (CRITICAL STEP) + +Ask the user if they have generated the post-refactoring data from profiling tools yet. + +**Step 1: Validate Your Refactoring Changes** +```bash +# Ensure your code changes are applied +git status +git diff HEAD~1 # Review recent changes +``` + +**Step 2: Generate New Profiling Reports** +cd profiler/scripts +./java-profile.sh --mode memory --duration 60 + +**Step 3: Verify the reports were generated** +review the files in the `profiler/results` directory. + +```bash +# Check that you have both sets of reports +echo "=== BASELINE REPORTS ===" +ls -la profiler/results/*baseline* || ls -la profiler/results/*before* + +echo "=== POST-REFACTORING REPORTS ===" +ls -la profiler/results/*after* || ls -la profiler/results/*$(date +%Y%m%d)* + +# Verify reports are not empty +wc -c profiler/results/*.html +``` +### Step Performance Metrics Comparison + + +**Memory Analysis Checklist** +- [ ] **Memory leak detection**: Compare heap usage patterns between before/after flamegraphs +- [ ] **Allocation patterns**: Analyze allocation flamegraphs for reduced object creation +- [ ] **GC pressure**: Compare garbage collection frequency and duration +- [ ] **Peak memory usage**: Identify improvements in maximum heap utilization +- [ ] **Stack depth**: Compare flamegraph complexity (canvas height, levels) + +**CPU Performance Checklist** +- [ ] **Hot spots identification**: Compare CPU flamegraphs to identify resolved bottlenecks +- [ ] **Method execution time**: Analyze improvements in critical path performance +- [ ] **Thread contention**: Look for reduced blocking or improved concurrency + +**Visual Comparison Process** +```bash +# Open reports side by side for comparison +# Browser tab 1: Baseline report +open profiler/results/memory-leak-*baseline*.html + +# Browser tab 2: After refactoring report +open profiler/results/memory-leak-*after*.html + +# Compare: +# - Canvas height (lower = better) +# - Stack depth (fewer levels = better) +# - Hot spot patterns (reduced width = better) +``` + +### Step Documentation Creation + +**Note**: All documentation files are created with date suffixes (YYYYMMDD format) to enable tracking multiple profiling sessions and maintain historical analysis records. + +**Step 1: Create Comparison Analysis Document** +```bash +# Create the comparison analysis document with date suffix +DATE_SUFFIX=$(date +%Y%m%d) +touch profiler/docs/profiling-comparison-analysis-${DATE_SUFFIX}.md +``` + +Template for `profiler/docs/profiling-comparison-analysis-YYYYMMDD.md`: + +```markdown +# Profiling Comparison Analysis - [Date] + +## Executive Summary +- **Refactoring Objective**: [What was being fixed] +- **Overall Result**: [Success/Partial/Failed] +- **Key Improvements**: [List main improvements] + +## Methodology +- **Baseline Date**: [Timestamp of baseline reports] +- **Post-Refactoring Date**: [Timestamp of after reports] +- **Test Scenarios**: [What endpoints/operations were tested] +- **Duration**: [How long profiling ran] + +## Before/After Metrics +| Metric | Before | After | Improvement | +|-----|-----|----|----| +| Stack Depth (levels) | X | Y | Z% | +| Canvas Height (px) | X | Y | Z% | +| Memory Allocations | X | Y | Z% | +| Thread Count | X | Y | Z% | + +## Key Findings +### Resolved Issues +- [ ] Issue 1: [Description and evidence] +- [ ] Issue 2: [Description and evidence] + +### Remaining Concerns +- [ ] Concern 1: [Description and next steps] + +## Visual Evidence +- **Baseline Reports**: `../results/[filename]` +- **After Reports**: `../results/[filename]` +- **Key Differences**: [Describe what to look for in flamegraphs] + +## Recommendations +1. [Next step 1] +2. [Next step 2] +``` + +**Step 2: Create Final Results Summary** +```bash +# Create the final results summary document with date suffix +DATE_SUFFIX=$(date +%Y%m%d) +touch profiler/docs/profiling-final-results-${DATE_SUFFIX}.md +``` + +Template for `profiler/docs/profiling-final-results-YYYYMMDD.md`: + +```markdown +# Profiling Final Results - [Date] + +## Summary +- **Analysis Date**: [Date of analysis] +- **Performance Objective**: [What was being optimized] +- **Status**: [Complete/Ongoing/Failed] + +## Key Metrics Summary +| Performance Area | Before | After | Improvement | +|---|---|----|----| +| Memory Usage | [value] | [value] | [%] | +| CPU Usage | [value] | [value] | [%] | +| Response Time | [value] | [value] | [%] | +| Throughput | [value] | [value] | [%] | + +## Critical Issues Resolved +1. **[Issue Name]**: [Description and resolution] +2. **[Issue Name]**: [Description and resolution] + +## Production Readiness +- [ ] Performance targets met +- [ ] No regressions introduced +- [ ] Load testing completed +- [ ] Monitoring alerts configured + +## Next Steps +1. [Action item 1] +2. [Action item 2] + +## Related Documents +- Analysis: `profiling-comparison-analysis-YYYYMMDD.md` +- Reports: `../results/[report-files]` +``` + +### Phase 5: Troubleshooting Missing Reports + +#### Problem: No New Reports Generated +```bash +# 1. Check if profiler is working +cd profiler/scripts +./java-profile.sh --help + +# 2. Verify application is running +curl http://localhost:8080/actuator/health +jps | grep -i spring + +# 3. Check profiler permissions +ls -la profiler/current/bin/asprof +chmod +x profiler/current/bin/asprof + +# 4. Manual profiling attempt +java -jar profiler/current/lib/async-profiler.jar --help +``` + +#### Problem: Reports Are Empty or Corrupted +```bash +# 1. Check file sizes +ls -la profiler/results/*.html | tail -5 + +# 2. Verify HTML structure +head -20 profiler/results/[latest-report].html + +# 3. Re-run with verbose logging +cd profiler/scripts +./java-profile.sh --mode memory --duration 30 --verbose +``` + +**Problem: Can't Compare - Different Test Scenarios** +```bash +# 1. Document your test scenarios +echo "Test scenarios used:" > profiler/docs/test-scenarios.md + +# 2. Re-run with identical load patterns +# Use same curl commands, same timing, same duration + +# 3. Automate test scenarios +cat > profiler/scripts/load-test.sh << 'EOF' +#!/bin/bash +for i in {1..10}; do + curl http://localhost:8080/api/v1/objects/create + curl http://localhost:8080/api/v1/threads/create + sleep 5 +done +EOF +chmod +x profiler/scripts/load-test.sh +``` + +**File Naming Conventions** + +**Recommended Naming Pattern** +```bash +# Before refactoring (baseline) +memory-leak-baseline-YYYYMMDD-HHMMSS.html +allocation-flamegraph-baseline-YYYYMMDD-HHMMSS.html + +# After refactoring +memory-leak-after-refactoring-YYYYMMDD-HHMMSS.html +allocation-flamegraph-after-refactoring-YYYYMMDD-HHMMSS.html + +# Alternative: timestamp-based (if baseline already exists) +memory-leak-YYYYMMDD-HHMMSS.html (earlier = baseline, later = after) +``` + +**File Organization Validation** +```bash +# Verify you have complete sets +ls profiler/results/ | grep -E "(baseline|before)" | wc -l # Should be > 0 +ls profiler/results/ | grep -E "(after|refactoring)" | wc -l # Should be > 0 +``` + +**Deliverables Checklist** + +**Pre-Comparison Validation** +- [ ] Baseline profiling results exist and are complete +- [ ] Code refactoring has been implemented and tested +- [ ] Application runs successfully with refactored code +- [ ] New profiling reports have been generated post-refactoring +- [ ] Both sets of reports use identical test scenarios + +**Comparison Analysis Completed** +- [ ] Side-by-side flamegraph comparison performed +- [ ] Quantitative metrics extracted and compared +- [ ] Key improvements and regressions identified +- [ ] Visual evidence documented with specific file references + +**Documentation Deliverables** +- [ ] `profiler/docs/profiling-comparison-analysis-YYYYMMDD.md` created +- [ ] `profiler/docs/profiling-final-results-YYYYMMDD.md` created +- [ ] Quantified performance improvements documented +- [ ] Recommendations for production deployment provided +- [ ] Ongoing monitoring strategy defined + +**Validation Commands** +```bash +# Final validation that comparison is complete +echo "=== COMPARISON READINESS CHECK ===" +echo "Baseline reports: $(ls profiler/results/*baseline* 2>/dev/null | wc -l)" +echo "After reports: $(ls profiler/results/*after* 2>/dev/null | wc -l)" +echo "Analysis docs: $(ls profiler/docs/profiling-comparison-analysis-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].md 2>/dev/null | wc -l)" +echo "Final results: $(ls profiler/docs/profiling-final-results-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].md 2>/dev/null | wc -l)" +``` + + +## Output Format + +- Generate post-refactoring profiling reports using identical test conditions as baseline +- Perform systematic side-by-side comparison of before/after flamegraphs and metrics +- Create comprehensive comparison analysis documentation with quantified improvements +- Validate that performance optimization goals were achieved through rigorous measurement +- Identify any performance regressions introduced during optimization efforts +- Provide clear recommendations for production deployment and ongoing monitoring + +## Safeguards + +- Always ensure identical test conditions between baseline and post-refactoring profiling sessions +- Verify that both baseline and post-refactoring reports are complete and non-empty before comparison +- Document all test scenarios and load patterns used for consistent reproduction +- Validate that application is fully operational with refactored code before generating new reports +- Create dated documentation files to maintain historical analysis tracking \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 548145a4..7ecedc4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -130,7 +130,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **Architecture Decision Records (ADRs)**: Added formal documentation for architectural decisions - ADR-001: Generate cursor rules from XML files - ADR-002: Configure cursor rules with manual scope -- **Comprehensive User Guide**: Added `CURSOR-RULES-JAVA.md` as a complete reference guide for all cursor rules +- **Comprehensive User Guide**: Added `SYSTEM-PROMPTS-JAVA.md` as a complete reference guide for all cursor rules - **Build Infrastructure Improvements**: - JBang script for markdown validation - GitHub workflow artifact upload for generated cursor rules diff --git a/README.md b/README.md index 0e509a6f..5b2ddcd8 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,9 @@ https://forms.gle/TpNXENjmu45wuXoi6 ## Goal -The project provides a collection of `System prompts` for Java Enterprise development that help software engineers in their daily programming work and pipelines. -The [available System prompts for Java](./CURSOR-RULES-JAVA.md) cover aspects like `Build system based on Maven`, `Design`, `Coding`, `Testing`, `Refactoring & JMH Benchmarking`, `Performance testing with JMeter`, `Profiling with Async profiler/OpenJDK tools`, `Documentation` & `Diagrams`. +The project provides a collection of `System prompts` for Java Enterprise development that help software engineers in their daily programming work and data pipelines. +The [available System prompts for Java](./SYSTEM-PROMPTS-JAVA.md) cover aspects like `Build system based on Maven`, `Design`, `Coding`, `Testing`, `Refactoring & JMH Benchmarking`, `Performance testing with JMeter`, `Profiling with Async profiler/OpenJDK tools`, `Documentation` & `Diagrams`. + ### Compatibility with Modern IDEs, CLI & Others @@ -66,7 +67,7 @@ New to this repository? Start with our [comprehensive guide](./documentation/GET ## How many system prompts for Java does this project include? -Explore the [complete catalog of available System prompts](./CURSOR-RULES-JAVA.md) to discover the full range of capabilities and find the perfect rules for your specific use cases. +Explore the [complete catalog of available System prompts](./SYSTEM-PROMPTS-JAVA.md) to discover the full range of capabilities and find the perfect rules for your specific use cases. ## Constraints, Output format & Safety guards diff --git a/CURSOR-RULES-JAVA.md b/SYSTEM-PROMPTS-JAVA.md similarity index 97% rename from CURSOR-RULES-JAVA.md rename to SYSTEM-PROMPTS-JAVA.md index f2db27b3..5c8f3259 100644 --- a/CURSOR-RULES-JAVA.md +++ b/SYSTEM-PROMPTS-JAVA.md @@ -63,7 +63,7 @@ Use the following collection of System prompts of Java to improve your Java deve | [161-java-profiling-detect](.cursor/rules/161-java-profiling-detect.md) | Profile your development in runtime and collect evidences to be analyzed later. | **Prompt:** `My Java application has performance issues - help me set up comprehensive profiling process using @161-java-profiling-detect and use the location YOUR-DEVELOPMENT/profiler` **Note:** Replace YOUR-DEVELOPMENT with your actual development path. Example: examples/spring-boot-memory-leak-demo/profiler | Non conversational cursor rule. The Cursor rule will generate 2 scripts. One script designed to run your development with the right JVM flags for profiling and the second scripts will ask few questions about what problem do you want to solve/analyze over one particular PID. **Step 1:** execute `./run-with-profiler.sh --help` **Step2:** execute `./run-jmeter.sh --help` **Step 3:** execute `./profiler/scripts/java-profile.sh` | | [162-java-profiling-analyze](.cursor/rules/162-java-profiling-analyze.md) | Analyze results from previous step and generate reports with the analysis results.| **Prompt:** `Analyze the results located in YOUR-DEVELOPMENT/profiler and use the cursor rule @162-java-profiling-analyze` **Note:** Replace YOUR-DEVELOPMENT with your actual development path. Example: examples/spring-boot-memory-leak-demo/profiler | Non conversational cursor rule. | | - | Code Refactoring from suggestions from analysis | `Can you apply the solutions from @profiling-solutions-yyyymmdd.md in @/info to mitigate bottlenecks` | Make a refactoring with the notes from the analysis | -| [164-java-profiling-compare](.cursor/rules/164-java-profiling-compare.md) | Compare results comparing results before and after applying changes in the code | **Prompt:** `Review if the problems was solved with last refactoring using the reports located in @/results with the cursor rule @164-java-profiling-compare` **Note:** Put in the context the folder with the results | This cursor rule is applied automatically without any interaction with the Software engineer. | +| [164-java-profiling-verify](.cursor/rules/164-java-profiling-verify.md) | Compare results comparing results before and after applying changes in the code | **Prompt:** `Review if the problems was solved with last refactoring using the reports located in @/results with the cursor rule @164-java-profiling-verify` **Note:** Put in the context the folder with the results | This cursor rule is applied automatically without any interaction with the Software engineer. | ## Documentation rules diff --git a/site-generator/assets/images/0.11.0-github-stats.png b/site-generator/assets/images/0.11.0-github-stats.png index 24d31723..60ae0b5f 100644 Binary files a/site-generator/assets/images/0.11.0-github-stats.png and b/site-generator/assets/images/0.11.0-github-stats.png differ diff --git a/site-generator/content/blog/2025/09/release-0.10.0.md b/site-generator/content/blog/2025/09/release-0.10.0.md index 4cbcbfb8..5310c57c 100644 --- a/site-generator/content/blog/2025/09/release-0.10.0.md +++ b/site-generator/content/blog/2025/09/release-0.10.0.md @@ -9,7 +9,7 @@ status=published ## What are Cursor rules for Java? The project provides a collection of System prompts for Java that help software engineers in their daily programming work. -The [available System prompts for Java](https://github.com/jabrena/cursor-rules-java/blob/main/CURSOR-RULES-JAVA.md) cover aspects like `Build system based on Maven`, `Design`, `Coding`, `Testing`, `Refactoring & JMH Benchmarking`, `Performance testing with JMeter`, `Profiling with Async profiler/JDK tools` & `Documentation`. +The [available System prompts for Java](https://github.com/jabrena/cursor-rules-java/blob/main/SYSTEM-PROMPTS-JAVA.md) cover aspects like `Build system based on Maven`, `Design`, `Coding`, `Testing`, `Refactoring & JMH Benchmarking`, `Performance testing with JMeter`, `Profiling with Async profiler/JDK tools` & `Documentation`. ![](/cursor-rules-java/images/workflow.png) @@ -282,7 +282,7 @@ Add Maven Enforcer plugin only from the rule @112-java-maven-plugins without any Add tests for the following classes with @131-java-unit-testing ``` -Additional examples in the [documentation](https://github.com/jabrena/cursor-rules-java/blob/main/CURSOR-RULES-JAVA.md). +Additional examples in the [documentation](https://github.com/jabrena/cursor-rules-java/blob/main/SYSTEM-PROMPTS-JAVA.md). ### Improve readability in system prompts diff --git a/site-generator/content/blog/2025/09/release-0.11.0.md b/site-generator/content/blog/2025/09/release-0.11.0.md index 52cf7166..f759b5c3 100644 --- a/site-generator/content/blog/2025/09/release-0.11.0.md +++ b/site-generator/content/blog/2025/09/release-0.11.0.md @@ -8,7 +8,7 @@ status=published ## What are Cursor rules for Java? -The project provides a collection of System prompts for Java Enterprise development that help software engineers in their daily programming work & data pipelines. The [available System prompts for Java](https://github.com/jabrena/cursor-rules-java/blob/main/CURSOR-RULES-JAVA.md) cover areas such as `Build system based on Maven`, `Design`, `Coding`, `Testing`, `Refactoring & JMH Benchmarking`, `Performance testing with JMeter`, `Profiling with async-profiler/JDK tools`, `Documentation`, and `Diagrams`. +The project provides a collection of System prompts for Java Enterprise development that help software engineers in their daily programming work & data pipelines. The [available System prompts for Java](https://github.com/jabrena/cursor-rules-java/blob/main/SYSTEM-PROMPTS-JAVA.md) cover areas such as `Build system based on Maven`, `Design`, `Coding`, `Testing`, `Refactoring & JMH Benchmarking`, `Performance testing with JMeter`, `Profiling with async-profiler/JDK tools`, `Documentation`, and `Diagrams`. ## What's new in this release? @@ -71,7 +71,7 @@ Improve the classes provided in the context by applying the system prompt @128-java-generics ``` -Further information: https://github.com/jabrena/cursor-rules-java/blob/0.11.0/CURSOR-RULES-JAVA.md +Further information: https://github.com/jabrena/cursor-rules-java/blob/0.11.0/SYSTEM-PROMPTS-JAVA.md With this evolution, software engineers now can combine pure system prompts and specialized behaviors in `16^3 = 4096` combinations by design. @@ -133,7 +133,7 @@ In this release, the script `profile-java-process.sh`, included in `@161-java-p ![](/cursor-rules-java/images/0.11.0-profiling-menu.png) -In recent months, I have been inspired by the work of outstanding engineers in this field: [Francesco Nigro](https://x.com/forked_franz), [Jaromir Hamala](https://x.com/jerrinot), [Johannes Bechberger](https://x.com/parttimen3rd) & [Brendan Gregg](https://x.com/brendangregg). I highly recommend following them. +In recent months, I have been inspired by the work of outstanding engineers in this field: [Francesco Nigro](https://x.com/forked_franz), [Jaromir Hamala](https://x.com/jerrinot), [Johannes Bechberger](https://x.com/parttimen3rd), [Erik Gahlin](https://x.com/ErikGahlin), [Marcus Hirt](https://x.com/hirt) & [Brendan Gregg](https://x.com/brendangregg). I highly recommend following them. If you are interested in the Profiling model `Detect, Analyze, Refactor & Compare` implemented with the following set of System prompts: diff --git a/system-prompts-generator/src/main/resources/100-java-cursor-rules-list.xml b/system-prompts-generator/src/main/resources/100-java-system-prompt-java-list.xml similarity index 85% rename from system-prompts-generator/src/main/resources/100-java-cursor-rules-list.xml rename to system-prompts-generator/src/main/resources/100-java-system-prompt-java-list.xml index c638ee5c..5690c4c8 100644 --- a/system-prompts-generator/src/main/resources/100-java-cursor-rules-list.xml +++ b/system-prompts-generator/src/main/resources/100-java-system-prompt-java-list.xml @@ -4,17 +4,17 @@ Juan Antonio Breña Moral 0.12.0-SNAPSHOT - Create a Checklist with all Java steps to use with cursor rules for Java + Create a Checklist with all Java steps to use with system prompts for Java You are a Senior software engineer with extensive experience in Java software development Your task is to create a comprehensive step-by-step guide that follows the exact format and structure defined in the embedded template below. Create a markdown file named - `CURSOR-RULES-JAVA.md` with the following content: + `SYSTEM-PROMPTS-JAVA.md` with the following content: ```markdown - + ``` @@ -37,10 +37,10 @@ **File Creation**: Generate the complete markdown file named - `CURSOR-RULES-JAVA.md` in the project root directory + `SYSTEM-PROMPTS-JAVA.md` in the project root directory **Template Adherence**: Follow the embedded template structure and content exactly - no additions, modifications, or omissions - **File Handling**: If `CURSOR-RULES-JAVA.md` already exists, + **File Handling**: If `SYSTEM-PROMPTS-JAVA.md` already exists, overwrite it completely with the new generated content diff --git a/system-prompts-generator/src/main/resources/163-java-profiling-refactor.xml b/system-prompts-generator/src/main/resources/163-java-profiling-refactor.xml new file mode 100644 index 00000000..71c5fa02 --- /dev/null +++ b/system-prompts-generator/src/main/resources/163-java-profiling-refactor.xml @@ -0,0 +1,42 @@ + + + + + Juan Antonio Breña Moral + 0.12.0-SNAPSHOT + Java Profiling Workflow / Step 3 / Refactor code to fix issues + + + You are a Senior software engineer with extensive experience in Java software development + + + This cursor rule provides a systematic approach to refactoring Java code based on profiling analysis findings. It serves as the third step in the structured profiling workflow, focusing on implementing targeted fixes to resolve performance issues and improve application efficiency. + + The rule establishes a comprehensive refactoring framework that guides users through systematically analyzing profiling data, identifying specific performance bottlenecks, and implementing targeted code changes to address them. + + + + + + Review notes from the analysis step + + Review the notes from the analysis step to identify the specific performance bottlenecks. + + The files to review are: `docs/profiling-problem-analysis-YYYYMMDD.md` and `docs/profiling-solutions-YYYYMMDD.md` + + + + Refactor the code to fix the performance bottlenecks + + Refactor the code to fix the performance bottlenecks. + + + + + + + + Verify that changes pass all tests with `./mvnw clean verify` or `mvn clean verify` + + + diff --git a/system-prompts-generator/src/main/resources/164-java-profiling-compare.xml b/system-prompts-generator/src/main/resources/164-java-profiling-verify.xml similarity index 99% rename from system-prompts-generator/src/main/resources/164-java-profiling-compare.xml rename to system-prompts-generator/src/main/resources/164-java-profiling-verify.xml index cf9d057e..9e566456 100644 --- a/system-prompts-generator/src/main/resources/164-java-profiling-compare.xml +++ b/system-prompts-generator/src/main/resources/164-java-profiling-verify.xml @@ -4,7 +4,7 @@ Juan Antonio Breña Moral 0.12.0-SNAPSHOT - Java Profiling Workflow / Step 4 / Compare results after refactoring + Java Profiling Workflow / Step 4 / Verify results You are a Senior software engineer with extensive experience in Java software development diff --git a/system-prompts-generator/src/main/resources/fragments/java-cursor-rules-list-template.md b/system-prompts-generator/src/main/resources/fragments/java-system-prompts-java-list-template.md similarity index 94% rename from system-prompts-generator/src/main/resources/fragments/java-cursor-rules-list-template.md rename to system-prompts-generator/src/main/resources/fragments/java-system-prompts-java-list-template.md index 96905b90..5ecfecc7 100644 --- a/system-prompts-generator/src/main/resources/fragments/java-cursor-rules-list-template.md +++ b/system-prompts-generator/src/main/resources/fragments/java-system-prompts-java-list-template.md @@ -63,8 +63,9 @@ Use the following collection of System prompts of Java to improve your Java deve |----|----|-----|----| | [161-java-profiling-detect](.cursor/rules/161-java-profiling-detect.md) | Profile your development in runtime and collect evidences to be analyzed later. | **Prompt:** `My Java application has performance issues - help me set up comprehensive profiling process using @161-java-profiling-detect and use the location YOUR-DEVELOPMENT/profiler` **Note:** Replace YOUR-DEVELOPMENT with your actual development path. Example: examples/spring-boot-memory-leak-demo/profiler | Non conversational cursor rule. The Cursor rule will generate 2 scripts. One script designed to run your development with the right JVM flags for profiling and the second scripts will ask few questions about what problem do you want to solve/analyze over one particular PID. **Step 1:** execute `./run-with-profiler.sh --help` **Step2:** execute `./run-jmeter.sh --help` **Step 3:** execute `./profiler/scripts/java-profile.sh` | | [162-java-profiling-analyze](.cursor/rules/162-java-profiling-analyze.md) | Analyze results from previous step and generate reports with the analysis results.| **Prompt:** `Analyze the results located in YOUR-DEVELOPMENT/profiler and use the cursor rule @162-java-profiling-analyze` **Note:** Replace YOUR-DEVELOPMENT with your actual development path. Example: examples/spring-boot-memory-leak-demo/profiler | Non conversational cursor rule. | +| [163-java-profiling-refactor](.cursor/rules/163-java-profiling-refactor.md) | Refactor code based on profiling analysis findings to fix performance bottlenecks | **Prompt:** `Apply refactoring from profiling analysis using @163-java-profiling-refactor` **Note:** Review `docs/profiling-problem-analysis-YYYYMMDD.md` and `docs/profiling-solutions-YYYYMMDD.md` before refactoring. Replace YYYYMMDD with the analysis date. | Step 3 of profiling workflow. Non conversational. Verifies changes with `./mvnw clean verify`. | | - | Code Refactoring from suggestions from analysis | `Can you apply the solutions from @profiling-solutions-yyyymmdd.md in @/info to mitigate bottlenecks` | Make a refactoring with the notes from the analysis | -| [164-java-profiling-compare](.cursor/rules/164-java-profiling-compare.md) | Compare results comparing results before and after applying changes in the code | **Prompt:** `Review if the problems was solved with last refactoring using the reports located in @/results with the cursor rule @164-java-profiling-compare` **Note:** Put in the context the folder with the results | This cursor rule is applied automatically without any interaction with the Software engineer. | +| [164-java-profiling-verify](.cursor/rules/164-java-profiling-verify.md) | Compare results comparing results before and after applying changes in the code | **Prompt:** `Review if the problems was solved with last refactoring using the reports located in @/results with the cursor rule @164-java-profiling-verify` **Note:** Put in the context the folder with the results | This cursor rule is applied automatically without any interaction with the Software engineer. | ## Documentation rules diff --git a/system-prompts-generator/src/test/java/info/jab/pml/SystemPromptsInventory.java b/system-prompts-generator/src/test/java/info/jab/pml/SystemPromptsInventory.java index 6952210d..e868b234 100644 --- a/system-prompts-generator/src/test/java/info/jab/pml/SystemPromptsInventory.java +++ b/system-prompts-generator/src/test/java/info/jab/pml/SystemPromptsInventory.java @@ -9,7 +9,7 @@ private SystemPromptsInventory() { public static final Stream baseNames() { return Stream.of( - "100-java-cursor-rules-list", + "100-java-system-prompt-java-list", "110-java-maven-best-practices", "111-java-maven-dependencies", "112-java-maven-plugins", @@ -29,7 +29,8 @@ public static final Stream baseNames() { "151-java-performance-jmeter", "161-java-profiling-detect", "162-java-profiling-analyze", - "164-java-profiling-compare", + "163-java-profiling-refactor", + "164-java-profiling-verify", "170-java-documentation", "171-java-diagrams", "behaviour-consultative-interaction",