knowledge-shared-api-and-runtime-schemas

knowledge-shared-api-and-runtime-schemas is a skill for Claude Code, Codex from echoVic/blade-code. It costs 149 tokens per session (2,214 once invoked), scanned A, original, MIT.

Shared request and response definitions for the server and web app, with runtime checks for incoming data and cleaned JSON schemas for tools. TypeBox is the library used to describe these data shapes.

In plain words
What is it for?
Use it when adding API fields or events, validating requests, defining tool parameters, applying schema defaults, or fixing differences between server and web types.
Why use it?
It keeps the frontend and backend using the same data contracts, reducing type mismatches and rejecting invalid or unwanted fields at the boundary.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding API fields or events, validating requests, defining tool…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/echovic/blade-code/shared-api-and-runtime-schemas
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add echoVic/blade-code --skill shared-api-and-runtime-schemas
Clone the repo
git clone --depth 1 https://github.com/echoVic/blade-code

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for knowledge-shared-api-and-runtime-schemas

README.md
[![agentmods](https://agentmods.dev/badge/skills/echovic/blade-code/shared-api-and-runtime-schemas.svg)](https://agentmods.dev/skills/echovic/blade-code/shared-api-and-runtime-schemas)
Your own site
<a href="https://agentmods.dev/skills/echovic/blade-code/shared-api-and-runtime-schemas"><img src="https://agentmods.dev/badge/skills/echovic/blade-code/shared-api-and-runtime-schemas.svg" alt="Measured on agentmods" height="20"></a>
Per session 149 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,214 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00149 $0.02214
Opus 5 $0.00075 $0.01107
Sonnet 5 $0.00030 $0.00443
Haiku 4.5 $0.00015 $0.00221

Measured 3d ago against content hash 4b0436d99e2b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

knowledge-shared-api-and-runtime-schemas scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.trae/knowledges/workspace-policy-and-shared-foundations/shared-api-and-runtime-schemas/SKILL.md · 96 lines

How it starts

The opening of the file, as written. The whole thing — 96 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Module Structure

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

Directory Layout

  • packages/cli/src/schema/index.tsRuntimeDefaultStringEnum 和 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 路由验证请求

const parsed = safeParseSchema(CreateTaskRequestSchema, body);
if (!parsed.success) {
  throw new BadRequestError('Invalid task request');
}

Read the full file on GitHub · 96 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 96 lines · 149 tokens per session scan A 4b0436d99e2b

Subscribe to this mod's changes

knowledge-shared-api-and-runtime-schemas is a skill published in the GitHub repository echoVic/blade-code (178 stars, last pushed yesterday), licensed MIT. It adds 149 tokens to every session and 2,214 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

groq-inference

Ultra-fast LLM inference on custom LPU hardware. OpenAI-compatible API at api.groq.com. Lowest latency in the industry (500-1000+ tok/s). Supports chat completions, vision, audio (Whisper STT + TTS), tool calling, JSON mode, and streaming. Free tier available. Inference only — no training.

synthetic-sciences/openscience · 77 tokens

bun-file-io

Use this when you are working on file operations like reading, writing, scanning, or deleting files. It summarizes the preferred file APIs and patterns used in this repo. It also notes when to use filesystem helpers for directories.

synthetic-sciences/openscience · 49 tokens

protocolsio-integration

Integration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io…

synthetic-sciences/openscience · 85 tokens

langbot-dev

Develop, build, and debug the LangBot core backend and web frontend. Use when working inside the LangBot repository — backend (Python/Quart, src/langbot/pkg), the Vite/React web UI, HTTP API controllers/services, Alembic migrations, or the MCP server. Covers the dev environment (uv, pnpm), repo layout, the API auth…

langbot-app/LangBot · 136 tokens

data-leakage-detection

Detect sensitive information disclosure via escalating dialogue probes. Covers system prompt extraction, credential/API key leakage, PII, and internal configuration exposure.

Tencent/AI-Infra-Guard · 34 tokens

clinical-reports

Write comprehensive clinical reports including case reports (CARE guidelines), diagnostic reports (radiology/pathology/lab), clinical trial reports (ICH-E3, SAE, CSR), and patient documentation (SOAP, H&P, discharge summaries). Full support with templates, regulatory compliance (HIPAA, FDA, ICH-GCP), and validation…

synthetic-sciences/openscience · 71 tokens