new-domain
Provides a consistent structure for adding new features to the backend API.
Install
mkdir -p .claude/skills/new-domain && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10244" && unzip -o skill.zip -d .claude/skills/new-domain && rm skill.zipInstalls to .claude/skills/new-domain
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Scaffold a new backend domain (feature module) in the GitGazer AWS Lambda API under apps/api/src/domains/. Use when adding a new REST resource, feature area, or set of API endpoints. Covers the routes/controller/middleware/test file layout, registering the router in the app, the AWS Powertools Router + middleware chain, role-based access with requireRole, RLS-scoped data access via withRlsTransaction, and the @/ and @gitgazer/db/* import conventions.Key capabilities
- →Scaffold REST resources
- →Create feature modules
- →Register API routes
How it works
It creates a self-contained feature folder with routes, controllers, and tests following project conventions.
Inputs & outputs
When to use new-domain
- →Add new rest resource
- →Create new backend feature module
- →Add api endpoints
About this skill
New Backend Domain — GitGazer
Scaffold a new feature module in the Lambda API following the project's controller-centric domain layout. Each domain is a self-contained folder under apps/lambdas/api/src/domains/.
When to Use
- Adding a new REST resource or feature area (e.g.
/api/<thing>) - Grouping a set of related endpoints + business logic + tests
Not for: a single extra route on an existing resource (just add it to that domain's *.routes.ts).
File Layout
Create apps/lambdas/api/src/domains/<domain>/ with:
| File | Purpose | Template |
|---|---|---|
<domain>.routes.ts | HTTP endpoints on an AWS Powertools Router | assets/domain.routes.template.ts |
<domain>.controller.ts | Business logic + RLS-scoped DB access | assets/domain.controller.template.ts |
<domain>.controller.test.ts | Vitest unit tests (AWS + DB mocked) | assets/domain.controller.test.template.ts |
<domain>.middleware.ts | Optional — only if the domain needs request-context middleware | see integrations.middleware.ts |
Reference implementation to copy patterns from: apps/lambdas/api/src/domains/integrations/.
Procedure
-
Create the folder and files from the templates above. Rename
things/Thingto your resource. -
Register the router in apps/lambdas/api/src/shared/router/index.ts:
import thingsRoutes from '@/domains/things/things.routes'; // ...inside createApp(), with the other includeRouter calls: app.includeRouter(thingsRoutes);The global middleware chain (
compress→cors→authenticate→originCheck) is applied bycreateApp— do not re-add it per domain. -
Write controllers that wrap every tenant-scoped query in
withRlsTransaction(see therefactorskill for the boundary rules). Default role is reader; passuserName: gitgazerWriter.namefor writes. -
Add tests colocated as
*.test.ts. Mock@gitgazer/db/clientand all AWS clients — never hit real services. -
Verify:
cd apps/lambdas/api && pnpm run test:unit && pnpm run lint.
Conventions (enforced — see backend.instructions.md)
- Imports:
@/forapps/lambdas/api/src,@gitgazer/db/*for the shared package. Never../../../. - Auth context: handlers receive
AppRequestContext; use theaddUserIntegrationsToCtxmiddleware to populatereqCtx.appContext.integrations/integrationRoles. - Authorization: gate state-changing routes with
requireRole('admin' | 'owner' | ...)from @/shared/middleware/require-role. - Responses: return a
ResponsewithJSON.stringify(...)and anHttpStatusCodesstatus; throwBadRequestError/UnauthorizedError/ etc. from@aws-lambda-powertools/event-handler/httpfor errors. - Logging:
getLogger()from@gitgazer/backend-core/logger(AWS Powertools structured logging). - AWS clients: import pre-configured clients from
@/shared/clients/— never instantiate SDK clients in a controller.
Checklist
-
<domain>.routes.tsexportsdefaultaRouterand is registered viaapp.includeRouter(...) - All tenant-scoped DB access goes through
withRlsTransactionwith the correct role - State-changing routes protected with
requireRole(...) - Inputs validated; errors thrown as Powertools HTTP errors
- Colocated
*.test.tswith@gitgazer/db/client+ AWS mocked -
pnpm run test:unitandpnpm run lintpass
When not to use it
- →Single route additions
Prerequisites
Limitations
- →Requires adherence to project conventions
How it compares
It enforces standardized domain layout and middleware chains.
Compared to similar skills
new-domain side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| new-domain (this skill) | 0 | 2mo | No flags | Intermediate |
| moai-domain-backend | 1 | 3mo | Review | Advanced |
| web-server-architecture | 0 | 3mo | No flags | Intermediate |
| bullmq-specialist | 25 | 6mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
moai-domain-backend
modu-ai
Backend development specialist covering API design, database integration, microservices architecture, and modern backend patterns.
web-server-architecture
develsvai
`web/src/server/**`의 router, service, 공통 계층을 건드릴 때 사용하는 스킬이다. tRPC router와 service 책임 분리, 도메인 구조, Prisma 사용 경계를 맞춘다.
bullmq-specialist
davila7
BullMQ expert for Redis-backed job queues, background processing, and reliable async execution in Node.js/TypeScript applications. Use when: bullmq, bull queue, redis queue, background job, job queue.
agentdb-advanced-features
ruvnet
Master advanced AgentDB features including QUIC synchronization, multi-database management, custom distance metrics, hybrid search, and distributed systems integration. Use when building distributed AI systems, multi-agent coordination, or advanced vector search applications.
senior-backend
davila7
Comprehensive backend development skill for building scalable backend systems using NodeJS, Express, Go, Python, Postgres, GraphQL, REST APIs. Includes API scaffolding, database optimization, security implementation, and performance tuning. Use when designing APIs, optimizing database queries, implementing business logic, handling authentication/authorization, or reviewing backend code.
database-migration
wshobson
Execute database migrations across ORMs and platforms with zero-downtime strategies, data transformation, and rollback procedures. Use when migrating databases, changing schemas, performing data transformations, or implementing zero-downtime deployment strategies.