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-optimizationThis skill uses the workspace's default tool permissions.
Reduce payload sizes, implement caching, and enable compression for faster APIs.
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
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%) |