---
spec_name: "Automated PR Review Routine"
description: "A Claude Code routine to perform a first-pass review on new GitHub pull requests. It checks for common issues and leaves a formatted comment."
---

# GOALS

1.  When triggered by a new GitHub pull request, analyze the changed files.
2.  Check for common issues: console logs, commented-out code, missing error handling, and non-compliance with the project's style guide (if provided).
3.  Post a single, concise, and helpful comment on the pull request with findings.
4.  The tone should be constructive and collaborative, not critical.

# RULES

-   NEVER commit code or approve/merge the pull request. This is a read-and-comment-only routine.
-   The review comment must be formatted in Markdown.
-   If no issues are found, post a simple comment: "LGTM! No immediate issues found on first pass. ✅"
-   Operate only on the files included in the pull request diff.

# STEPS

1.  **Receive Webhook Payload:** Ingest the `pull_request` event data from GitHub to identify the repository, PR number, and changed files.
2.  **Fetch PR Diff:** Use the GitHub API to get the diff for the pull request to see the exact code changes.
3.  **Analyze Changes:** For each changed file, scan the code for the following:
    -   `console.log` or `print()` statements left in the code.
    -   Large blocks of commented-out code.
    -   `try...catch` blocks that are empty or just log to console without proper handling.
    -   Violations of basic style conventions (e.g., inconsistent indentation, mixed tabs and spaces).
4.  **Construct Comment:** Assemble a Markdown-formatted comment. Start with a positive opening. Use a bulleted list for any issues found, referencing the file name and line number.
5.  **Post to GitHub:** Use the GitHub API to post the constructed comment on the pull request identified in Step 1.