Back to Skills

design-a2a-agent-card

pjt222
Updated Yesterday
6 views
17
2
17
View on GitHub
Metadesign

About

This skill generates an A2A Agent Card manifest (.well-known/agent.json) that defines an agent's capabilities, skills, and authentication requirements for interoperability. Use it when building discoverable agents for the A2A protocol, enabling multi-agent orchestration and registry integration. It establishes the public contract for agent capabilities before implementation.

Quick Install

Claude Code

Recommended
Primary
npx skills add pjt222/agent-almanac -a claude-code
Plugin CommandAlternative
/plugin add https://github.com/pjt222/agent-almanac
Git CloneAlternative
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/design-a2a-agent-card

Copy and paste this command in Claude Code to install this skill

Documentation

設 A2A Agent Card

建合標之 A2A Agent Card,告代理之身、技、認證、能,供他代理發現。

用時

  • 建代理宜由他 A2A 合規代理發現
  • 為多代理編排曝能
  • 將既有代理遷至 A2A(Agent-to-Agent)協議
  • 於實裝前定代理之公契
  • 與消費 Agent Card 之代理冊合

  • 必要:代理名與述
  • 必要:代理所行之技單(名、述、入出之 schema)
  • 必要:代理宿之基 URL
  • 可選:認證法(noneoauth2oidcapi-key
  • 可選text/plain 外之內容型(如 image/pngapplication/json
  • 可選:能旗(流、推通知、狀態變史)
  • 可選:供應組織名與 URL

第一步:定代理身與述

1.1. 擇代理身字段:

{
  "name": "data-analysis-agent",
  "description": "Performs statistical analysis, data visualization, and report generation on tabular datasets.",
  "url": "https://agent.example.com",
  "provider": {
    "organization": "Example Corp",
    "url": "https://example.com"
  },
  "version": "1.0.0"
}

1.2. 書明可行之述,答:

  • 此代理覆何域?
  • 可理何任?
  • 其限為何?

1.3. 設規範 URL,Agent Card 於 /.well-known/agent.json 服。

得: 全身塊,含名、述、URL、供應、版。

敗則: 若代理服多域,思宜為一代理多技,或多代理聚範。A2A 偏範清之聚焦代理。

第二步:列技之入出 schema

2.1. 定代理可行諸技:

{
  "skills": [
    {
      "id": "analyze-dataset",
      "name": "Analyze Dataset",
      "description": "Run descriptive statistics, correlation analysis, or hypothesis tests on a CSV dataset.",
      "tags": ["statistics", "data-analysis", "csv"],
      "examples": [
        "Analyze the correlation between columns A and B in my dataset",
        "Run a t-test comparing group 1 and group 2"
      ],
      "inputModes": ["text/plain", "application/json"],
      "outputModes": ["text/plain", "application/json", "image/png"]
    },
    {
      "id": "generate-chart",
      "name": "Generate Chart",
      "description": "Create bar, line, scatter, or histogram charts from tabular data.",
      "tags": ["visualization", "charts"],
      "examples": [
        "Create a scatter plot of height vs weight",
        "Generate a histogram of the age column"
      ],
      "inputModes": ["text/plain", "application/json"],
      "outputModes": ["image/png", "image/svg+xml"]
    }
  ]
}

2.2. 每技宜供:

  • id:唯一識(kebab-case)
  • name:人可讀之顯名
  • description:一二句述技之所為
  • tags:供發現之關鍵詞
  • examples:觸此技之自然語任例
  • inputModes:技受之 MIME 型
  • outputModes:技可生之 MIME 型

2.3. 確技界清無疊。各任宜映唯一技。

得: 技陣,每項有 id、name、description、tags、examples 及 I/O 型。

敗則: 若技顯疊,合為一更廣技附多例。若技過廣,分為聚焦子技。

第三步:配認證

3.1. 依部署境定認證方案:

無認證(本地/信網):

{
  "authentication": {
    "schemes": []
  }
}

OAuth 2.0(產宜):

{
  "authentication": {
    "schemes": ["oauth2"],
    "credentials": {
      "oauth2": {
        "authorizationUrl": "https://auth.example.com/authorize",
        "tokenUrl": "https://auth.example.com/token",
        "scopes": {
          "agent:invoke": "Invoke agent skills",
          "agent:read": "Read task status"
        }
      }
    }
  }
}

API Key(簡共秘):

{
  "authentication": {
    "schemes": ["apiKey"],
    "credentials": {
      "apiKey": {
        "headerName": "X-API-Key"
      }
    }
  }
}

3.2. 擇合部署境最低可行認證:

  • 本地開發:none
  • 內服:apiKey
  • 公向代理:oauth2oidc

3.3. 將令牌/鑰發程記於 Agent Card 之 provider 段或外文檔。

得: 認證塊合部署安要。

敗則: 若無 OAuth 2.0 設施,由 API key 認證始,謀遷。勿以 none 認證部公代理。

第四步:陳能

4.1. 宣代理所支之協議特:

{
  "capabilities": {
    "streaming": true,
    "pushNotifications": false,
    "stateTransitionHistory": true
  }
}

4.2. 依實裝備度設各能旗:

  • streaming:若代理支經 tasks/sendSubscribe 之 SSE 流,則 true。啟實時進度更供久任。
  • pushNotifications:若代理可於任變時送 webhook 回調,則 true。代理宜存並呼 webhook URL。
  • stateTransitionHistory:若代理維任全狀變史(submitted、working、completed 等),則 true。審計有用。

4.3. 實裝全支乃設 true。告未支之能破互操。

得: 能塊含布爾旗合實實裝。

敗則: 若不定某能將實裝,設 false。能可後版加。移能為破壞之變。

第五步:驗並發布 Agent Card

5.1. 集全 Agent Card:

{
  "name": "data-analysis-agent",
  "description": "Performs statistical analysis and visualization on tabular datasets.",
  "url": "https://agent.example.com",
  "version": "1.0.0",
  "provider": {
    "organization": "Example Corp",
    "url": "https://example.com"
  },
  "authentication": {
    "schemes": ["oauth2"],
    "credentials": { ... }
  },
  "capabilities": {
    "streaming": true,
    "pushNotifications": false,
    "stateTransitionHistory": true
  },
  "skills": [ ... ],
  "defaultInputModes": ["text/plain"],
  "defaultOutputModes": ["text/plain"]
}

5.2. 驗 Agent Card:

  • 以 JSON 解並驗無法錯
  • 驗諸必字段存(name、description、url、skills)
  • 驗各技有 id、name、description 及至少一入/出型
  • 驗 URL 可達且於 /.well-known/agent.json 服卡

5.3. 發布 Agent Card:

  • https://<agent-url>/.well-known/agent.json
  • Content-Type: application/json
  • 若需跨源發現,啟 CORS 頭
  • 於相關代理目錄或冊注冊

5.4. 以取卡測發現:

curl -s https://agent.example.com/.well-known/agent.json | python3 -m json.tool

得: 有效 JSON Agent Card 於 well-known URL 服,諸 A2A 客可解。

敗則: 若 JSON 驗敗,以 linter 尋法錯。若 URL 不達,察 DNS、SSL 證書、web 伺配。若需 CORS,加 Access-Control-Allow-Origin 頭。

  • Agent Card 為有效 JSON 無法錯
  • 諸必字段皆存:name、description、url、skills
  • 各技有 id、name、description、inputModes、outputModes
  • 認證方案合部署安要
  • 能旗準反實裝態
  • Agent Card 於 /.well-known/agent.json 以正 Content-Type 服
  • A2A 客成取並解卡
  • 技之 examples 實際且觸正確之技

  • 過諾能:無實裝而設 streaming: truepushNotifications: true 致客用時敗。宜保守。
  • 技述含糊:「行數據事」之述阻準技匹。對入、出、域宜具體。
  • 缺 CORS 頭:瀏覽器 A2A 客無正 CORS 配不能取 Agent Card。
  • 技疊:若二技可理同任,客代理不能定呼何者。確界清。
  • 忘默模:若 defaultInputModesdefaultOutputModes 略,客或不知送何內容型。
  • 版停:技或能變時宜更 Agent Card 版。客或緩舊版。
  • 實前發布:Agent Card 為契。發布未實之技致運時敗。

Related Skills

  • implement-a2a-server - 實 Agent Card 後之服
  • test-a2a-interop - 驗 Agent Card 合規與互操
  • build-custom-mcp-server - MCP 伺為 A2A 之替/補
  • configure-mcp-server - MCP 配模式可施 A2A 設

GitHub Repository

pjt222/agent-almanac
Path: i18n/wenyan/skills/design-a2a-agent-card
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

Related Skills

content-collections

Meta

This skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.

View skill

polymarket

Meta

This skill enables developers to build applications with the Polymarket prediction markets platform, including API integration for trading and market data. It also provides real-time data streaming via WebSocket to monitor live trades and market activity. Use it for implementing trading strategies or creating tools that process live market updates.

View skill

creating-opencode-plugins

Meta

This skill helps developers create OpenCode plugins that hook into 25+ event types like commands, files, and LSP operations. It provides the plugin structure, event API specifications, and implementation patterns for JavaScript/TypeScript modules. Use it when you need to intercept, monitor, or extend the OpenCode AI assistant's lifecycle with custom event-driven logic.

View skill

sglang

Meta

SGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.

View skill