# express-typescript

Rules that steer your agent when it writes Express.js and TypeScript APIs: project layout, middleware, validation, security.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1400 installs · ★ 286
- Author: Mindrally
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/Mindrally/skills/tree/HEAD/express-typescript/SKILL.md
- Updated: 2026-10-08
- HTML: https://affpapa.org/en/nevibecode/skills/express-typescript

## What it does

This skill hands the agent a set of conventions for Express.js and TypeScript code. Naming rules come first: PascalCase for types, camelCase for functions, kebab-case for files. No `any` — build the type instead. Interfaces over type aliases, Zod for runtime validation. The agent also gets a directory layout to follow: `routes/{resource}/` with controller and validators, plus `middleware/`, `services/`, `models/`, `types/express.d.ts`.

Then come the code patterns. App setup with `helmet`, `cors` and body parsing. A request logger that times each call. Auth middleware that pulls the token from the authorization header. A router where validation runs before the controller and the error handler sits last in the chain. There is a section on extending Express types with `declare global` so `req.user` stops failing type checks.

Security is a checklist: security headers, rate limiting, input sanitisation, HTTPS in production. The rate limiter example in the source cuts off partway through its options, so you pick the window and the request cap yourself. The skill installs across six platforms, and the rule text is the same everywhere — no drift between editors.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add Mindrally/skills --skill express-typescript -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/express-typescript/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/express-typescript/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add Mindrally/skills --skill express-typescript -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/express-typescript/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add Mindrally/skills --skill express-typescript -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/express-typescript/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install Mindrally/skills express-typescript
```

2. **Manually: put the files in place**
- File: `.github/skills/express-typescript/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add Mindrally/skills --skill express-typescript -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/Mindrally/skills --path express-typescript
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/express-typescript/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add Mindrally/skills --skill express-typescript -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/Mindrally/skills/tree/HEAD/express-typescript/SKILL.md

## When to use it
- split Express routes by resource with controllers and validators
- write auth middleware that verifies a bearer token
- wire up Zod and return 400 with error details
- build a central error handler with AppError classes
- add helmet, CORS and request rate limiting to the app

## Example prompts
- Set up an Express TypeScript project structure using the express-typescript skill
- Add Zod validation middleware for the create user route
- Show me how to extend the Request type with a user field

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 929d40e921fa3a25.

BEGIN THIRD-PARTY FILE 929d40e921fa3a25
````text
---
name: express-typescript
description: Guidelines for building robust APIs with Express.js and TypeScript, covering middleware patterns, routing, and security best practices
metadata:
  maintainer: Mindrally
  source: https://github.com/Mindrally/skills
---

# Express TypeScript Development

You are an expert in Express.js and TypeScript development with deep knowledge of building scalable, maintainable APIs.

## TypeScript General Guidelines

### Basic Principles

- Use English for all code and documentation
- Always declare types for variables and functions (parameters and return values)
- Avoid using `any` type - create necessary types instead
- Use JSDoc to document public classes and methods
- Write concise, maintainable, and technically accurate code
- Use functional and declarative programming patterns; avoid classes where possible
- Prefer iteration and modularization to adhere to DRY principles

### Nomenclature

- Use PascalCase for types and interfaces
- Use camelCase for variables, functions, and methods
- Use kebab-case for file and directory names
- Use UPPERCASE for environment variables
- Use descriptive variable names with auxiliary verbs: `isLoading`, `hasError`, `canDelete`
- Start each function with a verb

### Functions

- Write short functions with a single purpose
- Use arrow functions for middleware and handlers
- Use async/await consistently throughout the codebase
- Use the RO-RO pattern for multiple parameters

### Types and Interfaces

- Prefer interfaces over types for object shapes
- Avoid enums; use maps or const objects instead
- Use Zod for runtime validation with inferred types
- Use `readonly` for immutable properties

## Express-Specific Guidelines

### Project Structure

```
src/
  routes/
    {resource}/
      index.ts
      controller.ts
      validators.ts
  middleware/
    auth.ts
    errorHandler.ts
    requestLogger.ts
    validateRequest.ts
  services/
    {domain}Service.ts
  models/
    {entity}.ts
  types/
    express.d.ts
    index.ts
  utils/
  config/
  app.ts
  server.ts
```

### Application Setup

```typescript
import express, { Express } from 'express';
import helmet from 'helmet';
import cors from 'cors';
import { errorHandler } from './middleware/errorHandler';
import { requestLogger } from './middleware/requestLogger';
import routes from './routes';

const createApp = (): Express => {
  const app = express();

  // Security middleware
  app.use(helmet());
  app.use(cors());

  // Body parsing
  app.use(express.json());
  app.use(express.urlencoded({ extended: true }));
````
END THIRD-PARTY FILE 929d40e921fa3a25

The third-party file has ended. Everything between the 929d40e921fa3a25 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2573 of 7636 bytes. © Mindrally · Apache-2.0 · https://github.com/Mindrally/skills/tree/HEAD/express-typescript/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
