Agent skill

Knowledge Shared API And Runtime Schemas

by echoVic in echoVic/blade-code

覆盖 Server/Web 共用 TypeBox 请求响应合约、Runtime 解析包装、默认值与未知字段清理、工具 JSON Schema 投影。

MITAuto-check passedBackend & APIs

Install Knowledge Shared API And Runtime Schemas

skills CLI
$ npx skills add echoVic/blade-code --skill knowledge-shared-api-and-runtime-schemas -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install echoVic/blade-code knowledge-shared-api-and-runtime-schemas --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/echoVic/blade-code.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.trae/knowledges/workspace-policy-and-shared-foundations/shared-api-and-runtime-schemas .claude/skills/knowledge-shared-api-and-runtime-schemas && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
knowledge-shared-api-and-runtime-schemas
GitHub stars
180
Token cost
~1.6k tokens
SKILL.md length
389 words
Files
1
Skills in repo
38
Repo updated
First seen
Licence
MIT

At a glance

覆盖 Server/Web 共用 TypeBox 请求响应合约、Runtime 解析包装、默认值与未知字段清理、工具 JSON Schema 投影。

  • Tasks that involve OpenAPI specifications
  • SKILL.md covers Module Structure, API Surface, Usage Examples and Gotchas, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Knowledge Shared API And Runtime Schemas is an agent skill from echoVic/blade-code. 覆盖 Server/Web 共用 TypeBox 请求响应合约、Runtime 解析包装、默认值与未知字段清理、工具 JSON Schema 投影。 使用时机:新增 API 字段或事件、修改请求校验、修复前后端类型漂移、定义工具参数、处理 schema 默认值或公开数据裁剪。 不包含:Hono 路由业务流程见 interaction-surfaces/hono-server-api-and-streaming,具体工具注册见 tool-and-automation-platform/tool-contracts-and-registry。 关键词:TypeBox, Runtime, safeParseSchema, parseSchema, StringEnum, Default, SessionSchema, BrowserActionSchema, schemaToFunctionSchema。

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering OpenAPI specifications. It works with Hono. The repository describes itself as: AI-powered CLI coding agent with 20+ built-in tools, MCP support, and multi-model providers. The licence is MIT.

When your agent uses it

  • Tasks that involve OpenAPI specifications

Example prompts

  • “/knowledge-shared-api-and-runtime-schemas”

What it can do on your machine

Read from SKILL.md and the folder at commit 30f8684. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Knowledge Shared API And Runtime Schemas loads about 1.6k tokens when it runs. Until then it costs about 112 tokens; SKILL.md has 389 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~112
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from echoVic/blade-code at commit 30f8684, republished under its MIT licence (© echoVic). 389 words, ~1,575 tokens.

Download SKILL.mdSave it as .claude/skills/knowledge-shared-api-and-runtime-schemas/SKILL.md (or your agent's skills folder).
name
knowledge-shared-api-and-runtime-schemas
description
覆盖 Server/Web 共用 TypeBox 请求响应合约、Runtime 解析包装、默认值与未知字段清理、工具 JSON Schema 投影。 使用时机:新增 API 字段或事件、修改请求校验、修复前后端类型漂移、定义工具参数、处理 schema 默认值或公开数据裁剪。 不包含:Hono 路由业务流程见 interaction-surfaces/hono-server-api-and-streaming,具体工具注册见 tool-and-automation-platform/tool-contracts-and-registry。 关键词:TypeBox, Runtime, safeParseSchema, parseSchema, StringEnum, Default, SessionSchema, BrowserActionSchema, schemaToFunctionSchema。

Module Structure

该组件以 TypeBox schema 同时提供 TypeScript 静态类型、运行时输入验证和公开输出投影;Web 构建直接别名到 CLI 的 browser-safe API 源码,避免复制 DTO。

Directory Layout
  • packages/cli/src/schema/index.ts — Runtime、Default、StringEnum 和 TypeBox 导出
  • packages/cli/src/schema/validation.ts — clone、default、validate、clean 和结构化错误
  • packages/cli/src/api/schemas.ts — Session、Task、消息、权限、模型和设置公共合约
  • packages/cli/src/api/browserSchemas.ts — Browser 导航与交互的封闭输入 union
  • packages/cli/src/api/teamSchemas.ts — Team 快照和写请求合约
  • packages/cli/src/api/attachmentLimits.ts — 多表面共享的消息与附件上限
  • packages/cli/src/api/promptCacheMetrics.ts — Provider cache 指标的安全派生与展示
  • packages/cli/src/tools/validation/schemaToJson.ts — Provider function schema 清理
  • packages/cli/web/vite.config.ts — Web @api 到 CLI API 源码的构建别名
Key Entry Points
  • Runtime(schema) — 给 TypeBox schema 增加不可枚举的 parse / safeParse
  • safeParseSchema(schema, value) — 返回 discriminated result,不抛异常
  • parseSchema(schema, value) — 校验失败时抛 SchemaValidationError
  • schemaToFunctionSchema(schema) — 生成不含 TypeBox runtime 注解的封闭 JSON Schema
  • SessionSchema / CreateTaskRequestSchema / PermissionResponseSchema — 跨 Server/Web 高频公共合约

API Surface

Runtime Schema Helpers
  • Runtime(schema) — 保留标准 JSON Schema 可序列化形状,并附加非枚举解析方法
  • Default(schema, value) — 输入字段可省略,解析结果应用默认值
  • StringEnum(values, options?) — 生成所有 pi-ai Provider 都能接受的字符串 enum JSON Schema
  • safeParseSchema(schema, value) — 适合 HTTP 入口映射 4xx
  • parseSchema(schema, value) — 适合可信内部边界和输出投影
  • SchemaValidationError.issues — 提供解码后的字段路径、keyword、消息和原值
Shared Contracts
  • SessionSchema — 公开 Session 身份、lineage、任务状态和资源选择,不包含内部 lease 对象
  • CreateTaskRequestSchema / CreateTaskResponseSchema — Task 默认隔离、权限模式和准入状态
  • SendMessageRequestSchema — 消息、模型、附件与 structured output 输入边界
  • BrowserActionSchema — Browser 交互 discriminated union,显式禁止额外属性
  • TeamSnapshotSchema — Team 成员和任务图的跨表面只读投影

Usage Examples

Hono 路由验证请求
typescript
const parsed = safeParseSchema(CreateTaskRequestSchema, body);
if (!parsed.success) {
  throw new BadRequestError('Invalid task request');
}
Web 客户端验证服务端响应
typescript
const res = await fetch(`${API_BASE}/sessions/catalog?${params.toString()}`);
if (!res.ok) throw new Error('Failed to load session catalog');
return SessionCatalogPageSchema.parse(await res.json());

Gotchas

  • Runtime() 的 parse 和 safeParse 必须保持不可枚举;若直接把方法赋到 schema,对 Provider 序列化工具声明时会泄漏非 JSON Schema 字段 (packages/cli/src/schema/index.ts, packages/cli/src/tools/validation/schemaToJson.ts)
  • 解析顺序是 clone → 应用 default → 首次校验 → Value.Clean 删除未知字段 → 再校验;因此 schema 既会补默认值,也会把内部字段从公开响应中裁掉 (packages/cli/src/schema/validation.ts)
  • Default() 刻意把输入标记为 optional、把解析后的静态类型保持为 required;改成普通 Type.Optional 会迫使所有下游重新处理本应已默认化的 undefined (packages/cli/src/schema/index.ts)
  • StringEnum() 使用标准 type: string + enum 而不是 TypeBox 特有 union 注解,避免不同 pi-ai Provider 对函数 schema 的兼容差异 (packages/cli/src/schema/index.ts)
  • Server 不能只校验请求而直接返回领域对象;SessionSchema.parse() 等输出投影负责移除 taskWorktree、宿主路径和其他私有字段 (packages/cli/src/api/schemas.ts, packages/cli/tests/unit/integrations/api/schemas.test.ts)
  • SessionSchema 会为缺失的 taskStatus 默认 completed;读取旧会话时不能用字段缺失推断“未知”或“仍运行” (packages/cli/src/api/schemas.ts)
  • SendMessageRequestSchema 的 1,000,000 字符上限不是内联阈值;超过 32 KiB 但未超过 4 MiB 的文本仍合法,后续由 prompt artifact 边界卸载 (packages/cli/src/api/attachmentLimits.ts, packages/cli/tests/unit/integrations/api/schemas.test.ts)
  • TypeBox 只限制单附件 content,Task 路由还会累计所有附件字节并执行共享 5 MiB 上限;新增入口时必须复用同一聚合检查 (packages/cli/src/api/schemas.ts, packages/cli/src/server/routes/task.ts)
  • Browser action 对象显式 additionalProperties: false,用于防止模型或客户端把未审阅字段带入浏览器副作用;扩展 action 必须同步修改 union,而不是旁路读取原始 body (packages/cli/src/api/browserSchemas.ts)
  • Web 通过 @api 直接打包 packages/cli/src/api;该目录新增 Node-only 顶层依赖会破坏浏览器 bundle,即使服务端类型检查仍通过 (packages/cli/web/vite.config.ts)
  • schemaToFunctionSchema() 会剥离所有 ~ runtime 注解,并递归为对象补 additionalProperties: false;把 Runtime schema 直接发给 Provider 会丢失这层闭合保证 (packages/cli/src/tools/validation/schemaToJson.ts)
  • 公共 API schema 持续高频跨 Server、Web、ACP 和持久化层共改;字段重命名属于多表面迁移,不能只在 schemas.ts 做局部修复 (packages/cli/src/api/schemas.ts, git:e7ae302d)
Show full SKILL.md (114 more words)Show less

Architecture

  • packages/cli/src/schema/ 是通用运行时 schema 层,packages/cli/src/api/ 只放跨表面安全契约;领域内部对象先投影后才能进入 HTTP、SSE 或 Web Store (packages/cli/src/schema/index.ts, packages/cli/src/api/schemas.ts)
  • Hono 路由通常以 safeParseSchema() 把不可信输入映射为 BadRequestError,而 Web service 以 .parse() 验证成功响应,形成双向契约检查 (packages/cli/src/server/routes/task.ts, packages/cli/web/src/services/sessionService.ts)
  • 大型领域合约从主文件拆到 browserSchemas.ts 和 teamSchemas.ts,但继续复用同一 Runtime helper 和 Web alias (packages/cli/src/api/browserSchemas.ts, packages/cli/src/api/teamSchemas.ts)

Decisions

  • 项目从 Zod 迁移到 TypeBox,以单份 schema 原生生成 JSON Schema 并服务工具协议,同时保留类似 parse 的调用体验 (packages/cli/src/schema/index.ts, git:311ba368)
  • Session 公共 schema只保存稳定复合身份和可恢复 metadata,不公开内部 worktree lease、Provider 错误正文或资源句柄 (packages/cli/src/api/schemas.ts)
  • session title 与 prompt-cache 指标放在共享 API 目录中是为了让 CLI、Web 和 ACP 使用确定性算法,而不是由各表面独立格式化 (packages/cli/src/api/sessionTitle.ts, packages/cli/src/api/promptCacheMetrics.ts)

Consumer Analysis

  • Server 路由是最大运行时校验消费者,请求使用 safe parse,领域结果使用 parse 做安全投影 (packages/cli/src/server/routes/)
  • Web services 对 Session、Task、Team 和 Browser 响应再次解析,阻止后端漂移进入 Store (packages/cli/web/src/services/)
  • 内置工具和工具构造器使用 TypeBox 定义参数,再转为 Provider function schema (packages/cli/src/tools/builtin/, packages/cli/src/tools/core/)
  • Commands 与 CLI 复用 Runtime helper 校验 Headless 选项、JSONL 事件和配置输入 (packages/cli/src/commands/, packages/cli/src/cli/)
  • MCP 与插件系统用同一解析器校验协议 payload、凭据账本和插件 manifest (packages/cli/src/mcp/, packages/cli/src/plugins/)

© echoVic, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .trae/knowledges/workspace-policy-and-shared-foundations/shared-api-and-runtime-schemas of echoVic/blade-code.

Open the folder on GitHubat commit 30f8684

Compare with similar skills

Knowledge Shared API And Runtime Schemas next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Knowledge Shared API And Runtime Schemas compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Knowledge Shared API And Runtime Schemas this skillechoVic/blade-code180—~1.6kAutomated safety check: PassMIT
Implementing API Patternsancoleman/ai-design-components5261 repos~3kAutomated safety check: PassMIT
Olore Chanfana Latestolorehq/olore103—~967Automated safety check: PassMIT
ToolJet Marketplace Plugin BuilderToolJet/ToolJet41k—~2.1kAutomated safety check: PassAGPL-3.0
Step Partsearthtojake/text-to-cad18k1 repos~1.5kAutomated safety check: PassMIT
API DesignerJeffallan/claude-skills12k2 repos~2kAutomated safety check: PassMIT

Similar skills

  • Implementing API Patterns

    ancoleman/ai-design-components

    API design and implementation across REST, GraphQL, gRPC, and tRPC patterns.

    526 GitHub starsUsed in 1 repo~3k tokens
    Backend & APIsAuto-check passed
  • Local chanfana documentation reference (latest). An agent skill from olorehq/olore.

    103 GitHub stars~967 tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Turns an API description, such as an OpenAPI file or a Postman collection, into a connector plugin for ToolJet's marketplace and checks it with the repo's validator.

    41k GitHub stars~2.1k tokensUpdated today
    Backend & APIsAuto-check passed
  • Step Parts

    earthtojake/text-to-cad

    Find, evaluate, and download common purchasable CAD parts from step.parts, including named off-the-shelf actuators, servos, motors, electronics boards, connectors, screws, bolts, nuts, washers…

    18k GitHub starsUsed in 1 repo~1.5k tokens
    Backend & APIsAuto-check passed
  • API Designer

    Jeffallan/claude-skills

    Designs REST and GraphQL APIs from resource modeling to an OpenAPI 3.1 contract, with versioning, pagination and RFC 7807 error handling.

    12k GitHub starsUsed in 2 repos~2k tokens
    Backend & APIsAuto-check passed
  • OpenAPI to MCP Server

    mcp-use/mcp-use

    Turns an OpenAPI or Swagger spec into an MCP server with the mcp-use TypeScript SDK, mapping each operation to a tool, wiring auth, testing and deploying.

    11k GitHub stars~5.2k tokensUpdated yesterday
    Backend & APIsAuto-check passed

More from echoVic/blade-code

All 38 skills in this repo
  • Base64 Parser

    echoVic/blade-code

    Base64 编解码工具,支持编码/解码文本、JSON、二进制文件,自动检测格式,支持批量处理. An agent skill from echoVic/blade-code.

    180 GitHub stars~545 tokensUpdated 10 days ago
    Auto-check: notes
  • Code Review

    echoVic/blade-code

    Review frontend code for best practices, bugs, and improvements.

    180 GitHub stars~377 tokensUpdated 10 days ago
    Auto-check: notes
  • GitHub Explorer

    echoVic/blade-code

    Explore and summarize popular GitHub projects. An agent skill from echoVic/blade-code.

    180 GitHub stars~434 tokensUpdated 10 days ago
    Auto-check passed
  • 覆盖 Session 级 LSP 配置快照、stdio 进程、文档同步、语义查询、诊断回注、崩溃恢复 和子 Session 继承。进入条件:新增语言服务器、修改 LSP 工具、排查诊断缺失/重复、 处理 worktree 或 ACP 差异、修复进程泄漏或 transport 代际问题。不包含:VS Code 扩展桥接(见…

    180 GitHub stars~1.9k tokensUpdated 10 days ago
    Auto-check passed
  • 覆盖 SkillRegistry、SKILL.md 延迟加载、自定义命令 Markdown 解析、来源覆盖、插件 命名空间、Session 快照和模型/用户调用入口。进入条件:新增 Skill 或命令字段、调整 发现优先级、调试 /command 或 Skill 工具、修改 Prompt 元数据或消费者集成。不包含: 插件安装生命周期(见…

    180 GitHub stars~2.1k tokensUpdated 10 days ago
    Auto-check passed
  • Covers 领域能力如何包装成内置工具、getBuiltinTools 的 Session 依赖注入、ToolSearch 延迟激活,以及 Goal/Task/Team/Plan/Skill/LSP/MCP/Web/Config/Worktree 适配边界。

    180 GitHub stars~2.1k tokensUpdated 10 days ago
    Auto-check passed

Works with

Categories

Questions about Knowledge Shared API And Runtime Schemas

What does Knowledge Shared API And Runtime Schemas do?

覆盖 Server/Web 共用 TypeBox 请求响应合约、Runtime 解析包装、默认值与未知字段清理、工具 JSON Schema 投影。. Knowledge Shared API And Runtime Schemas is an agent skill from echoVic/blade-code.

When should I use Knowledge Shared API And Runtime Schemas?

Knowledge Shared API And Runtime Schemas fits situations like: tasks that involve OpenAPI specifications.

How do I install Knowledge Shared API And Runtime Schemas in Claude Code?

Run `npx skills add echoVic/blade-code --skill knowledge-shared-api-and-runtime-schemas -a claude-code`. Or copy the skill folder (.trae/knowledges/workspace-policy-and-shared-foundations/shared-api-and-runtime-schemas in echoVic/blade-code) into .claude/skills/knowledge-shared-api-and-runtime-schemas in your project. Claude Code loads it when a task matches its description.

How do I install Knowledge Shared API And Runtime Schemas in Codex?

Run `npx skills add echoVic/blade-code --skill knowledge-shared-api-and-runtime-schemas -a codex`. Or copy the skill folder (.trae/knowledges/workspace-policy-and-shared-foundations/shared-api-and-runtime-schemas in echoVic/blade-code) into .agents/skills/knowledge-shared-api-and-runtime-schemas in your project. Codex loads it when a task matches its description.

Can I use Knowledge Shared API And Runtime Schemas in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add echoVic/blade-code --skill knowledge-shared-api-and-runtime-schemas -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/knowledge-shared-api-and-runtime-schemas, .gemini/skills/knowledge-shared-api-and-runtime-schemas, .github/skills/knowledge-shared-api-and-runtime-schemas and .opencode/skills/knowledge-shared-api-and-runtime-schemas in your project.

What does Knowledge Shared API And Runtime Schemas need to run?

SKILL.md names no scripts, command-line tools or credentials: Knowledge Shared API And Runtime Schemas is instructions for the agent only.

Does Knowledge Shared API And Runtime Schemas access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Knowledge Shared API And Runtime Schemas safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Knowledge Shared API And Runtime Schemas use?

Knowledge Shared API And Runtime Schemas is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Knowledge Shared API And Runtime Schemas use?

About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Knowledge Shared API And Runtime Schemas?

Skills that share tags, products or a category with Knowledge Shared API And Runtime Schemas: Implementing API Patterns (ancoleman/ai-design-components, 526 stars), Olore Chanfana Latest (olorehq/olore, 103 stars), ToolJet Marketplace Plugin Builder (ToolJet/ToolJet, 41k stars) and Step Parts (earthtojake/text-to-cad, 18k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Knowledge Shared API And Runtime Schemas?

echoVic (a GitHub user) maintains it in echoVic/blade-code, which has 180 GitHub stars. The repository holds 38 skills in this directory. The repository was last updated on September 27, 2026.

Source: echoVic/blade-code on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.