Skip to content

Commit 4e9b321

Browse files
justin808claude
andcommitted
Add agent invocation and workflow integration sections
Adds two new sections to PR Testing Agent documentation: 1. When to Use This Agent - Automatic invocation triggers (PR creation, CI failures, "ready to merge" checks) - Manual invocation scenarios (validating testing claims, reviewing PRs) - Usage pattern examples 2. Integration with Existing Workflows - Relationship to code review process and code-reviewer agent - Integration at each workflow stage (pre-commit, pre-push, during CI, pre-merge) - Complete workflow example from code change to merge These sections clarify when and how to invoke the agent, and how it fits into the existing development workflow alongside git hooks, CI, and code review. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 0c51451 commit 4e9b321

File tree

1 file changed

+119
-9
lines changed

1 file changed

+119
-9
lines changed

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

Lines changed: 119 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,116 @@
44

55
**Core Principle:** Be deeply suspicious of claims that tests passed unless you have concrete evidence. Assume automated tests have gaps. Manual testing is often required.
66

7+
## When to Use This Agent
8+
9+
### Automatic Invocation (Recommended)
10+
11+
**Invoke this agent automatically when:**
12+
13+
- Creating a PR (before `gh pr create`)
14+
- Responding to PR review comments about testing
15+
- CI failures occur and need investigation
16+
- Asked to verify if a PR is "ready to merge"
17+
18+
### Manual Invocation
19+
20+
**Explicitly request this agent when:**
21+
22+
- Validating testing claims in PR descriptions
23+
- Reviewing someone else's PR for testing adequacy
24+
- Unsure what testing is needed for specific changes
25+
- Need a comprehensive testing checklist
26+
27+
### Usage Pattern
28+
29+
```bash
30+
# Before creating PR:
31+
# "Use the PR Testing Agent to validate my testing before I create this PR"
32+
33+
# During PR review:
34+
# "Use the PR Testing Agent to check if this PR has adequate testing coverage"
35+
36+
# When investigating failures:
37+
# "Use the PR Testing Agent to help me debug these CI failures"
38+
```
39+
40+
## Integration with Existing Workflows
41+
42+
### Relationship to Code Review
43+
44+
**This agent complements but does not replace:**
45+
46+
- Standard code review for logic, design, and maintainability
47+
- The `code-reviewer` agent (focuses on code quality, security)
48+
- CI automated checks (provides guidance when they fail)
49+
50+
**This agent specializes in:**
51+
52+
- Testing verification and validation
53+
- Identifying untested code paths
54+
- Catching silent failures in build/infrastructure
55+
- Providing testing checklists based on change type
56+
- Translating CI failures to local reproduction steps
57+
58+
### Integration with Development Workflow
59+
60+
**Pre-commit:**
61+
62+
- Git hooks handle linting/formatting automatically
63+
- Agent focuses on which tests to run manually
64+
65+
**Pre-push:**
66+
67+
- Agent validates testing claims before PR creation
68+
- Generates comprehensive testing checklist
69+
- Identifies environmental testing limitations
70+
71+
**During CI:**
72+
73+
- Agent helps reproduce CI failures locally
74+
- Distinguishes pre-existing vs. new failures
75+
- Maps CI failures to local test commands
76+
77+
**Pre-merge:**
78+
79+
- Agent validates all testing completed
80+
- Ensures manual testing gaps documented
81+
- Reviews PR description for testing claims
82+
83+
### Workflow Example
84+
85+
```bash
86+
# 1. Make code changes
87+
vim lib/react_on_rails/helper.rb
88+
89+
# 2. Run relevant tests locally (agent suggests which)
90+
bundle exec rspec spec/react_on_rails/helper_spec.rb
91+
92+
# 3. Commit (hooks auto-lint)
93+
git commit -m "Fix helper method"
94+
95+
# 4. Before pushing, consult agent
96+
# "What testing do I need before creating a PR for helper.rb changes?"
97+
# Agent responds with checklist
98+
99+
# 5. Complete testing checklist
100+
cd spec/dummy
101+
bin/dev
102+
# Test in browser...
103+
104+
# 6. Create PR with testing documentation
105+
git push
106+
gh pr create # Include testing summary from agent
107+
108+
# 7. If CI fails, consult agent again
109+
# "CI is failing on integration tests, help me reproduce locally"
110+
# Agent provides exact commands
111+
112+
# 8. Before merge, final validation
113+
# "Is this PR ready to merge from a testing perspective?"
114+
# Agent reviews what was tested vs. what's still needed
115+
```
116+
7117
## Agent Behavior
8118

9119
### Default Stance: Skeptical
@@ -415,7 +525,7 @@ bundle exec rspec spec/system/integration_spec.rb
415525

416526
**Template for test status comment:**
417527

418-
````markdown
528+
```markdown
419529
## Testing Status
420530

421531
### ✅ Verified Locally
@@ -429,15 +539,15 @@ bundle exec rspec spec/system/integration_spec.rb
429539

430540
- [ ] **Build scripts** - CRITICAL: Clean install test in full environment
431541
`bash
432-
rm -rf node_modules && yarn install --frozen-lockfile
433-
yarn run yalc:publish
434-
`
542+
rm -rf node_modules && yarn install --frozen-lockfile
543+
yarn run yalc:publish
544+
`
435545
- [ ] **Browser testing** - Dummy app visual inspection
436546
`bash
437-
cd spec/dummy && bin/dev
438-
# Visit http://localhost:3000/hello_world
439-
# Check console for errors
440-
`
547+
cd spec/dummy && bin/dev
548+
# Visit http://localhost:3000/hello_world
549+
# Check console for errors
550+
`
441551

442552
### ❌ Cannot Test (Environment Limitation)
443553

@@ -449,7 +559,7 @@ bundle exec rspec spec/system/integration_spec.rb
449559
- Latest workflow: [link]
450560
- Known pre-existing failures: None (master passing)
451561
- New failures introduced: None
452-
````
562+
```
453563

454564
### In Commit Messages
455565

0 commit comments

Comments
 (0)