- Home
- Skills
- Code Quality & Review
- Design Software Interfaces
Works with the AI Agents you already use
Design Software Interfaces
Audit and refactor software interfaces for better encapsulation, stable contracts, and clean signatures.
$5.99
Design Software Interfaces
Example session with this skill installed
Audit this TypeScript UserService for state leaks and suggest a better interface. It currently takes 7 arguments in the constructor and returns the internal user map via a public getter.
- Read your context and instructions
- Compiled the design software interfaces
I have audited the UserService interface and identified two critical encapsulation violations and a signature clarity issue. The current design allows clients to bypass the service's invariants by mutating the internal state directly.
Interface Audit and Refactor
| Finding | Impact | Recommendation |
|---|---|---|
| State Leak | Public getter returns the mutable Map reference. | Return a read-only view or a specific DTO snapshot. |
| Constructor Bloat | 7 arguments make instantiation fragile and testing difficult. | Group configuration into a UserConfig object; use DI for services. |
| Ownership Violation | The service retains the caller's mutable input array. | Clone the input array during initialization to own the lifecycle. |
// Proposed Refactor: UserService
export interface UserConfig {
maxRetry: number;
cacheTtl: number;
region: string;
}
export class UserService {
private readonly users = new Map<string, User>();
constructor(
private readonly repository: UserRepository,
private readonly logger: Logger,
private readonly config: UserConfig
) {}
/**
* Returns a snapshot of a user.
* The returned object is a copy to prevent external mutation.
*/
public getUser(id: string): UserDTO | undefined {
const user = this.users.get(id);
return user ? { ...user } : undefined;
}
}
Next steps
- Update
UserServicetests to use the newUserConfigobject. - Verify that existing callers of the public user map are refactored to use the
getUsermethod. - Implement a deep clone for the
UserDTOif theUserobject contains nested mutable properties.
Connects securely to your tools. The creator never sees your data.
About this skill
Leaky abstractions and brittle interfaces lead to breaking changes, impossible testing, and security vulnerabilities. This skill audits and refactors software interfaces to ensure proper encapsulation, stable contracts, and clean dependency boundaries. It moves beyond superficial linting to analyze how state, ownership, and invariants flow across your API.
What it does
- Architectural Selection determines whether a function, concrete class, interface, or orchestrator best serves a specific requirement.
- Encapsulation Auditing traces state leaks, mutable aliases, and ownership boundaries to prevent unauthorized state observation.
- Contract Specification defines behavioral guarantees, including preconditions, postconditions, error states, and lifecycle limits.
- Signature Refactoring optimizes parameter handling through domain types, options objects, or builders based on call-site clarity.
- SOLID Alignment evaluates interfaces against SRP, LSP, and ISP to ensure substitution works without private implementation knowledge.
How it works
- Boundary Identification establishes the language, clients, and compatibility constraints for the specific code surface.
- Scenario Mapping creates client-side call examples for ordinary, failure, and advanced usage to test interface ergonomics.
- State-Leak Tracing follows the reachable object graph to identify where internal mutation or resource ownership is exposed.
- Signature & SOLID Review assesses method signatures and dependency roles using a specific decision tree for abstraction.
Frameworks & tools
Language-neutral core logic with specialized implementation guidance for PHP, TypeScript, JavaScript, and Kotlin.
Why this beats prompting it yourself
Generic prompts often focus on superficial style or mechanical parameter counts. This skill applies a formal state-leak audit and behavioral contract methodology that uncovers deep architectural flaws, like request-state bleeding in long-lived services, which standard LLM responses miss.
Use cases
- Refactoring a sprawling service class into cohesive domain objects and orchestrators.
- Auditing a library API for breaking changes before a major version release.
- Designing a plugin system that requires strict isolation between host and extension.
- Identifying why an object's internal state is changing unexpectedly across requests.
Known limitations
Does not handle visual UI/UX design, CSS styling, or screen layouts. Scope is strictly limited to software contracts and code-level interfaces.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.
Does not handle visual UI/UX design, CSS styling, or screen layouts. Scope is strictly limited to software contracts and code-level interfaces.
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 buying a skill.
Reviews
Trust & safety
Security scan
Security scan passed 2 days ago
- Software
Node.js