AgentSkillsCN

codegen

在后端发生任何变更后,包括新增或修改的API端点、DTO变更、路由调整,或控制器修改时,重新生成TypeScript模型与API服务。

SKILL.md
--- frontmatter
name: codegen
description: Regenerate TypeScript models and API services from the backend. Use this after any backend API change including new/modified endpoints, DTO changes, route changes, or controller modifications.
allowed-tools: [Bash(dotnet build:*), Bash(npm run gen-model:*)]

Run the full code generation pipeline to sync the Angular frontend with backend API changes.

Steps

  1. Build the API in Debug configuration to regenerate swagger.json:

    code
    dotnet build Neptune.API/Neptune.API.csproj -c Debug
    

    Verify the build succeeds before continuing.

  2. Regenerate TypeScript models and API services from the updated swagger spec:

    code
    cd Neptune.Web && npm run gen-model
    
  3. Report what changed by running git diff --stat Neptune.Web/src/app/shared/generated/ and git diff --stat Neptune.API/swagger.json to summarize the regenerated files.

Notes

  • The Debug build configuration triggers Swagger JSON generation via a post-build step.
  • Generated TypeScript files go to Neptune.Web/src/app/shared/generated/ — never edit these directly.
  • If new API services were generated, they may need to be imported in Angular components.