All skills
sanyuan0704 avatar

/code-review-expert

@ae75e91
by Shawn Yangsanyuan0704/sanyuan-skills3.9k stars
344

Expert code review of current git changes with a senior engineer lens. Detects SOLID violations, security risks, and proposes actionable improvements.

Use this Skill: https://skilld.dev/gh/sanyuan0704/sanyuan-skills/code-review-expert

This session only. Nothing lands on disk.

referencessolid-checklist.md

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

SOLID Smell Prompts

SRP (Single Responsibility)

  • File owns unrelated concerns (e.g., HTTP + DB + domain rules in one file)
  • Large class/module with low cohesion or multiple reasons to change
  • Functions that orchestrate many unrelated steps
  • God objects that know too much about the system
  • Ask: "What is the single reason this module would change?"

OCP (Open/Closed)

  • Adding a new behavior requires editing many switch/if blocks
  • Feature growth requires modifying core logic rather than extending
  • No plugin/strategy/hook points for variation
  • Ask: "Can I add a new variant without touching existing code?"

LSP (Liskov Substitution)

  • Subclass checks for concrete type or throws for base method
  • Overridden methods weaken preconditions or strengthen postconditions
  • Subclass ignores or no-ops parent behavior
  • Ask: "Can I substitute any subclass without the caller knowing?"

ISP (Interface Segregation)

  • Interfaces with many methods, most unused by implementers
  • Callers depend on broad interfaces for narrow needs
  • Empty/stub implementations of interface methods
  • Ask: "Do all implementers use all methods?"

DIP (Dependency Inversion)

  • High-level logic depends on concrete IO, storage, or network types
  • Hard-coded implementations instead of abstractions or injection
  • Import chains that couple business logic to infrastructure
  • Ask: "Can I swap the implementation without changing business logic?"

Common Code Smells (Beyond SOLID)

Smell Signs
Long method Function > 30 lines, multiple levels of nesting
Feature envy Method uses more data from another class than its own
Data clumps Same group of parameters passed together repeatedly
Primitive obsession Using strings/numbers instead of domain types
Shotgun surgery One change requires edits across many files
Divergent change One file changes for many unrelated reasons
Dead code Unreachable or never-called code
Speculative generality Abstractions for hypothetical future needs
Magic numbers/strings Hardcoded values without named constants

Refactor Heuristics

  1. Split by responsibility, not by size - A small file can still violate SRP
  2. Introduce abstraction only when needed - Wait for the second use case
  3. Keep refactors incremental - Isolate behavior before moving
  4. Preserve behavior first - Add tests before restructuring
  5. Name things by intent - If naming is hard, the abstraction might be wrong
  6. Prefer composition over inheritance - Inheritance creates tight coupling
  7. Make illegal states unrepresentable - Use types to enforce invariants

Source: SKILL.md on GitHub

No alerts16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The 'Code Review Expert' skill provides structured analysis of code changes, focusing on security, performance, and design principles. It operates using local git tools and requires user approval before making any changes to the codebase, maintaining a safe and transparent workflow.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    7 files scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

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

Last checked against GitHub 2 months ago.

Steadyupdated 7 months ago

README badge

README badge for sanyuan0704/sanyuan-skills/code-review-expert