Skip to content

Commit 8530553

Browse files
ofriwclaude
andcommitted
Add reusable prompt components as MDX partials
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a8c582e commit 8530553

File tree

7 files changed

+227
-0
lines changed

7 files changed

+227
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## AI-Assisted PR Review
2+
3+
Systematic PR analysis using GitHub CLI for metadata, Chain of Draft (CoD) for efficient reasoning, and code research for architectural validation.
4+
5+
### The Prompt
6+
7+
````markdown
8+
You are $PROJECT_NAME's maintainer reviewing $PR_LINK. Ensure code quality, prevent technical debt, and maintain architectural consistency.
9+
10+
Context from the PR author:
11+
$PASTE_AI_OPTIMIZED_DESCRIPTION
12+
13+
# Review Process
14+
15+
1. Use GitHub CLI to read the PR discussions, comments, and related issues
16+
2. Think step by step, but only keep a minimum draft for each thinking step, with 5 words at most. End the assessment with a separator ####.
17+
3. Never speculate about code you haven't read - investigate files before commenting
18+
19+
# Critical Checks
20+
21+
Before approving, verify:
22+
23+
- Can existing code be extended instead of creating new?
24+
- Does this respect module boundaries and responsibilities?
25+
- Are there similar patterns elsewhere? Search the codebase.
26+
- Is this introducing duplication?
27+
28+
# Output Format
29+
30+
```markdown
31+
**Summary**: [One sentence verdict]
32+
**Strengths**: [2-3 items]
33+
**Issues**: [By severity: Critical/Major/Minor with file:line refs]
34+
**Reusability**: [Specific refactoring opportunities]
35+
**Decision**: [APPROVE/REQUEST CHANGES/REJECT]
36+
```
37+
38+
Start by executing `gh pr view $PR_LINK --comments`, follow with the Code Research tool for codebase understanding.
39+
````
40+
41+
**Replace:** `$PROJECT_NAME` (repo name), `$PR_LINK` (GitHub PR URL or number), `$PASTE_AI_OPTIMIZED_DESCRIPTION` ([from Dual-Optimized PR](/prompts/pull-requests/dual-optimized-pr)).
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Comprehensive Code Review
2+
3+
Four-category review structure (Architecture, Code Quality, Maintainability, UX) ensuring comprehensive coverage while preventing confirmation bias through fresh-context execution.
4+
5+
### The Prompt
6+
7+
```markdown
8+
You are an expert code reviewer. Analyze the current changeset and provide a critical review.
9+
10+
The changes in the working tree were meant to: $DESCRIBE_CHANGES
11+
12+
Think step-by-step through each aspect below, focusing solely on the changes in the working tree.
13+
14+
1. **Architecture & Design**
15+
- Verify conformance to project architecture
16+
- Check module responsibilities are respected
17+
- Ensure changes align with the original intent
18+
19+
2. **Code Quality**
20+
- Code must be self-explanatory and readable
21+
- Style must match surrounding code patterns
22+
- Changes must be minimal - nothing unneeded
23+
- Follow KISS principle
24+
25+
3. **Maintainability**
26+
- Optimize for future LLM agents working on the codebase
27+
- Ensure intent is clear and unambiguous
28+
- Verify comments and docs remain in sync with code
29+
30+
4. **User Experience**
31+
- Identify areas where extra effort would significantly improve UX
32+
- Balance simplicity with meaningful enhancements
33+
34+
Review the changes critically. Focus on issues that matter.
35+
Use ChunkHound's code research.
36+
DO NOT EDIT ANYTHING - only review.
37+
```
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Dual-Optimized PR Description Generation
2+
3+
Generate coordinated PR descriptions for two audiences: human maintainers (concise summaries) and AI review assistants (comprehensive technical context).
4+
5+
### The Prompt
6+
7+
```markdown
8+
You are a contributor to $PROJECT_NAME creating a GitHub pull request for the current branch.
9+
Using the sub task tool to conserve context, explore the changes in the git history relative to main.
10+
Summarize and explain them like you would to a fellow co-worker:
11+
12+
- Direct and concise
13+
- Professional but conversational
14+
- Assume competence and intelligence
15+
- Skip obvious explanations
16+
17+
The intent of the changes are:
18+
$CHANGES_DESC
19+
20+
Building upon this, draft two markdown files: one for a human reviewer/maintainer of the project
21+
and another complementary that's optimized for the reviewer's agent. Explain:
22+
23+
- What was done and the reasoning behind it
24+
- Breaking changes, if any exist
25+
- What value the changes adds to the project
26+
27+
Constraints:
28+
29+
- The human optimized markdown file should be 1-3 paragraphs max
30+
- Agent optimized markdown should focus on explaining the changes efficiently
31+
32+
Use ArguSeek, learn how to explain and optimize both for humans and LLMs.
33+
Use the code research to learn the overall architecture, module responsibilities and coding style.
34+
```
35+
36+
**Replace:** `$PROJECT_NAME` (repo name), `$CHANGES_DESC` (1-2 sentence PR summary).
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Edge Case Discovery
2+
3+
Two-step pattern to discover what needs testing through systematic research, grounding test generation in actual code rather than generic advice.
4+
5+
### The Prompt (Step 1: Discover Existing Edge Cases)
6+
7+
```
8+
How does validateUser() work? What edge cases exist in the current implementation?
9+
What special handling exists for different auth providers?
10+
Search for related tests and analyze what they cover.
11+
```
12+
13+
**Replace `validateUser()` with your target function/module.**
14+
15+
### Follow-Up Prompt (Step 2: Identify Gaps)
16+
17+
```
18+
Based on the implementation you found, what edge cases are NOT covered by tests?
19+
What happens with:
20+
- Null or undefined inputs
21+
- Users mid-registration (incomplete profile)
22+
- Concurrent validation requests
23+
```
24+
25+
**Adapt bulleted questions to your domain.** Examples: payment processing (refunds, expired cards, rate limiting), data transformation (empty arrays, special characters, unicode), API endpoints (malformed JSON, missing headers, rate limits), auth (expired tokens, permission escalation), financial (rounding errors, overflow, currency conversion).
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Evidence-Based Debugging
2+
3+
Systematic debugging workflow combining Chain-of-Thought reasoning, grounding directives, and evidence requirements to prevent hallucination and force code retrieval.
4+
5+
### The Prompt
6+
7+
````markdown
8+
```
9+
$ERROR_DESCRIPTION
10+
```
11+
12+
Use the code research to analyze the error above.
13+
14+
INVESTIGATE:
15+
16+
1. Read relevant source files and trace the code path
17+
2. Examine error messages, stack traces, and logs
18+
3. Identify the specific location of the failure
19+
4. Understand the surrounding architecture and data flow
20+
21+
ANALYZE:
22+
23+
5. Compare expected vs actual behavior
24+
6. Identify the root cause of the failure
25+
7. Determine if related issues exist elsewhere
26+
27+
EXPLAIN:
28+
29+
Provide your root cause analysis with evidence:
30+
- File paths and line numbers (`src/auth/jwt.ts:45-67`)
31+
- Actual values from code (`port: 8080`)
32+
- Specific identifiers (`validateJWT()`)
33+
- Exact error messages
34+
35+
Then propose a fix.
36+
````
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Generate AGENTS.md (Project Context File)
2+
3+
Systematic workflow for bootstrapping project context files using [ChunkHound](https://chunkhound.github.io/) codebase analysis and [ArguSeek](https://github.com/ArguSeek/arguseek) ecosystem research.
4+
5+
### The Prompt
6+
7+
```
8+
Generate AGENTS.md for this project.
9+
Use the code research tool to learn the project architecture, tech stack,
10+
how auth works, testing conventions, coding style, and deployment process.
11+
Use ArguSeek to fetch current best practices for the tech stack used and the
12+
latest security guidelines.
13+
14+
Create a concise file (≤500 lines) with sections:
15+
- Tech Stack
16+
- Development Commands (modified for non-interactive execution)
17+
- Architecture (high-level structure)
18+
- Coding Conventions and Style
19+
- Critical Constraints
20+
- Common Pitfalls (if found).
21+
22+
Do NOT duplicate information already in README or code comments—instead, focus
23+
exclusively on AI-specific operations: environment variables, non-obvious
24+
dependencies, and commands requiring modification for agents.
25+
```
26+
27+
**Adapt sections** for your project: Security Guidelines (sensitive data), API Integration Patterns (microservices), Database Schema (data-intensive), Deployment Checklist (complex workflows).
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Test Failure Diagnosis
2+
3+
Systematic four-phase workflow for debugging test failures, combining Chain-of-Thought reasoning, grounding directives, and evidence requirements for objective analysis.
4+
5+
### The Prompt
6+
7+
````markdown
8+
```
9+
$FAILURE_DESCRIPTION
10+
```
11+
12+
Use the code research to analyze the test failure above.
13+
14+
DIAGNOSE:
15+
16+
1. Examine the test code and its assertions.
17+
2. Understand and clearly explain the intention and reasoning of the test - what is it testing?
18+
3. Compare against the implementation code being tested
19+
4. Identify the root cause of failure
20+
21+
DETERMINE:
22+
Is this a test that needs updating or a real bug in the implementation?
23+
24+
Provide your conclusion with evidence.
25+
````

0 commit comments

Comments
 (0)