Skip to content
Back to skills

Collection

ASecurity

HTTPプロトコルを正しく効率的に活用するためのベストプラクティス集。 📚 リソース参照: このスキルには以下のリソースが含まれています。 必要に応じて該当するリソースを参照してください: - `.claude/skills/http-best-practices/resources/status-codes.md`: 2xx/4xx/5xxステータスコードの適切な使い分け - `.claude/skills/http-best-practices/resources/idempotency.md`: 冪等性設計と冪等キー実装 - `.claude/skills/http-best-practices/resources/connection-management.md`: Keep-Alive、コネクションプーリング、HTTP/2最適化 - `.claude/skills/http-best-practices/resources/headers-best-practices.md`: 標準ヘッダー活用とカスタムヘッダー設計 専門分野: - HTTPステータスコード: ...

  • 24 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
developmenttypescriptnodeapibackend

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add mattnigh/skills_collection --skill collection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Collection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Collection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattnigh-collection-248b9d90/badge)](https://www.skillsdirectory.com/skills/mattnigh-collection-248b9d90)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: .claude/skills/http-best-practices/SKILL.md
description: |
  HTTPプロトコルを正しく効率的に活用するためのベストプラクティス集。

  📚 リソース参照:
  このスキルには以下のリソースが含まれています。
  必要に応じて該当するリソースを参照してください:

  - `.claude/skills/http-best-practices/resources/status-codes.md`: 2xx/4xx/5xxステータスコードの適切な使い分け
  - `.claude/skills/http-best-practices/resources/idempotency.md`: 冪等性設計と冪等キー実装
  - `.claude/skills/http-best-practices/resources/connection-management.md`: Keep-Alive、コネクションプーリング、HTTP/2最適化
  - `.claude/skills/http-best-practices/resources/headers-best-practices.md`: 標準ヘッダー活用とカスタムヘッダー設計

  専門分野:
  - HTTPステータスコード: 2xx/4xx/5xx系の適切な使い分けとエラー設計
  - 冪等性設計: 冪等キー実装とリトライセーフなAPI設計
  - コネクション管理: Keep-Alive、コネクションプーリング、HTTP/2マルチプレキシング
  - ヘッダー設計: Content-Type/Accept交渉、キャッシュ制御、カスタムヘッダー

  使用タイミング:
  - RESTful APIを設計・実装する時
  - HTTPクライアントを実装する時
  - API通信のパフォーマンスを最適化する時
  - エラーハンドリング戦略を設計する時

  Use proactively when designing RESTful APIs, implementing HTTP clients,
  or optimizing API communication.
version: 1.0.0
---

# HTTP Best Practices スキル

## 概要

HTTP プロトコルを正しく効率的に活用するためのベストプラクティス集。
ステータスコード、冪等性、コネクション管理、ヘッダー設計など、
堅牢な API 通信を実現するための知識を提供します。

## 対象エージェント

- .claude/agents/gateway-dev.md
- @backend-architect
- .claude/agents/api-doc-writer.md

## 含まれるリソース

### 1. HTTP ステータスコード (resources/status-codes.md)

- 2xx 成功系の適切な使い分け
- 4xx クライアントエラーの設計
- 5xx サーバーエラーのハンドリング
- カスタムエラーレスポンス設計

### 2. 冪等性設計 (resources/idempotency.md)

- HTTP メソッドと冪等性
- 冪等キーの実装
- リトライセーフな API 設計
- 重複リクエスト防止

### 3. コネクション管理 (resources/connection-management.md)

- Keep-Alive 最適化
- コネクションプーリング
- HTTP/2 マルチプレキシング
- コネクションタイムアウト設計

### 4. ヘッダー設計 (resources/headers-best-practices.md)

- 標準ヘッダーの活用
- カスタムヘッダー設計
- Content-Type/Accept 交渉
- キャッシュ制御ヘッダー

## ワークフロー

```
1. 要件分析
   ├── APIの特性を把握
   ├── 必要なステータスコードを特定
   └── 冪等性要件を確認

2. 設計
   ├── エンドポイント設計
   ├── エラーレスポンス設計
   └── ヘッダー戦略策定

3. 実装
   ├── HTTPクライアント設定
   ├── ステータスコードハンドリング
   └── コネクション管理設定

4. 検証
   ├── エラーシナリオテスト
   ├── 冪等性テスト
   └── パフォーマンステスト
```

## ベストプラクティス

### ステータスコード選択

```typescript
// 成功レスポンス
200 OK           // 取得・更新成功(ボディあり)
201 Created      // リソース作成成功(Locationヘッダー必須)
202 Accepted     // 非同期処理受付
204 No Content   // 削除成功(ボディなし)

// クライアントエラー
400 Bad Request  // リクエスト形式エラー
401 Unauthorized // 認証エラー
403 Forbidden    // 認可エラー
404 Not Found    // リソース未存在
409 Conflict     // 競合(楽観ロック失敗など)
422 Unprocessable Entity // バリデーションエラー
429 Too Many Requests    // レート制限

// サーバーエラー
500 Internal Server Error // 予期しないエラー
502 Bad Gateway           // 上流サービスエラー
503 Service Unavailable   // 一時的利用不可
504 Gateway Timeout       // 上流タイムアウト
```

### 冪等性設計

```typescript
// 冪等キー実装
interface IdempotentRequest {
  headers: {
    "Idempotency-Key": string; // クライアント生成UUID
  };
}

// サーバー側実装
async function handleIdempotentRequest(
  key: string,
  handler: () => Promise<Response>,
): Promise<Response> {
  // 既存レスポンスをチェック
  const cached = await cache.get(`idempotency:${key}`);
  if (cached) return cached;

  // 新規実行
  const response = await handler();

  // キャッシュに保存(24時間)
  await cache.set(`idempotency:${key}`, response, 86400);

  return response;
}
```

### コネクション最適化

```typescript
// Node.js HTTPエージェント設定
import { Agent } from "http";

const agent = new Agent({
  keepAlive: true, // コネクション再利用
  keepAliveMsecs: 30000, // Keep-Alive間隔
  maxSockets: 50, // 最大同時接続数
  maxFreeSockets: 10, // 待機コネクション数
  timeout: 30000, // ソケットタイムアウト
});

// fetch使用時
const response = await fetch(url, {
  agent,
  signal: AbortSignal.timeout(10000),
});
```

## 品質チェックリスト

### 設計時

- [ ] 各エンドポイントに適切なステータスコードが定義されているか?
- [ ] エラーレスポンス形式が統一されているか?
- [ ] 冪等でないエンドポイントに冪等キーが実装されているか?

### 実装時

- [ ] Content-Type/Accept が正しく設定されているか?
- [ ] タイムアウトが適切に設定されているか?
- [ ] コネクションプールが設定されているか?

### 運用時

- [ ] ステータスコード別のメトリクスが収集されているか?
- [ ] コネクションリークが監視されているか?
- [ ] エラー率にアラートが設定されているか?

## 参考資料

- **RFC 7231**: HTTP/1.1 Semantics and Content
- **RFC 7232**: HTTP/1.1 Conditional Requests
- **RFC 9110**: HTTP Semantics
- **『RESTful Web APIs』** Leonard Richardson 著

## 関連スキル

- .claude/skills/api-client-patterns/SKILL.md: API クライアント実装パターン
- .claude/skills/retry-strategies/SKILL.md: リトライ・サーキットブレーカー
- .claude/skills/rate-limiting/SKILL.md: レート制限実装

Files in this skill

  • 0Chan-smc__claude-code-workflow-lab__claude__skills__frontend-dev-guidelines__SKILL.md15.1 KB
  • 17hz__nextjs-template__claude__skills__example-skill__SKILL.md316 B
  • 1ambda__dataops-platform__claude__skills__context-synthesis__SKILL.md3.5 KB
  • 1natsu172__dotfiles__claude__skills__git-analysis__SKILL.md5.4 KB
  • 1natsu172__dotfiles__claude__skills__github-pr-best-practices__SKILL.md7.7 KB
  • 23Maestro__prospect-pipeline__claude__skills__npid-fastapi-skill.md26.1 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-javascript__SKILL.md15.7 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-python__SKILL.md17.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-expression-syntax__SKILL.md9.4 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-mcp-tools-expert__SKILL.md12.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-node-configuration__SKILL.md16.6 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-workflow-patterns__SKILL.md11.2 KB
  • 3x-Projetos__claude-memory-framework__claude__skills__scientist__SKILL.md14.8 KB
  • 5MinFutures__futures-arena__claude__skills__migration-tracker__SKILL.md16.2 KB
  • 5MinFutures__futures-arena__claude__skills__planning-guidelines__SKILL.md11.8 KB
  • 92Bilal26__TaskPilotAI__claude__skills__assessment-builder__SKILL.md17.5 KB
  • 92Bilal26__TaskPilotAI__claude__skills__book-scaffolding__SKILL.md19.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__code-validation-sandbox__SKILL.md6.2 KB
  • 92Bilal26__TaskPilotAI__claude__skills__exercise-designer__SKILL.md18.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__learning-objectives__SKILL.md24.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.