pr-review
The pr-review command performs a detailed line-by-line code review of a GitHub pull request, examining changes while ignoring repository configuration and binary files. Use this command to evaluate pull request quality by checking Go idioms, code clarity, variable naming, comment adequacy, test patterns, and architectural decisions before merging.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/specstoryai/getspecstory/HEAD/specstory-cli/.claude/commands/pr-review.md -o ~/.claude/commands/pr-review.mdpr-review.md
## Context - Current pull request status: !`gh pr view $1` - Current pull request diff: !`gh pr diff $1` ## Your task Examine pull request $1 using the GitHub CLI command. Ignore any changes to: - .specstory/history files - .claude/ files - .cursor/ files - ./specstory binary - CLAUDE.md - AGENT.md - changelog.md Please code review the pull request. Review line by line and explain to me the purpose of each change. Use file names and line numbers to reference the changes, but also sequentially number every observation so we can easily reference them. In the line by line review, pay attention to: - clarity of variable names - Go lang idiomatic code - code clarity and simplicity, readable over clever - "why" comments, not "how" comments - missing comments - missing log output - missing analytics tracking - single function exit point where possible (immediate guard clauses are OK) - verify the code has to exist, is actually needed, and is in use - verify the code is DRY, and doesn't replicate the same or similar code - for test cases, ensure a data-driven approach is being used rather than lots of repetitive test code Format your line by line review like this example: ``` cmd/remote.go Line 12 (removed): Removed unused import of pkg/service package - (1) ✅ Good - Cleaning up unused imports is proper Go hygiene Lines 157-162 (modified): Changed from loading config directly to using RPC client // Old: config, err := service.LoadConfig(dir) // New: rpcClient, err := client.NewRPCClient(dir) - (2) ✅ Good architectural decision - Now operates via daemon RPC instead of direct file access - (3) ✅ Proper defer cleanup pattern for RPC client - (4) ✅ Variable name rpcClient is clear and follows conventions Lines 164-189 (new): Added remote status check before disabling - (5) ✅ Good UX - Detects current connection state to provide better feedback - (6) ✅ Type assertions use the two-value form (ok pattern) for safety - (7) ⚠️ Nested if statements become deeply indented (4 levels) - could be refactored for readability - (8) ✅ Variable names wasConnected, oldURL are descriptive - (9) ❓ Missing error handling - if remote.status call fails, we continue anyway. Should we? --- pkg/remote/sync.go Lines 260-265 (modified): Success messages now come after RPC call - (10) ✅ Comment "config is now saved" is helpful context - (11) ⚠️ Misleading comment placement - comment says "config is now saved" but we can't be certain from this code's perspective (that happens in the daemon) ``` In addition to the line by line review, suggest the 2-5 most important improvements for this code review. In addition to the most important improvements, let's also think about if any of these changes could benefit from new, updated or expanded unit tests. We focus our unit tests on complicated logic, and combinatorial scenarios, not on coverage or completeness for completeness sake. Better to not have a unit test than to have tests that are simplistic or tautological. We also don't test 3rd party library or language features, only our own code. For any new test cases that were added, confirm the tests are: - Not trivial - They test real logic in our code and aren't just testing Go lang or 3rd party libraries - Not tautological - They would catch real bugs - Well-designed - Each assertion accurately verifies specific logic and complexity in the code being tested - Reliable - They won't be flaky, don't rely on external state, and don't catch false positives. - Not repetitive - They test different scenarios, and use data-driven testing rather than repetitive test code.
SpecStory Lore - mine your SpecStory coding histories (any agent - Claude Code, Codex, Cursor, Gemini, and more) into a persistent corpus, surface your reproducible workflows with corroborated evidence, and interactively forge the chosen ones into skills installed across all your agent harnesses. Use when the user wants to turn past AI coding sessions into reusable skills, asks "what could I make into a skill", "mine my lore", "forge skills from my history", or points at a .specstory/history directory.
Code review the current proposed code change