clean-code

Enforce naming, function size, error handling, and testing discipline in code reviews.

Updated Apr 18, 2026
One-click install
npx skills add https://github.com/sachio222/based-stack --skill clean-code-sachio222
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-code
Source: https://github.com/sachio222/based-stack/tree/main/clean-code
Command: npx skills add https://github.com/sachio222/based-stack --skill clean-code-sachio222

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Write readable, maintainable code through disciplined naming, small functions, and clean error handling. Use when the user mentions "code review", "naming conventions", "function too long", "code smells", or "readable code". Covers SRP, comment discipline, formatting, and unit testing. For refactoring techniques, see refactoring-patterns. For architecture, see clean-architecture.

Core Features & Use Cases

  • Meaningful Names: Names reveal intent and reduce confusion across the codebase.
  • Small Functions: Prefer 4-6 lines, zero to two arguments, no side effects, single abstraction level.
  • Error Handling & Testing: Separate concerns; use exceptions; promote robust unit tests.
  • Refactoring Guide: Use the Boy Scout Rule and Extract Till You Drop to incrementally improve code quality.
  • Code Smells Awareness: Detect and address duplication, misabstraction, and unsafe patterns using the included references.

Quick Start

Apply the clean-code principles in your next code change to improve readability and maintainability.

Frequently Asked Questions about clean-code

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

FAQPage Schema
How do I improve code readability and maintainability during a code review?

To improve code readability during a code review, enforce meaningful naming conventions, small functions with zero to two arguments, and clean error handling to eliminate code smells and reduce confusion across the codebase.

What is the Single Responsibility Principle and how does it affect function size?

The Single Responsibility Principle (SRP) dictates that functions should operate at a single abstraction level. Applying SRP means preferring functions of four to six lines with no side effects, ensuring code remains maintainable and focused.

How do I refactor a long function to eliminate code smells?

Refactor a long function by applying the Boy Scout Rule and Extract Till You Drop technique. Incrementally extract small, single-level functions to address misabstraction, remove duplication, and improve overall code quality.

How should error handling and unit testing be structured in clean code?

Error handling and unit testing should be structured by separating concerns and using exceptions. This separation promotes robust unit tests, ensuring your codebase remains reliable and maintainable without mixing business logic with error management.

Does this clean code approach apply to architecture planning across software teams?

Yes, this clean code approach applies directly to architecture planning across software teams. It enforces naming, function size, and testing discipline, ensuring architectural designs remain readable and maintainable at scale. For deeper structural design, consider clean-architecture.

When should I not use clean code refactoring techniques?

Avoid applying clean code refactoring techniques like Extract Till You Drop when functions already operate at a single abstraction level or when incremental changes would introduce unsafe patterns and break existing unit tests.