agentsop-output-format-by-model
Pick an LM output format per (task x consumer x model) rather than by reflex: different formats carry different cognitive load (e.g. code-in-JSON makes the same model write worse code than plain-text+diff, while asking for prose when you need a typed object fails the other way). Use when designing or debugging an LM's output schema, choosing between plain text / diff / JSON / tool-call / grammar-constrained output, or when a model's quality drops after wrapping its output in a structured format.
npx skills add agentsope/SkillAlchemy --skill agentsop-output-format-by-model --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
The skill instructs an agent to select an appropriate output format for LM responses based on the task, the consumer, and the model. It argues that different formats impose different cognitive load and provides concrete guidance on when to prefer plain text with diffs, JSON schemas, Pydantic or typed fields, tool_use envelopes, or markdown prose. It includes model-specific recommendations and a decision workflow that maps content type, consumer constraints, and target model to a preferred format. It also enumerates ten concrete operation scenarios where specific formats are recommended, plus worked examples showing how to handle composite tasks (e.g., extraction plus rewriting) with multi-pass or multi-zone strategies. The emphasis is on matching format to content and downstream needs to preserve quality and reliability, rather than forcing a single format across all tasks.
How it works
- Activate before committing to an output schema in coder-agent design, tool integration, extraction/classification, evaluation wiring, or migrating to structured outputs.
- Use a three-step decision workflow: Step 1 assess what's being consumed (content type) to pick a default format; Step 2 assess who consumes the output (human, parser, downstream LM, compiler, tool dispatcher, diff applier) to adjust formatting; Step 3 assess which model is targeted to select a model-specific best code-edit format (e.g., udiff, diff, json tool_use, whole-file rewrite).
- Provide concrete pairings of tasks to formats (e.g., edit code → plain-text diff in markdown; extract fields → JSON / Pydantic; answer math problems → markdown reasoning with a final line; tool calls → JSON tool_use with scalar args).
- Include dilemma cases showing how to handle mixed contents, two-pass solutions, and how to avoid nesting large blocks inside JSON when code-like payloads are involved.
When to use it
Use this skill when designing or debugging an LM's output schema, choosing between plain text / diff / JSON / tool-call / grammar-constrained output, or when a model’s quality drops after wrapping its output in a structured format. It is activated before committing to an output schema in coder-agent design, tool integration, extraction/classification, evaluator wiring, or structured-output migrations.
What it can touch
- It references formats and tool names such as plain text, diff formats (udiff, SEARCH/REPLACE diff, unified diff), JSON tool_use, Pydantic / typed OutputField, markdown, and a variety of tool interfaces (e.g., code editors, SQL in tool bodies).
- It prescribes a per-model edit-format default and cites model-specific recommendations (e.g., GPT-4 Turbo prefers udiff or diff; Claude Sonnet prefers diff; Gemini uses diff-fenced).
Caveats
- It relies on empirical anchors from cited sources (e.g., models’ sensitivity to JSON-wrapped code, and Let Me Speak Freely? findings); outcomes depend on model behavior and downstream parsers.
- It cautions against forcing JSON schemas for content that is better served as prose or code, to avoid escaping penalties and degraded quality.
# Output-Format-by-Model — 让格式服务于任务,而不是反过来 > **One-liner**: Different output formats carry different cognitive load for the model. Code-in-JSON is the canonical proof: the same model writes worse code when wrapped in a JSON tool-call than when emitted as plain text + diff. The reverse failure (asking for prose when you need a typed object) is just as common. Pick format per (task × consumer), not by reflex. --- ## 1. 何时激活 (When to activate) Activate this skill **before** committing to an output schema in any of these situations: | Trigger | Signal | |---|---| | Designing a coder-agent | "should the model return a `apply_patch` tool call or plain-text diff?" | | Adding a tool to an existing agent | "tool input has a `code` / `query` / `sql` / `regex` field — should I nest it in JSON or leave it as a string?" | | Building extraction / classification | "should I use `dspy.Predict` typed fields, Pydantic + `response_format=json_schema`, or just markdown?" | | Wiring an evaluator | "the metric needs a number — but the model also has to *reason* to produce it" | | Migrating a working prompt to "structured outputs" | someone said "let's make it safer with JSON schema" | | Tool-call harnes
- 1. 何时激活 (When to activate)
- 2. 核心心智模型 (Core mental model)
- 2.1 Three-layer claim
- 2.2 The two reflexes to unlearn
- 2.3 Mental model: format as a tax on the generation surface
- 3. SOP 工作流 (Decision workflow)
- Step 1 — What's being consumed?
- Step 2 — Who consumes the output?
- Step 3 — Which model am I targeting?
- 4. 操作模型 (Task → format pairs)
- 5. 困境决策案例 (Dilemma cases / worked examples)
- Case A — "I'm writing an extractor for invoice fields. Plain text or JSON?"
- Case B — "Same task but the extractor also rewrites the invoice text"
- Case C — "Tool call decision, but the tool's input is SQL"
What does the agentsop-output-format-by-model skill do?
Pick an LM output format per (task x consumer x model) rather than by reflex: different formats carry different cognitive load (e.g. code-in-JSON makes the same model write worse code than plain-text+diff, while asking for prose when you need a typed object fails the other way). Use when designing or debugging an LM's output schema, choosing between plain text / diff / JSON / tool-call / grammar-constrained output, or when a model's quality drops after wrapping its output in a structured format.
How do I install it?
Run `npx skills add agentsope/SkillAlchemy --skill agentsop-output-format-by-model --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From agentsope/SkillAlchemy, a repository with 255 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
