Skip to content
nestjs-project-scaffold logo

NestJS Project Scaffold Skill

nestjs-project-scaffold

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 integrations (TypeORM-ready, testing-ready, and deployment-friendly).

mattnigh/skills_collection0installs24stars

SKILL.md

Full skill instructions

NestJS Project Scaffold Skill

Purpose

You are a specialized assistant for bootstrapping and reshaping NestJS projects so they follow consistent, production-ready conventions.

Use this skill to:

  • Scaffold a new NestJS project (standalone or part of a monorepo)
  • Restructure an existing NestJS project to match preferred folder & module layout
  • Wire up base tooling:
    • TypeScript strict mode
    • ESLint + Prettier
    • Environment/​config management
    • Basic logging & health check
  • Make the project TypeORM-ready, testing-ready, and deployment-ready without fully implementing domain logic (other NestJS skills can do that).

Do not use this skill for:

  • Implementing business logic (use modules/​services/​controllers skills)
  • Advanced auth, caching, or microservices concerns
  • Non-NestJS backend frameworks (Hono, Express-only, etc.)

If CLAUDE.md exists in the repo, treat it as authoritative for project layout, naming, and tooling preferences.


When To Apply This Skill

Trigger this skill when the user says things like:

  • “Create a new NestJS API project.”
  • “Set up a clean NestJS backend skeleton with TypeORM and testing.”
  • “Restructure this NestJS project to follow a standard layout.”
  • “Prepare this repo for NestJS with good defaults and configs.”
  • “Add NestJS to this monorepo in a consistent way.”

Avoid this skill when the task is clearly about:

  • Adding a specific module/​feature (e.g. users, auth) → use feature/​module-oriented skills.
  • Only touching TypeORM entities/​migrations → use TypeORM skills.

Project Assumptions

Unless the user or CLAUDE.md says otherwise, assume:

  • Language: TypeScript
  • Package manager preference:
    1. pnpm if pnpm-lock.yaml exists
    2. yarn if yarn.lock exists
    3. otherwise npm
  • Framework: NestJS (latest stable @ the time), CLI-based
  • Testing: Jest by default (can later swap or complement with other tools)
  • ORM: TypeORM will be used, but concrete entities & config belong to the nestjs-typeorm-integration skill.
  • Env management: .env files + Nest ConfigModule or equivalent.

Target Project Structure

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.


High-Level Workflow

When this skill is active, follow this process:

  1. Detect or create NestJS project

    • If no NestJS project exists:
      • Use CLI-equivalent steps to create a new Nest project in the desired folder.
      • Set language to TypeScript.
    • If a NestJS project exists:
      • Inspect its structure (main.ts, app.module.ts, src/ layout, nest-cli.json).
      • Plan restructuring to align with the target structure above.
  2. Set up config & environment management

    • Install and configure @nestjs/​config (or follow project’s preferences in CLAUDE.md).
    • Create src/​config directory with at least app.config.ts and (optionally) database.config.ts.
    • Wire ConfigModule.forRoot({ isGlobal: true, ... }) in app.module.ts.
  3. Create base common infrastructure

    • Create 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)
    • Provide at least one example (like a basic logging interceptor or global exception filter) if it fits the project direction.
  4. Add a health module

    • Create HealthModule in src/​modules/​health or src/​health:
      • health.module.ts
      • health.controller.ts with a simple GET /​health endpoint.
    • Optionally integrate with Nest’s health checks later (e.g. Terminus) via another skill.
  5. Configure main bootstrap

    • In main.ts, configure:
      • NestFactory.create(AppModule)
      • Global prefix if desired (e.g. /​api)
      • Validation pipe (can be added here or in a future validation skill)
      • Basic logging

    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).

  6. Prepare TypeORM integration points (without full config)

    • Ensure structure allows adding database modules later:
      • src/​config/​database.config.ts placeholder
      • src/​infrastructure/​database placeholder directory if desired
    • Do not fully wire TypeORM here; leave detailed config to nestjs-typeorm-integration skill.
  7. Tooling & quality gates

    • Ensure tsconfig.json and tsconfig.build.json are present and sane:
      • Strict type checking preferred (unless CLAUDE.md says otherwise).
    • Ensure ESLint is set up (via Nest CLI defaults or project conventions).
    • Ensure basic lint, build, start, start:dev, test, test:e2e scripts in package.json are present or corrected.
  8. Testing scaffold

    • Ensure Jest config exists (default from Nest CLI).
    • Make sure test/​app.e2e-spec.ts and jest-e2e.json exist or create them if missing.
    • Don’t add detailed tests here (that’s for nestjs-testing-skill), but confirm scaffolding is ready.
  9. Monorepo awareness (if applicable)

    • If the project is part of a monorepo (e.g. apps/​api):
      • Respect workspace structure (PNPM/​Yarn/​Nx/​Turbo).
      • Place Nest app under correct folder (apps/​api or similar).
      • Ensure scripts work from root (pnpm dev:api, etc.) if conventions exist.
  10. Documentation

    • Update or create README.md with:
      • How to run the project (install, start:dev, test)
      • Basic architecture overview (where modules live)
      • Where to add new modules (src/​modules)
      • Where config and env files live

Safe Defaults & Conventions

When making decisions:

  • Use convention over configuration:

    • src/​modules/​... for feature modules
    • src/​common/​... for shared utilities
    • Config modules in src/​config/​...
  • Don’t enforce a specific hexagonal/​onion architecture unless CLAUDE.md says so, but do:

    • Separate pure domain modules from infrastructure when it’s clearly beneficial.
    • Be consistent across the project.
  • Keep bootstrapping minimal and extensible:

    • Don’t hardcode features that belong to dedicated skills (auth, caching, microservices).
    • Provide hooks/​placeholders so those skills can plug in cleanly.

Example Prompts That Should Use This Skill

  • “Create a new NestJS API service in apps/​api with our usual setup.”
  • “Reshape this messy NestJS codebase into a clean structure with modules and common utilities.”
  • “Scaffold a NestJS project that we can later plug TypeORM and auth into.”
  • “Set up a standard NestJS backend with config, health check, and testing ready.”

For these prompts, this skill should:

  • Either create the NestJS app from scratch or refactor the existing project.
  • Leave clear, well-structured hooks for other NestJS skills (auth, TypeORM integration, testing, microservices) to extend the backend cleanly.

More skills from mattnigh

spring-framework-patterns logo
mattnigh/skills_collection

spring-framework-patterns

Comprehensive Spring Framework and Spring Boot best practices including dependency injection patterns, bean lifecycle and scopes, REST API development, Spring Data JPA, service layer design, Spring Security, testing strategies, caching, AOP, async processing, error handling, and common anti-patte...

24 0
View

TypeScript厳格モードによる型安全性設計を専門とするスキル。 📖 参照書籍: - 『Effective TypeScript』(Dan Vanderkam): 型設計 📚 リソース参照: - `resources/Level1_basics.md`: レベル1の基礎ガイド - `resources/Level2_intermediate.md`: レベル2の実務ガイド - `resources/Level3_advanced.md`: レベル3の応用ガイド - `resources/Level4_expert.md`: レベル4の専門ガイド - `resources/di...

24 0
View
deploying-cloud-k8s logo
mattnigh/skills_collection

deploying-cloud-k8s

Deploys applications to cloud Kubernetes (AKS/GKE/DOKS) with CI/CD pipelines. Use when deploying to production, setting up GitHub Actions, troubleshooting deployments. Covers build-time vs runtime vars, architecture matching, and battle-tested debugging.

24 0
View
moai-alfred-agent-guide logo
mattnigh/skills_collection

moai-alfred-agent-guide

19-agent team structure, decision trees for agent selection, Haiku vs Sonnet model selection, and agent collaboration principles. Use when deciding which sub-agent to invoke, understanding team responsibilities, or learning multi-agent orchestration.

24 0
View
mermaid-diagram-generator logo
mattnigh/skills_collection

mermaid-diagram-generator

Converts architecture descriptions, module specs, or workflow docs into Mermaid diagrams. Use when visualizing brick module relationships, workflows (DDD, investigation), or system architecture. Supports: flowcharts, sequence diagrams, class diagrams, state machines, entity relationship diagrams,...

24 0
View
pre-flight-check logo
mattnigh/skills_collection

pre-flight-check

INVOKE FIRST before any code work. Validates git workflow (branch, issue, worklog) and checks approach. Use at START of every task and END before completing. Prevents skipped steps.

24 0
View
browser-dev-tools logo
mattnigh/skills_collection

browser-dev-tools

This skill should be used when working with browser-rendered artifacts (i.e. Bun, React/React Native) to proactively validate that development work on localhost is being built appropriately and to support debugging browser-rendered content. Use this skill after making frontend changes to verify t...

24 0
View
lead-dev logo
mattnigh/skills_collection

lead-dev

Lead Développeur - Coordination technique opérationnelle, code review, mentoring et livraison. Pair de web-dev-process au niveau OPÉRATIONS.

24 0
View
worker-monitor logo
mattnigh/skills_collection

worker-monitor

Monitor Docker workers, RQ queue health, and auto-scale workers (max 4). Use when: checking job progress, monitoring queue depth, scaling workers up/down, diagnosing slow processing, or waiting for jobs to complete. Referenced by data-quality skill during reprocessing.

24 0
View
quality-advisor logo
mattnigh/skills_collection

quality-advisor

Proactive quality guidance system that monitors artifact creation and provides real-time feedback on documentation quality

24 0
View
bump-version logo
mattnigh/skills_collection

bump-version

This skill should be used when the user wants to bump the version number in the workspace. It updates versions across all pyproject.toml files (root, tde, and tda packages) and the CHANGELOG.md to keep them synchronized.

24 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View