module-exports

Enforce factory-based exports and complete type re-exports for TypeScript libraries.

6|Updated Feb 20, 2025
One-click install
npx skills add https://github.com/zerobias-org/module --skill module-exports
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: module-exports
Source: https://github.com/zerobias-org/module/tree/main/.claude/skills/module-exports
Command: npx skills add https://github.com/zerobias-org/module --skill module-exports

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Module authors often struggle with inconsistent library entry points, leading to brittle integrations and DI friction. This Skill provides a clear pattern to publish a clean, minimal public API by combining a factory-based export surface with comprehensive generated type re-exports.

Core Features & Use Cases

  • Factory function as the primary export to create instances or connectors without exposing internal classes.
  • Re-export of all generated API and model types to ensure a complete, stable public surface.
  • Minimal public surface strategy with explicit guidance on what to export and what to keep internal.

Quick Start

Create a simple, explicit public API by exporting a factory function and re-exporting generated types.

Frequently Asked Questions about module-exports

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

FAQPage Schema
How do I enforce a clean public API for a TypeScript library?

To enforce a clean public API for a TypeScript library, use a factory-based export surface combined with comprehensive generated type re-exports. This pattern restricts internal implementation exposure and ensures a stable, minimal integration point.

Why use a factory function for module exports in TypeScript?

Re-exporting generated API and model types ensures a complete, stable public surface. It allows consumers to access all necessary types directly from the module entry point without importing internal files that may change.

What is the best way to re-export generated types in a TypeScript module?

The best way to re-export generated types is to consolidate them at the module entry point. This creates a single, explicit public surface and removes the need for consumers to import from deep internal paths.

When should I restrict internal implementation exposure in library design?

You should restrict internal implementation exposure when publishing a TypeScript library to prevent brittle integrations. Keeping the public surface minimal ensures that internal refactoring does not break consumer code.

Does this module export pattern help with dependency injection friction?

Yes, this pattern reduces dependency injection friction by providing a clear, consistent entry point. The factory function handles instance creation, making the module easier to inject and integrate into external systems.