Skip to content

Commit 0dd5108

Browse files
justin808claude
andcommitted
Add comprehensive "Using with Claude Code" section
Adds detailed guidance on how to use the PR Testing Agent with Claude Code: Quick Start: - Shows basic prompt patterns for referencing the agent - Examples of asking for specific sections Common Workflows (5 scenarios): 1. Before creating a PR - get testing checklist 2. Validating your testing - check against criteria 3. Generating PR documentation - use templates 4. Investigating CI failures - reproduction steps 5. Code review - identify testing gaps Referencing Specific Sections: - By section number - By change type - By checklist name - By success criteria Complete Example Workflow: - Full end-to-end example from code change to PR creation - Shows actual prompts and expected Claude Code responses - Demonstrates validation and documentation generation Tips for Effective Use: - Be specific vs vague prompts (good/bad examples) - Reference by change type - Ask for validation - Request templates What Claude Code Can/Cannot Do: - Clear list of capabilities and limitations - Sets realistic expectations Automatic Context: - Explains when guidelines are available - No special setup needed This makes the agent immediately actionable for developers using Claude Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 7d70ef8 commit 0dd5108

File tree

1 file changed

+281
-0
lines changed

1 file changed

+281
-0
lines changed

.claude/docs/pr-testing-agent.md

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
**Jump to Section:**
1818

1919
- [When to Use This Agent](#when-to-use-this-agent)
20+
- [Using with Claude Code](#using-with-claude-code)
2021
- [Testing Requirements by Change Type](#testing-requirements-by-change-type)
2122
- [Pre-Merge Testing Checklist](#pre-merge-testing-checklist)
2223
- [Success Criteria](#success-criteria-well-tested-pr)
@@ -61,6 +62,286 @@
6162
"Apply PR Testing Agent criteria: Is this PR ready to merge from a testing perspective?"
6263
```
6364

65+
## Using with Claude Code
66+
67+
### Quick Start
68+
69+
**The easiest way to use this agent with Claude Code is to explicitly reference it in your prompts:**
70+
71+
```
72+
"Use the PR Testing Agent guidelines from .claude/docs/pr-testing-agent.md to validate my testing"
73+
74+
"I changed package.json. According to PR Testing Agent Section 3, what testing is required?"
75+
76+
"Generate a testing checklist for my changes using the PR Testing Agent Pre-Merge Checklist"
77+
```
78+
79+
### Common Workflows
80+
81+
#### 1. Before Creating a PR
82+
83+
```
84+
# After making changes and committing:
85+
"I modified lib/react_on_rails/helper.rb. According to the PR Testing Agent,
86+
what testing do I need before creating a PR?"
87+
88+
# Claude Code will reference Section 1 (Ruby Code Changes) and provide checklist
89+
```
90+
91+
#### 2. Validating Your Testing
92+
93+
```
94+
"Based on PR Testing Agent success criteria, is my testing adequate?
95+
Here's what I tested: [paste your test output]"
96+
97+
# Claude Code will check against the 7 Success Criteria
98+
```
99+
100+
#### 3. Generating PR Testing Documentation
101+
102+
```
103+
"Generate a Testing Status section for my PR description using the
104+
PR Testing Agent template from 'Communicating Test Status'"
105+
106+
# Claude Code will create formatted testing documentation
107+
```
108+
109+
#### 4. Investigating CI Failures
110+
111+
```
112+
"CI is failing on integration tests. Help me reproduce locally following
113+
PR Testing Agent process."
114+
115+
# Claude Code will guide you through Section 5 (CI Configuration Changes)
116+
```
117+
118+
#### 5. Code Review
119+
120+
```
121+
"Review this PR description and identify missing testing according to
122+
PR Testing Agent standards"
123+
124+
# Claude Code applies skeptical stance and identifies gaps
125+
```
126+
127+
### Referencing Specific Sections
128+
129+
**For targeted help, reference specific sections by number or name:**
130+
131+
```
132+
# By section number:
133+
"Show me the MANDATORY testing checklist from PR Testing Agent Section 3"
134+
135+
# By change type:
136+
"I modified webpack.config.js. Use PR Testing Agent Section 4
137+
(Webpack/Shakapacker Configuration Changes) to tell me what to test"
138+
139+
# By checklist:
140+
"Generate the Pre-Merge Testing Checklist for build configuration changes"
141+
142+
# By success criteria:
143+
"Does this PR meet PR Testing Agent Success Criteria #4 (Testing Documentation)?"
144+
```
145+
146+
### Complete Example Workflow
147+
148+
Here's a full example of using the agent throughout the PR lifecycle:
149+
150+
```bash
151+
# 1. Make changes
152+
vim lib/react_on_rails/helper.rb
153+
git add .
154+
git commit -m "Fix helper method"
155+
156+
# 2. Ask Claude Code for testing guidance
157+
```
158+
159+
**Prompt to Claude Code:**
160+
161+
```
162+
"I changed lib/react_on_rails/helper.rb. According to PR Testing Agent
163+
Section 1 (Ruby Code Changes), what testing do I need?"
164+
```
165+
166+
**Claude Code responds with checklist:**
167+
168+
````markdown
169+
Based on PR Testing Agent Section 1, you need:
170+
171+
### Automated (will run in CI):
172+
173+
- ✅ RSpec unit tests
174+
- ✅ RuboCop linting
175+
- ✅ RBS type validation
176+
177+
### Manual verification required:
178+
179+
- [ ] Run unit tests locally: `bundle exec rake run_rspec:gem`
180+
- [ ] If helper affects browser behavior: Test in dummy app
181+
- [ ] Ensure RuboCop passes: `bundle exec rubocop`
182+
183+
### Before declaring "fixed":
184+
185+
```bash
186+
bundle exec rubocop
187+
bundle exec rake run_rspec:gem
188+
bundle exec rake rbs:validate
189+
```
190+
````
191+
192+
````
193+
194+
```bash
195+
# 3. Complete the testing
196+
bundle exec rubocop
197+
bundle exec rake run_rspec:gem
198+
# (tests pass)
199+
200+
# 4. Ask for validation
201+
````
202+
203+
**Prompt to Claude Code:**
204+
205+
```
206+
"Based on PR Testing Agent Success Criteria, is my testing adequate?
207+
I ran: bundle exec rubocop (0 violations), rake run_rspec:gem (all passed)"
208+
```
209+
210+
**Claude Code validates:**
211+
212+
```markdown
213+
Checking against PR Testing Agent Success Criteria:
214+
215+
✅ 1. Automated Testing - RuboCop and RSpec passed
216+
✅ 2. Local Verification - Tests run before pushing
217+
⚠️ 3. Manual Testing - Did you test in browser if helper affects UI?
218+
❌ 4. Testing Documentation - Need to document in PR description
219+
...
220+
221+
Recommendation: Add testing documentation to PR description before creating PR.
222+
```
223+
224+
```bash
225+
# 5. Generate PR documentation
226+
```
227+
228+
**Prompt to Claude Code:**
229+
230+
```
231+
"Generate a Testing Status section for my PR using PR Testing Agent template"
232+
```
233+
234+
**Claude Code provides:**
235+
236+
```markdown
237+
## Testing Status
238+
239+
### ✅ Verified Locally
240+
241+
- [x] RuboCop: 0 violations
242+
- [x] RSpec unit tests: 15 examples, 0 failures
243+
- [x] RBS validation: Types valid
244+
245+
### Manual Testing
246+
247+
- [x] Unit tests cover helper method changes
248+
- [x] No browser-facing changes - UI testing not required
249+
250+
### CI Status
251+
252+
- All checks pending (will run after push)
253+
```
254+
255+
```bash
256+
# 6. Create PR with documentation
257+
git push
258+
gh pr create # Include generated testing section
259+
260+
# 7. If CI fails, investigate
261+
```
262+
263+
**Prompt to Claude Code:**
264+
265+
```
266+
"CI failing on dummy app integration tests. Use PR Testing Agent to help
267+
me reproduce locally."
268+
```
269+
270+
**Claude Code guides:**
271+
272+
```bash
273+
# Following PR Testing Agent Section 5 (CI Configuration Changes):
274+
275+
# Step 1: Check if pre-existing
276+
gh run list --workflow="Integration Tests" --branch master --limit 5
277+
278+
# Step 2: Reproduce locally
279+
bin/ci-rerun-failures
280+
281+
# Step 3: If specific failures
282+
pbpaste | bin/ci-run-failed-specs
283+
```
284+
285+
### Tips for Effective Use
286+
287+
**1. Be specific about sections:**
288+
289+
```
290+
✅ "Use PR Testing Agent Section 3 Build Configuration checklist"
291+
❌ "What testing do I need?"
292+
```
293+
294+
**2. Reference by change type:**
295+
296+
```
297+
✅ "I changed package.json. PR Testing Agent guidelines?"
298+
❌ "Should I test this?"
299+
```
300+
301+
**3. Ask for validation:**
302+
303+
```
304+
✅ "Does this meet PR Testing Agent Success Criteria?"
305+
❌ "Is this good enough?"
306+
```
307+
308+
**4. Request templates:**
309+
310+
```
311+
✅ "Generate testing documentation using PR Testing Agent template"
312+
❌ "Write a testing section"
313+
```
314+
315+
### What Claude Code Can Do
316+
317+
**Claude Code can:**
318+
319+
- ✅ Read the PR Testing Agent document directly when referenced
320+
- ✅ Apply guidelines to your specific changes
321+
- ✅ Generate checklists based on files you modified
322+
- ✅ Validate testing against the 7 Success Criteria
323+
- ✅ Create formatted testing documentation
324+
- ✅ Identify testing gaps using the skeptical approach
325+
- ✅ Suggest specific commands from the relevant section
326+
327+
**Claude Code cannot:**
328+
329+
- ❌ Automatically run the tests for you (you still need to execute commands)
330+
- ❌ Access your browser to verify UI changes
331+
- ❌ Know if tests passed without you providing the output
332+
- ❌ Push commits or create PRs automatically
333+
334+
### Automatic Context
335+
336+
**The PR Testing Agent guidelines are automatically available when:**
337+
338+
- You reference `.claude/docs/pr-testing-agent.md` in prompts
339+
- You mention "PR Testing Agent" or "testing checklist"
340+
- You ask about testing requirements for specific file types
341+
- CLAUDE.md is loaded (which references this documentation)
342+
343+
**No special setup needed** - just reference it in your prompts!
344+
64345
## Integration with Existing Workflows
65346

66347
### Relationship to Code Review

0 commit comments

Comments
 (0)