# Middleware Skill

> describe how to write middleware code in the codebase, use when you need a filter or interceptor to process the request or response Use when this capability is needed.

- Skill: `tomevault-io/middleware-skill` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/middleware-skill`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/middleware-skill/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/middleware-skill

---


# middleware best practices
the document outlines the best practices for writing middleware code in the codebase.

## when to use this skill
when you need a filter or interceptor to process the request or response

## best practices
+ when you have multiple data to process, you should write separate middleware to process each data
+ if you need to check data present or not, try to use cache instead of database query
+ you should fail fast if the request is invalid, don't process the request further
+ you should return 400 bad request if request is invalid

---
> Source: [ambersun1234/skills](https://github.com/ambersun1234/skills) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-06-03 -->

