clean-code

Applies Clean Code principles to review, refactor, and improve code readability and maintainability.

1|Updated Jul 30, 2026
One-click install
npx skills add https://github.com/matrixNeo76/rustcopy --skill clean-code-matrixneo76
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clean-code
Source: https://github.com/matrixNeo76/rustcopy/tree/main/.agents/skills/clean-code
Command: npx skills add https://github.com/matrixNeo76/rustcopy --skill clean-code-matrixneo76

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Codebases accumulate unclear names, oversized functions, scattered error handling, and fragile tests that slow every change. This Skill provides a disciplined framework for diagnosing code quality issues and applying targeted improvements based on Robert C. Martin's Clean Code principles. ## Core Features & Use Cases - Six-Discipline Framework: Covers meaningful naming, small single-purpose functions, comment and formatting discipline, exception-based error handling, clean unit testing (TDD, F.I.R.S.T.), and a full code-smell catalog with targeted refactorings. - Scoring and Diagnostics: Rates code 0-10 against clean code criteria and provides a quick diagnostic checklist to pinpoint specific weaknesses. - Use Case: When reviewing a pull request with a 200-line function full of flag arguments and magic numbers, use this Skill to identify each smell, score the code, and get concrete refactoring steps such as extracting named helpers, splitting flag-based branches, and naming constants. ## Quick Start Review this function for clean code issues and suggest specific refactorings to improve its readability and testability.

Frequently Asked Questions about clean-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor a long function into smaller pieces?▼

Apply the Extract Till You Drop technique: pull each identifiable step into its own named function, use guard clauses for error cases, and follow the Step-Down Rule so code reads top-down from high-level to low-level abstraction. Aim for functions of 4-10 lines doing one thing.

What are the most common code smells to look for in a code review?▼

The highest-impact smells are duplication, functions with too many or flag arguments, misleading or abbreviated names, magic numbers, dead code, and feature envy. Each smell maps to a specific refactoring such as extracting shared logic, splitting functions, or renaming for intent.

Should I use exceptions or return codes for error handling?▼

Use exceptions rather than return codes, because return codes force callers to check immediately and clutter the happy path. Provide context in every exception, prefer unchecked exceptions in application code, and never return or pass null.

When are comments acceptable in clean code?▼

Comments are acceptable for legal headers, explaining why a decision was made, warnings of consequences, and tracked TODOs. Comments explaining what code does signal the code itself needs clearer naming or extraction, and commented-out code should always be deleted.

What makes a unit test clean and maintainable?▼

Clean tests follow the F.I.R.S.T. principles: Fast, Independent, Repeatable, Self-validating, and Timely. Each test covers one concept using Arrange-Act-Assert structure, has a descriptive name like shouldRejectExpiredToken, and uses builder helpers for readable setup.