governing-component-reuse

Audit OpenAPI specifications for inline schema anti-patterns and enforce component reuse.

Updated Mar 6, 2026
One-click install
npx skills add https://github.com/musher-dev/bundles --skill governing-component-reuse
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: governing-component-reuse
Source: https://github.com/musher-dev/bundles/tree/main/openapi-specification-governance/skills/governing-component-reuse
Command: npx skills add https://github.com/musher-dev/bundles --skill governing-component-reuse

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses the maintenance nightmares and silent divergence caused by duplicated or inconsistently managed OpenAPI component definitions, ensuring DRY principles are applied at the specification level.

Core Features & Use Cases

  • Component Extraction & Referencing: Guides the extraction of reusable schemas, responses, and parameters into the components section and their subsequent referencing using $ref.
  • Inline Schema Auditing: Identifies and provides rules for when inline schemas are acceptable versus when they must be extracted to prevent duplication and SDK generation issues.
  • Schema Composition Governance: Enforces best practices for allOf, oneOf (with discriminator), and anyOf to ensure clarity, maintainability, and compatibility with code generation tools.
  • RFC 9457 ProblemDetails: Promotes the use of a standardized, reusable error schema for consistent API error handling.
  • Use Case: When reviewing an OpenAPI specification, use this Skill to audit the usage of $ref, identify inline schemas that should be components, and ensure that polymorphic types (oneOf) are correctly implemented with discriminators.

Quick Start

Use the governing-component-reuse skill to audit the OpenAPI specification for inline schema anti-patterns and ensure all response bodies are defined as reusable components.

Frequently Asked Questions about governing-component-reuse

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

FAQPage Schema
How do I find and fix inline schema anti-patterns in OpenAPI specifications?

To fix inline schema anti-patterns in OpenAPI, extract duplicated schemas, responses, and parameters into the components section and reference them using $ref to enforce DRY principles. This prevents maintenance nightmares and SDK generation issues.

When should I use a discriminator with oneOf in OpenAPI schema composition?

Use a discriminator with oneOf in OpenAPI schema composition to clearly define polymorphic types and ensure compatibility. Enforcing this best practice guarantees clarity, maintainability, and seamless compatibility with code generation tools.

How do I implement RFC 9457 ProblemDetails as a reusable OpenAPI component?

Implement RFC 9457 ProblemDetails by defining the standardized error schema in the components section and referencing it across your API operations. This promotes consistent API error handling and reduces duplicated error definitions.

What is the best way to audit OpenAPI components for DRY principles?

The best way to audit OpenAPI components for DRY principles is to review $ref usage and identify inline schemas that should be extracted. This ensures all response bodies are defined as reusable components, preventing silent divergence.

Why does OpenAPI schema composition with allOf affect SDK generation?

OpenAPI schema composition with allOf affects SDK generation because complex or poorly structured inheritance can confuse code generation tools. Governing these patterns ensures the generated SDKs accurately reflect the intended data models.

Can I use this to govern OpenAPI component organization strategies for large APIs?

Yes, you can govern OpenAPI component organization strategies for large APIs. It provides rules for when inline schemas are acceptable versus extracted, ensuring component definitions remain consistent and manageable at scale.