clean-code

Reviews and refactors code using naming conventions, SOLID principles, and code smell detection.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/JenilRevaliya/ARGUS --skill clean-code-jenilrevaliya
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clean-code
Source: https://github.com/JenilRevaliya/ARGUS/tree/main/.agent/skills/clean-code
Command: npx skills add https://github.com/JenilRevaliya/ARGUS --skill clean-code-jenilrevaliya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Codebases accumulate unreadable naming, bloated functions, hidden duplication, and fragile error handling that slow down every future change. This Skill provides concrete, example-driven rules for reviewing code quality and refactoring it systematically. ## Core Features & Use Cases - Naming and Function Design Standards: Enforces self-documenting variable, boolean, and constant names, plus small single-purpose functions with object parameters instead of long parameter lists. - SOLID Principles with Code Examples: Demonstrates Single Responsibility, Open/Closed, and Dependency Inversion through before-and-after TypeScript examples. - Code Smell Detection and Refactoring: Maps common smells (long functions, deep nesting, magic numbers, god classes) to specific refactoring techniques like extract method and guard clauses. - Use Case: When reviewing a pull request, apply the smell-to-refactoring table to identify deep nesting and replace it with early-return guard clauses, keeping the happy path unindented. ## Quick Start Review this TypeScript module for code smells and refactor it following clean code principles.

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 ones?▼

Apply the extract method refactoring: identify each distinct responsibility in the function (validation, calculation, persistence, notification) and move each into its own named function. The original function then orchestrates calls, keeping each unit single-purpose and testable.

How to fix deep nesting in code with guard clauses?▼

Replace nested if-blocks with early returns that handle failure cases first. Each guard clause returns immediately when a precondition fails, leaving the happy path at the top indentation level and eliminating arrow-shaped code.

When should I not apply DRY to remove duplication?▼

Do not DRY code used in only one place, since premature abstraction is worse than duplication. Inline trivial one-liners when the operation is self-documenting, and only extract shared functions when duplication represents the same concept changing together.

What makes a good code comment versus a bad one?▼

Good comments explain why a decision was made, such as business rules, performance constraints, or external system behavior. Bad comments restate what the code already says, like "increment i by 1", and should be removed in favor of clearer naming.

Does the Open/Closed principle require interfaces for every class?▼

No, it applies where variation is expected, such as discount types or payment providers. Define a strategy interface so new variants are added as new classes without modifying existing code, but avoid abstracting stable single-implementation logic.