| name | code-reviewer |
| description | Performs code reviews following SF-Bench quality standards. The agent invokes this skill when reviewing code, evaluating pull requests, or assessing code quality for production-readiness. |
Code Reviewer
Overview
This skill provides a structured code review process following SF-Bench quality standards. It focuses on production-readiness, error handling, and adherence to project conventions.
When This Skill Applies
- Reviewing code changes or pull requests
- Assessing code quality before merging
- Evaluating production-readiness
- Checking adherence to project standards
Review Checklist
Critical (Must Fix)
Error Handling
Resource Management
Security
Important (Should Fix)
Code Quality
Logging
Testing
Suggestions (Nice to Have)
Performance
Documentation
Review Process
Step 1: Understand the Change
- Read the PR description or commit message
- Identify the scope (files changed, components affected)
- Understand the intended behavior
Step 2: Check Critical Issues
- Scan for error handling patterns
- Verify resource cleanup
- Check for security issues
- Identify any breaking changes
Step 3: Review Code Quality
- Check adherence to style guidelines
- Verify type hints and docstrings
- Assess test coverage
- Review logging practices
Step 4: Validate Functionality
- Trace the code path mentally
- Identify edge cases
- Check error scenarios
- Verify business logic correctness
Step 5: Provide Feedback
- Prioritize issues (Critical > Important > Suggestions)
- Provide specific line references
- Suggest alternatives when rejecting
- Acknowledge good patterns
Feedback Format
For Issues
**[CRITICAL/IMPORTANT/SUGGESTION]** Line XX-YY
**Issue**: [Brief description of the problem]
**Why**: [Explanation of why this is problematic]
**Suggestion**: [Recommended fix or alternative]
For Approval
**Approved**
Changes look good. Key observations:
- [Positive observation 1]
- [Positive observation 2]
Minor suggestions (non-blocking):
- [Optional improvement 1]
SF-Bench Specific Patterns
Retry Pattern (Required for transient operations)
for attempt in range(max_retries):
try:
result = operation()
return result
except TransientError as e:
if attempt < max_retries - 1:
delay = initial_delay * (2 ** attempt)
logger.warning(f"Attempt {attempt + 1} failed, retrying in {delay}s...")
time.sleep(delay)
continue
raise
Cleanup Pattern (Required for scratch orgs)
try:
org_alias = create_scratch_org()
finally:
delete_scratch_org(org_alias)
Logging Pattern (Required for operations)
logger.info(f"Starting operation for task {task_id}")
logger.debug(f"Input preview: {input[:500]}...")
logger.error(f"Operation failed: {error}", exc_info=True)
Anti-Patterns to Flag
Silent Failures
try:
operation()
except Exception:
pass
try:
operation()
except Exception as e:
logger.error(f"Operation failed: {e}", exc_info=True)
raise
Resource Leaks
org = create_scratch_org()
deploy(org)
org = create_scratch_org()
try:
deploy(org)
finally:
delete_scratch_org(org)
Hardcoded Secrets
api_key = "sk-12345abcde"
api_key = os.environ.get("API_KEY")
Missing Type Hints
def process(data):
return result
def process(data: Dict[str, Any]) -> List[Result]:
return result