Implement GitOps workflows with ArgoCD and Flux for automated, declarative Kubernetes...
npx skills add DonggangChen/antigravity-agentic-skills --skill "backend_core"
Install specific skill from multi-skill repository
# Description
Node.js/TypeScript core principles, project structure, and TypeScript strict mode rules.
# SKILL.md
name: backend_core
router_kit: FullStackKit
description: Node.js/TypeScript core principles, project structure, and TypeScript strict mode rules.
metadata:
skillport:
category: development
tags: [accessibility, api integration, backend, backend core, browser apis, client-side, components, css3, debugging, deployment, frameworks, frontend, fullstack, html5, javascript, libraries, node.js, npm, performance optimization, responsive design, seo, state management, testing, typescript, ui/ux, web development] - backend-database
๐ง Backend Core
Node.js/TypeScript core principles and project structure.
๐ 1. Scope
| Area | Technology |
|---|---|
| Runtime | Node.js 20+ (LTS) |
| Language | TypeScript (Strict) |
| Framework | NestJS, Fastify, Express |
โ๏ธ 2. TypeScript Strict Mode
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitReturns": true
}
}
any Forbidden
// โ WRONG
function process(data: any) { }
// โ
RIGHT
function process(data: DataPayload) { }
// Use unknown for unknown types
function parse(input: unknown) { }
๐ 3. Project Structure (Feature-First)
src/
โโโ modules/
โ โโโ auth/
โ โ โโโ auth.controller.ts
โ โ โโโ auth.service.ts
โ โ โโโ auth.repository.ts
โ โ โโโ auth.dto.ts
โ โโโ users/
โโโ shared/
โ โโโ middleware/
โ โโโ guards/
โ โโโ utils/
โโโ infrastructure/
โ โโโ database/
โ โโโ cache/
โ โโโ logger/
โโโ config/
โโโ main.ts
๐ 4. Environment Variables
import { z } from 'zod';
const envSchema = z.object({
NODE_ENV: z.enum(['development', 'production', 'test']),
PORT: z.string().transform(Number),
DATABASE_URL: z.string().url(),
JWT_SECRET: z.string().min(32),
});
export const env = envSchema.parse(process.env);
๐ Related Skills
backend-api- REST/GraphQL designbackend-database- DB patterns, caching
backend-database- DB patterns, caching
Backend Core v1.2 - Verified
๐ Workflow
Phase 1: Foundation (Structure)
- [ ] Components: Separate folders by component (components/user, components/order), not by technical role (controllers, models).
- [ ] Config: Type-safe environment variables using
dotenvandenvalid(or Zod). - [ ] Entry: Separate app into
app.ts(setup) andserver.ts(listen).
Phase 2: Core Utilities
- [ ] Logger: Install
winstonorpinoinstead ofconsole.log. - [ ] Async Wrapper: Use global handler or wrapper to catch Promise rejections.
- [ ] Linter: Connect ESLint and Prettier settings to CI pipeline.
Phase 3: Hardening
- [ ] Graceful Shutdown: Listen for SIGTERM/SIGINT signals and close connections gently.
- [ ] Health Check: Add
/healthendpoint.
Checkpoints
| Phase | Verification |
|---|---|
| 1 | Do you need to touch 5 different folders when adding a new feature? (Should not -> Component based) |
| 2 | Is the .env file committed? (Should not be) |
| 3 | Does the process restart automatically if the app crashes? (PM2/Docker) |
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.