api-response-optimization

仓库创建 2025年11月8日最近提交 29 天前SkillHot 收录 22 天前
▸ 精选理由

直接降低带宽与延迟,对高并发服务改进明显且实施成本低。

这个 Skill 做什么

通过字段筛选、缓存与压缩等方法减少 API 响应体并提升速度。

通过筛选字段、分页、压缩和缓存等手段把 API 返回体变小、响应更快,减少带宽和延迟。适合接口返回太大、用户加载慢或流量成本高时优化。尤其要结合 HTTP 缓存头、CDN、gzip/Brotli 和智能缓存策略来显著提升性能。

▸ 展开 SKILL.md 英文原文

Optimizes API performance through payload reduction, caching strategies, and compression techniques. Use when improving API response times, reducing bandwidth usage, or implementing efficient caching.

开发编程响应优化缓存压缩通用
180
Stars
28
Forks
40
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/secondsky/claude-skills/main/plugins/api-response-optimization/skills/api-response-optimization/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/secondsky/claude-skills/main/plugins/api-response-optimization/skills/api-response-optimization/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# 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
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有