skills/nodejs-skills/express/SKILL.md
Provides comprehensive guidance for Express.js framework including routing, middleware, request handling, error handling, and API development. Use when the user asks about Express, needs to create HTTP servers, set up routes, implement middleware, or build REST APIs.
npx skillsauth add teachingai/agent-skills expressInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill whenever the user wants to:
const express = require('express');
const cors = require('cors');
const helmet = require('helmet');
const app = express();
// Middleware
app.use(helmet());
app.use(cors());
app.use(express.json());
// Routes
app.get('/api/items', async (req, res, next) => {
try {
const items = await Item.findAll();
res.json({ items });
} catch (err) {
next(err);
}
});
app.post('/api/items', async (req, res, next) => {
try {
const { name, price } = req.body;
const item = await Item.create({ name, price });
res.status(201).json(item);
} catch (err) {
next(err);
}
});
// 404 handler
app.use((req, res) => {
res.status(404).json({ error: 'Not found' });
});
// Error middleware (must have 4 params)
app.use((err, req, res, next) => {
console.error(err.stack);
res.status(err.status || 500).json({
error: err.message || 'Internal server error',
});
});
app.listen(3000, () => console.log('Server running on port 3000'));
// Wrap async handlers to catch rejected promises
const asyncHandler = (fn) => (req, res, next) =>
Promise.resolve(fn(req, res, next)).catch(next);
app.get('/api/users', asyncHandler(async (req, res) => {
const users = await User.findAll();
res.json(users);
}));
// routes/items.js
const router = require('express').Router();
router.get('/', asyncHandler(async (req, res) => { /* ... */ }));
router.post('/', asyncHandler(async (req, res) => { /* ... */ }));
router.get('/:id', asyncHandler(async (req, res) => { /* ... */ }));
module.exports = router;
// app.js
app.use('/api/items', require('./routes/items'));
express.Router() for organizationhelmet for security headers and configure CORS for production originsmorgan for request logging and structured error responsesexpress, Node.js, middleware, routing, REST API, error handling, async, helmet, cors
development
Guidance for Next.js using the official docs at nextjs.org/docs. Use when the user needs Next.js concepts, configuration, routing, data fetching, or API reference details.
tools
Provides comprehensive guidance for Flask framework including routing, templates, forms, database integration, extensions, and deployment. Use when the user asks about Flask, needs to create web applications, implement routes, or build Python web services.
development
Provides comprehensive guidance for FastAPI framework including routing, request validation, dependency injection, async operations, OpenAPI documentation, and database integration. Use when the user asks about FastAPI, needs to create REST APIs, or build high-performance Python web services.
development
Provides comprehensive guidance for Django framework including models, views, templates, forms, admin, REST framework, and deployment. Use when the user asks about Django, needs to create web applications, implement models and views, or build Django REST APIs.