| name | prepare-pr |
| description | Allows to prepares the current branch for a pull request. Use when ready to create a PR or before committing changes. |
// turbo-all
Prepare Pull Request
This skill provides a comprehensive workflow to prepare your Java code for a pull request. It runs all CI checks locally, fixes any issues,
and creates a well-documented pull request.
⚠️ User Intervention Policy
Proceed autonomously when steps complete successfully. STOP and ASK the user only for: blockers/unfixable errors, ambiguous
decisions, or approval before committing. Do NOT ask for confirmation on routine passing steps.
Overview
- Run Maven build and verify compilation
- Run unit tests (JUnit 5) and fix failures
- Run license checks
- Analyze changes and update documentation
- Review changes with user and commit
- Create pull request
Prerequisites
Java 25 (Temurin recommended) | Maven 3.9+ | gh (GitHub CLI)
Step-by-Step Instructions
Step 1: Run Maven Build
mvn clean install -DskipTests # Initial build
mvn clean install -DskipTests -e # If build fails, run with full output
If compilation errors occur, STOP, present errors to user, apply fixes per user guidance, and re-run until build succeeds.
Step 2: Run Unit Tests
mvn test # Run all tests with coverage
mvn test -pl <module_name> # Test specific module (e.g., agent_core, ui_test_execution_agent)
If tests fail, STOP and present failure details. Analyze causes (code bug vs. outdated test), ASK user
which approach to take, apply fixes, and re-run until all tests pass.
Step 3: Run License Checks
mvn license:check # Verify license headers
mvn license:format # Auto-fix missing headers (if issues found)
Step 4: Analyze Changes and Update Documentation
4.1: Get Diff and Categorize Changes
git fetch origin main
git diff origin/main...HEAD
Review the diff and categorize changes according to the structure in resources/pr_body_template.md (Features, Bug Fixes, Refactoring,
Tests, Documentation, Dependencies, Configuration). This analysis will be used for README updates and PR description.
4.2: Update README Documentation
Review and update README.md to reflect current code state:
- Update feature descriptions, usage examples, configuration sections as needed
- Add new sections for significant functionality, remove outdated information
- Only STOP for complex documentation decisions requiring user input
4.3: Update Relevant Skills
Check if changes affect any skills in .agent/skills/:
Get-ChildItem -Path ".agent/skills" -Directory | Select-Object Name
Update SKILL.md, resources, scripts, or examples if workflow steps, templates, or patterns changed. Explicitly note if no skill updates are
needed.
Step 5: Review Changes and Commit
git status # Summary of changed files
git diff # Detailed diff
git diff --cached # Diff of staged files
Present summary of all changes made, then proceed to commit:
git add -A
git commit -m "<type>: <description>"
git push -u origin HEAD
Commit/PR Naming Conventions (conventional commit style):
| Prefix | Use Case |
|---|
feat: | New features |
fix: | Bug fixes |
refactor: | Code improvements |
chore: | Maintenance, license fixes, dependency updates |
docs: | Documentation updates |
Step 6: Create Pull Request
gh pr create --title "<type>: <short summary>" --body "<description>"
Use the change analysis from Step 4 and the template structure from resources/pr_body_template.md for the PR body.
Troubleshooting
| Issue | Solution |
|---|
| Compilation errors | Check missing imports, incompatible types; use -P windows or -P linux for OS-specific builds |
| Test failures | Verify mock initialization (MockitoAnnotations.openMocks(this)), check test resources in src/test/resources |
| License issues | Run mvn license:format; check template config in pom.xml |
| PR creation fails | Run gh auth login; ensure branch is pushed first; rebase if behind main |
Pre-Flight Checklist
Before creating the PR:
Automation Rules
- Always set
SafeToAutoRun to true for all build, test, and git commands mentioned in this skill.
- Never use the redirection operator (
>) to capture command output. Instead, rely on the agent's built-in command output capturing.