solid
Clean Code Principles
Apply principles as constraints, not dogma. Prefer measurable maintainability over theoretical purity.
Use This Skill When
- Refactoring complex modules with coupling and duplication.
- Reviewing architecture decisions or PR quality.
- Designing reusable TypeScript services/components.
Principles to Apply
SOLID
- SRP: one reason to change per unit.
- OCP: extend behavior without modifying stable core.
- LSP: subtype must preserve contract behavior.
- ISP: small consumer-focused interfaces.
- DIP: depend on abstractions, not concrete details.
Supporting Rules
- DRY: remove duplicated business logic.
- KISS: prefer simple control flow and explicit naming.
- YAGNI: avoid speculative abstractions.
Refactor Workflow
- Detect smells:
- large functions/classes
- feature envy
- repeated condition branches
- temporal coupling
- Write/extend tests around current behavior.
- Extract boundaries:
- interfaces
- services
- adapters
- Reduce responsibilities and dependencies.
- Re-run tests and compare behavior.
Code Review Checklist
- Does this change reduce or increase coupling?
- Are contracts explicit and stable?
- Is duplication reduced meaningfully?
- Are dependencies inverted where needed?
- Is complexity lower than before?
Output Requirements for Agent
- Identify concrete smells with file-level evidence.
- Recommend smallest safe refactor sequence.
- State tradeoffs and migration risks.
- Provide test strategy for behavior preservation.
References
- Detailed examples and before/after refactors:
references/guide.md
More from alicoder001/agent-skills
reasoning
Chain-of-thought reasoning, self-reflection, and systematic problem-solving patterns for AI agents. Use before any complex task to ensure logical and accurate solutions.
38typescript
TypeScript strict mode patterns, naming conventions, and type safety rules. Use when writing TypeScript code, defining types, or reviewing TypeScript projects. Includes generics, utility types, and best practices.
35collaboration
Multi-agent communication, task delegation, and coordination patterns. Use when working with multiple agents or complex collaborative workflows.
27security
Security best practices for web applications. Use when handling user input, authentication, or sensitive data. Covers XSS, SQL injection, CSRF, environment variables, and secure coding patterns.
22memory
Working memory management, context prioritization, and knowledge retention patterns for AI agents. Use when you need to maintain relevant context and avoid information loss during long tasks.
22react-vite
React + Vite SPA development patterns including project setup, configuration, and optimization. Use for building single-page applications with Vite bundler.
22