PluginBench
Skill
Pass
Audit score 90

clean-code

sickn33/antigravity-awesome-skills

Apply Uncle Bob's Clean Code principles to write, review, and refactor more readable, maintainable code.

What is clean-code?

This skill applies the principles from Robert C. Martin's 'Clean Code' book to help write, review, and refactor code for readability and maintainability. It covers naming, functions, comments, formatting, error handling, unit testing, and class design, plus a practical checklist for applying these standards.

  • Guides naming of variables, functions, and classes to be intention-revealing and unambiguous
  • Provides rules for writing small, single-purpose functions with minimal arguments
  • Distinguishes good vs bad comments and encourages self-documenting code
  • Covers formatting, object/data structure design (including the Law of Demeter), and error handling practices
  • Outlines unit testing principles (TDD laws, F.I.R.S.T.) and class design (SRP, Stepdown Rule)
  • Lists common code smells (rigidity, fragility, immobility, viscosity, needless complexity/repetition) and an implementation checklist

How to install clean-code

npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill clean-code
Claude Code
Cursor
Windsurf
Cline

How to use clean-code

  1. 1.Invoke the skill when writing new code, reviewing a PR, or refactoring legacy code
  2. 2.Apply the naming, function, comment, formatting, and class-design principles described to the code in question
  3. 3.Run through the Implementation Checklist (function size, single responsibility, naming, comments, argument count, test coverage) before finalizing changes
  4. 4.Use the smells and heuristics section to identify rigidity, fragility, immobility, viscosity, or needless complexity/repetition
  5. 5.Validate results with environment-specific testing and expert review since the skill itself does not substitute for these

Use cases

Good for
  • Writing new code with high-quality naming and structure from the start
  • Reviewing pull requests with principle-based, constructive feedback
  • Refactoring legacy code to remove code smells like rigidity and needless complexity
  • Aligning a team on industry-standard coding best practices
  • Running through a checklist before finalizing a code change
Who it's for
  • Software developers writing new code
  • Code reviewers evaluating pull requests
  • Engineers refactoring legacy codebases
  • Teams establishing or aligning on coding standards

clean-code FAQ

Does this skill automatically refactor my code?

It provides principle-based guidance and checklists for naming, functions, comments, error handling, and class design; it's meant to guide writing and reviewing code, not to act as a fully automated refactoring tool.

Is this based on a specific book or methodology?

Yes, it's based on 'Clean Code' by Robert C. Martin (Uncle Bob), covering meaningful names, small functions, comments, formatting, objects/data structures, error handling, unit tests, classes, and code smells.

Can I use this for code review feedback?

Yes, it's designed to help provide constructive, principle-based feedback when reviewing pull requests.

Does it replace testing or environment-specific validation?

No, per its limitations it should not be treated as a substitute for testing, validation, or expert review.

Full instructions (SKILL.md)

Source of truth, from sickn33/antigravity-awesome-skills.


name: clean-code description: "This skill embodies the principles of "Clean Code" by Robert C. Martin (Uncle Bob). Use it to transform "code that works" into "code that is clean."" risk: safe source: "ClawForge (https://github.com/jackjin1997/ClawForge)" date_added: "2026-02-27"

Clean Code Skill

This skill embodies the principles of "Clean Code" by Robert C. Martin (Uncle Bob). Use it to transform "code that works" into "code that is clean."

🧠 Core Philosophy

"Code is clean if it can be read, and enhanced by a developer other than its original author." — Grady Booch

When to Use

Use this skill when:

  • Writing new code: To ensure high quality from the start.
  • Reviewing Pull Requests: To provide constructive, principle-based feedback.
  • Refactoring legacy code: To identify and remove code smells.
  • Improving team standards: To align on industry-standard best practices.

1. Meaningful Names

  • Use Intention-Revealing Names: elapsedTimeInDays instead of d.
  • Avoid Disinformation: Don't use accountList if it's actually a Map.
  • Make Meaningful Distinctions: Avoid ProductData vs ProductInfo.
  • Use Pronounceable/Searchable Names: Avoid genymdhms.
  • Class Names: Use nouns (Customer, WikiPage). Avoid Manager, Data.
  • Method Names: Use verbs (postPayment, deletePage).

2. Functions

  • Small!: Functions should be shorter than you think.
  • Do One Thing: A function should do only one thing, and do it well.
  • One Level of Abstraction: Don't mix high-level business logic with low-level details (like regex).
  • Descriptive Names: isPasswordValid is better than check.
  • Arguments: 0 is ideal, 1-2 is okay, 3+ requires a very strong justification.
  • No Side Effects: Functions shouldn't secretly change global state.

3. Comments

  • Don't Comment Bad Code—Rewrite It: Most comments are a sign of failure to express ourselves in code.
  • Explain Yourself in Code:
    # Check if employee is eligible for full benefits
    if employee.flags & HOURLY and employee.age > 65:
    
    vs
    if employee.isEligibleForFullBenefits():
    
  • Good Comments: Legal, Informative (regex intent), Clarification (external libraries), TODOs.
  • Bad Comments: Mumbling, Redundant, Misleading, Mandated, Noise, Position Markers.

4. Formatting

  • The Newspaper Metaphor: High-level concepts at the top, details at the bottom.
  • Vertical Density: Related lines should be close to each other.
  • Distance: Variables should be declared near their usage.
  • Indentation: Essential for structural readability.

5. Objects and Data Structures

  • Data Abstraction: Hide the implementation behind interfaces.
  • The Law of Demeter: A module should not know about the innards of the objects it manipulates. Avoid a.getB().getC().doSomething().
  • Data Transfer Objects (DTO): Classes with public variables and no functions.

6. Error Handling

  • Use Exceptions instead of Return Codes: Keeps logic clean.
  • Write Try-Catch-Finally First: Defines the scope of the operation.
  • Don't Return Null: It forces the caller to check for null every time.
  • Don't Pass Null: Leads to NullPointerException.

7. Unit Tests

  • The Three Laws of TDD:
    1. Don't write production code until you have a failing unit test.
    2. Don't write more of a unit test than is sufficient to fail.
    3. Don't write more production code than is sufficient to pass the failing test.
  • F.I.R.S.T. Principles: Fast, Independent, Repeatable, Self-Validating, Timely.

8. Classes

  • Small!: Classes should have a single responsibility (SRP).
  • The Stepdown Rule: We want the code to read like a top-down narrative.

9. Smells and Heuristics

  • Rigidity: Hard to change.
  • Fragility: Breaks in many places.
  • Immobility: Hard to reuse.
  • Viscosity: Hard to do the right thing.
  • Needless Complexity/Repetition.

🛠️ Implementation Checklist

  • Is this function smaller than 20 lines?
  • Does this function do exactly one thing?
  • Are all names searchable and intention-revealing?
  • Have I avoided comments by making the code clearer?
  • Am I passing too many arguments?
  • Is there a failing test for this change?

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.