From claude-commands
Documents both input and output JSON schemas for LLM-driven features, linking fields with extraction notes and emphasizing server-side validation to prevent data flow confusion.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-commands:llm-json-schema-documentationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Purpose:** Ensure LLM-driven features have complete schema documentation covering both input (what LLM receives) and output (what LLM returns).
Purpose: Ensure LLM-driven features have complete schema documentation covering both input (what LLM receives) and output (what LLM returns).
JSON Schema Over Text Instructions - Tell the LLM what data structures exist, not how to write the content.
Common Mistake: Documenting only OUTPUT schema while assuming LLM "just knows" what INPUT fields are available.
✅ CORRECT Approach:
### Input Schema
When `npc_data` is present in your input, each NPC entry contains:
- `tier`: (string) Social HP tier - commoner | merchant | noble | god
- `name`: (string) NPC display name
- `role`: (string) NPC role/title
### Output Schema
When Social HP is active, populate:
- `social_hp_challenge.npc_tier`: (string) **Extract from npc_data.tier**
- `social_hp_challenge.npc_name`: (string) **Extract from npc_data.name**
❌ WRONG Approach:
### Output Schema
- `social_hp_challenge.npc_tier`: (string) NPC tier
- `social_hp_challenge.npc_name`: (string) NPC name
# Missing: Where does the LLM get this data from?
Pattern:
npc_data.tiersocial_hp_challenge.npc_tierThis prevents "where does this data come from?" confusion.
✅ Examples (Reference - show good patterns):
**Example Output:**
[SOCIAL SKILL CHALLENGE: Lady Ashwood] Objective: Access family archives Social HP: 5/5 | Status: RESISTING
❌ Templates (Prescription - constrains LLM):
**Required Format:**
[SOCIAL SKILL CHALLENGE: {npc_name}]
Objective: {objective}
Social HP: {hp}/{max} | Status: {status}
# This tells LLM HOW to write, reducing autonomy
Pattern: LLM Decides, Server Executes
def validate_output(self):
"""Server validates LLM output structure."""
# Check required fields exist
if not self.social_hp_challenge.get("npc_name"):
logging_util.warning("Missing required field: npc_name")
# Cross-validate JSON with narrative
if self.social_hp_challenge and not self.narrative_contains_box():
logging_util.warning("JSON exists but narrative missing box")
When adding LLM-driven features:
Document INPUT schema - What data does the LLM receive?
Document OUTPUT schema - What data must the LLM return?
Link Input to Output - How does data flow?
Provide Examples - Show good patterns (not templates)
Server Validation - Enforce structure post-generation
Problem: LLM didn't know where to get npc_tier for output.
Solution:
npc_data.tier field existssocial_hp_challenge.npc_tier fieldFiles Updated:
$PROJECT_ROOT/prompts/game_state_instruction.md: INPUT/OUTPUT schemas$PROJECT_ROOT/narrative_response_schema.py: Server validationCLAUDE.md: Architectural principle documentationPrevents Confusion:
Preserves Autonomy:
Enables Validation:
❌ Template-Based Instructions
Write exactly this format:
[SOCIAL SKILL CHALLENGE: {npc_name}]
Problem: Reduces LLM autonomy, constrains creativity
❌ Undocumented Input Fields
Return npc_tier in your output.
Problem: LLM doesn't know where to get this data
❌ Missing Extraction Notes
- `output.tier`: (string) NPC tier
Problem: No link to input field source
❌ Pure Text Instructions
When an NPC resists persuasion, describe their resistance narratively.
Problem: No schema - server can't validate or track state
Last Updated: 2025-01-07 (Social HP all-tiers PR)
npx claudepluginhub jleechanorg/claude-commands --plugin claude-commandsProvides guidelines for writing system instructions that LLMs reliably follow, covering unconditional language, explicit input/output schemas, and instruction positioning.
Guides Pydantic schema design for Atomic Agents apps using BaseIOSchema. Covers fields, constraints, validators, enums, and patterns like chat input/output.
Generates reliable typed JSON from LLMs using constrained decoding, JSON Schema, Zod, Pydantic, and Instructor. Use for structured output, schema validation, data extraction, API responses, and debugging malformed JSON.