Skip to content

Commit accfba9

Browse files
authored
Guide agents(s) to be more concise on issue & PR descriptions (#338)
Update agent guidance to include more useful Pull-Request guidance. I've noticed our agents generate pretty bad descriptions in pull-requests, so I've been playing around with better guidance - specifically by: - Documenting our expectations around pull-requests - Guiding the agent to use a checklist to validate the PR description The PR.md file can also be used by regular contributors for guidance on how to create PRs I also had a small change here to stop including effort estimations in task creation, since I think it's unless noise. --------- Co-authored-by: Mackenzie Zastrow <[email protected]>
1 parent 2bb8202 commit accfba9

File tree

3 files changed

+245
-15
lines changed

3 files changed

+245
-15
lines changed

.github/agent-sops/task-implementer.sop.md

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Create a comprehensive list of test scenarios covering normal operation, edge ca
9898
- You MUST check for existing testing strategies documented in the repository documentation or your notes
9999
- You MUST cover all acceptance criteria with at least one test scenario
100100
- You MUST define explicit input/output pairs for each test case
101-
- You MUST make note of these test scenarios
101+
- You MUST make note of these test scenarios
102102
- You MUST design tests that will initially fail when run against non-existent implementations
103103
- You MUST NOT create mock implementations during the test design phase because tests should be written based solely on expected behavior, not influenced by implementation details
104104
- You MUST focus on test scenarios and expected behaviors rather than detailed test code in documentation
@@ -234,23 +234,40 @@ If the implementation meets all requirements and follows established patterns, p
234234

235235
If all tests are passing, draft a conventional commit message, perform the git commit, and create/update the pull request.
236236

237+
**PR Checklist Verification (REQUIRED):**
238+
239+
Before creating or updating a PR, you MUST copy the checklist from [docs/PR.md](../../docs/PR.md) into your progress notes and explicitly verify each item. For each checklist item, you MUST:
240+
241+
1. Copy the checklist item verbatim
242+
2. Mark it as `[x]` (pass) or `[ ]` (fail)
243+
3. If failed, revise the PR description until the item passes
244+
245+
Example format in your notes:
246+
247+
```markdown
248+
## PR Description Checklist Verification
249+
250+
- [x] Does the PR description target a Senior Engineer familiar with the project?
251+
- [ ] Does the PR include a "Resolves #<ISSUE NUMBER>" in the body? → FAILED: missing issue reference, adding now
252+
```
253+
254+
You MUST NOT create or update the PR until ALL checklist items pass.
255+
237256
**Constraints:**
257+
258+
- You MUST read and follow the PR description guidelines in [docs/PR.md](../../docs/PR.md) when creating pull requests & commits
238259
- You MUST check that all tasks are complete before proceeding
239260
- You MUST reference your notes for the issue you are creating a pull request for
240-
- You MUST NOT commit changes until builds AND tests have been verified because committing broken code can disrupt the development workflow and introduce bugs into the codebase
261+
- You MUST NOT commit changes until builds AND tests have been verified because committing broken code can disrupt the development workflow and introduce bugs into the codebase
241262
- You MUST follow the Conventional Commits specification
242263
- You MUST use `git status` to check which files have been modified
243264
- You MUST use `git add` to stage all relevant files
244265
- You MUST execute the `git commit -m <COMMIT_MESSAGE>` command with the prepared commit message
245266
- You MAY use `git push origin <BRANCH_NAME>` to push the local branch to the remote if the `GITHUB_WRITE` environment variable is set to `true`
246-
- If the push operation is deferred, continue with PR creation and note the deferred status
267+
- If the push operation is deferred, continue with PR creation and note the deferred status
247268
- You MUST attempt to create the pull request using the `create_pull_request` tool if it does not exist yet
248269
- If the PR creation is deferred, continue with the workflow and note the deferred status
249270
- You MUST use the task id recorded in your notes, not the issue id
250-
- You MUST include "Resolves: #<ISSUE NUMBER>" in the body of the pull request
251-
- You MUST NOT bold this line
252-
- You MUST give an overview of the feature being implemented
253-
- You MUST include any notes on key implementation decisions, ambiguity, or other information as part of the pull request description
254271
- If the `create_pull_request` tool fails (excluding deferred responses):
255272
- The tool automatically handles fallback by posting a properly URL-encoded manual PR creation link as a comment on the specified fallback issue
256273
- You MUST verify the fallback comment was posted successfully by checking the tool's return message
@@ -303,6 +320,7 @@ Based on the users feedback, you will review and update your implementation plan
303320
- You MUST NOT close the parent issue - only the user should close it after the pull request is merged
304321
- You MUST not attempt to merge the pull request
305322
- You MUST use the handoff_to_user tool to inform the user you are ready for clarifying information on the pull request
323+
- You MUST include additional checklist items from [docs/PR.md](../../docs/PR.md) to validate the pull request description is correct after making additional changes
306324

307325
## Desired Outcome
308326

@@ -396,8 +414,27 @@ If builds fail during implementation:
396414
- Use progress tracking with markdown checklists
397415
- Document decisions, assumptions, and challenges
398416

417+
### Checklist Verification Pattern
418+
419+
When documentation files contain checklists (e.g., `docs/PR.md`), you MUST:
420+
421+
1. Copy the entire checklist into your progress notes
422+
2. Explicitly verify each item by marking `[x]` or `[ ]`
423+
3. For any failed items, document the issue and fix it before proceeding
424+
4. Re-verify failed items after fixes until all pass
425+
426+
This pattern ensures quality gates are not skipped and provides an audit trail of verification.
427+
428+
### Pull Request Best Practices
429+
430+
- You MUST follow the PR description guidelines in [docs/PR.md](../../docs/PR.md)
431+
- Focus on WHY the change is needed, not HOW it's implemented
432+
- Document public API changes with before/after code examples
433+
- Write for senior engineers familiar with the project
434+
- Skip implementation details, test coverage notes, and line-by-line change lists
435+
399436
### Git Best Practices
400437
- Commit early and often with descriptive messages
401438
- Follow Conventional Commits specification
402439
- You must create a new commit for each feedback iteration
403-
- You must only push to your feature branch, never main
440+
- You must only push to your feature branch, never main

.github/agent-sops/task-refiner.sop.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ Record that the task review is complete and ready as a comment on the issue.
185185
- If comment posting is deferred, continue with the workflow and note the deferred status
186186
- You MUST summarize what was accomplished in your comment
187187
- You MUST confirm in your comment that the issue is ready for implementation, or explain why it is not
188-
- You MUST record the estimated scope of work based on repository analysis
189188
- You SHOULD mention any final recommendations or considerations
190189

191190
## Examples
@@ -257,12 +256,6 @@ Based on clarification discussion and repository analysis:
257256
- [ ] 2FA can be enabled/disabled by user
258257
- [ ] Integration tests pass
259258
- [ ] Existing auth functionality remains intact
260-
261-
### Estimated Scope
262-
- **Complexity**: Medium
263-
- **Files Modified**: ~8-10 files
264-
- **New Components**: 2-3 React components
265-
- **Database Migrations**: 1-2 migrations required
266259
```
267260

268261
## Troubleshooting

docs/PR.md

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# Pull Request Description Guidelines
2+
3+
Good PR descriptions help reviewers understand the context and impact of your changes. They enable faster reviews, better decision-making, and serve as valuable historical documentation.
4+
5+
When creating a PR, follow the [GitHub PR template](../.github/PULL_REQUEST_TEMPLATE.md) and use these guidelines to fill it out effectively.
6+
7+
## Who's Reading Your PR?
8+
9+
Write for senior engineers familiar with the SDK. Assume your reader:
10+
11+
- Understands the SDK's architecture and patterns
12+
- Has context about the broader system
13+
- Can read code diffs to understand implementation details
14+
- Values concise, focused communication
15+
16+
## What to Include
17+
18+
Every PR description should have:
19+
20+
1. **Motivation** — Why is this change needed?
21+
2. **Public API Changes** — What changes to the public API (with code snippets)?
22+
3. **Use Cases** (optional) — When would developers use this feature? Only include for non-obvious functionality; skip for trivial changes or obvious fixes.
23+
4. **Breaking Changes** (if applicable) — What breaks and how to migrate?
24+
25+
## Writing Principles
26+
27+
**Focus on WHY, not HOW:**
28+
29+
- ✅ "The OpenAI SDK supports dynamic API keys, but we don't expose this capability"
30+
- ❌ "Added ApiKeySetter type import from openai/client"
31+
32+
**Document public API changes with example code snippets:**
33+
34+
- ✅ Show before/after code snippets for API changes
35+
- ❌ List every file or line changed
36+
37+
**Be concise:**
38+
39+
- ✅ Use prose over bullet lists when possible
40+
- ❌ Create exhaustive implementation checklists
41+
42+
**Emphasize user impact:**
43+
44+
- ✅ "Enables secret manager integration for credential rotation"
45+
- ❌ "Updated error message to mention 'string or function'"
46+
47+
## What to Skip
48+
49+
Leave these out of your PR description:
50+
51+
- **Implementation details** — Code comments and commit messages cover this
52+
- **Test coverage notes** — CI will catch issues; assume tests are comprehensive
53+
- **Line-by-line change lists** — The diff provides this
54+
- **Build/lint/coverage status** — CI handles verification
55+
- **Commit hashes** — GitHub links commits automatically
56+
57+
## Anti-patterns
58+
59+
**Over-detailed checklists:**
60+
61+
```markdown
62+
### Type Definition Updates
63+
64+
- Added ApiKeySetter type import from 'openai/client'
65+
- Updated OpenAIModelOptions interface apiKey type
66+
```
67+
68+
**Implementation notes reviewers don't need:**
69+
70+
```markdown
71+
## Implementation Notes
72+
73+
- No breaking changes - all existing string-based usage continues to work
74+
- OpenAI SDK handles validation of function return values
75+
```
76+
77+
**Test coverage bullets:**
78+
79+
```markdown
80+
### Test Coverage
81+
82+
- Added test: accepts function-based API key
83+
- Added test: accepts async function-based API key
84+
```
85+
86+
## Good Examples
87+
88+
**Motivation section:**
89+
90+
```markdown
91+
## Motivation
92+
93+
The OpenAI SDK supports dynamic API key resolution through async functions,
94+
enabling use cases like credential rotation and secret manager integration.
95+
However, our SDK currently only accepts static strings for the apiKey parameter,
96+
preventing users from leveraging these capabilities.
97+
```
98+
99+
**Public API Changes section:**
100+
101+
````markdown
102+
## Public API Changes
103+
104+
The `OpenAIModelOptions.apiKey` parameter now accepts either a string or an
105+
async function:
106+
107+
```typescript
108+
// Before: only string supported
109+
const model = new OpenAIModel({
110+
modelId: 'gpt-4o',
111+
apiKey: 'sk-...',
112+
})
113+
114+
// After: function also supported
115+
const model = new OpenAIModel({
116+
modelId: 'gpt-4o',
117+
apiKey: async () => await secretManager.getApiKey(),
118+
})
119+
```
120+
121+
The change is backward compatible—all existing string-based usage continues
122+
to work without modification.
123+
124+
````
125+
126+
**Use Cases section:**
127+
```markdown
128+
## Use Cases
129+
130+
- **API key rotation**: Rotate keys without application restart
131+
- **Secret manager integration**: Fetch credentials from AWS Secrets Manager, Vault, etc.
132+
- **Multi-tenant systems**: Dynamically select API keys based on context
133+
````
134+
135+
## Template
136+
137+
````markdown
138+
## Motivation
139+
140+
[Explain WHY this change is needed. What problem does it solve? What limitation
141+
does it address? What user need does it fulfill?]
142+
143+
Resolves: #[issue-number]
144+
145+
## Public API Changes
146+
147+
[Document changes to public APIs with before/after code snippets. If no public
148+
API changes, state "No public API changes."]
149+
150+
```typescript
151+
// Before
152+
[existing API usage]
153+
154+
// After
155+
[new API usage]
156+
```
157+
158+
[Explain behavior, parameters, return values, and backward compatibility.]
159+
160+
## Use Cases (optional)
161+
162+
[Only include for non-obvious functionality. Provide 1-3 concrete use cases
163+
showing when developers would use this feature. Skip for trivial changes obvious fixes..]
164+
165+
## Breaking Changes (if applicable)
166+
167+
[If this is a breaking change, explain what breaks and provide migration guidance.]
168+
169+
### Migration
170+
171+
```typescript
172+
// Before
173+
[old code]
174+
175+
// After
176+
[new code]
177+
```
178+
179+
````
180+
181+
## Why These Guidelines?
182+
183+
**Focus on WHY over HOW** because code diffs show implementation details, commit messages document granular changes, and PR descriptions provide the broader context reviewers need.
184+
185+
**Skip test/lint/coverage details** because CI pipelines verify these automatically. Including them adds noise without value.
186+
187+
**Write for senior engineers** to enable concise, technical communication without redundant explanations.
188+
189+
## References
190+
191+
- [Conventional Commits](https://www.conventionalcommits.org/)
192+
- [Google's Code Review Guidelines](https://google.github.io/eng-practices/review/)
193+
194+
## Checklist Items
195+
196+
- [ ] Does the PR description target a Senior Engineer familiar with the project?
197+
- [ ] Does the PR description give an overview of the feature being implemented, including any notes on key implemention decisions
198+
- [ ] Does the PR include a "Resolves #<ISSUE NUMBER>" in the body and is not bolded?
199+
- [ ] Does the PR contain the motivation or use-cases behind the change?
200+
- [ ] Does the PR omit irrelevent details not needed for historical reference?

0 commit comments

Comments
 (0)