Skip to content
Agentmart
Submit a tool

express-api

Express.js server-side development patterns for building robust REST APIs with proper middleware chains, error handling, request validation, security…

Skill by dallay

IndexedMIT★ 2
Write a review

Chalk Labs

Need help deploying express-api?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/dallay-express-api

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Express.js server-side development patterns for building robust REST APIs with proper middleware chains, error handling, request validation, security hardening, and scalable project structure. Use when the task involves `Express.js`, `Express server`, `Express middleware`, `Node.js REST API`, or `Express routing`.

Use cases: backend, security, productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/express-api

What's inside

Skill name
express-api
Description
Express.js server-side development patterns for building robust REST APIs with proper middleware chains, error handling, request validation, security hardening, and scalable project structure. Use when the task involves `Express.js`, `Express server`, `Express middleware`, `Node.js REST API`, or `Express routing`.
License
MIT
Metadata
version: 1.0.0
Instructions
291 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

## When to Use

- Building or refactoring a REST API with Express.js.
- Setting up middleware chains for authentication, logging, or validation.
- Structuring an Express project for maintainability and testability.
- Adding security headers, rate limiting, or CORS configuration.
- Implementing centralized error handling across routes.

## Critical Patterns

- **Layered Architecture:** Separate routes → controllers → services → repositories. Routes define
  endpoints, controllers handle HTTP concerns, services contain business logic, repositories handle
  data access.
- **Centralized Error Handling:** NEVER scatter `try/catch` in every route. Use an async wrapper and
  a single error-handling middleware at the end of the middleware chain.
- **Validate at the Edge:** Validate ALL incoming data (body, params, query) at the route level
  using Zod or Joi BEFORE it reaches the controller.
- **Security by Default:** Always use `helmet`, configure `cors` explicitly (never `*` in
  production), and apply rate limiting to public endpoints.
- **Environment Config:** Use a validated config module. NEVER access `process.env` directly
  throughout the codebase.
- **Consistent Response Shape:** Every API response should follow the same envelope:
  `{ data, error, meta }`.

## Project Structure

```
src/
├── config/
│   └── env.ts              # Validated environment config
├── middleware/
│   ├── errorHandler.ts      # Centralized error handler
│   ├── validate.ts          # Request validation middleware
│   ├── auth.ts              # Authentication middleware
│   └── rateLimiter.ts       # Rate limiting config
├── routes/
│   ├── index.ts             # Route aggregator
│   └── users.routes.ts      # /users route definitions
├── controllers/
│   └── users.controller.ts  # HTTP concern handling
├── services/
│   └── users.service.ts     # Business logic
├── repositories/
│   └── users.repository.ts  # Data access
├── errors/
│   └── AppError.ts          # Custom error classes
├── utils/
│   └── asyncHandler.ts      # Async error wrapper
└── app.ts                   # Express app setup
```

## Code Examples

### App Setup with Security Middleware

```typescript
import express from "express";
import helmet from "helmet";
import cors from "cors";
import { rateLimit } from "express-rate-limit";
import { errorHandler } from "./middleware/errorHandler";
import { routes } from "./routes";

const app = express();

// Security middleware — order matters
app.use(helmet());
app.use(cors({
  origin: process.env.ALLOWED_ORIGINS?.split(",") ?? [],
  credentials: true,
}));
app.use(rateLimit({
  windowMs: 15 * 60 * 1000, // 15 minutes
  max: 100,
  standardHeaders: true,
  legacyHeaders: false,
}));

// Body parsing
app.use(express.json({ limit: "10kb" }));
app.use(express.urlencoded({ extended: true }));

// Routes
app.use("/api/v1", routes);

// Health check — outside versioned routes
app.get("/health", (_req, res) => {
  res.json({ status: "ok" });
});

// Centralized error handler — MUST be last
app.use(errorHandler);

export { app };
```

### Async Error Wrapper

```typescript
import { Request, Response, NextFunction, RequestHandler } from "express";

// Wraps async route handlers so thrown errors reach the error middleware
export const asyncHandler = (
  fn: (req: Request, res: Response, next: NextFunction) => Promise<void>
): RequestHandler => {
  return (req, res, next) => {
    Promise.resolve(fn(req, res, next)).catch(next);
  };
};
```

### Custom Error Classes

```typescript
export class AppError extends Error {
  constructor(
    public readonly statusCode: number,
    public readonly message: string,
    public readonly isOperational = true,

From dallay/agents-skills, MIT.

More from dallay/agents-skills

Signals

Stars
2
Forks
0
Open issues
3
Last commit (this folder)
Apr 4, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.0.0
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from dallay

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get express-api running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying express-api?

CallGet help
Cite this page

express-api skill. Agent Mart. https://agentmart.dev/skills/dallay-express-api (last updated 2026-10-24)