clean-code

Enforce pragmatic coding standards for concise, maintainable code.

Updated Dec 22, 2025
One-click install
npx skills add https://github.com/alaminmain/DoorAuthServer --skill clean-code-alaminmain
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-code
Source: https://github.com/alaminmain/DoorAuthServer/tree/main/.agent/skills/clean-code
Command: npx skills add https://github.com/alaminmain/DoorAuthServer --skill clean-code-alaminmain

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers write concise, maintainable code by enforcing pragmatic coding standards and avoiding over-engineering or unnecessary comments.

Core Features & Use Cases

  • SRP: Single Responsibility - each function/class does ONE thing
  • DRY: Don't Repeat Yourself - extract duplicates, reuse
  • KISS: Keep It Simple - simplest solution that works
  • YAGNI: You Aren't Gonna Need It - don't build unused features
  • Boy Scout: Leave code cleaner than you found it
  • Naming Rules: use descriptive names for variables, functions, and constants
  • Code Structure: favor guard clauses, avoid deep nesting, prefer small, composable functions

Quick Start

Integrate the clean-code guidelines into your codebase:

  • Review the next module you touch and identify any functions that violate SRP or exceed two levels of nesting.
  • Refactor to smaller, testable units and add guard clauses where appropriate.
  • Remove obvious or redundant comments; ensure the code self-documents through clear naming.

Frequently Asked Questions about clean-code

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

FAQPage Schema
Why remove redundant comments when writing maintainable code?

To refactor code following SRP and DRY principles, break down functions exceeding two levels of nesting into smaller, single-responsibility units. Extract duplicated logic for reuse, add guard clauses to minimize nesting, and ensure descriptive naming eliminates redundant comments.

How do I refactor code to follow SRP and DRY principles?

To refactor code following SRP and DRY principles, break down functions exceeding two levels of nesting into smaller, single-responsibility units. Extract duplicated logic for reuse, add guard clauses to minimize nesting, and ensure descriptive naming eliminates redundant comments.

What is the best way to prevent deep nesting during feature development?

The best way to prevent deep nesting is to implement guard clauses that exit early from functions. Favor flat structures and small, composable functions, ensuring each function does one thing and avoids exceeding two levels of nesting.

Can I apply clean code standards like KISS and YAGNI across mainstream languages?

Yes, you can apply clean code standards like KISS and YAGNI across mainstream languages. These pragmatic coding standards are language-agnostic, enforcing simple solutions, avoiding unused features, and guiding code reviews and refactoring universally.

When should I use guard clauses instead of conditional nesting?

Use guard clauses instead of conditional nesting to maintain a flat structure and improve readability. Guard clauses check for edge cases early and exit immediately, preventing deep nested if-else blocks and keeping the main logic clear.

Why remove redundant comments when writing maintainable code?

Remove redundant comments because code should self-document through clear, descriptive naming for variables and functions. Enforcing this clean code standard ensures maintainability without obvious or unnecessary comments that clutter the codebase.