Skip to content

Commit 8124101

Browse files
adinauerclaude
andauthored
chore(ai): Add /create-java-pr Claude Code skill (#5119)
* ci: add create-java-pr Claude Code skill Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * use PR template for Java PRs --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 41fa056 commit 8124101

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
name: create-java-pr
3+
description: Create a pull request in sentry-java. Use when asked to "create pr", "prepare pr", "prep pr", "open pr", "ready for pr", "prepare for review", "finalize changes". Handles branch creation, code formatting, API dump, committing, pushing, PR creation, and changelog.
4+
---
5+
6+
# Create Pull Request (sentry-java)
7+
8+
Prepare local changes and create a pull request for the sentry-java repo.
9+
10+
## Step 1: Ensure Feature Branch
11+
12+
```bash
13+
git branch --show-current
14+
```
15+
16+
If on `main` or `master`, create and switch to a new branch:
17+
18+
```bash
19+
git checkout -b <type>/<short-description>
20+
```
21+
22+
Derive the branch name from the changes being made. Use `feat/`, `fix/`, `ref/`, etc. matching the commit type conventions.
23+
24+
## Step 2: Format Code and Regenerate API Files
25+
26+
```bash
27+
./gradlew spotlessApply apiDump
28+
```
29+
30+
This is **required** before every PR in this repo. It formats all Java/Kotlin code via Spotless and regenerates the `.api` binary compatibility files.
31+
32+
If the command fails, diagnose and fix the issue before continuing.
33+
34+
## Step 3: Commit Changes
35+
36+
Check for uncommitted changes:
37+
38+
```bash
39+
git status --porcelain
40+
```
41+
42+
If there are uncommitted changes, invoke the `sentry-skills:commit` skill to stage and commit them following Sentry conventions.
43+
44+
**Important:** When staging, ignore changes that are only relevant for local testing and should not be part of the PR. Common examples:
45+
46+
| Ignore Pattern | Reason |
47+
|---|---|
48+
| Hardcoded booleans flipped for testing | Local debug toggles |
49+
| Sample app config changes (`sentry-samples/`) | Local testing configuration |
50+
| `.env` or credentials files | Secrets |
51+
52+
Restore these files before committing:
53+
54+
```bash
55+
git checkout -- <file-to-restore>
56+
```
57+
58+
## Step 4: Push the Branch
59+
60+
```bash
61+
git push -u origin HEAD
62+
```
63+
64+
If the push fails due to diverged history, ask the user how to proceed rather than force-pushing.
65+
66+
## Step 5: Create PR
67+
68+
Invoke the `sentry-skills:create-pr` skill to create a draft PR. When providing the PR body, use the repo's PR template structure from `.github/pull_request_template.md`:
69+
70+
```
71+
## :scroll: Description
72+
<Describe the changes in detail>
73+
74+
## :bulb: Motivation and Context
75+
<Why is this change required? What problem does it solve?>
76+
77+
## :green_heart: How did you test it?
78+
<Describe how you tested>
79+
80+
## :pencil: Checklist
81+
- [ ] I added GH Issue ID _&_ Linear ID
82+
- [ ] I added tests to verify the changes.
83+
- [ ] No new PII added or SDK only sends newly added PII if `sendDefaultPII` is enabled.
84+
- [ ] I updated the docs if needed.
85+
- [ ] I updated the wizard if needed.
86+
- [ ] Review from the native team if needed.
87+
- [ ] No breaking change or entry added to the changelog.
88+
- [ ] No breaking change for hybrid SDKs or communicated to hybrid SDKs.
89+
90+
## :crystal_ball: Next steps
91+
```
92+
93+
Fill in each section based on the changes being PR'd. Check any checklist items that apply.
94+
95+
Then continue to Step 6.
96+
97+
## Step 6: Update Changelog
98+
99+
After the PR is created, add an entry to `CHANGELOG.md` under the `## Unreleased` section.
100+
101+
### Determine the subsection
102+
103+
| Change Type | Subsection |
104+
|---|---|
105+
| New feature | `### Features` |
106+
| Bug fix | `### Fixes` |
107+
| Refactoring, internal cleanup | `### Internal` |
108+
| Dependency update | `### Dependencies` |
109+
110+
Create the subsection under `## Unreleased` if it does not already exist.
111+
112+
### Entry format
113+
114+
```markdown
115+
- <Short description of the change> ([#<PR_NUMBER>](https://github.com/getsentry/sentry-java/pull/<PR_NUMBER>))
116+
```
117+
118+
Use the PR number returned by `sentry-skills:create-pr`. Match the style of existing entries — sentence case, ending with the PR link, no trailing period.
119+
120+
### Commit and push
121+
122+
Stage `CHANGELOG.md`, commit with message `changelog`, and push:
123+
124+
```bash
125+
git add CHANGELOG.md
126+
git commit -m "changelog"
127+
git push
128+
```

0 commit comments

Comments
 (0)