module-augmentation-guardrails

Analyze TypeScript module augmentation files to prevent declaration conflicts.

309|117|Updated Jul 23, 2024
One-click install
npx skills add https://github.com/ai-shifu/ai-shifu --skill module-augmentation-guardrails
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: module-augmentation-guardrails
Source: https://github.com/ai-shifu/ai-shifu/tree/main/src/cook-web/skills/module-augmentation-guardrails
Command: npx skills add https://github.com/ai-shifu/ai-shifu --skill module-augmentation-guardrails

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses issues related to type declaration conflicts and accidental overwriting in TypeScript module augmentation, providing guidance for correct and safe augmentation practices.

Core Features & Use Cases

  • Validation of augmentation files: Ensures augmentation files follow best practices like including import statements and augmenting the correct module parts.
  • Guidance for dependency imports: Advises explicit import of dependency types like ReactNode to prevent type degradation.
  • Use Case: A developer wants to extend markdown-flow-ui/slide without risking import errors or partial overrides, and uses this Skill to verify correct augmentation code.

Quick Start

Use the module augmentation guardrails skill to review your augmentation files and ensure they conform to best practices before deployment.

Frequently Asked Questions about module-augmentation-guardrails

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

FAQPage Schema
How do I prevent TypeScript module augmentation conflicts in complex projects?

Prevent TypeScript module augmentation conflicts by validating that augmentation files include proper import statements and target the correct module parts to avoid accidental overwriting.

What is TypeScript module augmentation and when do I need it?

TypeScript module augmentation extends existing module types without modifying original files. You need it when extending libraries like markdown-flow-ui to maintain type safety across subpath exports.

How do I safely extend types for subpath exports in TypeScript?

Safely extend subpath exports by ensuring correct module targeting in declaration files and explicitly importing dependency types like ReactNode to prevent type degradation and runtime issues.

Why does my TypeScript declaration file cause import errors after augmentation?

TypeScript declaration files cause import errors after augmentation when they omit explicit dependency imports or target incorrect module parts, leading to partial overrides and type degradation.

Do I need explicit imports for dependency types like ReactNode in declaration files?

Yes, you need explicit imports for dependency types like ReactNode in declaration files to prevent type degradation and ensure accurate type safety during module augmentation.