add-middleware

add-middleware is a skill for Claude Code, Codex from KhaledSaeed18/node-express-boilerplate. It costs 44 tokens per session (705 once invoked), scanned A, original, MIT.

A project-specific guide for adding Express middleware, which is code that processes web requests before they reach an endpoint. It covers middleware such as rate limits, validation, logging enrichment, and authentication checks.

In plain words
What is it for?
Use it when adding and wiring middleware in an Express TypeScript project, including request guards, validation, rate limiting, logging, or custom authentication checks.
Why use it?
It helps new middleware follow the project’s existing patterns for types, errors, logging, configuration, and asynchronous work. This reduces inconsistent implementations and common Express mistakes.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/khaledsaeed18/node-express-boilerplate/add-middleware
Any agent
npx skills add KhaledSaeed18/node-express-boilerplate --skill add-middleware
Clone the repo
git clone --depth 1 https://github.com/KhaledSaeed18/node-express-boilerplate

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for add-middleware

README.md
[![agentmods](https://agentmods.dev/badge/skills/khaledsaeed18/node-express-boilerplate/add-middleware.svg)](https://agentmods.dev/skills/khaledsaeed18/node-express-boilerplate/add-middleware)
Your own site
<a href="https://agentmods.dev/skills/khaledsaeed18/node-express-boilerplate/add-middleware"><img src="https://agentmods.dev/badge/skills/khaledsaeed18/node-express-boilerplate/add-middleware.svg" alt="Measured on agentmods" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 705 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00044 $0.00705
Opus 5 $0.00022 $0.00352
Sonnet 5 $0.00009 $0.00141
Haiku 4.5 $0.00004 $0.00071

Measured 5d ago against content hash bdf7a2f45364, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

add-middleware scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/add-middleware/SKILL.md · 103 lines

How it starts

The opening of the file, as written. The whole thing — 103 lines — stays where its author put it; the contents beside it link to each section on GitHub.

When the user asks to add middleware, follow these steps.

Step 1 — Create the file (src/middleware/<name>.middleware.ts)

Rules:

  • Export named functions, not default exports — consistent with the barrel pattern.
  • Type req, res, next as Request, Response, NextFunction from express. No any.
  • Use the Pino logger from src/config/logger.ts if logging is needed — never console.*.
  • Use config values from src/config/env.ts — never process.env directly.
  • Throw from src/errors/ for error conditions and call next(error) — never res.status().json() directly.
  • No floating promises — always await or .catch().

Auth guard pattern:

import type { Request, Response, NextFunction } from 'express';
import { AuthenticationError } from '../errors';

export const requireAdmin = (req: Request, _res: Response, next: NextFunction): void => {
    if (!req.user || req.user.role !== 'admin') {
        return next(new AuthenticationError('Admin access required'));
    }
    next();
};

Async middleware pattern:

import type { Request, Response, NextFunction } from 'express';
import { NotFoundError } from '../errors';
import logger from '../config/logger';

export const someAsyncGuard = async (req: Request, _res: Response, next: NextFunction): Promise<void> => {
    try {
        // async work
        next();
    } catch (error) {
        logger.error(error, 'someAsyncGuard failed');
        next(error);
    }
};

Rate limiter pattern (if adding a new limiter):

import rateLimit from 'express-rate-limit';

export const myLimiter = rateLimit({
    windowMs: 15 * 60 * 1000,
    max: 100,
    standardHeaders: true,
    legacyHeaders: false,
    message: { success: false, message: 'Too many requests' },
});

Step 2 — Export from the barrel (src/middleware/index.ts)

export { myMiddleware } from './<name>.middleware';

Step 3 — Apply it

App-wide (applies to every request) — add to src/app.ts in the correct position in the middleware chain. Order matters:

Read the full file on GitHub · 103 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 103 lines · 44 tokens per session scan A bdf7a2f45364

Subscribe to this mod's changes

add-middleware is a skill published in the GitHub repository KhaledSaeed18/node-express-boilerplate (33 stars, last pushed 4d ago), licensed MIT. It adds 44 tokens to every session and 705 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

backend

Backend development with Node.js, Express, NestJS, and server patterns.

miles990/claude-software-skills · 16 tokens

expressjs-development

Comprehensive Express.js development skill covering routing, middleware, request/response handling, error handling, and building production-ready REST APIs.

manutej/luxor-claude-marketplace · 29 tokens

debugging-output-and-previewing-html-using-ray

Use when user says "send to Ray," "show in Ray," "debug in Ray," "log to Ray," "display in Ray," or wants to visualize data, debug output, or show diagrams in the Ray desktop application.

coollabsio/coolify · 58 tokens

laravel-actions

Build, refactor, and troubleshoot Laravel Actions using lorisleiva/laravel-actions. Use when implementing reusable action classes (object/controller/job/listener/command), converting service classes/controllers/jobs into actions, orchestrating workflows via faked actions, or debugging action entrypoints and wiring.

coollabsio/coolify · 62 tokens

review-pending-pr-reviews

Review, grill, edit, and post pending PR review drafts saved by /review-pr (or its batch/cron runners). Lists drafts that have not yet been posted, walks the maintainer through each finding, then posts, closes, or discards. Use when the user says "post my pending reviews", "what reviews are waiting", "go through the…

nrwl/nx · 93 tokens

saas-builder

Clone, verify, map, and build on top of ixartz/SaaS-Boilerplate for a user's SaaS idea. Use when a user wants to reuse SaaS Boilerplate, evaluate how their product fits it, or build product-specific pages, database schema, roles, permissions, MVP features, and launch scope on top of the boilerplate.

ixartz/SaaS-Boilerplate · 75 tokens