types

majiayu000 的头像作者 majiayu000

TypeScript 类型生成与后端 OpenAPI 和前端同步。使用 openapi-typescript 自动从 /openapi.json 生成类型。API 更改后至关重要。

📖 中文导读:TypeScript 类型生成与后端 OpenAPI 和前端同步。使用 openapi-typescript 自动从 /openapi.json 生成类型。API 更改后至关重要。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: types description: TypeScript type generation and synchronization between backend OpenAPI and frontend. Auto-generates types from /openapi.json using openapi-typescript. Critical after any API change.

Skill: Types

Type generation and synchronization between frontend and backend.

Routing Logic

Analyze the user's intent and route to the appropriate workflow:

Generate Types → workflows/generate.md

  • "Generate types"
  • "Update frontend types"
  • "Sync types from backend"
  • "Regenerate API types"

Type Usage → workflows/usage.md

  • "How do I use the generated types?"
  • "Import types for [endpoint]"
  • "Type the API response"

Troubleshooting → workflows/troubleshoot.md

  • "Types are out of sync"
  • "TypeScript error with API"
  • "Type doesn't match response"

Configuration Questions → context/config.md

  • "Where are types generated?"
  • "How does type generation work?"

Workflows

  • workflows/generate.md - Generate TypeScript types from OpenAPI
  • workflows/usage.md - How to use generated types
  • workflows/troubleshoot.md - Fix type issues

Context

  • context/config.md - Type generation configuration
  • context/patterns.md - Type usage patterns