Skip to content
secondsky avatar

Api Response Optimization

Practical API response optimization covering sparse fieldsets, HTTP caching headers, and response compression for faster, lighter endpoints.

CCM score
52 of 100
skills.sh installs
442
GitHub stars
257
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers payload reduction, ETag-based HTTP caching, and gzip or brotli response compression for Express-style APIs
  • Includes JavaScript examples for ?fields= sparse fieldsets, 304 conditional responses, and compression middleware with a per-request opt-out
  • Sets performance targets of under 100ms response time, under 50KB payloads, and under 30% server CPU
  • Provides a checklist covering field removal, pagination, N+1 query prevention, and APM monitoring, plus caching rules for immutable and frequently changing data

Install

$ npx -y skills add secondsky/claude-skills --skill api-response-optimization -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

API Response Optimization

Reduce payload sizes, implement caching, and enable compression for faster APIs.

Sparse Fieldsets

// 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

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

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

Details

Repository
github.com/secondsky/claude-skills
Categories
Backend & APIs, Code Review & Quality
First seen
Jun 3, 2026

Questions

What does the api-response-optimization skill do?

The api-response-optimization skill reduces API payload sizes, adds HTTP caching with ETag and Cache-Control headers, and enables response compression. It is meant for improving API response times, reducing bandwidth usage, and setting up efficient caching in an API.

How do I install the api-response-optimization skill?

Run npx -y skills add secondsky/claude-skills --skill api-response-optimization -y in a project to install api-response-optimization. Once installed, the skill gives your agent guidance on sparse fieldsets, ETag caching and gzip or brotli compression.

Where does api-response-optimization stand in the Backend & APIs category?

api-response-optimization is listed under Backend & APIs on Claude Marketplaces, next to entra-app-registration, neon, firebase-basics, firebase-auth-basics and workers-best-practices. It sets itself apart by focusing on payload reduction, HTTP caching headers and compression rather than on a single platform.

Which performance targets does api-response-optimization suggest?

api-response-optimization gives targets of under 100ms response time, down from 500ms, payloads under 50KB, down from 500KB, and server CPU under 30%, down from 80%. It also includes a checklist covering sparse fieldsets, ETag headers, compression, pagination and N+1 query prevention.

More from secondsky/claude-skills

All 116

Similar to Api Response Optimization

More Backend & APIs