Help us improve
Share bugs, ideas, or general feedback.
From api-response-optimization
Optimizes API responses via sparse fieldsets for payload reduction, ETag caching headers, and compression middleware. Use for improving response times, reducing bandwidth, and efficient caching in Node.js apps.
npx claudepluginhub secondsky/claude-skills --plugin api-response-optimizationHow this skill is triggered — by the user, by Claude, or both
Slash command
/api-response-optimization:api-response-optimizationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Reduce payload sizes, implement caching, and enable compression for faster APIs.
Implements HTTP caching strategies including Cache-Control directives, ETags, conditional requests, CDN caching for APIs, response compression (gzip/Brotli), HTTP/2, and circuit breakers.
Implements API response caching with Redis, Memcached, cache-aside patterns, TTL, tag-based invalidation, HTTP headers, and stale-while-revalidate for performance optimization.
Configures Cache-Control directives and ETags for HTTP endpoints to reduce redundant network round-trips and origin load.
Share bugs, ideas, or general feedback.
Reduce payload sizes, implement caching, and enable compression for faster APIs.
// Allow clients to select fields: GET /users?fields=id,name,email
app.get('/users', async (req, res) => {
const fields = req.query.fields?.split(',') || null;
const users = await User.find({}, fields?.join(' '));
res.json(users);
});
app.get('/products/:id', async (req, res) => {
const product = await Product.findById(req.params.id);
const etag = crypto.createHash('md5').update(JSON.stringify(product)).digest('hex');
if (req.headers['if-none-match'] === etag) {
return res.status(304).end();
}
res.set({
'Cache-Control': 'public, max-age=3600',
'ETag': etag
});
res.json(product);
});
const compression = require('compression');
app.use(compression({
filter: (req, res) => {
if (req.headers['x-no-compression']) return false;
return compression.filter(req, res);
},
level: 6 // Balance between speed and compression
}));
| Metric | Target |
|---|---|
| Response time | <100ms (from 500ms) |
| Payload size | <50KB (from 500KB) |
| Server CPU | <30% (from 80%) |