Skip to content
Back to skills

Clean Code Architect

ASecurity

Write maintainable, SOLID code with proper design patterns, refactoring techniques, and clean architecture principles. Use when starting new projects, refactoring legacy code, or reviewing architectural decisions.

  • 11 stars
  • 0 votes
  • 0 copies
  • 7 views
  • Added September 10, 2026
code-qualitygorefactoringgitapi

Works with

  • claude code
  • cursor
  • api

Security analysis

A100/100

Scanned September 10, 2026

npx -y skills add luokai0/ai-agent-skills-by-luo-kai --skill clean-code-architect --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Clean Code Architect?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Clean Code Architect
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/luokai0-clean-code-architect/badge)](https://www.skillsdirectory.com/skills/luokai0-clean-code-architect)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: clean-code-architect
description: Write maintainable, SOLID code with proper design patterns, refactoring techniques, and clean architecture principles. Use when starting new projects, refactoring legacy code, or reviewing architectural decisions.
license: CC0-1.0
compatibility: Works with Cursor, Windsurf, GitHub Copilot, Claude Code, and any AI coding assistant
metadata:
  author: skillsdirectory
  version: "1.0"
  category: coding
  tools: cursor, windsurf, copilot, claude-code
---

# Clean Code Architect

You write code that other developers love to read and maintain. You follow SOLID principles and proven design patterns.

## SOLID Principles

### S — Single Responsibility
Every class/function does ONE thing well.
```
❌ UserService: handles auth, email, billing, reports
✅ AuthService, EmailService, BillingService (separate)
```

### O — Open/Closed
Open for extension, closed for modification.
```
❌ if (type === 'email') ... else if (type === 'sms') ...
✅ NotificationStrategy interface → EmailStrategy, SmsStrategy
```

### L — Liskov Substitution
Subtypes must be substitutable for their base types.

### I — Interface Segregation
Many specific interfaces > one general interface.

### D — Dependency Inversion
Depend on abstractions, not implementations.

## Clean Code Rules

### Naming
- **Variables**: Descriptive, reveal intent → `remainingTrials` not `rt`
- **Functions**: Verb + noun → `calculateTotalPrice()` not `process()`
- **Classes**: Noun → `OrderProcessor` not `DoStuff`
- **Booleans**: Question form → `isActive`, `hasPermission`, `canEdit`
- **Constants**: UPPER_SNAKE → `MAX_RETRY_COUNT`

### Functions
- Max 20 lines (ideally under 10)
- Max 3 parameters (use object for more)
- One level of abstraction per function
- No side effects (pure functions when possible)
- Early returns over nested conditions

### Comments
- Code should be self-documenting
- Comments explain WHY, not WHAT
- Delete commented-out code (version control exists)
- Docstrings for public APIs only

### Error Handling
- Fail fast — validate inputs early
- Use exceptions for exceptional cases only
- Custom error types with context
- Never swallow errors silently

## Design Patterns to Use

| Pattern | When to Use |
|---|---|
| **Strategy** | Swappable algorithms (sorting, validation) |
| **Observer** | Event-driven communication |
| **Factory** | Complex object creation |
| **Repository** | Data access abstraction |
| **Adapter** | Integration with third-party APIs |
| **Builder** | Complex object construction |

## Refactoring Signals

- Function > 20 lines → Extract Method
- Class > 200 lines → Extract Class
- 3+ parameters → Parameter Object
- Repeated code → Extract & Reuse
- Deep nesting → Early Return / Guard Clauses
- Switch statements → Strategy Pattern

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.