SOLID Principles Architect
Install this skill
npx skills add SmidigStorm/regelverk-pythonWorks across Claude Code, Cursor, Codex, Copilot & Antigravity
What this skill does
- •Detects violations of SRP, OCP, LSP, ISP, and DIP in existing class hierarchies
- •Suggests structural refactorings for monolithic or overly complex classes
- •Promotes the use of Python Protocols and Abstract Base Classes for loose coupling
- •Provides actionable checklists for code reviews focused on maintainability
- •Guides the transition from concrete implementation dependencies to abstraction-based design
When to use it
- ✓During code reviews when classes grow beyond 200 lines
- ✓When adding new features requires modifying existing, stable logic
- ✓When unit testing is blocked by tight coupling or excessive external dependencies
- ✓When designing new systems that need to remain extensible
When not to use it
- ✕For rapid prototyping or throwaway scripts where architecture is secondary to speed
- ✕In highly performance-constrained code where abstraction overhead is unacceptable
- ✕For extremely small, single-purpose functions that do not involve OOP
How to invoke it
Example prompts that trigger this skill:
- “Analyze this module and identify any SOLID principle violations.”
- “Help me refactor these classes to adhere to the Interface Segregation Principle.”
- “Review this codebase for tight coupling and suggest how to apply Dependency Inversion.”
- “Refactor this rule engine class to follow the Open/Closed principle.”
- “Check if my current class hierarchy violates Liskov Substitution.”
Example workflow
- Load the relevant source files into the context.
- Prompt the agent to perform an architectural audit of the target modules.
- Review the identified violations and the proposed refactoring strategy.
- Apply the suggested code changes to split interfaces or introduce abstractions.
- Run existing test suites to confirm that functional behavior remains unchanged.
Prerequisites
- –Basic knowledge of Python object-oriented programming
- –Existing codebase with class structures
Pitfalls & limitations
- !Over-engineering: applying complex abstractions to code that does not need them
- !Increased file counts: splitting large classes into many small modules can overwhelm navigation
- !Performance overhead: excessive use of abstract layers can impact hot code paths
FAQ
How it compares
Unlike a generic code review prompt, this skill forces the agent to analyze the structure against specific architectural rules, resulting in higher-quality refactoring suggestions rather than simple cleanup.
Source & trust
From the source: “# SOLID Principles Skill You are assisting with code that must follow SOLID principles strictly. ## Principles to Enforce ### 1. Single Responsibility Principle (SRP) - Each class should have ONE reason to change - Each function should do ONE thing well - Separate concerns: business logic, data acce…”
View the full SKILL.md source
# SOLID Principles Skill You are assisting with code that must follow SOLID principles strictly. ## Principles to Enforce ### 1. Single Responsibility Principle (SRP) - Each class should have ONE reason to change - Each function should do ONE thing well - Separate concerns: business logic, data access, presentation, validation - If a class name contains "and" or "or", it likely violates SRP **Red flags:** - Classes with multiple unrelated methods - Functions doing multiple operations - Mixed concerns (e.g., validation + persistence in same method) ### 2. Open/Closed Principle (OCP) - Open for extension, closed for modification - Use abstract base classes and protocols for extensibility - Prefer composition over inheritance - New features should be added by extending, not modifying existing code **Patterns to use:** - Strategy pattern for varying algorithms - Template method for varying steps - Dependency injection for varying implementations ### 3. Liskov Substitution Principle (LSP) - Subtypes must be substitutable for their base types - Derived classes must not strengthen preconditions - Derived classes must not weaken postconditions - Avoid empty implementations or NotImplementedError in production code **Guidelines:** - Don't override methods to do nothing - Maintain expected behavior contracts - Use composition when inheritance doesn't fit naturally ### 4. Interface Segregation Principle (ISP) - Clients should not depend on interfaces they don't use - Create focused, cohesive protocols/abstract classes - Many small interfaces > one large interface - Use Python Protocols for implicit interfaces **Implementation:** - Split large interfaces into role-specific ones - Use Protocol from typing module - Avoid "fat" base classes with many optional methods ### 5. Dependency Inversion Principle (DIP) - High-level modules should not depend on low-level modules - Both should depend on abstractions (protocols, abstract classes) - Abstractions should not depend on details - Details should depend on abstractions **Patterns:** - Constructor injection for required dependencies - Use abstract base classes or Protocols - Depend on interfaces, not concrete implementations ## Code Review Checklist When reviewing or writing code, check: - [ ] Does each class have a single, clear responsibility? - [ ] Can new behavior be added without modifying existing code? - [ ] Can subclasses replace their parents without breaking functionality? - [ ] Are interfaces focused and cohesive? - [ ] Do modules depend on abstractions rather than concrete implementations? ## Practical Application for Admission Rules System For the Norwegian admission rules system: - **SRP**: Separate rule evaluation, grade calculation, quota management - **OCP**: Make rules extensible (new admission rules without changing core engine) - **LSP**: All rule types should be substitutable - **ISP**: Separate interfaces for validators, calculators, reporters - **DIP**: Depend on abstract rule interfaces, not concrete rule implementations ## Response Format When applying SOLID principles: 1. Identify which principle(s) are relevant 2. Explain the violation if any exists 3. Provide refactored code following the principle(s) 4. Explain the benefit of the refactoring
Quoted from SmidigStorm/regelverk-python for reference — see the original for the authoritative, latest version.
📄 Full skill instructions — original source: SmidigStorm/regelverk-python
How to Use This Skill Unit
Option A: Project-Specific (Recommended)
- Click "Download" above
- In your project, create the directory:
.agent/skills/solid-principles/ - Save the file as
SKILL.md - The agent will automatically discover the skill based on its description.
Option B: Global Installation (All Agents)
Save the file to these locations to make it available across all projects:
- Claude Code:
~/.claude/skills/SmidigStorm/regelverk-python/solid-principles/SKILL.md - Cursor:
~/.cursor/skills/SmidigStorm/regelverk-python/solid-principles/SKILL.md - Antigravity:
~/.gemini/antigravity/skills/SmidigStorm/regelverk-python/solid-principles/SKILL.md
🚀 Install with CLI:npx skills add SmidigStorm/regelverk-python