interface-segregation-principle

Split large interfaces into smaller, focused contracts for client-specific needs.

13|2|Updated Jan 21, 2026
One-click install
npx skills add https://github.com/yanko-belov/code-craft --skill interface-segregation-principle
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: interface-segregation-principle
Source: https://github.com/yanko-belov/code-craft/tree/main/skills/interface-segregation
Command: npx skills add https://github.com/yanko-belov/code-craft --skill interface-segregation-principle

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Clients should not be forced to depend on interfaces they don't use. A fat interface forces implementers to provide methods that are irrelevant, leading to brittle code, throw/no-op workarounds, and hidden capabilities. ISP promotes smaller, cohesive interfaces that map to actual needs.

Core Features & Use Cases

  • Segregated interfaces: Create focused contracts like Printer, Scanner, Fax.
  • Avoids throw/no-op: Implement only what you can deliver.
  • Improves maintainability and testability across API design and refactoring.

Quick Start

  1. Identify a fat interface in your codebase.
  2. Split it into focused interfaces reflecting cohesive capabilities.
  3. Update implementations to depend only on the interfaces they need and remove unused methods.

Frequently Asked Questions about interface-segregation-principle

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor a fat interface to stop forcing clients to implement unused methods?

To refactor a fat interface, split it into smaller, focused contracts reflecting cohesive capabilities. Update implementations to depend only on the interfaces they need and remove unused methods to avoid throw or no-op workarounds.

What is the interface segregation principle in API design?

The interface segregation principle (ISP) ensures clients are not forced to depend on interfaces they don't use. It promotes smaller, cohesive interfaces that map to actual client needs rather than a single large, fat interface.

Why should I avoid throw or no-op implementations in interface design?

Avoiding throw or no-op implementations prevents hidden capabilities and brittle code. Fat interfaces force implementers to provide irrelevant methods, whereas segregated interfaces ensure clients implement only what they can actually deliver.

When do I need to split interfaces during codebase refactoring?

You need to split interfaces during codebase refactoring when different clients or implementations rely on only a subset of methods. Dividing large interfaces enables compile-time capability checks and improves maintainability.

Does interface segregation work for both API design and existing codebase refactoring?

Yes, interface segregation is applicable during both API design and codebase refactoring. It improves maintainability and testability by creating focused contracts like separating Printer, Scanner, and Fax capabilities.

What is the best way to identify a fat interface in my codebase?

The best way to identify a fat interface is to look for implementations containing throw or no-op workarounds. If clients rely on only a subset of methods, the interface should be split into focused, cohesive contracts.