Communitygithub.com

Agent-接驳件构建

设计并优化AI Agent的动作空间、工具定义和观察格式化,以提高完成率。适用于定义或修订Agent时使用。

Agent-接驳件构建 是什么?

Agent-接驳件构建(Agent Harness Construction)是一项专注于提升AI Agent执行效率的专业技能。它通过四个核心方面——动作空间质量、观察质量、恢复质量与上下文预算质量——来约束并优化Agent的产出。该技能支持ReAct、函数调用及其混合架构,并为每种模式提供最佳实践指导。其核心价值在于:通过设计稳定、显式且粒度恰当的工具(如高风险操作使用微工具、常见编辑循环使用中等工具),搭配结构化的观察输出(包含状态、摘要、后续动作和工件),以及可靠的错误恢复合约(含根因提示、安全重试指令和显式终止条件),显著提高Agent任务完成率。此外,该技能还包含上下文预算优化策略和基准测试建议(包括完成率、每任务重试次数、pass@1/pass@3及成本),并明确指出了需避免的反模式(如工具语义重叠、不透明的工具输出、缺少后续步骤的错误输出、以及上下文过载)。它适用于Claude Code、Cursor、Codex等主流AI开发平台,帮助开发者系统性地设计和迭代Agent的接驳件,从而获得更稳定、高效且可预测的Agent行为。

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

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Agent-接驳件构建 是做什么的?

当您要改进Agent的规划、工具调用、错误恢复以及收敛完成时,请使用此技能。

核心模型

Agent输出质量受以下因素制约:

  1. 动作空间质量
  2. 观察质量
  3. 恢复质量
  4. 上下文预算质量

动作空间设计

  1. 使用稳定、显式的工具名称。
  2. 保持输入以schema优先且范围狭窄。
  3. 返回确定性的输出形状。
  4. 除非无法隔离,否则避免使用全能型工具。

粒度规则

  • 对高风险操作(部署、迁移、权限)使用微工具。
  • 对常见的编辑/读取/搜索循环使用中等工具。
  • 仅当往返开销是主要成本时,才使用宏工具。

观察设计

每个工具响应应包含:

  • status: success|warning|error
  • summary: 一行摘要
  • next_actions: 可操作的后续步骤
  • artifacts: 文件路径 / 唯一标识符

错误恢复合约

对于每条错误路径,包含:

  • 根因提示
  • 安全重试指令
  • 显式终止条件

上下文预算规划

  1. 保持系统提示简洁且不变。
  2. 将大量指导性内容移至按需加载的技能中。
  3. 优先引用文件,而非内联长文档。
  4. 在阶段边界处进行压缩,而不是在任意token阈值处。

架构模式指南

  • 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.

相关技能