clean-code-principles

Clean Code Refactoring Detection

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "clean-code-principles" with this command: npx skills add emvnuel/skill.md/emvnuel-skill-md-clean-code-principles

Clean Code Refactoring Detection

Identify opportunities to apply Clean Code principles based on Robert C. Martin's guidelines.

Naming

Meaningful Names

Detect: Single-letter variables, abbreviations, temp /data /info suffixes

Refactor: Intention-revealing names that explain purpose

Cookbook: meaningful-names.md

Pronounceable Names

Detect: Unpronounceable abbreviations (genymdhms , modymdhms )

Refactor: Names that can be discussed verbally

Cookbook: meaningful-names.md

Searchable Names

Detect: Magic numbers, single-letter constants

Refactor: Named constants with clear purpose

Cookbook: meaningful-names.md

Functions

Small Functions

Detect: Methods longer than 20 lines, multiple levels of abstraction

Refactor: Extract smaller, single-purpose functions

Cookbook: small-functions.md

Single Responsibility

Detect: Functions doing multiple unrelated tasks

Refactor: One function, one responsibility, one level of abstraction

Cookbook: small-functions.md

Few Arguments

Detect: Functions with more than 3 arguments

Refactor: Parameter objects, builder pattern, method extraction

Cookbook: function-arguments.md

No Side Effects

Detect: Functions that modify global state or input parameters

Refactor: Pure functions, explicit state changes

Cookbook: side-effects.md

Command Query Separation

Detect: Functions that both change state AND return values

Refactor: Separate commands (void) from queries (return value)

Cookbook: command-query-separation.md

Comments

Self-Documenting Code

Detect: Comments explaining "what" instead of code explaining itself

Refactor: Rename variables and extract methods to make intent clear

Cookbook: comments.md

Useful Comments

Detect: Commented-out code, redundant comments, changelog in code

Refactor: Legal/license comments, intent explanation, TODO with tickets

Cookbook: comments.md

Error Handling

Exceptions Over Error Codes

Detect: Methods returning error codes or status flags

Refactor: Throw specific, descriptive exceptions

Cookbook: error-handling.md

Unchecked Exceptions

Detect: Checked exceptions creating coupling

Refactor: Runtime exceptions with meaningful messages

Cookbook: error-handling.md

Don't Return Null

Detect: Methods returning null for error/empty cases

Refactor: Optional<T> , empty collections, Null Object pattern

Cookbook: null-handling.md

Don't Pass Null

Detect: null passed as method argument

Refactor: Overloaded methods, default values, Optional parameters

Cookbook: null-handling.md

Classes

Single Responsibility (SRP)

Detect: Classes with multiple reasons to change, mixed concerns

Refactor: Separate classes for distinct responsibilities

Cookbook: single-responsibility.md

Cohesion

Detect: Methods not using instance variables, unrelated fields

Refactor: Extract related fields/methods into new classes

Cookbook: cohesion.md

Small Classes

Detect: Classes with 200+ lines or 10+ methods

Refactor: Identify hidden responsibilities, extract collaborators

Cookbook: small-classes.md

Code Smells

Long Method

Detect: Methods exceeding 20 lines

Refactor: Extract Method until each does one thing

Cookbook: long-method.md

Primitive Obsession

Detect: Strings for emails/phone/money, parallel arrays

Refactor: Value objects, domain-specific types

Cookbook: primitive-obsession.md

Feature Envy

Detect: Method uses more data from other class than its own

Refactor: Move method to the class it envies

Cookbook: feature-envy.md

Data Clumps

Detect: Same group of parameters passed together repeatedly

Refactor: Parameter object or extract class

Cookbook: data-clumps.md

Divergent Change

Detect: Class changes for unrelated reasons

Refactor: Split class by responsibility

Cookbook: divergent-change.md

Shotgun Surgery

Detect: One change requires many small edits across classes

Refactor: Consolidate related logic into single class

Cookbook: shotgun-surgery.md

Quick Reference Table

Principle Detection Signal Clean Code Solution

Meaningful Names Single-letter vars, abbreviations Intention-revealing names

Small Functions Methods > 20 lines Extract, one level of abstraction

Few Arguments

3 parameters Parameter objects, builder

No Side Effects Modifies global/input state Pure functions

Command Query Sep. Function changes state AND returns Separate commands from queries

Self-Documenting Comments explain "what" Rename, extract methods

Exceptions Error codes, status flags Specific exceptions

Don't Return Null Null for errors/empty Optional, empty collections

Single Responsibility Multiple reasons to change Separate classes

Cohesion Methods don't use instance vars Extract new classes

Long Method

20 lines Extract Method

Primitive Obsession Strings for domain types Value objects

Feature Envy Uses external class data Move method

Data Clumps Repeated parameter groups Parameter object

Boy Scout Rule

Leave the code cleaner than you found it.

Apply opportunistic refactoring:

  • Fix one naming issue

  • Extract one long method

  • Remove one piece of dead code

  • Add one missing null check

Cookbook Index

Clean Code recipes with practical examples:

Naming: Meaningful Names

Functions: Small Functions · Function Arguments · Side Effects · Command Query Separation

Comments: Comments

Error Handling: Error Handling · Null Handling

Classes: Single Responsibility · Cohesion · Small Classes

Code Smells: Long Method · Primitive Obsession · Feature Envy · Data Clumps · Divergent Change · Shotgun Surgery

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

quarkus-panache-smells

No summary provided by upstream source.

Repository SourceNeeds Review
General

lombok-patterns

No summary provided by upstream source.

Repository SourceNeeds Review
General

mapstruct-patterns

No summary provided by upstream source.

Repository SourceNeeds Review