Module augmentation guardrails

From ai-shifu/ai-shifu · View interactive version

Module augmentation guardrails is an AI agent skill from the GitHub repository ai-shifu/ai-shifu. Use when TypeScript subpath exports lose types or have declaration conflicts. Follow module augmentation conventions to avoid replacing upstream exports.

How to use this skill

Skill file

TypeScript 模块增强防护

核心规则

工作流

  1. 先确认是上游类型问题还是本地声明覆盖导致。
  2. 在 augmentation 中显式引入依赖类型(如 InteractionDefaultValueOptions)。
  3. 避免在 .d.ts 里重写整个模块结构。
  4. 变更后执行定向类型检查,确认导出成员未丢失。
  5. 若扩展字段依赖 React 类型(如 ReactNode),在声明文件顶层显式 import type,避免 TS 在模块增强中退化成 any。
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.