modifying-cli-output-schema

Guides modification of Golem CLI StructuredOutput implementations and command-output.schema.json definitions.

1.5k|212|Updated Nov 24, 2023
One-click install
npx skills add https://github.com/golemcloud/golem --skill modifying-cli-output-schema
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: modifying-cli-output-schema
Source: https://github.com/golemcloud/golem/tree/main/.agents/skills/modifying-cli-output-schema
Command: npx skills add https://github.com/golemcloud/golem --skill modifying-cli-output-schema

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Changing structured JSON output from the golem-cli requires keeping Rust DTOs, serde serialization, the handwritten JSON Schema, and property-based test generators in sync, and drift between them silently breaks downstream consumers.

Core Features & Use Cases

  • Schema Synchronization Rules: Enforces that command-output.schema.json matches actual serde output, including tagged enums, flattened payloads, and nullable Option fields.
  • $type Contract Governance: Defines naming conventions for output type discriminators and required metadata like x-golem-output-mode and x-golem-command.
  • Generator and Validation Workflow: Directs updates to DTO-backed arbitrary generators in cli_output/tests.rs and lists the exact cargo test and cargo make commands to validate changes.
  • Use Case: When adding a new agent.invoke output field, follow the workflow to update the DTO, schema, generator, and user-facing skills, then run the focused schema tests to confirm no drift.

Quick Start

Ask the agent to add a new field to a golem-cli structured output type and update the output schema, generators, and tests accordingly.

Frequently Asked Questions about modifying-cli-output-schema

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new field to golem-cli structured JSON output?

Update the Rust DTO or view model first, then edit command-output.schema.json to match the actual serde serialized shape. Add or extend the generator in cli_output/tests.rs using real DTO values, and run the focused schema tests to confirm no drift.

How should $type values be named for CLI output types?

$type values are semantic output identifiers using command-like names such as agent.invoke, or command family plus resource for streams like agent.oplog. Do not add redundant .result or .event suffixes, and never preserve old values through aliases.

What is the difference between the CLI output schema and the manifest schema?

The output schema at cli/golem-cli/command-output-schema/command-output.schema.json covers structured command output, while cli/schema.golem.cloud/app/golem/ covers application manifests. Manifest schema version changes use the modifying-cli-manifest-schema skill instead.

Why does the CLI output schema test fail after changing a DTO?

Failures usually indicate drift between serde's actual serialized shape and the handwritten schema, caused by tagged enums, skipped fields, custom serializers, or missing null for Option fields. Inspect the serialized DTO and fix the schema or DTO intentionally.

When is generic JsonValue acceptable in the output schema?

Generic JSON is acceptable only for semantically arbitrary payloads such as ValueAndTypeJson.value, AgentConfigEntryDto.value, manifest config leaves, and oplog snapshot payloads. Typed schema definitions are preferred everywhere else.