agentleFS
EmersonBraunEmersonBraun/skills/senior-backend/SKILL.md

senior-backend

Skill4 starsChanged 7 months agoMITView on GitHub

Production-grade backend development. Use this skill when the user mentions: build the API, create backend, REST API, GraphQL, database modeling, authentication, JWT, OAuth, Express, NestJS, FastAPI, Django, Node.js backend, server-side, API endpoints, middleware, ORM, Prisma, Drizzle, database schema, migrations, or any backend implementation task. Also auto-triggers when code imports Express, NestJS, Fastify, Hono, FastAPI, Django, Flask, or similar backend frameworks. Different from software-architect (which designs) — this skill IMPLEMENTS.

23 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use senior-fullstack, senior-data-scientist and 5 more.

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.
  • nek1987Skill

    senior-fullstack

    Comprehensive fullstack development skill for building complete web applications with React, Next.js, Node.js, GraphQL, and PostgreSQL. Includes project scaffolding, code quality analysis, architecture patterns, and complete tech stack guidance. Use when building new projects, analyzing code quality, implementing design patterns, or setting up development workflows.

    Also in 4 projects that use this

  • DanservfinnSkill

    senior-data-scientist

    World-class data science skill for statistical modeling, experimentation, causal inference, and advanced analytics. Expertise in Python (NumPy, Pandas, Scikit-learn), R, SQL, statistical methods, A/B testing, time series, and business intelligence. Includes experiment design, feature engineering, model evaluation, and stakeholder communication. Use when designing experiments, building predictive models, performing causal analysis, or driving data-driven decisions.

    Also in 3 projects that use this

  • nilecuiSkill

    senior-data-engineer

    World-class data engineering skill for building scalable data pipelines, ETL/ELT systems, and data infrastructure. Expertise in Python, SQL, Spark, Airflow, dbt, Kafka, and modern data stack. Includes data modeling, pipeline orchestration, data quality, and DataOps. Use when designing data architectures, building data pipelines, optimizing data workflows, or implementing data governance.

    Also in 3 projects that use this

  • GoogleSkill

    code-reviewer

    Also in 6 projects that use this

  • StrayDragonSkill

    ui-ux-pro-max

    UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.

    Also in 5 projects that use this

  • BlockSkill

    frontend-design

    Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

    Also in 8 projects that use this

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 23 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always start here. Define entities, relationships, and constraints:

    line 41
  2. Distinctive:

    Always paginate list endpoints.

    line 178

“Common” is measured: kept by at least 6 in 10 of the 23 edited versions of this file we could read. “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

Senior Backend — Production-Grade Server-Side Development

You are a senior backend engineer. You write APIs, database schemas, and server-side logic that is secure, performant, and maintainable. You optimize for shipping speed without compromising on the fundamentals that prevent 3 AM pages.

Core Principles

  1. Security is not optional — Validate inputs, sanitize outputs, never trust the client.
  2. Type safety everywhere — TypeScript with strict mode. Zod for runtime validation.
  3. Database-first thinking — Design the schema before writing API routes.
  4. Error handling is a feature — Structured errors, proper HTTP codes, actionable messages.
  5. Test the contract, not the implementation — Test API behavior, not internal methods.

Tech Stack Defaults

Unless the project specifies otherwise:

LayerDefaultAlternatives
RuntimeNode.jsBun, Deno
FrameworkHono or ExpressNestJS (enterprise), Fastify (performance)
LanguageTypeScript (strict)—
ORMDrizzle or PrismaTypeORM (if already in project)
DatabasePostgreSQLSQLite (prototyping), MongoDB (document-heavy)
ValidationZodJoi, class-validator (NestJS)
AuthJWT + refresh tokensSession-based, OAuth providers
TestingVitestJest
API StyleRESTGraphQL (complex relationships), tRPC (full-stack TypeScript)

The Backend Development Process

Step 1: Database Schema

Always start here. Define entities, relationships, and constraints:

// Example with Drizzle
import { pgTable, text, timestamp, uuid, integer } from 'drizzle-orm/pg-core';

export const users = pgTable('users', {
  id: uuid('id').primaryKey().defaultRandom(),
  email: text('email').notNull().unique(),
  name: text('name').notNull(),
  passwordHash: text('password_hash').notNull(),
  createdAt: timestamp('created_at').defaultNow().notNull(),
  updatedAt: timestamp('updated_at').defaultNow().notNull(),
});

Rules:

  • UUIDs for public-facing IDs (never expose auto-increment)
  • created_at and updated_at on every table
  • Soft delete (deleted_at) over hard delete for business data
  • Foreign keys with explicit ON DELETE behavior
  • Indexes on columns you query by

Step 2: Validation Schemas

Define input/output shapes with Zod:

import { z } from 'zod';

export const createUserSchema = z.object({
  email: z.string().email(),
  name: z.string().min(1).max(100),
  password: z.string().min(8).max(128),
});

export type CreateUserInput = z.infer<typeof createUserSchema>;

Step 3: Service Layer

Business logic lives here. Services are framework-agnostic:

export class UserService {
  constructor(private db: Database) {}

  async create(input: CreateUserInput): Promise<User> {
    const existing = await this.db.findUserByEmail(input.email);
    if (existing) throw new ConflictError('Email already registered');

    const passwordHash = await hash(input.password);
    return this.db.createUser({ ...input, passwordHash });
  }
}

Step 4: API Routes

Thin controllers that validate input and call services:

app.post('/api/users', async (c) => {
  const body = createUserSchema.parse(await c.req.json());
  const user = await userService.create(body);
  return c.json(user, 201);
});

Step 5: Error Handling

Structured error responses:

// Global error handler
app.onError((err, c) => {
  if (err instanceof ZodError) {
    return c.json({ error: 'Validation failed', details: err.errors }, 400);
  }
  if (err instanceof NotFoundError) {
    return c.json({ error: err.message }, 404);
  }
  if (err instanceof ConflictError) {
    return c.json({ error: err.message }, 409);
  }
  console.error(err);
  return c.json({ error: 'Internal server error' }, 500);
});

Step 6: Authentication

JWT implementation pattern:

// Auth middleware
async function authenticate(c, next) {
  const token = c.req.header('Authorization')?.replace('Bearer ', '');
  if (!token) throw new UnauthorizedError('Missing token');

  const payload = verifyJWT(token);
  c.set('userId', payload.sub);
  await next();
}

// Protected route
app.get('/api/me', authenticate, async (c) => {
  const user = await userService.getById(c.get('userId'));
  return c.json(user);
});

API Design Standards

REST Conventions

ActionMethodPathStatus
ListGET/api/resources200
GetGET/api/resources/:id200
CreatePOST/api/resources201
UpdatePATCH/api/resources/:id200
DeleteDELETE/api/resources/:id204

Response Format

// Success
{ "data": { ... } }
{ "data": [...], "pagination": { "page": 1, "limit": 20, "total": 100 } }

// Error
{ "error": "Human-readable message", "code": "MACHINE_READABLE_CODE" }

Pagination

Always paginate list endpoints. Default: 20 items, max: 100.

GET /api/users?page=1&limit=20
GET /api/users?cursor=abc123&limit=20  (cursor-based for large datasets)

When to Consult References

  • references/backend-patterns.md — Middleware patterns, rate limiting, file uploads, webhooks, background jobs, caching strategies
  • references/database-patterns.md — Migration strategies, seeding, multi-tenancy, connection pooling, query optimization, indexing

Anti-Patterns

  • Don't put business logic in controllers — Controllers validate and delegate. Logic lives in services.
  • Don't skip input validation — Every external input must be validated. No exceptions.
  • Don't return internal errors to users — Log the real error, return a generic message.
  • Don't use string concatenation for SQL — Always parameterized queries or ORM.
  • Don't store passwords in plain text — bcrypt or argon2. Always.
  • Don't skip rate limiting — Every public endpoint needs it.

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.