mirror-types

Mirror external types into internal definitions to decouple code.

Updated Jul 17, 2017
One-click install
npx skills add https://github.com/luyi985/lyi-bash --skill mirror-types
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mirror-types
Source: https://github.com/luyi985/lyi-bash/tree/main/ai/skills/mirror-types
Command: npx skills add https://github.com/luyi985/lyi-bash --skill mirror-types

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When depending on external types, changes to those types can break your code. Mirroring types severs this dependency, useful when you want a subset of external types or want insulation from external changes.

Core Features & Use Cases

  • Mirror external types into internal definitions to break tight coupling.
  • Use in adapters or wrappers to shield internal code from external API changes.
  • Applicable when external types are evolving, large, or rarely used internally.

Quick Start

Create internal mirrors for the external types your module uses, then replace references to the external types with the internal counterparts.

Frequently Asked Questions about mirror-types

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

FAQPage Schema
How do I decouple code from external library types to prevent breaking changes?

Mirror types by creating internal definitions that match the external equivalents. This severs the dependency by replacing external references with internal counterparts, shielding your code from external API changes.

What is the best way to isolate internal code when building adapters around external libraries?

Build adapters or wrappers using mirrored internal types. This insulates your internal code by mapping conversions and selecting only the subset of external fields you actually use.

When should I mirror external types instead of using them directly?

Mirror types when external types are evolving, large, or rarely used internally. This approach breaks tight coupling and protects your code from unexpected breaking changes in external dependencies.

How do I map conversions and select fields for mirrored internal types?

Specify concrete requirements to mirror types by selecting the exact fields needed from external definitions and mapping their conversions to maintain alignment with the original internal equivalents.

Does mirroring types work for large external definitions where only a subset is used?

Yes, mirroring types is specifically applicable when external types are large or rarely used internally. You can select a subset of fields to mirror into internal definitions, breaking the tight coupling.