- Home
- Skills
- Agents & Orchestration
- code design
code design
Architect maintainable systems using evolutionary design, SOLID principles, and clean package topology.
Free
Works with the AI Agents you already use
code design
Example session with this skill installed
Design a notification system module. I need to handle Email and SMS, but it should be easy to add WhatsApp later. Organize the packages and define the core interfaces using OO principles.
- Read your context and instructions
- Compiled the code design
I have designed the notification system module using evolutionary design principles. The structure prioritizes the Open-Closed Principle (OCP) for future extensions like WhatsApp and enforces Dependency Inversion (DIP) to decouple the sender logic from the business triggers.
Notification System Design
1. Package Topology
| Package | Responsibility | Principle Applied |
|---|---|---|
com.system.notify.api | Public interfaces and DTOs. | CRP (Common Reuse) |
com.system.notify.core | Dispatcher logic and contract enforcement. | CCP (Common Closure) |
com.system.notify.provider | Concrete implementations (Email, SMS). | OCP (Open-Closed) |
2. Core Contracts and Modeling
/**
* Role-based interface for notification providers.
* Following ISP: clients only depend on the send capability.
*/
interface NotificationProvider {
/**
* Precondition: recipient must be valid format; content non-empty.
* Postcondition: returns a Receipt with provider-specific ID.
*/
send(recipient: string, message: Message): Promise<Receipt>;
supports(type: ChannelType): boolean;
}
/**
* Strategy-based Dispatcher.
* Uses composition over inheritance to manage multiple providers.
*/
class NotificationDispatcher {
private providers: NotificationProvider[];
constructor(providers: NotificationProvider[]) {
// ADP: Injected via constructor to avoid circular dependencies
this.providers = providers;
}
async notify(request: NotifyRequest): Promise<void> {
const provider = this.providers.find(p => p.supports(request.channel));
if (!provider) throw new Error("Unsupported channel");
await provider.send(request.target, request.payload);
}
}
Next steps
- Implement the
EmailProviderandSmsProviderwithin theproviderpackage. - Add a
WhatsAppProviderto theproviderpackage without modifying theDispatcherclass. - Define the
Receiptinvariant to ensure consistent logging across all channels.
Connects securely to your tools. The creator never sees your data.
About this skill
Stop fighting technical debt and over-engineered abstractions. This skill enforces Martin Fowler’s evolutionary design and Robert Martin’s component principles to build systems that remain maintainable as requirements shift. It moves your development process from "Big Design Up Front" to a lean, contract-based approach.
What it does
- Component Topology Mapping applies CCP and CRP principles to organize classes into cohesive packages that minimize cross-boundary ripple effects.
- Dependency Graph Cleanup identifies and breaks circular dependencies (ADP) using Dependency Inversion or abstraction extraction to maintain a Directed Acyclic Graph.
- Contract-Based Modeling defines clear interfaces using Design by Contract (DbC), specifying preconditions, postconditions, and invariants for every module.
- Interface Refinement splits bloated "fat" interfaces into role-specific "lean" interfaces (ISP) to reduce client coupling.
- Evolutionary Implementation applies the Four Rules of Simple Design to eliminate duplication and ensure code expresses intent with minimal elements.
How it works
- Top-down Decomposition starts with package-level partitioning based on common closure and reuse principles.
- Interface Definition establishes polymorphic strategies and role-based interfaces to ensure the system is Open-Closed (OCP).
- Dependency Inversion applies DIP to decouple high-level business logic from low-level implementation details or circular loops.
- Refinement and Simplification applies YAGNI and KISS filters to prune unnecessary abstractions and favor composition over inheritance.
Frameworks & tools
Works with any object-oriented language including Java, C#, C++, TypeScript, or Python. It follows SOLID, GRASP, and specialized component principles (CCP, CRP, ADP, DbC).
Why this beats prompting it yourself
Generic AI prompts often produce rigid, boilerplate-heavy designs or deep inheritance trees that break easily. This skill prioritizes composition and evolutionary growth, ensuring your architecture stays flexible enough to change without requiring a full rewrite.
Use cases
- Designing a new microservice or module from scratch with a clean package structure.
- Refactoring a monolithic "god class" into a decoupled set of interfaces and strategies.
- Eliminating circular dependencies in a legacy codebase to improve build stability.
- Auditing a design proposal to identify violations of the Open-Closed or Interface Segregation principles.
Known limitations
This skill focuses on mid-level (package) and low-level (class) design. It does not handle high-level infrastructure provisioning or cloud-native orchestration logic.
Focused on mid-level (package) and low-level (class) OO modeling. Does not cover infrastructure, cloud orchestration, or hardware-level design.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 13 days ago
- Free with an Agensi account