Skip to content

feat(code-review): optimize cost and improve review quality#3

Merged
pokhiii merged 1 commit intomainfrom
feat/optimize-code-review-cost-quality
Feb 1, 2026
Merged

feat(code-review): optimize cost and improve review quality#3
pokhiii merged 1 commit intomainfrom
feat/optimize-code-review-cost-quality

Conversation

@pokhiii
Copy link
Copy Markdown
Member

@pokhiii pokhiii commented Feb 1, 2026

Summary

  • Cost optimization: Single consolidated comment instead of multiple inline comments (~50% cost reduction)
  • Project-specific guidelines: Claude reads all .md files from docs/code-review/ directory
  • Scope awareness: Reviews only what's within the PR's stated intent
  • Streamlined prompt: Prioritized focus areas, skip list for generated files

Problem

Issue Impact
$50 credits exhausted in 2 days Projected $1000/month vs $400 target
Single PR review costs $0.89 Too expensive
Multiple scattered comments Cluttered PR threads
Generic feedback Not aligned with project standards
Reviews out-of-scope items Wastes developer time

Changes

1. Single Comment Output

  • Removed mcp__github_inline_comment__create_inline_comment from allowed tools
  • Added explicit instruction for ONE summary comment with structured format

2. Project Guidelines Support

  • New guidelines_dir input (default: docs/code-review)
  • Claude reads ALL .md files in the directory
  • Projects can split guidelines: security.md, style.md, api.md, etc.

3. Scope Awareness

  • Explicit instruction to read PR title/description for intent
  • Only review changes within stated scope
  • Out-of-scope items noted briefly, not reviewed

4. Prompt Optimization

  • Removed generic "Learning" section
  • Prioritized focus: Security → Bugs → Performance → Maintainability
  • Skip list: lock files, minified files, generated files

Expected Impact

Metric Before After
Cost per review $0.89 ~$0.40
Monthly projected $1000 ~$400
Comments per review Multiple ONE
Guidelines support None Directory-based

Test plan

  • Create test PR in a project using this workflow
  • Add "ready for review" label
  • Verify Claude creates ONE comment (not multiple)
  • Verify Claude reads guidelines if docs/code-review/ exists
  • Verify review stays within PR scope
  • Monitor API cost in Anthropic dashboard

🤖 Generated with Claude Code

- Replace multiple inline comments with single summary comment
- Add guidelines_dir input for project-specific review standards
- Claude now reads all .md files in docs/code-review/ directory
- Add scope awareness to focus only on PR intent
- Remove inline comment tool, add Read tool for file access
- Streamline prompt with prioritized focus areas
- Add skip list for lock files, minified, and generated files

Expected impact:
- ~50% cost reduction per review ($0.89 → ~$0.40)
- Project-specific feedback based on guidelines
- Cleaner PR threads with one consolidated comment

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@pokhiii pokhiii merged commit 5ac4a70 into main Feb 1, 2026
1 check failed
@rathorevaibhav rathorevaibhav deleted the feat/optimize-code-review-cost-quality branch February 2, 2026 05:50
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.

1 participant