Claude-skill-registry code-scoring

Provides quantitative rubrics and criteria for scoring code quality on a 1-10 scale. Use when reviewing code, performing code audits, establishing quality baselines, comparing implementations, or providing objective code feedback.

install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/code-scoring" ~/.claude/skills/majiayu000-claude-skill-registry-code-scoring && rm -rf "$T"
manifest: skills/data/code-scoring/SKILL.md
source content

Code Scoring

Systematic, quantitative code quality assessment using weighted categories and standardized deductions.

Quick Start

Full code review with score:

Score this code on a 1-10 scale using the code-scoring rubric

Category-specific assessment:

Evaluate the error handling in this module using the scoring rubric

Compare implementations:

Score both implementations and recommend which is better

Scoring Methodology

The Formula

Final Score = 10 - Total Deductions

Where:
Total Deductions = SUM(Category Deductions * Category Weight)
Category Deduction = SUM(Issue Points * Severity Multiplier)

Category Weights

CategoryWeightFocus Areas
Organization12%File structure, module boundaries, separation of concerns
Naming10%Variables, functions, classes, constants, files
Error Handling12%Try/catch, validation, error propagation, recovery
Testing12%Coverage, quality, edge cases, maintainability
Performance10%Efficiency, resource usage, scalability
Security12%Input validation, auth, data protection, secrets
Documentation8%Comments, API docs, README, inline explanations
SOLID Principles10%SRP, OCP, LSP, ISP, DIP adherence
Dependencies6%Version management, minimal deps, no circular refs
Maintainability8%Readability, complexity, changeability

Total: 100%

Severity Multipliers

SeverityMultiplierDescription
Critical2.0xSecurity vulnerabilities, data loss risks, crashes
Major1.5xSignificant bugs, poor patterns, missing core functionality
Minor1.0xCode smells, style issues, minor inefficiencies
Nitpick0.5xPreferences, optional improvements

Quick Scoring Cheat Sheet

ScoreLabelMeaningTypical Characteristics
10ExemplaryProduction excellenceMinimal issues, well-tested, secure, documented
9ExcellentMinor polish needed1-2 nitpicks, strong overall quality
8Very GoodReady with small fixesFew minor issues, solid fundamentals
7GoodAcceptable qualitySome improvements needed, no major issues
6SatisfactoryFunctional but roughMultiple minor issues, needs cleanup
5AdequateMeets minimum barWorks but has clear problems
4Below AverageNeeds significant workMajor issues present, risky to deploy
3PoorSubstantial reworkMultiple major issues, architectural problems
2Very PoorFundamental problemsBarely functional, serious concerns
1CriticalDo not deploySecurity vulnerabilities, crashes, data risks

Common Deductions Table

Quick reference for frequent issues. See references/deduction-catalog.md for complete list.

High-Impact Deductions

IssueBase PointsCategory
SQL injection vulnerability2.0Security
Hardcoded secrets/credentials2.0Security
No error handling in critical path1.5Error Handling
Missing input validation1.5Security
No tests for core functionality1.5Testing
N+1 query pattern1.5Performance
God class (500+ lines)1.5Organization

Medium-Impact Deductions

IssueBase PointsCategory
Inconsistent naming convention1.0Naming
Missing JSDoc/docstrings on public API1.0Documentation
Circular dependency1.0Dependencies
Deeply nested code (4+ levels)1.0Maintainability
Magic numbers without constants1.0Naming
Empty catch blocks1.0Error Handling
Duplicated code blocks1.0Organization

Low-Impact Deductions

IssueBase PointsCategory
Inconsistent formatting0.5Maintainability
Missing edge case tests0.5Testing
Verbose variable names0.5Naming
Outdated dependencies (no CVEs)0.5Dependencies
Missing inline comments in complex logic0.5Documentation

Scoring Workflow

Step 1: Initial Scan

1. Count lines of code
2. Identify file/module structure
3. Note language and framework
4. Check for tests presence
5. Scan for obvious red flags

Step 2: Category Assessment

For each of the 10 categories:

1. Review relevant code sections
2. Identify issues
3. Classify severity (critical/major/minor/nitpick)
4. Calculate: Issues * Severity Multiplier
5. Apply category weight

Step 3: Calculate Final Score

Final Score = 10 - (Sum of weighted deductions)

If score < 1: score = 1
If score > 10: score = 10

Step 4: Generate Report

## Code Score: X.X/10

### Score Breakdown
| Category | Weight | Deductions | Weighted |
|----------|--------|------------|----------|
| Organization | 12% | ... | ... |
| ... | ... | ... | ... |

### Critical Issues (Fix Immediately)
- [Issue 1]

### Major Issues (Fix Before Merge)
- [Issue 1]

### Minor Issues (Fix When Convenient)
- [Issue 1]

### Recommendations
- [Improvement 1]

Category Quick Guides

Organization (12%)

Excellent (0 deductions):

  • Clear module boundaries
  • Single responsibility per file
  • Logical folder structure
  • No circular dependencies

Red flags:

  • Files > 500 lines: -1.0
  • Mixed concerns in module: -1.0
  • No clear structure: -1.5
  • Circular dependencies: -1.0

Naming (10%)

Excellent (0 deductions):

  • Descriptive, intention-revealing names
  • Consistent convention (camelCase, snake_case)
  • Domain terminology used correctly
  • Acronyms handled consistently

Red flags:

  • Single-letter variables (non-loop): -0.5
  • Misleading names: -1.0
  • Inconsistent convention: -1.0
  • Magic numbers: -1.0

Error Handling (12%)

Excellent (0 deductions):

  • All external calls wrapped
  • Specific error types used
  • Errors logged with context
  • Graceful degradation where appropriate

Red flags:

  • Empty catch blocks: -1.0
  • Generic catch-all: -0.5
  • Missing validation: -1.5
  • Swallowed errors: -1.0

Testing (12%)

Excellent (0 deductions):

  • 80%+ coverage on critical paths
  • Unit, integration, and E2E tests
  • Edge cases covered
  • Tests are maintainable

Red flags:

  • No tests: -2.0
  • Only happy path: -1.0
  • Flaky tests: -1.0
  • Test code duplication: -0.5

Performance (10%)

Excellent (0 deductions):

  • Efficient algorithms
  • Appropriate caching
  • No memory leaks
  • Optimized queries

Red flags:

  • N+1 queries: -1.5
  • Blocking operations in hot path: -1.0
  • Memory leaks: -1.5
  • No pagination on lists: -1.0

Security (12%)

Excellent (0 deductions):

  • Input validation on all boundaries
  • Parameterized queries
  • Secrets in environment variables
  • Proper authentication/authorization

Red flags:

  • SQL/command injection: -2.0
  • Hardcoded secrets: -2.0
  • Missing auth checks: -1.5
  • XSS vulnerabilities: -1.5

Documentation (8%)

Excellent (0 deductions):

  • Public API documented
  • Complex logic explained
  • README with setup instructions
  • Changelog maintained

Red flags:

  • No documentation: -1.5
  • Outdated docs: -1.0
  • Missing API docs: -1.0
  • No README: -0.5

SOLID Principles (10%)

Excellent (0 deductions):

  • Single responsibility classes
  • Open for extension, closed for modification
  • Proper abstractions
  • Dependency injection used

Red flags:

  • God classes: -1.5
  • Tight coupling: -1.0
  • Violation of LSP: -1.0
  • Concrete dependencies: -0.5

Dependencies (6%)

Excellent (0 deductions):

  • Minimal dependencies
  • Locked versions
  • No vulnerabilities
  • Clear dependency boundaries

Red flags:

  • CVE vulnerabilities: -2.0
  • Circular dependencies: -1.0
  • Excessive dependencies: -0.5
  • Unlocked versions: -0.5

Maintainability (8%)

Excellent (0 deductions):

  • Low cyclomatic complexity
  • DRY principle followed
  • Consistent style
  • Easy to understand

Red flags:

  • Cyclomatic complexity > 15: -1.0
  • Duplicated code: -1.0
  • Deep nesting (4+): -1.0
  • Inconsistent style: -0.5

Score Interpretation Guide

Deployment Readiness

Score RangeDeployment Decision
8-10Ready for production
7-7.9Ready with minor fixes
5-6.9Needs review and fixes
3-4.9Significant rework required
1-2.9Do not deploy

Review Actions

Score RangeRequired Actions
9-10Approve immediately
7-8.9Approve with suggestions
5-6.9Request changes
3-4.9Major revision needed
1-2.9Reject with detailed feedback

Reference Files