|
1 | 1 | --- |
2 | 2 | name: ai-pr |
3 | | -description: Generate concise PR descriptions from git diffs and commit context. |
| 3 | +description: Generate concise PR descriptions from git diffs and commit context. Use when the user asks to create a PR description, write a pull request summary, or needs help documenting changes for code review. Automatically analyzes git diffs and commit history to produce well-structured PR descriptions with summary, changes, testing info, and breaking changes. |
4 | 4 | --- |
5 | 5 |
|
6 | | -## Instructions |
7 | | -- Omit trivial changes entirely (formatting-only, whitespace, comment removal, import reordering, empty lines). |
8 | | -- Include only functional code changes, bug fixes that change behavior, new features, API/config changes, tests, significant docs. |
9 | | - |
10 | | -## Language rules |
11 | | -- Plain technical language (no marketing: avoid "enhanced", "optimized", "robust"). |
12 | | -- Lexical level = CEFR B1: short, common words; max 12 words per sentence. |
13 | | -- Prefer simple verbs: added/removed/changed/fixed/updated. |
14 | | -- Describe only what the diff or commits explicitly show; never guess intent. |
15 | | -- For fixes: mention what was broken only if visible, plus how diff fixes it. |
16 | | -- For other changes: state what changed from/to; include reasons only when explicitly stated. |
17 | | -- Prefer lists; use backticks for `files`/`functions`/`APIs`. |
18 | | -- Keep each bullet under 12 words for readability. |
19 | | - |
20 | | -## Structure |
21 | | -- Title: use commit type and ticket from context (present tense, concise). |
22 | | -- Summary section: max 2 short sentences describing overall change. |
23 | | -- Changes section: bullet list (max 5 items). Only substantive changes. |
24 | | -- Testing section: bullet list; mention commands or "- Not stated". |
25 | | -- Breaking Changes section: include only when diff obviously breaks behavior. |
26 | | - |
27 | | -## Output |
28 | | -**CRITICAL: Your response must contain ONLY the PR content below. Do not include ANY explanatory text, thoughts, analysis, or meta-commentary before or after the PR content.** |
29 | | - |
30 | | -- First line is the PR title only. |
31 | | -- Blank line after title. |
32 | | -- Then markdown PR description using the provided section headings. |
33 | | -- Do not output anything else. |
| 6 | +# AI Pull Request Description Generator |
| 7 | + |
| 8 | +Generate clear, concise PR descriptions from git diffs and commit messages. |
| 9 | + |
| 10 | +## Core Principles |
| 11 | + |
| 12 | +**Focus on functional changes:** |
| 13 | +- Include code behavior changes, bug fixes, new features, API changes, tests |
| 14 | +- Omit trivial changes: formatting, whitespace, comment-only edits, import reordering |
| 15 | + |
| 16 | +**Plain technical language:** |
| 17 | +- Avoid marketing terms ("enhanced", "optimized", "robust", "improved") |
| 18 | +- Use simple verbs: add, remove, change, fix, update |
| 19 | +- Keep sentences under 12 words |
| 20 | +- Use backticks for `files`, `functions`, `APIs`, `variables` |
| 21 | + |
| 22 | +**Describe what is visible:** |
| 23 | +- Only describe what the diff or commits explicitly show |
| 24 | +- Never guess intent or future implications |
| 25 | +- State what changed from/to |
| 26 | +- Include reasons only when explicitly stated in commits |
| 27 | + |
| 28 | +## PR Structure |
| 29 | + |
| 30 | +```markdown |
| 31 | +[Type]([Ticket]): [Brief Description] |
| 32 | + |
| 33 | +## Summary |
| 34 | +[1-2 sentences describing overall change] |
| 35 | + |
| 36 | +## Changes |
| 37 | +- [Functional change 1] |
| 38 | +- [Functional change 2] |
| 39 | +- [Functional change 3] |
| 40 | + |
| 41 | +## Testing |
| 42 | +- [Test approach or commands] |
| 43 | +- Not stated (if no testing info available) |
| 44 | + |
| 45 | +## Breaking Changes |
| 46 | +- [Breaking change] (only if diff obviously breaks behavior) |
| 47 | +- None (if no breaking changes) |
| 48 | +``` |
| 49 | + |
| 50 | +## Title Format |
| 51 | + |
| 52 | +Use commit type and ticket number from context: |
| 53 | +- `feat(AB#12345): add user authentication` |
| 54 | +- `fix(AB#12345): prevent null pointer in validation` |
| 55 | +- `refactor(AB#12345): extract helper functions` |
| 56 | +- `docs(AB#12345): update API examples` |
| 57 | + |
| 58 | +If no ticket number: |
| 59 | +- `feat: add user authentication` |
| 60 | +- `fix: prevent crash on empty input` |
| 61 | + |
| 62 | +## Writing Guidelines |
| 63 | + |
| 64 | +**Summary section:** |
| 65 | +- Max 2 short sentences |
| 66 | +- Describe the overall goal or problem solved |
| 67 | +- Present tense, active voice |
| 68 | + |
| 69 | +**Changes section:** |
| 70 | +- Max 5 bullets |
| 71 | +- Each bullet under 12 words |
| 72 | +- List only substantive functional changes |
| 73 | +- Order by importance/impact |
| 74 | + |
| 75 | +**Testing section:** |
| 76 | +- List test commands run or test files added |
| 77 | +- Mention testing approach if stated in commits |
| 78 | +- Use "- Not stated" if no testing info available |
| 79 | + |
| 80 | +**Breaking Changes section:** |
| 81 | +- Include only when diff obviously breaks existing behavior |
| 82 | +- Describe what breaks and how |
| 83 | +- Use "- None" if no breaking changes |
| 84 | + |
| 85 | +## Examples |
| 86 | + |
| 87 | +**Feature PR:** |
| 88 | +``` |
| 89 | +feat(AB#50147): add email validation to registration |
| 90 | +
|
| 91 | +## Summary |
| 92 | +Add email format validation and uniqueness check to registration form. |
| 93 | +
|
| 94 | +## Changes |
| 95 | +- Add `validateEmail` function to `utils/validators.ts` |
| 96 | +- Update `RegistrationForm` to check email format |
| 97 | +- Add unique email constraint to database schema |
| 98 | +- Display error message for invalid or duplicate emails |
| 99 | +
|
| 100 | +## Testing |
| 101 | +- Run `npm test` for unit tests |
| 102 | +- Manual testing with valid/invalid email formats |
| 103 | +
|
| 104 | +## Breaking Changes |
| 105 | +- None |
| 106 | +``` |
| 107 | + |
| 108 | +**Bug Fix PR:** |
| 109 | +``` |
| 110 | +fix(AB#50271): prevent null pointer in user profile |
| 111 | +
|
| 112 | +## Summary |
| 113 | +Fix crash when accessing user profile with missing data. |
| 114 | +
|
| 115 | +## Changes |
| 116 | +- Add null check before accessing `user.profile.avatar` |
| 117 | +- Set default avatar when profile image is missing |
| 118 | +- Update `ProfileCard` component error handling |
| 119 | +
|
| 120 | +## Testing |
| 121 | +- Add test case for users without profile data |
| 122 | +- Verify no crash with null profile |
| 123 | +
|
| 124 | +## Breaking Changes |
| 125 | +- None |
| 126 | +``` |
| 127 | + |
| 128 | +**Refactoring PR:** |
| 129 | +``` |
| 130 | +refactor(AB#50198): extract validation to shared module |
| 131 | +
|
| 132 | +## Summary |
| 133 | +Move validation functions to shared module for reuse across forms. |
| 134 | +
|
| 135 | +## Changes |
| 136 | +- Create `utils/validators.ts` with shared functions |
| 137 | +- Update `LoginForm` to use shared validators |
| 138 | +- Update `RegistrationForm` to use shared validators |
| 139 | +- Remove duplicate validation code |
| 140 | +
|
| 141 | +## Testing |
| 142 | +- Existing tests pass with refactored code |
| 143 | +- No behavior changes |
| 144 | +
|
| 145 | +## Breaking Changes |
| 146 | +- None |
| 147 | +``` |
| 148 | + |
| 149 | +**PR with breaking changes:** |
| 150 | +``` |
| 151 | +feat(AB#50299): migrate to new authentication API |
| 152 | +
|
| 153 | +## Summary |
| 154 | +Update authentication to use v2 API endpoints. |
| 155 | +
|
| 156 | +## Changes |
| 157 | +- Replace `/auth/login` with `/v2/auth/token` endpoint |
| 158 | +- Update auth response parsing for new format |
| 159 | +- Add token refresh flow |
| 160 | +- Update tests for new API |
| 161 | +
|
| 162 | +## Testing |
| 163 | +- Integration tests with v2 API |
| 164 | +- Manual testing of login and token refresh |
| 165 | +
|
| 166 | +## Breaking Changes |
| 167 | +- Old `/auth/login` endpoint no longer supported |
| 168 | +- Auth tokens now require refresh after 1 hour |
| 169 | +``` |
| 170 | + |
| 171 | +## Process |
| 172 | + |
| 173 | +1. **Analyze git diff** - Review changed files and specific code changes |
| 174 | +2. **Review commit messages** - Extract context about intent and testing |
| 175 | +3. **Identify type and scope** - Determine PR type (feat/fix/refactor) and ticket number |
| 176 | +4. **Filter changes** - Exclude trivial formatting/whitespace changes |
| 177 | +5. **List functional changes** - Focus on behavior changes, max 5 bullets |
| 178 | +6. **Extract testing info** - From commits or test file changes |
| 179 | +7. **Check for breaking changes** - Look for API/behavior changes |
| 180 | +8. **Write concise description** - Follow structure, keep language simple |
| 181 | + |
| 182 | +## Output Format |
| 183 | + |
| 184 | +**CRITICAL:** Output ONLY the PR content. No explanatory text, thoughts, or meta-commentary. |
| 185 | + |
| 186 | +1. First line: PR title only |
| 187 | +2. Blank line |
| 188 | +3. Markdown PR description with section headings |
| 189 | +4. Nothing else |
| 190 | + |
| 191 | +Do not add any preamble like "Here's the PR description:" or any analysis afterward. |
0 commit comments