Use this skill whenever the user wants to create, restructure, or standardize a NestJS backend project in TypeScript, including folder layout, config, environment setup, tooling, and initial...
You are a specialized assistant for bootstrapping and reshaping NestJS projects so they follow consistent, production-ready conventions.
Use this skill to:
Do not use this skill for:
If CLAUDE.md exists in the repo, treat it as authoritative for project layout, naming, and tooling preferences.
Trigger this skill when the user says things like:
Avoid this skill when the task is clearly about:
users, auth) → use feature/module-oriented skills.Unless the user or CLAUDE.md says otherwise, assume:
pnpm if pnpm-lock.yaml existsyarn if yarn.lock existsnpmnestjs-typeorm-integration skill..env files + Nest ConfigModule or equivalent.This skill aims to create or converge towards a structure like:
project-root/
src/
app.module.ts
main.ts
config/
app.config.ts
database.config.ts # optional, for TypeORM later
common/
filters/
guards/
interceptors/
decorators/
dto/
modules/
health/
health.module.ts
health.controller.ts
infrastructure/
# optional: cross-cutting infra, e.g. database, messaging
test/
app.e2e-spec.ts
jest-e2e.json
.env.example
nest-cli.json
tsconfig.json
tsconfig.build.json
package.json
README.md
For monorepos, adapt to a apps/api or similar convention, but maintain the same internal NestJS structure.
When this skill is active, follow this process:
Detect or create NestJS project
main.ts, app.module.ts, src/ layout, nest-cli.json).Set up config & environment management
@nestjs/config (or follow project’s preferences in CLAUDE.md).src/config directory with at least app.config.ts and (optionally) database.config.ts.ConfigModule.forRoot({ isGlobal: true, ... }) in app.module.ts.Create base common infrastructure
src/common with subfolders for:filters (e.g. http-exception.filter.ts)guards (e.g. auth guards to be filled later)interceptors (e.g. logging/transform interceptors)decorators (custom decorators go here)dto (shared DTOs)Add a health module
HealthModule in src/modules/health or src/health:health.module.tshealth.controller.ts with a simple GET /health endpoint.Configure main bootstrap
main.ts, configure:NestFactory.create(AppModule)/api)Example outline (pseudocode-level, adjusted per project):
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.setGlobalPrefix("api");
await app.listen(process.env.PORT ?? 3000);
}
bootstrap();
Maintain flexibility; actual details may depend on other skills (auth, validation).
Prepare TypeORM integration points (without full config)
src/config/database.config.ts placeholdersrc/infrastructure/database placeholder directory if desirednestjs-typeorm-integration skill.Tooling & quality gates
tsconfig.json and tsconfig.build.json are present and sane:CLAUDE.md says otherwise).lint, build, start, start:dev, test, test:e2e scripts in package.json are present or corrected.Testing scaffold
test/app.e2e-spec.ts and jest-e2e.json exist or create them if missing.nestjs-testing-skill), but confirm scaffolding is ready.Monorepo awareness (if applicable)
apps/api):apps/api or similar).pnpm dev:api, etc.) if conventions exist.Documentation
README.md with:install, start:dev, test)src/modules)When making decisions:
Use convention over configuration:
src/modules/... for feature modulessrc/common/... for shared utilitiessrc/config/...Don’t enforce a specific hexagonal/onion architecture unless CLAUDE.md says so, but do:
Keep bootstrapping minimal and extensible:
apps/api with our usual setup.”For these prompts, this skill should: