Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Claude Code Api Conversation

ASecurity

Use when implementing server-side message and content-block compatibility for a Claude Code Anthropic gateway, including messages arrays, system blocks, tool_result pairing, image/document/thinking blocks, cache_control, and tolerant validation.

4 stars
0 votes
0 copies
0 views
Added 9/20/2026
ai-agentsapi

Works with

claude codeapi

Security Analysis

A100/100

Scanned 9/20/2026

Install to Claude Code

$npx -y skills add ZipperCode/lingma2api --skill claude-code-api-conversation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Claude Code Api Conversation?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Claude Code Api Conversation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/zippercode-claude-code-api-conversation/badge)](https://www.skillsdirectory.com/skills/zippercode-claude-code-api-conversation)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: claude-code-api-conversation
description: Use when implementing server-side message and content-block compatibility for a Claude Code Anthropic gateway, including messages arrays, system blocks, tool_result pairing, image/document/thinking blocks, cache_control, and tolerant validation.
---

# Claude Code 网关消息协议

## 目标

根据本 skill,实现 `/v1/messages` 服务端对 `messages`、`system` 和 content blocks 的兼容解析。你要校验并转发 Anthropic 消息结构,不要实现 Claude Code 本地 transcript 存储。

详细字段见 `references/message-wire-format.md`。

## Message 结构

请求中的 message 只有两类:

```json
{ "role": "user", "content": "hello" }
{ "role": "assistant", "content": [{ "type": "text", "text": "hi" }] }
```

Claude Code 通常发送 content block array。网关应同时接受字符串和数组。

## 必须支持的 content blocks

| Block | 方向 | 处理 |
|---|---|---|
| `text` | user/assistant | 普通文本 |
| `tool_use` | assistant history | 模型曾请求工具 |
| `tool_result` | user | 工具执行结果 |
| `image` | user | base64 图片 |
| `document` | user | base64 PDF |
| `thinking` | assistant history | 保留或忽略 |
| `redacted_thinking` | assistant history | 保留或忽略 |
| `server_tool_use` | assistant history | 保留或忽略 |
| `cache_edits` | user | 不支持缓存时忽略 |

## System prompt

`system` 可能是字符串,也可能是:

```json
[
  { "type": "text", "text": "...", "cache_control": { "type": "ephemeral", "scope": "org" } }
]
```

不支持 prompt cache 时忽略 `cache_control`,但保留 `text`。

## Tool pairing

如果历史中有 assistant `tool_use`,下一条或后续 user message 通常包含同 id 的 `tool_result`。服务端应尽量保留这条链路给上游模型。

最低要求:

- 孤立 `tool_result` 不要导致 500;可以忽略或转成文本提示。
- 缺失 `tool_result` 的 `tool_use` 不要阻断整个请求;可以按历史内容保留。
- `tool_result.tool_use_id` 与 `tool_use.id` 匹配时,应作为工具结果传给上游。

## 媒体与附件

- `image.source` 是 base64,`media_type` 常见 `image/png`、`image/jpeg`、`image/gif`、`image/webp`。
- `document.source.media_type` 常见 `application/pdf`。
- 如果上游不支持媒体,返回明确 400,或把媒体替换为文本占位;不要静默丢掉用户文本。

## 宽松兼容

Claude Code 请求里可能携带 cache、tool search、advisor、caller 等扩展字段。外部网关不需要实现这些内部能力,但应尽量忽略未知字段,只在真正无法转换时返回 400。

Attribution

ZipperCodeZipperCode
View sourceMore from ZipperCode →
SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

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

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Related Skills

Caveman

Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.

1023331 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

686011 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3331 votes

catchup

Recovers prior coding-agent session context by running `catchup <agent> --since-compact`, which extracts a clean summary of a previous Codex, Claude Code, Antigravity, OpenCode, or Pi Agent session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", or asks to recover/summarize a previous session before continuing. Do NOT use for the current conversation, git history, or any non-agent log.

611 votes

math-skill

A comprehensive mathematical reasoning skill for AI assistants — handles arithmetic to research-level problems with rigorous step-by-step reasoning, systematic verification, and transparent uncertainty handling

381 votes
View all in ai-agents →