agentleFS
hoangNguyenAngelhackhoangNguyenAngelhack/ai-agent-setup/.agents/skills/nodejs-backend/SKILL.md

nodejs-backend

Skill3 starsChanged 6 months agoMITView on GitHub

Build production-ready Node.js backend APIs with Express, Prisma, Redis, and BullMQ. Use when creating REST APIs, database models, services, middleware, background jobs, or server-side logic.

5 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use security.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • 0xSeroSkill

    security

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never hardcode secrets - use environment variables

    line 139
  2. Distinctive:

    Use parameterized queries (Prisma handles this)

    line 142
  3. Very specific:

    Use Helmet.js for HTTP security headers

    line 144

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Node.js Backend Development

Build production-ready backend APIs following industry best practices.

Impact Levels

LevelDescription
CRITICALMust follow - security, data integrity
HIGHShould follow - maintainability, performance
MEDIUMRecommended - code quality

Tech Stack

  • Framework: Express.js + TypeScript
  • ORM: Prisma
  • Database: PostgreSQL
  • Cache: Redis (ioredis)
  • Queue: BullMQ
  • Validation: Zod
  • Logging: Pino

Project Structure

src/
├── config/          # Configuration (db, redis, env)
├── controllers/     # Route handlers (thin layer)
├── middleware/      # Auth, error handler, logging
├── repositories/    # Data access layer
├── routes/          # Route definitions
├── services/        # Business logic
├── utils/           # Helpers (AppError, logger)
└── index.ts         # Entry point

Patterns

Layered Architecture (HIGH)

Request → Routes → Middleware → Controllers → Services → Repositories → Database

Error Handling (CRITICAL)

// Use AppError for operational errors
class AppError extends Error {
  constructor(
    message: string,
    public statusCode: number = 500,
    public code: string = 'INTERNAL_ERROR'
  ) {
    super(message);
    this.name = 'AppError';
  }
}

// Throw in services
if (!user) throw new AppError('User not found', 404, 'USER_NOT_FOUND');

API Response Format

// Success
{ "success": true, "data": { ... } }

// Error
{ "success": false, "error": { "code": "...", "message": "..." } }

// Paginated
{ "success": true, "data": [...], "pagination": { "page": 1, "total": 100 } }

Database (Prisma) (HIGH)

// Always use transactions for multi-step operations
await db.$transaction(async (tx) => {
  const order = await tx.order.create({ data: orderData });
  await tx.inventory.update({ 
    where: { id: productId }, 
    data: { stock: { decrement: 1 } } 
  });
  return order;
});

// Select only needed fields
const user = await db.user.findUnique({
  where: { id },
  select: { id: true, email: true, name: true }
});

Caching (Redis) (HIGH)

async function getOrSet<T>(
  key: string,
  fetcher: () => Promise<T>,
  ttlSeconds = 3600
): Promise<T> {
  const cached = await redis.get(key);
  if (cached) return JSON.parse(cached);
  
  const data = await fetcher();
  await redis.setex(key, ttlSeconds, JSON.stringify(data));
  return data;
}

Queue (BullMQ) (MEDIUM)

// Producer
const emailQueue = new Queue('email', { connection: redis });
await emailQueue.add('send-welcome', { to: user.email, name: user.name });

// Consumer
const worker = new Worker('email', async (job) => {
  await sendEmail(job.data);
}, { connection: redis });

Security Rules (CRITICAL)

  • Never hardcode secrets - use environment variables
  • Hash passwords with bcrypt (12+ rounds)
  • Validate all inputs with Zod
  • Use parameterized queries (Prisma handles this)
  • Implement rate limiting on auth endpoints
  • Use Helmet.js for HTTP security headers

Testing (HIGH)

  • 80% minimum test coverage
  • Unit tests for services
  • Integration tests for routes
  • Use Vitest + Supertest

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.