clean-code

Enforce DRY and SOLID coding standards when writing, reviewing, or refactoring software.

2|Updated Aug 8, 2024
One-click install
npx skills add https://github.com/walid-mos/mac-config --skill clean-code-walid-mos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-code
Source: https://github.com/walid-mos/mac-config/tree/main/claude/.claude/skills/clean-code
Command: npx skills add https://github.com/walid-mos/mac-config --skill clean-code-walid-mos

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses the challenges of writing code that is difficult to maintain, understand, and extend by enforcing DRY and SOLID principles, leading to higher quality software.

Core Features & Use Cases

  • DRY Enforcement: Guides developers on when and how to extract duplicated code, ensuring a single source of truth for business logic.
  • SOLID Principles Application: Provides clear guidelines for adhering to Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion.
  • Code Quality Best Practices: Offers actionable advice on naming, function design, module structure, error handling, and commenting.
  • Use Case: When refactoring a complex module, consult this Skill to ensure new abstractions adhere to SOLID principles and that duplication is managed effectively.

Quick Start

Apply the clean-code skill to refactor the attached code snippet, focusing on DRY and SOLID principles.

Frequently Asked Questions about clean-code

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

FAQPage Schema
How do I apply SOLID principles when refactoring a complex software module?

To apply SOLID principles during refactoring, enforce Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion to ensure new abstractions are maintainable. This provides clear guidelines for structuring modules and managing dependencies.

What is the best way to identify and remove duplicated code to improve maintainability?

The best way to remove duplicated code is by enforcing DRY (Don't Repeat Yourself) standards to extract repeated logic, ensuring a single source of truth for business logic. This maintains a single source of truth for business logic and reduces maintenance overhead.

What are the key refactoring signals for poor code quality in software engineering?

Key refactoring signals include violations of DRY and SOLID principles, such as duplicated business logic, overly complex functions, or modules handling multiple responsibilities. Addressing these signals improves naming, function design, and module structure.

How does following clean code standards affect error handling and code reviews?

Following clean code standards improves error handling and code reviews by providing actionable best practices for naming, function design, and commenting. This ensures software adheres to DRY and SOLID guidelines, leading to higher quality and more understandable code.

Can I use DRY and SOLID guidelines for reviewing existing codebases?

Yes, you can use DRY and SOLID guidelines to review existing codebases by checking for duplicated logic and adherence to Single Responsibility, Open/Closed, and Dependency Inversion principles. This enforces higher quality software during active code review and refactoring.