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.
npx skills add softspark/ai-toolkit --skill json-mode-patternsgit clone --depth 1 https://github.com/softspark/ai-toolkitWrote 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.
[](https://agentmods.dev/skills/softspark/ai-toolkit/json-mode-patterns)<a href="https://agentmods.dev/skills/softspark/ai-toolkit/json-mode-patterns"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/json-mode-patterns.svg" alt="Measured on agentmods" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00039 | $0.01047 |
| Opus 5 | $0.00019 | $0.00524 |
| Sonnet 5 | $0.00008 | $0.00209 |
| Haiku 4.5 | $0.00004 | $0.00105 |
Grade A, and why
json-mode-patterns 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 4d 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.
How it starts
The opening of the file, as written. The whole thing — 125 lines — stays where its author put it; the contents beside it link to each section on GitHub.
JSON Mode Patterns
Claude does not have a dedicated response_format: json parameter like some other APIs. The idiomatic way to get guaranteed JSON is tool use with a forced function call. This skill documents that pattern plus fallbacks.
Preferred Pattern: Tool-as-Schema
Define a tool whose input schema IS the JSON shape you want, then force the model to call it.
tools = [{
"name": "record_analysis",
"description": "Return the analysis as structured data",
"input_schema": {
"type": "object",
"properties": {
"sentiment": {"type": "string", "enum": ["positive", "neutral", "negative"]},
"confidence": {"type": "number", "minimum": 0, "maximum": 1},
"themes": {"type": "array", "items": {"type": "string"}}
},
"required": ["sentiment", "confidence", "themes"]
}
}]
response = client.messages.create(
model="claude-opus-4-8",
max_tokens=1024,
tools=tools,
tool_choice={"type": "tool", "name": "record_analysis"},
messages=[{"role": "user", "content": text_to_analyze}]
)
# The structured result is in response.content
for block in response.content:
if block.type == "tool_use" and block.name == "record_analysis":
result = block.input # already a Python dict, schema-validated
break
Why this wins:
- Schema is enforced at the API level
- No regex or parsing from model text
- Enums, min/max, required fields actually constrain the output
Fallback: Prompted JSON + Strict Parse
When tool use is unavailable (some SDKs/proxies strip it):
response = client.messages.create(
model="claude-opus-4-8",
max_tokens=1024,
system="You return ONLY valid JSON. No prose, no markdown fences.",
messages=[{
"role": "user",
"content": f"Extract as JSON matching this schema: {schema_str}\n\nInput: {text}"
}]
)
import json
try:
result = json.loads(response.content[0].text)
except json.JSONDecodeError:
# Claude sometimes wraps in ```json ... ```
result = json.loads(strip_markdown_fence(response.content[0].text))
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.
- 4d ago First seen · 125 lines · 39 tokens per session scan A c2551f80f367
json-mode-patterns is a skill published in the GitHub repository softspark/ai-toolkit (170 stars, last pushed today), licensed Apache-2.0. It adds 39 tokens to every session and 1,047 once invoked, about $0.0002 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.
Other skills, from other repositories
roo-fix-volatile-msg
Ladder-aware Roo Code Anthropic caching — verify the rolling read/write ladder on the wire, then close the real gaps (Vertex 4-block budget, MiniMax path).
ai-agent-builder
Conception et implémentation d'agents IA autonomes avec outils, mémoire et orchestration. Se déclenche avec "agent IA", "AI agent", "autonomous agent", "tool use", "function calling", "agent framework", "LangChain agent", "CrewAI", "AutoGen", "agent loop", "ReAct". Also triggers on "build an AI agent", "agent with…
ai-workflow-orchestrator
Orchestration de workflows IA complexes avec chaînes et pipelines. Se déclenche avec "workflow IA", "LangChain", "LangGraph", "pipeline IA", "chaîne de prompts", "orchestration LLM", "AI pipeline", "multi-step AI". Also triggers on "chain LLM calls", "orchestrate AI steps".
model-strategy
Multi-model orchestration and model-switching strategy. Score-based model selection, reasoning-effort routing, cross-agent delegation (Gemini, Codex, Ollama), advisor pairing, escalation triggers, permission matrix, and cost-efficiency optimization.
creator-prompt-engineer
Convert creative-department outputs (script, vision, cinematography, characters, sets, storyboards, shots) into producible, consistent AI image/video prompts — with tool-specific optimization, locked anchors, negative prompts, and safe alternatives. Default image tool priority for storyboard/character sheets is GPT…
continue-gemini-explicit
Continue's Gemini provider doesn't use the cachedContents API at all. Add explicit caching for sessions over the minimum token threshold.