interface-generator

Extract interfaces from concrete types by analyzing exported method signatures.

Updated Mar 14, 2026
One-click install
npx skills add https://github.com/CaptainPhantasy/floyd-v5 --skill interface-generator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: interface-generator
Source: https://github.com/CaptainPhantasy/floyd-v5/tree/main/extensibility/skills/refactoring/interface-generator
Command: npx skills add https://github.com/CaptainPhantasy/floyd-v5 --skill interface-generator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Analyzing existing concrete types and their methods to generate precise interfaces, enabling easier mocking and testing.

Core Features & Use Cases

  • Generates interface definitions that mirror exported methods, preserving signatures for accurate mocks.
  • Reduces boilerplate by automating interface creation from concrete types in Go-like languages.
  • Use Case: Refactor a large codebase by extracting interfaces for key services to improve testability.

Quick Start

Use a sample concrete type and run the generator to produce a matching interface, then implement the interface in tests.

Frequently Asked Questions about interface-generator

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

FAQPage Schema
How do I generate interfaces from concrete types for mocking in Go?

To generate interfaces from concrete types, you parse type definitions to analyze exported method sets and emit interface declarations with matching signatures. This reduces boilerplate and enables accurate mocks for statically-typed languages.

Why extract interfaces from concrete types during codebase refactoring?

Extracting interfaces from concrete types improves testability by isolating dependencies for mocking. It automates the creation of interface definitions that mirror exported methods, preserving signatures to ensure accurate mock generation.

Does interface generation work with non-exported methods in Go-like languages?

Interface generation focuses specifically on exported methods and their signatures to produce accurate interfaces. It does not process non-exported methods, ensuring the generated interface declarations are accessible and suitable for external mocking.

What is the best way to automate interface creation for static typing?

Automating interface creation involves parsing existing concrete types to analyze their method sets and emitting precise interface declarations. This approach preserves method signatures to generate matching interfaces with minimal manual boilerplate.

Can I use generated interfaces directly for test implementation?

You can use a sample concrete type to run the generator and produce a matching interface, then immediately implement that interface in tests. The generated definitions mirror exported methods to facilitate direct mock creation.

What are the limitations of extracting interfaces from concrete types?

Extracting interfaces from concrete types requires parsing type definitions and analyzing method sets, limiting it to exported methods. It focuses on emitting interface declarations and does not automatically generate the mock implementations themselves.