Communitygithub.com

コンテキストエンジニアリング

コンテキスト使用制限の確認、残り時間の監視、トークン消費の最適化、コンテキスト障害のデバッグを行います。コンテキスト使用率、レート制限、使用量警告、コンテキスト最適化、エージェントアーキテクチャ、メモリシステムについて質問する際に使用します。

コンテキストエンジニアリング とは?

このスキルは、エージェントシステムにおけるコンテキストウィンドウの効率的な管理と最適化に特化した包括的なツールセットです。開発者はこれにより、トークン使用量の監視、コンテキスト劣化の検出、圧縮戦略の実装、マルチエージェント調整の設計、メモリシステムの構築が可能になります。主な対象プラットフォームはClaude Codeですが、原則は多くのLLMベースのエージェントに応用可能です。内部では、PostToolUseフックを利用した使用状況認識の自動インジェクション、Pythonスクリプトによるコンテキスト健全性分析と圧縮品質評価を提供します。このスキルは、コンテキスト品質を数量よりも優先し、段階的な情報開示を採用し、サブエージェント間でのワーク分割による分離を促進する4バケット戦略に基づいています。トークン使用率が70%で警告、80%で最適化トリガーを推奨し、キャッシュヒット率70%以上を目標とすることで、コスト削減とレイテンシ改善を実現します。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/majiayu000/claude-skill-registry/tree/HEAD/skills/context-management/context-engineering-hoanghd218-landing-page-ai-kien

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

コンテキストエンジニアリング は何をしますか?

コンテキストエンジニアリングは、LLMタスクに対して最小限の高シグナルトークンセットを厳選します。目標は、トークン使用量を最小限に抑えながら、推論品質を最大化することです。

アクティベートすべきタイミング

  • エージェントシステムの設計/デバッグ
  • コンテキスト制限がパフォーマンスを制約している場合
  • コスト/レイテンシの最適化
  • マルチエージェント連携の構築
  • メモリシステムの実装
  • エージェントパフォーマンスの評価
  • LLMベースのパイプライン開発

基本原則

  1. コンテキスト品質 > 量 - 高シグナルトークンが網羅的なコンテンツに勝る
  2. 注意は有限 - U字曲線により先頭と末尾の位置が有利
  3. 段階的な開示 - 情報をジャストインタイムで読み込む
  4. 分離は劣化を防ぐ - 作業をサブエージェント間で分割する
  5. 最適化前に測定 - ベースラインを把握する

重要:

  • 簡潔さのために文法を犠牲にする。
  • 高品質を維持しながらトークン効率を確保する。
  • これらのルールをサブエージェントに引き継ぐ。

クイックリファレンス

トピック使用タイミング参照先
基礎コンテキスト構造、注意メカニズムの理解context-fundamentals.md
劣化障害、lost-in-middle、ポイズニングのデバッグcontext-degradation.md
最適化圧縮、マスキング、キャッシュ、分割context-optimization.md
圧縮長期セッション、要約戦略context-compression.md
メモリセッション間永続化、ナレッジグラフmemory-systems.md
マルチエージェント連携パターン、コンテキスト分離multi-agent-patterns.md
評価エージェントテスト、LLM-as-Judge、メトリクスevaluation.md
ツール設計ツール統合、説明エンジニアリングtool-design.md
パイプラインプロジェクト開発、バッチ処理project-development.md
実行時認識使用制限、コンテキストウィンドウ監視runtime-awareness.md

主要メトリクス

  • トークン使用率: 70%で警告、80%で最適化トリガー
  • トークン分散: エージェントパフォーマンス分散の80%を説明
  • マルチエージェントコスト: シングルエージェントベースラインの約15倍
  • 圧縮目標: 50-70%削減、品質損失5%未満
  • キャッシュヒット目標: 安定したワークロードで70%以上

4バケット戦略

  1. 書き出し: コンテキストを外部に保存(スクラッチパッド、ファイル)
  2. 選択: 関連コンテキストのみをプル(検索、フィルタリング)
  3. 圧縮: 情報を保持しながらトークンを削減(要約)
  4. 分離: サブエージェント間で分割(パーティショニング)

アンチパターン

  • 厳選されたコンテキストに対する網羅的なコンテキスト
  • 中間位置への重要な情報配置
  • 制限前に圧縮トリガーがない
  • 並列化可能なタスクへのシングルエージェント
  • 明確な説明がないツール

ガイドライン

  1. 重要な情報はコンテキストの先頭と末尾に配置する
  2. 使用率70-80%で圧縮を実装する
  3. コンテキスト分離にはロールプレイではなくサブエージェントを使用する
  4. 4つの質問フレームワーク(何を、いつ、入力、戻り値)でツールを設計する
  5. リクエストあたりのトークンではなく、タスクあたりのトークンで最適化する
  6. プローブベースの評価で検証する
  7. 本番環境でKVキャッシュヒット率を監視する
  8. 最小限から始め、必要な場合にのみ複雑性を追加する

実行時認識

システムはPostToolUseフックを介して使用状況認識を自動的に注入します:

<usage-awareness>
Claude Usage Limits: 5h=45%, 7d=32%
Context Window Usage: 67%
</usage-awareness>

しきい値:

  • 70%: 警告 - 最適化/圧縮を検討
  • 90%: 重大 - 即時対応が必要

データソース:

  • 使用制限: Anthropic OAuth API (https://api.anthropic.com/api/oauth/usage)
  • コンテキストウィンドウ: ステータスライン一時ファイル (/tmp/ck-context-{session_id}.json)

スクリプト

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

majiayu000/claude-skill-registry

Builds, edit or validate Agent Skill through conversational discovery. Use when the user requests to "Create an Agent", "Optimize an Agent" or "Edit an Agent".

majiayu000/claude-skill-registry

Edit existing BMAD agents while maintaining compliance

majiayu000/claude-skill-registry

Edit existing BMAD agents while maintaining compliance

majiayu000/claude-skill-registry

Edit existing BMAD modules while maintaining coherence

majiayu000/claude-skill-registry

Edit existing BMAD modules while maintaining coherence

majiayu000/claude-skill-registry

Analyzes current state and user query to answer BMad questions or recommend the next workflow or agent. Use when user says what should I do next, what do I do now, or asks a question about BMad

majiayu000/claude-skill-registry

Build AI agents with Google ADK Python (Agent Development Kit). Use for multi-agent systems, workflow agents (sequential/parallel/loop), Vertex AI deployment, tool integration, human-in-the-loop.

majiayu000/claude-skill-registry

Build AI agents with Google ADK Python (Agent Development Kit). Use for multi-agent systems, workflow agents (sequential/parallel/loop), Vertex AI deployment, tool integration, human-in-the-loop.

majiayu000/claude-skill-registry

Portfolio allocation and rebalancing optimizer. Manages asset allocation across stocks/cash/bonds, performs periodic rebalancing, and ensures diversification according to market regime and risk tolerance.

majiayu000/claude-skill-registry

Create a hilarious and ultra-realistic video of an anthropomorphic animal acting like a human vlogger in a real-world setting.

majiayu000/claude-skill-registry

Speech-to-text transcription and translation via OpenAI Audio API -- models, response formats, timestamps, prompting, streaming, chunking, and diarization

majiayu000/claude-skill-registry

BlockRun works with Claude Code and Google Antigravity.

majiayu000/claude-skill-registry

This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.

majiayu000/claude-skill-registry

小省导购员数字人带货版即梦视频提示词生成系统,基于四大智能体协同(提示词生成师、质量管控师、知识库运维师、跨环节适配师),按照"主体+运动+场景+(镜头语言+光影+氛围)"公式输出中英文双版提示词,适配5s短视频。确保人物一致性、视觉连贯性、情绪连贯性,支持知识库智能复用和跨工具适配(Suno音乐、AI绘画),为数字人带货视频提供高质量提示词生成服务。

majiayu000/claude-skill-registry

Upload and manage files using Google Gemini File API via scripts/. Use for uploading images, audio, video, PDFs, and other files for use with Gemini models. Supports file upload, status checking, and file management. Triggers on "upload file", "file API", "upload image", "upload PDF", "upload video", "file management".

majiayu000/claude-skill-registry

CRITICAL: Use for MolyKit AI chat toolkit. Triggers on: BotClient, OpenAI, SSE streaming, AI chat, molykit, PlatformSend, spawn(), ThreadToken, cross-platform async, Chat widget, Messages, PromptInput, Avatar, LLM

majiayu000/claude-skill-registry

AI and machine learning workflow covering LLM application development, RAG implementation, agent architecture, ML pipelines, and AI-powered features.

majiayu000/claude-skill-registry

Analyze images/audio/video with Gemini API (better vision than Claude). Generate images (Imagen 4), videos (Veo 3). Use for vision analysis, transcription, OCR, design extraction, multimodal AI.

majiayu000/claude-skill-registry

Analyze images/audio/video with Gemini API (better vision than Claude). Generate images (Imagen 4), videos (Veo 3). Use for vision analysis, transcription, OCR, design extraction, multimodal AI.

majiayu000/claude-skill-registry

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

関連スキル