AI skill for writing senior-engineer quality code using SOLID principles, TDD, and clean architecture. Benefits operations teams by improving code quality and maintainability. Integrates with development workflows and connects to code repositories.
git clone https://github.com/ramziddin/solid-skills.gitAI skill for writing senior-engineer quality code using SOLID principles, TDD, and clean architecture. Benefits operations teams by improving code quality and maintainability. Integrates with development workflows and connects to code repositories.
1. **Define Requirements**: Clearly specify the functionality you need in [FUNCTIONALITY_DESCRIPTION]. Include any specific design patterns or architectural constraints. 2. **Select Tools**: Choose your [PROGRAMMING_LANGUAGE], [TEST_FRAMEWORK], and [DESIGN_PATTERN] based on your project needs. For Python, common choices are pytest for testing and dependency-injector for DI. 3. **Run the Skill**: Paste the prompt into your AI assistant with your specific requirements filled in. Review the generated code structure and tests. 4. **Implement**: Use the generated structure as a starting point. The code will follow SOLID principles and clean architecture by default. Fill in the actual business logic where indicated. 5. **Integrate**: Connect the generated code to your existing codebase. The dependency injection container can be configured to use your production repositories. Tips: - For microservices, emphasize interface segregation and dependency inversion - For monoliths, focus on single responsibility and open/closed principles - Always review generated tests and add edge cases specific to your domain
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/ramziddin/solid-skillsCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Write a [PROGRAMMING_LANGUAGE] function/class that adheres to SOLID principles and follows Test-Driven Development (TDD) practices. The code should implement [FUNCTIONALITY_DESCRIPTION] while maintaining clean architecture. Include unit tests using [TEST_FRAMEWORK]. Structure the project with clear separation of concerns and dependency injection where applicable. Use [DESIGN_PATTERN] where it improves maintainability. Document the code with comments explaining the design decisions related to SOLID principles.
```python
# File: src/order_processor/domain/order.py
from dataclasses import dataclass
from abc import ABC, abstractmethod
@dataclass
class OrderItem:
product_id: str
quantity: int
unit_price: float
class OrderRepository(ABC):
@abstractmethod
def save(self, order: 'Order') -> None:
pass
class InMemoryOrderRepository(OrderRepository):
def __init__(self):
self.orders = []
def save(self, order: 'Order') -> None:
self.orders.append(order)
class Order:
def __init__(self, order_id: str, customer_id: str, items: list[OrderItem]):
self.order_id = order_id
self.customer_id = customer_id
self.items = items
def calculate_total(self) -> float:
return sum(item.quantity * item.unit_price for item in self.items)
# File: src/order_processor/services/order_service.py
from dependency_injector import containers, providers
from order_processor.domain.order import Order, OrderRepository
class OrderService:
def __init__(self, repository: OrderRepository):
self.repository = repository
def create_order(self, order_id: str, customer_id: str, items: list[OrderItem]) -> Order:
order = Order(order_id, customer_id, items)
self.repository.save(order)
return order
class Container(containers.DeclarativeContainer):
repository = providers.Singleton(OrderRepository, InMemoryOrderRepository)
order_service = providers.Factory(OrderService, repository=repository)
```
```python
# File: tests/test_order_processor.py
import pytest
from order_processor.domain.order import OrderItem, Order
from order_processor.services.order_service import OrderService, InMemoryOrderRepository
def test_order_creation():
items = [OrderItem("prod1", 2, 10.0), OrderItem("prod2", 1, 15.0)]
order = Order("order123", "cust456", items)
assert order.calculate_total() == 35.0
assert len(order.items) == 2
def test_order_service_creates_order():
repository = InMemoryOrderRepository()
service = OrderService(repository)
items = [OrderItem("prod1", 2, 10.0)]
order = service.create_order("order123", "cust456", items)
assert order.order_id == "order123"
assert len(repository.orders) == 1
```
```markdown
## Design Decisions:
1. **Single Responsibility Principle (SRP)**:
- `Order` class handles only order data and calculations
- `OrderRepository` interface defines persistence contract
- `OrderService` handles business logic
2. **Open/Closed Principle (OCP)**:
- Repository pattern allows adding new storage implementations without modifying existing code
3. **Liskov Substitution Principle (LSP)**:
- `InMemoryOrderRepository` can replace any `OrderRepository` implementation
4. **Interface Segregation Principle (ISP)**:
- `OrderRepository` interface is minimal and focused
5. **Dependency Inversion Principle (DIP)**:
- High-level `OrderService` depends on abstraction (`OrderRepository`) not concrete implementation
## Clean Architecture:
- Domain layer contains business logic and entities
- Service layer contains application-specific business rules
- Infrastructure layer (not shown) would contain concrete implementationsCustom software development for data, engagement, and automation
IronCalc is a spreadsheet engine and ecosystem
ITIL-aligned IT service management platform
Customer feedback management made simple
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan