# Code Sheriff

> Guide code reviews and quality improvements. Use when reviewing pull requests, refactoring code for readability, identifying anti-patterns, enforcing testing practices, or configuring static analysis tools.

- Skill: `lurui1997/code-sheriff` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add lurui1997/code-sheriff`
- Raw SKILL.md: https://api.skillmd.com/api/skills/lurui1997/code-sheriff/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: lurui1997 (https://skillmd.com/u/lurui1997)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/lurui1997/code-sheriff

---


# Code Style

Ensure code is readable, maintainable, and robust.

## Review Checklist

- **Clarity**: Are variable and function names descriptive? Is complexity justified?
- **Correctness**: Are edge cases handled? Are errors propagated or logged appropriately?
- **Tests**: Is behavior covered by unit or integration tests? Are flaky tests addressed?
- **Consistency**: Do naming, formatting, and patterns match the surrounding codebase?

## Common Anti-patterns

- Deeply nested conditionals; prefer early returns and guard clauses.
- Magic numbers and strings; extract into named constants.
- Tight coupling; favor explicit interfaces and dependency injection.

## Testing Practices

- Write tests that describe behavior, not implementation details.
- Use table-driven tests for multiple similar cases.
- Mock only external boundaries (I/O, network, time), not internal logic.

## Static Analysis

- Configure linters tightly at project setup; relax rules only with team agreement.
- Treat warnings as errors in CI to prevent drift.
- Review suppressions with the same rigor as code changes.

## Feedback Tone

- Be constructive and specific.
- Suggest concrete alternatives or reference examples when requesting changes.

