Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
asyrafhussin avatar

Clean Code Principles

  • 960 installs
  • 58 repo stars
  • Updated May 16, 2026
  • asyrafhussin/agent-skills

clean-code-principles is a code quality skill that enforces SOLID, DRY, KISS, YAGNI, and design-pattern rules during AI code generation, refactoring, and architecture reviews for developers shipping maintainable software

About

clean-code-principles is a language-agnostic agent skill (version 1.0.2, MIT) from asyrafhussin/agent-skills documenting 23 rules across 7 priority categories—10 SOLID, 12 core principles, and design patterns—with bad and good examples per rule. Categories span CRITICAL SOLID and core principles down to LOW-priority comment guidance, giving agents concrete refactoring guardrails instead of vague style advice. Activate it when generating new modules, reviewing pull requests, or refactoring legacy services where drift toward god objects and duplication is likely. The skill fits any stack because rules reference patterns, not framework APIs. A fourth pattern category is noted as planned in the documentation. Reach for clean-code-principles when you want agents to self-check architecture during implementation—not when you only need a language-specific linter config. Each rule pairs explanations with practical before-and-after snippets agents can apply immediately.

  • 23 enforceable rules across 10 SOLID, 12 Core Principles and 1 Design Pattern category
  • Language-agnostic guidance with concrete bad/good code examples for every rule
  • Organized into 7 priority tiers from CRITICAL (SOLID + Core) to LOW (Comments)
  • Activates on trigger phrases such as "review architecture", "SOLID principles", "refactoring advice" and "code smells"
  • Hard-gated review workflow that surfaces violations before code is committed

Clean Code Principles by the numbers

  • 960 all-time installs (skills.sh)
  • +64 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #129 of 1,382 Code Review & Quality skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/asyrafhussin/agent-skills --skill clean-code-principles

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs960
repo stars58
Security audit3 / 3 scanners passed
Last updatedMay 16, 2026
Repositoryasyrafhussin/agent-skills

How do you enforce SOLID principles in AI-generated code?

Enforce SOLID, DRY, KISS and design-pattern rules during code generation, refactoring and architecture reviews.

Who is it for?

Developers using AI coding agents who want SOLID, DRY, and design-pattern enforcement during generation and architecture reviews.

Skip if: Teams that only need language-specific linter configs without architectural principle guidance for agent workflows.

When should I use this skill?

The user asks for clean code review, SOLID enforcement, refactoring guidance, or design-pattern checks during AI code generation.

What you get

Refactored code aligned to 23 documented rules across SOLID, DRY, KISS, YAGNI, and design-pattern categories.

  • Rule-guided refactored code
  • Architecture review annotations
  • Bad/good example-aligned implementations

By the numbers

  • Version 1.0.2 with 23 documented rules across 7 categories
  • 10 SOLID rules plus 12 core principle rules plus design-pattern coverage

Files

SKILL.mdMarkdownGitHub ↗

Clean Code Principles

Fundamental software design principles, SOLID, design patterns, and clean code practices. Language-agnostic guidelines for writing maintainable, scalable software.

When to Apply

Reference these guidelines when:

  • Designing new features or systems
  • Reviewing code architecture
  • Refactoring existing code
  • Discussing design decisions
  • Improving code quality

Rule Categories by Priority

PriorityCategoryImpactPrefix
1SOLID PrinciplesCRITICALsolid-
2Core PrinciplesCRITICALcore-
3Design PatternsHIGHpattern-
4Code OrganizationHIGHorg-
5Naming & ReadabilityMEDIUMname-
6Functions & MethodsMEDIUMfunc-
7Comments & DocumentationLOWdoc-

Quick Reference

1. SOLID Principles (CRITICAL)

  • solid-srp - Single Responsibility Principle
  • solid-ocp - Open/Closed Principle
  • solid-lsp - Liskov Substitution Principle
  • solid-isp - Interface Segregation Principle
  • solid-dip - Dependency Inversion Principle

2. Core Principles (CRITICAL)

  • core-dry - Don't Repeat Yourself
  • core-kiss - Keep It Simple, Stupid
  • core-yagni - You Aren't Gonna Need It
  • core-separation-of-concerns - Separate different responsibilities
  • core-composition-over-inheritance - Favor composition
  • core-law-of-demeter - Principle of least knowledge
  • core-fail-fast - Detect and report errors early
  • core-encapsulation - Hide implementation details

3. Design Patterns (HIGH)

  • pattern-factory - Factory pattern for object creation
  • pattern-strategy - Strategy pattern for algorithms
  • pattern-repository - Repository pattern for data access
  • pattern-decorator - Decorator pattern for behavior extension
  • pattern-observer - Observer pattern for event handling
  • pattern-adapter - Adapter pattern for interface conversion
  • pattern-facade - Facade pattern for simplified interfaces
  • pattern-dependency-injection - DI for loose coupling

4. Code Organization (HIGH) — planned

  • org-feature-folders - Organize by feature, not layer
  • org-module-boundaries - Clear module boundaries
  • org-layered-architecture - Proper layer separation
  • org-package-cohesion - Related code together
  • org-circular-dependencies - Avoid circular imports

5. Naming & Readability (MEDIUM) — planned

  • name-meaningful - Use intention-revealing names
  • name-consistent - Consistent naming conventions
  • name-searchable - Avoid magic numbers/strings
  • name-avoid-encodings - No Hungarian notation
  • name-domain-language - Use domain terminology

6. Functions & Methods (MEDIUM) — planned

  • func-small - Keep functions small
  • func-single-purpose - Do one thing
  • func-few-arguments - Limit parameters
  • func-no-side-effects - Minimize side effects
  • func-command-query - Separate commands and queries

7. Comments & Documentation (LOW) — planned

  • doc-self-documenting - Code should explain itself
  • doc-why-not-what - Explain why, not what
  • doc-avoid-noise - No redundant comments
  • doc-api-docs - Document public APIs

Essential Guidelines

For detailed examples and explanations, see the rule files:

  • core-dry.md - Don't Repeat Yourself principle
  • pattern-repository.md - Repository pattern for data access

SOLID Principles (Summary)

PrincipleDefinition
Single ResponsibilityA class should have only one reason to change
Open/ClosedOpen for extension, closed for modification
Liskov SubstitutionSubtypes must be substitutable for base types
Interface SegregationDon't force clients to depend on unused interfaces
Dependency InversionDepend on abstractions, not concretions

Core Principles (Summary)

PrincipleDefinition
DRYDon't Repeat Yourself - single source of truth
KISSKeep It Simple - avoid over-engineering
YAGNIYou Aren't Gonna Need It - build only what's needed

Quick Examples

// Single Responsibility - one class, one job
class UserService {
  constructor(
    private validator: UserValidator,
    private repository: UserRepository,
  ) {}

  createUser(data) {
    this.validator.validate(data);
    return this.repository.create(data);
  }
}

// Dependency Inversion - depend on abstractions
interface Repository<T> {
  find(id: string): Promise<T | null>;
  save(entity: T): Promise<T>;
}

class OrderService {
  constructor(private repository: Repository<Order>) {}
}

// DRY - single source of truth
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
const isValidEmail = (email: string) => EMAIL_REGEX.test(email);

// Meaningful names over magic numbers
const MINIMUM_AGE = 18;
if (user.age >= MINIMUM_AGE) { }

Output Format

When auditing code, output findings in this format:

file:line - [principle] Description of issue

Example:

src/services/UserService.ts:15 - [solid-srp] Class handles validation, persistence, and notifications
src/utils/helpers.ts:42 - [core-dry] Email validation duplicated from validators/email.ts
src/models/Order.ts:28 - [name-meaningful] Variable 'x' should describe its purpose

How to Use

Read individual rule files for detailed explanations:

rules/solid-srp-class.md
rules/core-dry.md
rules/pattern-repository.md

References

This skill is built on established software engineering principles:

Core Books

  • Clean Code by Robert C. Martin - Foundation for clean code practices
  • Design Patterns by Gang of Four - Classic design pattern catalog
  • Refactoring by Martin Fowler - Improving code structure
  • The Pragmatic Programmer by Hunt & Thomas - Practical wisdom

Online Resources

Pattern Catalogs

Metadata

Version: 1.0.2 Status: Active Coverage: 23 rules across 3 implemented categories (SOLID, Core Principles, Design Patterns); 4 planned Last Updated: 2026-03-07

Rule Statistics

  • SOLID Principles: 10 rules
  • Core Principles: 12 rules
  • Design Patterns: 1 rule

Related skills

How it compares

Pick clean-code-principles over generic lint skills when agents need architectural SOLID and pattern guidance, not just syntax or style violations.

FAQ

How many rules does clean-code-principles include?

clean-code-principles version 1.0.2 documents 23 rules—10 SOLID, 12 core principles including DRY and KISS, and design patterns—organized across seven priority categories.

Is clean-code-principles tied to one programming language?

clean-code-principles is language-agnostic, supplying SOLID guidelines, core principles, and design patterns with bad and good examples applicable during any stack's generation or review.

When should agents activate clean-code-principles?

Activate clean-code-principles during AI code generation, refactoring sessions, and architecture reviews when maintainable, scalable design must be enforced before merge.

Is Clean Code Principles safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Code Review & Qualitybackendintegrationstesting

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.