Communitygithub.com

エージェントハーネス構築

AIエージェントのアクション空間、ツール定義、観測フォーマットを設計・最適化し、完了率を向上させます。エージェントの定義や改訂時に使用します。

エージェントハーネス構築 とは?

このスキルは、AIエージェントの計画立案、ツール呼び出し、エラー回復、タスク完了への収束を改善するための体系的なガイドを提供します。アクション空間の質、観測の質、回復の質、コンテキスト予算の質という4つの主要な制約に焦点を当て、エージェントの出力品質を向上させます。具体的には、安定したツール名の使用、スキーマファーストな入力設計、決定論的な出力形状の維持、そして高リスク操作にはマイクロツールを、一般的な操作にはミディアムツールを、ラウンドトリップコストが支配的な場合にはマクロツールを使用する粒度ルールを推奨します。また、各ツール応答にステータス、サマリー、次のアクション、成果物を含める観測設計や、エラー回復契約、コンテキスト予算管理のベストプラクティスも網羅しています。ReAct、関数呼び出し、ハイブリッドアーキテクチャのパターンガイダンスや、完了率、タスクあたりのリトライ数、pass@1/pass@3、成功タスクあたりのコストといったベンチマーク指標も提供し、重複セマンティクスや不透明なツール出力などのアンチパターンも警告します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/agent-harness-construction

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

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

ドキュメント

エージェントハーネス構築 は何をしますか?

このスキルは、エージェントの計画、ツール呼び出し、エラーからの回復、完了への収束を改善する際に使用します。

コアモデル

エージェントの出力品質は以下によって制約されます:

  1. アクション空間の質
  2. 観測の質
  3. 回復の質
  4. コンテキスト予算の質

アクション空間の設計

  1. 安定した明示的なツール名を使用します。
  2. 入力をスキーマファーストかつ狭く保ちます。
  3. 決定論的な出力形状を返します。
  4. 分離が不可能でない限り、包括的なツールは避けます。

粒度ルール

  • 高リスク操作(デプロイ、マイグレーション、権限)にはマイクロツールを使用します。
  • 一般的な編集/読み取り/検索ループにはミディアムツールを使用します。
  • ラウンドトリップのオーバーヘッドが支配的なコストとなる場合にのみマクロツールを使用します。

観測設計

すべてのツール応答には以下を含める必要があります:

  • status: success|warning|error
  • summary: 一行の結果
  • next_actions: 実行可能なフォローアップ
  • artifacts: ファイルパス / ID

エラー回復契約

すべてのエラーパスに対して、以下を含めます:

  • 根本原因のヒント
  • 安全なリトライ手順
  • 明示的な停止条件

コンテキスト予算管理

  1. システムプロンプトは最小限かつ不変に保ちます。
  2. 大規模なガイダンスはオンデマンドでロードされるスキルに移動します。
  3. 長いドキュメントをインライン化するよりも、ファイルへの参照を優先します。
  4. 任意のトークンしきい値ではなく、フェーズ境界でコンパクト化します。

アーキテクチャパターンガイダンス

  • ReAct: 不確実なパスを持つ探索的タスクに最適。
  • 関数呼び出し: 構造化された決定論的フローに最適。
  • ハイブリッド(推奨): ReAct計画 + 型付きツール実行。

ベンチマーキング

以下を追跡します:

  • 完了率
  • タスクあたりのリトライ数
  • pass@1 および pass@3
  • 成功タスクあたりのコスト

アンチパターン

  • 重複するセマンティクスを持つツールが多すぎる。
  • 回復ヒントのない不透明なツール出力。
  • 次のステップがないエラー専用の出力。
  • 無関係な参照によるコンテキストの過負荷。

Individual skills in this repo

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

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

関連スキル