claudegoodies
Command

middleware

From davila7

Create Express middleware for $ARGUMENTS following project conventions.

Install

/middleware

Facts

Status
Actively maintained
Last commit

Source preview

The instructions Claude Code reads when this command runs.

# Express Middleware

Create Express middleware for $ARGUMENTS following project conventions.

## Task

Create or optimize Express middleware based on the requirements:

1. **Analyze existing middleware**: Check current middleware patterns, naming conventions, and file organization
2. **Examine Express setup**: Review app configuration, middleware stack order, and TypeScript usage
3. **Identify middleware type**: Determine the middleware category:
   - Authentication/Authorization (JWT, sessions, role-based)
   - Validation (request body, params, query validation)
   - Logging (request/response logging, audit trails)
   - Error handling (global error handlers, custom errors)
   - Security (CORS, rate limiting, helmet)
   - Utility (parsing, compression, static files)
4. **Check dependencies**: Review existing middleware dependencies to avoid duplication
5. **Implement middleware**: Create middleware with proper TypeScript types and error handling
6. **Test middleware**: Write unit and integration tests following project patterns
7. **Update middleware stack**: Integrate middleware into Express app configuration
8. **Add documentation**: Include JSDoc comments and usage examples

## Implementation Requirements

- Follow project's TypeScript conventions and interfaces
- Use existing error handling patterns and response formats
- Include proper request/response typing with custom 
View full source on GitHub →

Other slash commands