Index of every page on this site: llms.txt
All skills
wshobson avatar

/code-review-excellence

@4220308
by Seth Hobsonwshobson/agents43k stars
4,518
Run it yourself

Master effective code review practices to provide constructive feedback, catch bugs early, and foster knowledge sharing while maintaining team morale. Use when reviewing pull requests, establishing review standards, or mentoring developers.

Use this Skill: https://skilld.dev/gh/wshobson/agents/code-review-excellence

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesreview-patterns.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Language-Specific Patterns

Python Code Review

# Check for Python-specific issues

# ❌ Mutable default arguments
def add_item(item, items=[]):  # Bug! Shared across calls
    items.append(item)
    return items

# ✅ Use None as default
def add_item(item, items=None):
    if items is None:
        items = []
    items.append(item)
    return items

# ❌ Catching too broad
try:
    result = risky_operation()
except:  # Catches everything, even KeyboardInterrupt!
    pass

# ✅ Catch specific exceptions
try:
    result = risky_operation()
except ValueError as e:
    logger.error(f"Invalid value: {e}")
    raise

# ❌ Using mutable class attributes
class User:
    permissions = []  # Shared across all instances!

# ✅ Initialize in __init__
class User:
    def __init__(self):
        self.permissions = []

TypeScript/JavaScript Code Review

// Check for TypeScript-specific issues

// ❌ Using any defeats type safety
function processData(data: any) {  // Avoid any
    return data.value;
}

// ✅ Use proper types
interface DataPayload {
    value: string;
}
function processData(data: DataPayload) {
    return data.value;
}

// ❌ Not handling async errors
async function fetchUser(id: string) {
    const response = await fetch(`/api/users/${id}`);
    return response.json();  // What if network fails?
}

// ✅ Handle errors properly
async function fetchUser(id: string): Promise<User> {
    try {
        const response = await fetch(`/api/users/${id}`);
        if (!response.ok) {
            throw new Error(`HTTP ${response.status}`);
        }
        return await response.json();
    } catch (error) {
        console.error('Failed to fetch user:', error);
        throw error;
    }
}

// ❌ Mutation of props
function UserProfile({ user }: Props) {
    user.lastViewed = new Date();  // Mutating prop!
    return <div>{user.name}</div>;
}

// ✅ Don't mutate props
function UserProfile({ user, onView }: Props) {
    useEffect(() => {
        onView(user.id);  // Notify parent to update
    }, [user.id, onView]);
    return <div>{user.name}</div>;
}

Advanced Review Patterns

Pattern 1: Architectural Review

When reviewing significant changes:

1. **Design Document First**
   - For large features, request design doc before code
   - Review design with team before implementation
   - Agree on approach to avoid rework

2. **Review in Stages**
   - First PR: Core abstractions and interfaces
   - Second PR: Implementation
   - Third PR: Integration and tests
   - Easier to review, faster to iterate

3. **Consider Alternatives**
   - "Have we considered using [pattern/library]?"
   - "What's the tradeoff vs. the simpler approach?"
   - "How will this evolve as requirements change?"

Pattern 2: Test Quality Review

// ❌ Poor test: Implementation detail testing
test('increments counter variable', () => {
    const component = render(<Counter />);
    const button = component.getByRole('button');
    fireEvent.click(button);
    expect(component.state.counter).toBe(1);  // Testing internal state
});

// ✅ Good test: Behavior testing
test('displays incremented count when clicked', () => {
    render(<Counter />);
    const button = screen.getByRole('button', { name: /increment/i });
    fireEvent.click(button);
    expect(screen.getByText('Count: 1')).toBeInTheDocument();
});

// Review questions for tests:
// - Do tests describe behavior, not implementation?
// - Are test names clear and descriptive?
// - Do tests cover edge cases?
// - Are tests independent (no shared state)?
// - Can tests run in any order?

Pattern 3: Security Review

## Security Review Checklist

### Authentication & Authorization

- [ ] Is authentication required where needed?
- [ ] Are authorization checks before every action?
- [ ] Is JWT validation proper (signature, expiry)?
- [ ] Are API keys/secrets properly secured?

### Input Validation

- [ ] All user inputs validated?
- [ ] File uploads restricted (size, type)?
- [ ] SQL queries parameterized?
- [ ] XSS protection (escape output)?

### Data Protection

- [ ] Passwords hashed (bcrypt/argon2)?
- [ ] Sensitive data encrypted at rest?
- [ ] HTTPS enforced for sensitive data?
- [ ] PII handled according to regulations?

### Common Vulnerabilities

- [ ] No eval() or similar dynamic execution?
- [ ] No hardcoded secrets?
- [ ] CSRF protection for state-changing operations?
- [ ] Rate limiting on public endpoints?

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts1mo5 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    This skill is an educational resource providing best practices, checklists, and techniques for conducting effective code reviews. It contains no executable code, network operations, or sensitive data access.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

  • Runlayer8mo

    1 file scanned · No issues

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 4220308. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated last month
  • code-review
  • pull-requests
  • feedback
  • mentoring
  • best-practices
  • team-collaboration
  • quality-assurance
  • architecture-review

README badge

README badge for wshobson/agents/code-review-excellence

Provides methods and frameworks for conducting effective code reviews: giving constructive feedback, catching bugs and security issues, organizing review processes by phase, and handling difficult feedback or disagreements. Covers language-specific patterns for Python and TypeScript, review checklists, and techniques for architectural and security reviews.

Generated from the current SKILL.md.

Does this skill apply to all programming languages?
The skill covers general review principles applicable to any language, with detailed examples for Python and TypeScript/JavaScript. The core techniques (checklist method, question approach, severity labeling) work across all languages.
What's the recommended PR size for review?
The skill recommends 200-400 lines max per PR for effective review. PRs larger than 400 lines should be asked to split into smaller changes.
Does this cover security code reviews?
Yes. The skill includes a dedicated security review checklist covering authentication, authorization, input validation, data protection, and common vulnerabilities like SQL injection and XSS.
How should I structure feedback when reviewing code?
The skill recommends using severity labels (blocking, important, nit, suggestion, learning, praise) and the question approach rather than commands, paired with specific, actionable suggestions tied to concrete problems.
What should I focus on and what should automated tools handle?
Focus on logic correctness, security, performance, design fit, and testing quality. Don't manually review formatting, imports, linting violations, or typos—use Prettier, Black, and linters for those.

Generated from the current SKILL.md. These answers refresh after source changes.