structured-output-json-schema
大模型严格结构化输出 JSON Schema 约束设计与 Function Calling 容错修复机制。
Skill by 2428424081cn
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/2428424081cn-structured-output-json-schema
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/structured-output-json-schema
What's inside
- Skill name
structured-output-json-schema- Description
- 大模型严格结构化输出 JSON Schema 约束设计与 Function Calling 容错修复机制。
- License
- MIT
- Instructions
- 35 lines in SKILL.md · view on GitHub
Files (2)
- SKILL.md
- skill.json
SKILL.md (first lines)
# 大模型严格结构化 JSON 输出设计准则
## 1. Zod / Pydantic 严格 Schema 约束
定义 Schema 时,必须设置 `additionalProperties: false`,并将所有字段设为 `required`:
```ts
import { z } from 'zod';
export const DecisionResultSchema = z.object({
status: z.enum(['APPROVED', 'REJECTED', 'NEEDS_REVIEW']),
confidenceScore: z.number().min(0).max(1),
reasoning: z.string().min(10).describe('详细决策依据,不少于 10 字'),
suggestedActions: z.array(z.string()).describe('推荐执行动作清单'),
}).strict();
export type DecisionResult = z.infer<typeof DecisionResultSchema>;
```
## 2. 容错与 JSON 修复流
大模型偶尔会输出包含 Markdown 代码块 (```json ... ```) 或尾随逗号。必须在反序列化层增加清洗容错:
```ts
export function safeParseJson<T>(rawText: string, schema: z.ZodType<T>): T {
let cleaned = rawText.trim();
// 去除 markdown 标记
if (cleaned.startsWith('```json')) cleaned = cleaned.replace(/^```json\s*/, '');
if (cleaned.startsWith('```')) cleaned = cleaned.replace(/^```\s*/, '');
if (cleaned.endsWith('```')) cleaned = cleaned.replace(/\s*```$/, '');
const parsed = JSON.parse(cleaned);
return schema.parse(parsed);
}
```From 2428424081cn/Skill-mcp, MIT.
More from 2428424081cn/Skill-mcp
- 0.544score
permissioned-github
2428424081cn
Guidelines for interacting with GitHub and request permissions from the user when commands fail due to restrictions in the agent environment.
SkillBFreshness: B★ 1Claude Code +9 - 0.544score
agy-customizations
2428424081cn
Comprehensive guide and reference for the Antigravity Customization System.
SkillBFreshness: B★ 1Claude Code +9 - 0.541score
golang-idiomatic-patterns
2428424081cn
Go (Golang) 原生工程惯用法:错误链包装、Context 生命周期、Goroutine 泄漏防御与表驱动测试。
SkillBFreshness: B★ 1Claude Code +9 - 0.541score
graphql-schema-design
2428424081cn
GraphQL API 设计准则:Relay 游标分页、DataLoader 批量防 N+1 查询与 Schema 优雅演进。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
nestjs-prisma-drizzle
2428424081cn
NestJS 模块化依赖注入架构与 Prisma / Drizzle ORM 端到端类型安全后端规范。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
spring-boot-clean-architecture
2428424081cn
Spring Boot 3 / Java 企业级 DDD 领域驱动设计与六边形 (Hexagonal) 干净架构规范。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
fastapi-rest-service
2428424081cn
FastAPI / Pydantic v2 高性能异步后端开发指南。涵盖依赖注入、异步数据库连接池与统一响应封装。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
redis-cache-patterns
2428424081cn
Redis 缓存实战架构模式。防击穿/雪崩/穿透、滑动窗口限流与分布式锁标准实现。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
architecture-decision-records
2428424081cn
架构决策记录 (ADR) 标准规范:技术选型、架构权衡论证与变更生命周期管理。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
llm-prompt-injection-defense
2428424081cn
大模型 Prompt 注入防御与越狱防护准则:非可信数据定界隔离、系统提示词防嗅探与输入清洗。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
prompt-ab-testing
2428424081cn
大模型 Prompt 提示词 A/B 测试与版本迭代指南。提供提示词量化评估指标与防御性提示词设计。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
sql-query-optimizer
2428424081cn
SQL 性能优化与慢查询诊断。提供索引覆盖(Covering Index)、分页深度优化与 JOIN 性能建议。
SkillBFreshness: B★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 24, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/2428424081cn/Skill-mcp
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from 2428424081cn
- 0.544score
permissioned-github
2428424081cn
Guidelines for interacting with GitHub and request permissions from the user when commands fail due to restrictions in the agent environment.
SkillBFreshness: B★ 1Claude Code +9 - 0.544score
agy-customizations
2428424081cn
Comprehensive guide and reference for the Antigravity Customization System.
SkillBFreshness: B★ 1Claude Code +9 - 0.541score
golang-idiomatic-patterns
2428424081cn
Go (Golang) 原生工程惯用法:错误链包装、Context 生命周期、Goroutine 泄漏防御与表驱动测试。
SkillBFreshness: B★ 1Claude Code +9 - 0.541score
graphql-schema-design
2428424081cn
GraphQL API 设计准则:Relay 游标分页、DataLoader 批量防 N+1 查询与 Schema 优雅演进。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
spring-boot-clean-architecture
2428424081cn
Spring Boot 3 / Java 企业级 DDD 领域驱动设计与六边形 (Hexagonal) 干净架构规范。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
architecture-decision-records
2428424081cn
架构决策记录 (ADR) 标准规范:技术选型、架构权衡论证与变更生命周期管理。
SkillBFreshness: B★ 1Claude Code +9
Cite this page
structured-output-json-schema skill. Agent Mart. https://agentmart.dev/skills/2428424081cn-structured-output-json-schema (last updated 2026-10-24)