Api endpoint

From hoangsonww/WealthWise-Finance-Tracker · View interactive version

Api endpoint is an AI agent skill from the GitHub repository hoangsonww/WealthWise-Finance-Tracker. Scaffold a complete new API endpoint for the WealthWise Express API. Triggers when asked to "add an endpoint", "create a route", "build an API for <entity>", or scaffold any new REST resource end-to-end. Does not trigger for frontend-only tasks.

How to use this skill

Skill file

Scaffold a complete new API endpoint for the WealthWise API following all project conventions.

The entity/resource name is provided in the task prompt.

Scope

Create all four layers in this exact order:

1. Zod schema — `packages/shared-types/src/schemas/<entity>.schema.ts`

import { z } from 'zod';

export const Create<Entity>Schema = z.object({
  // entity-specific fields with validation
});

export const Update<Entity>Schema = Create<Entity>Schema.partial();

export const <Entity>ResponseSchema = Create<Entity>Schema.extend({
  _id: z.string(),
  userId: z.string(),
  createdAt: z.string().datetime(),
  updatedAt: z.string().datetime(),
});

export const <Entity>ListResponseSchema = z.array(<Entity>ResponseSchema);

Add inferred types to packages/shared-types/src/types/index.ts:

export type Create<Entity>Input = z.infer<typeof Create<Entity>Schema>;
export type Update<Entity>Input = z.infer<typeof Update<Entity>Schema>;
export type <Entity>Response = z.infer<typeof <Entity>ResponseSchema>;

Export from packages/shared-types/src/index.ts.

2. Mongoose model — `apps/api/src/models/<entity>.model.ts`

3. Service — `apps/api/src/services/<entity>.service.ts`

Implement with full type signatures:

Rules:

4. Controller — `apps/api/src/controllers/<entity>.controller.ts`

5. Route — `apps/api/src/routes/<entity>.route.ts`

Standards

Verification

After scaffolding, run:

npx turbo lint --filter=@wealthwise/api
npx turbo test --filter=@wealthwise/api

Report all created file paths and the registered route paths (e.g., GET /api/v1/<entities>).

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.