Skip to content

Conversation

@marktoda
Copy link
Contributor

@marktoda marktoda commented Dec 12, 2025


✨ Claude-Generated Content

Summary

Restructures the Claude PR review prompt into a comprehensive, workflow-based format with explicit steps, output requirements, and enhanced teaching guidelines for better code review quality.

Changes

  • Added structured 7-step workflow with sequential checkpoints (check existing comments → verify patch-id → analyze → create review → add comments → update sticky → submit)
  • Added XML output format requirements for each workflow step to ensure review consistency
  • Added explicit operating constraints section highlighting critical limitations (COMMENT-only reviews, duplicate prevention, patch-id verification)
  • Expanded pattern examples with detailed teaching moments showing before/after code transformations
  • Added communication guidelines with concrete tone examples for bugs, patterns, and enhancements
  • Added quality checklist for pre-submission verification
  • Added context variables section for dynamic PR information injection
  • Enhanced inline comment rules with decision tree for duplicate prevention
  • Added recognition instructions for calling out good patterns

Notes

This is a documentation-only change affecting Claude Code's PR review behavior. No smart contract code is modified.
Note: The file contains some merge conflict markers (<<<<<<<, =======, >>>>>>>) that appear to be unresolved - these should be cleaned up before merging.

@marktoda marktoda requested a review from a team as a code owner December 12, 2025 23:47
@github-actions
Copy link

github-actions bot commented Dec 12, 2025

🤖 Claude Code Review

Review complete

Review Summary

This PR significantly expands the Claude PR review prompt from ~100 lines to ~487 lines, restructuring it into a more comprehensive workflow document. However, the file contains unresolved git merge conflicts that must be fixed before merging.

Critical Issues 🔴

1. Unresolved Git Merge Conflicts (.claude/prompts/claude-pr-review.md:298-368, 408-417)

The file contains two sections with unresolved merge conflict markers:

  • Lines 298-368: Conflict between <pattern_examples> section and ## Decision Framework section
  • Lines 408-417: Conflict in pattern example endings

These conflict markers (<<<<<<< Updated upstream, =======, >>>>>>> Stashed changes) will cause parsing issues and make the prompt non-functional.

2. Missing Template Variable Documentation (.claude/prompts/claude-pr-review.md:33-43)

The context block contains template variables like $REPOSITORY, $PR_NUMBER, $CURRENT_PATCH_ID, etc. without any documentation about:

  • What system populates these values
  • Expected behavior if values are missing/undefined
  • Format expectations for each variable

This makes the prompt difficult to maintain and debug.

Improvements Suggested 🟡

3. Constraint on COMMENT-only Reviews Removes Nuance (Line 11)

The new constraints force COMMENT-only reviews, but the original guide explicitly recommended "Approve with comments beats comment-only reviews." This removes valuable review signal. If this is a technical limitation (e.g., GitHub Actions permissions), documenting the reason would help future maintainers understand the constraint.

4. Verbose Examples May Reduce Effectiveness

The expanded teaching examples are more verbose than the originals. For example:

  • New (lines 385-392): 7-line detailed breakdown
  • Original: "Four responsibilities here. Splitting them makes testing easier - each piece testable without mocking the others."

In prompt engineering, brevity often works better because it leaves room for the model to adapt to specific context.

5. XML Output Format Requirements Add Ceremony

The 7-step workflow with mandatory XML output formats (e.g., <existing_comments_check>, <patch_id_check>) adds significant structure. While this ensures thoroughness, rigid formatting requirements can cause the model to focus on format compliance over review quality. The original achieved similar results with simpler prose instructions.

Good Practices Observed ✅

  • Clear prioritization framework: The Phase 1/2/3 priority system is well-structured
  • Decision tree for inline comments: The rules at lines 151-183 provide clear guidance for when to add vs skip comments
  • Communication tone examples: Concrete examples of good feedback style (lines 432-461)
  • Quality checklist: The final checklist (lines 463-472) provides useful validation

Action Items

  1. [BLOCKING] Resolve the git merge conflicts at lines 298-368 and 408-417
  2. Add documentation for template variables explaining how they're populated
  3. Consider documenting why COMMENT-only reviews are required (if it's a technical limitation)
  4. Consider whether the expanded verbosity improves or hurts prompt effectiveness

💡 Want a fresh review? Add a comment containing @request-claude-review to trigger a new review at any time.

@github-actions github-actions bot changed the title feat: update claude prompt docs: restructure PR review prompt with step-by-step workflow Dec 12, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 Review verdict: COMMENT

👆 The main review comment above is the source of truth for this PR review. It is automatically updated on each review cycle, so always refer to it for the most current feedback.

This formal review submission is for the verdict only. 4 inline comment(s) are attached below.


<constraints>
**CRITICAL OPERATING CONSTRAINTS:**
1. You can ONLY submit "COMMENT" reviews (technical limitation)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If COMMENT is truly the only option due to technical limitations, this is worth explaining. However, the original guide explicitly stated:

"Approve with comments beats comment-only reviews. If it's not worth blocking, it's worth approving."

This constraint removes a valuable nuance. COMMENT reviews create friction without clear signal. Consider documenting why this limitation exists, or if it's a GitHub Actions permission issue, note that as context.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current code still has not documented why COMMENT-only reviews are required. The issue remains - this constraint removes valuable nuance from the review process without explanation.

**Why this matters:** Duplicate comments waste everyone's time and make reviews harder to follow. By checking first, you ensure every comment adds unique value.

Nice-to-haves. Mention only if the win is obvious:
**Action:**

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 7-step workflow with XML outputs adds significant ceremony. This is a style choice, but be aware that rigid formatting requirements can cause the model to focus on format compliance over review quality.

The original guide achieved similar results with simpler prose instructions like "check existing comments and discussions" without requiring specific output formats.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 7-step workflow with XML outputs remains unchanged. This is a style/design choice that the PR author has made, though the concern about format compliance vs review quality is worth considering.

</teaching_mode>

Problems that would cause immediate harm:
<context>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These template variables ($REPOSITORY, $PR_NUMBER, etc.) need documentation about:

  • What system populates them
  • Expected behavior if missing
  • Format expectations

Without this, someone maintaining this prompt won't know how these integrate with the broader system.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template variables still lack documentation. This issue persists and should be addressed.


> Issue 1: Logger Interface Violation (Blocking)
> The Danger bot correctly identified that the code is logging strings directly to logger.error()... Why this matters: The logger interface expects Error objects for structured error logging...
**Teach this improvement:**

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This expanded teaching example:

"This function has 4 separate responsibilities. Splitting them makes testing trivial:
- `validateInput(userId)` - test with simple inputs
..."

Is more verbose than the original:

"Four responsibilities here. Splitting them makes testing easier - each piece testable without mocking the others."

The original was actually clearer. Brevity often wins in prompt engineering since it leaves more room for the model to adapt to context.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expanded teaching example remains more verbose than the original. This is a style choice, though the original's brevity may be more effective in prompt engineering.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 Review verdict: REQUEST_CHANGES

👆 The main review comment above is the source of truth for this PR review. It is automatically updated on each review cycle, so always refer to it for the most current feedback.

This formal review submission is for the verdict only. 3 inline comment(s) are attached below.

- Refactoring opportunities
</priorities>

<<<<<<< Updated upstream

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file contains unresolved git merge conflicts. The conflict markers (<<<<<<< Updated upstream, =======, >>>>>>> Stashed changes) will cause the prompt to malfunction.

Resolution needed: Decide which version of the "Pattern Examples" vs "Decision Framework" sections to keep, or merge them appropriately. The conflict spans lines 298-368 and 408-417.

To find all conflicts:

git diff --check

</teaching_mode>

Problems that would cause immediate harm:
<context>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These template variables ($REPOSITORY, $PR_NUMBER, $CURRENT_PATCH_ID, etc.) need documentation:

  • What system/script populates these values?
  • What happens if a variable is undefined or empty?
  • What format is expected for $CURRENT_PATCH_ID?
  • Is $CLAUDE_COMMENT_ID always present or only on re-reviews?

Without this documentation, future maintainers won't know how to integrate or debug this prompt.

Suggested change
<context>
<context>
<!-- Template variables populated by the CI/CD workflow that invokes this prompt -->
<!-- See .github/workflows/pr-review.yml for population logic -->
Repository: $REPOSITORY
PR Number: $PR_NUMBER
PR Title: $PR_TITLE
PR Body: $PR_BODY
Current Patch ID: $CURRENT_PATCH_ID
Existing Claude Comment ID: $CLAUDE_COMMENT_ID
Existing Comments: $PR_COMMENTS
Review Comments: $REVIEW_COMMENTS
Changed Files: $CHANGED_FILES
Trigger: $TRIGGER_COMMENT
</context>


<constraints>
**CRITICAL OPERATING CONSTRAINTS:**
1. You can ONLY submit "COMMENT" reviews (technical limitation)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original guide recommended "Approve with comments beats comment-only reviews. If it's not worth blocking, it's worth approving."

This constraint removes that nuance. COMMENT-only reviews create friction without clear signal about whether the reviewer thinks the code is safe to merge.

If this is a GitHub Actions permission limitation, adding a brief explanation would help:

1. You can ONLY submit "COMMENT" reviews (GitHub Actions tokens lack approval permissions)

If it's intentional design choice, explaining the rationale would help maintainers understand the tradeoff.

@marktoda marktoda closed this Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants