with one click
interface-pollution
Detect and avoid unnecessary interface abstractions
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Detect and avoid unnecessary interface abstractions
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Handle hook scripts and paths for plugin packaging
Package claudefiles components into a valid Claude Code plugin
Package language-specific subsets of claudefiles
Plugin validation errors and fixes
Common channel patterns and idioms
Context cancellation patterns for graceful shutdown
| name | interface-pollution |
| description | Detect and avoid unnecessary interface abstractions |
Interface pollution occurs when interfaces are created before they're needed. Define interfaces at consumption point, not production.
WRONG - Producer defines interface prematurely
// In package "storage"
type UserRepository interface {
GetUser(id int) (*User, error)
SaveUser(u *User) error
}
type PostgresRepo struct{}
func (p *PostgresRepo) GetUser(id int) (*User, error) { ... }
func (p *PostgresRepo) SaveUser(u *User) error { ... }
CORRECT - Consumer defines minimal interface
// In package "handler"
type UserGetter interface {
GetUser(id int) (*User, error)
}
func HandleRequest(repo UserGetter) http.Handler {
// Only needs GetUser, not entire repository
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
user, _ := repo.GetUser(123)
// ...
})
}
// Concrete type lives in storage package
// Handler depends on small interface, not full implementation
You have interface pollution if:
Before:
type DataService interface {
Read() error
Write() error
Validate() error
Transform() error
}
After:
// Split by actual usage
type Reader interface { Read() error }
type Writer interface { Write() error }
// Compose where needed
type ReadWriter interface {
Reader
Writer
}