AgentSkillsCN

backend-scaffolder

管理“指挥官”项目管理系统。在搭建新功能轨道、更新计划,以及检索轨道上下文时,可调用此技能。

SKILL.md
--- frontmatter
name: backend-scaffolder
description: Scaffolds backend files (Route, Service, Test) for a new resource in the Node.js/Fastify backend. Use when creating new API features.

Backend Scaffolder

Description

This skill automates the creation of backend "vertical slices". It generates the necessary files for a new resource (Route, Service, Test) and registers the route in the main application file.

Usage

To scaffold a new resource (e.g., "Reward"):

bash
node .gemini/skills/backend-scaffolder/scripts/scaffold_backend.cjs reward

Parameters:

  • resourceName: The singular name of the resource (e.g., "reward", "chore").

What it does

  1. Creates server/src/services/<resource>Service.ts with CRUD boilerplate.
  2. Creates server/src/routes/<resource>s.ts (pluralized) with Fastify routes.
  3. Creates server/test/routes/<resource>s.test.ts (pluralized) with a basic test.
  4. Injects the route registration into server/src/app.ts.

Post-Scaffold Checklist

After running the script, you MUST:

  1. Define the model in server/prisma/schema.prisma.
  2. Run migration: cd server && npx prisma migrate dev --name add_<resource>.
  3. Update the generated service file if the model fields require specific validation or logic.