api-response-optimization
Optimizes API performance through payload reduction, caching strategies, and compression techniques. Use when improving API response times, reducing bandwidth usage, or implementing efficient caching.
npx skills add majiayu000/claude-skill-registry --skill api-response-optimization-secondsky-claude-skills-2 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# API Response Optimization Reduce payload sizes, implement caching, and enable compression for faster APIs. ## Sparse Fieldsets ```javascript // 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); }); ``` ## HTTP Caching Headers ```javascript 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); }); ``` ## Response Compression ```javascript 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 })); ``` ## Performance Targets | Metric | Target | |--------|--------| | Response time | <100ms (from 500ms) | | Payload size | <50KB (from 500KB) | |
- Sparse Fieldsets
- HTTP Caching Headers
- Response Compression
- Performance Targets
- Optimization Checklist
- Best Practices
What does the api-response-optimization skill do?
Optimizes API performance through payload reduction, caching strategies, and compression techniques. Use when improving API response times, reducing bandwidth usage, or implementing efficient caching.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill api-response-optimization-secondsky-claude-skills-2 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
