go-go-golems/glazed/glazed-command-authoring
Claude Code and agent skill by go-go-golems/glazed
- community
Checking that the SKILL.md file is still in the repository.
Create, refactor, and validate Glazed commands using the current v1.4 structured-output, Cobra RunE, schema, middleware, help, and logging conventions. Use when adding a GlazeCommand, wiring command groups, defining fields or sections, emitting rows, choosing output behavior, or migrating code away from removed legacy output APIs.
Install
npx vskill@latest install go-go-golems/glazed/glazed-command-authoringSKILL.md
Glazed Command Authoring
Use this skill when creating or refactoring commands built with github.com/go-go-golems/glazed. It describes the v1.4 command contract: command implementations emit rows, Cobra builders add the minimal structured-output section, and applications retain ownership of domain flags and process errors.
Required workflow
- Inspect the current APIs and nearby first-party examples before writing code.
- Define a command description and a settings struct with
glazedtags. - Implement the appropriate command interface.
- Build the Cobra command through
pkg/clirather than duplicating parser setup. - Keep domain behavior in application fields and serialization behavior in structured output.
- Add focused tests for parsing, emitted rows, errors, and help-visible flags.
- Run the complete validation sequence before finishing.
Current public output contract
Every cmds.GlazeCommand built with cli.BuildCobraCommandFromCommand receives exactly these universal output flags:
Their meanings are intentionally narrow:
--formatselects stdout serialization. The default istable.--output-fieldsprojects emitted rows. Tabular formats preserve requested field order.--max-output-rowscaps serialized rows. Zero means unlimited. It does not cancel source work.
Do not reintroduce removed universal flags for jq, templates, rename, replacement, sorting, filtering, SQL, Excel, output files, table styles, stream toggles, or skip/limit behavior.
Use application fields when an operation changes source behavior. A database limit, API page size, server-side filter, or domain sort belongs to the command even if it also changes the output.
Canonical imports
Common invalid imports:
glazed/pkg/cmds/parameters/fields— usepkg/cmds/fields.glazed/pkg/cmds/middlewares— usepkg/middlewares.glazed/pkg/values— usepkg/cmds/values.glazed/pkg/settings/schema— usepkg/cmds/schema.
Minimal GlazeCommand
The Cobra builder injects structured output automatically. Do not manually add the structured-output section to ordinary GlazeCommand descriptions.
types.NewRow returns a types.Row value, not *types.Row. Processor.AddRow accepts that value.
Fields and positional arguments
Define flags with cmds.WithFlags. Decode them through values.Values; do not read Cobra flags inside the domain command.
Define positional arguments with cmds.WithArguments and fields.WithIsArgument(true):
A variadic positional argument must use a list type such as fields.TypeStringList, must be the final positional argument, and is decoded through the same glazed struct tag mechanism.
Building and registering Cobra commands
Build one command with:
For a collection, prefer cli.AddCommandsToRootCommand. It builds all commands and aliases before mounting any of them, so a schema or flag collision does not leave a partially mutated command tree.
Generated commands use Cobra RunE. Command errors, parsing failures, output setup failures, and processor-close failures propagate to the application's Execute() call. Do not call cobra.CheckErr or os.Exit from reusable command implementations. The application root owns error rendering, telemetry, cleanup, and exit-code mapping.
Raw Cobra integration
A raw Cobra command can mount the same three output flags explicitly:
Create its processor after Cobra has parsed flags:
The helper returns setup errors. Callers must propagate or handle them; they must not terminate inside the helper.
Structured-output APIs
Use pkg/settings only when a programmatic caller needs direct control over output setup:
SetupStructuredOutputapplies projection, row capping, and serialization.SetupStructuredProcessorapplies projection and row capping without attaching a formatter. Use it when the caller needs atypes.Tableor its own output middleware.
Do not use removed APIs such as NewGlazedSection, NewGlazedSchema, GlazedSlug, SetupTableProcessor, SetupProcessorOutput, or WithOutputSectionOptions.
Middleware composition and streaming
The middleware architecture remains available even though the old middleware flags were removed. TableProcessor still supports object, row, and table middleware.
Caller-provided middleware runs before structured-output projection, row capping, and serialization. Formatters may prepend required normalization middleware, such as object flattening for CSV and TSV.
Execution characteristics:
- JSON and JSONL serialize through row middleware and do not accumulate a table.
- Table, CSV, TSV, and YAML collect accepted rows and serialize during
Close. - JSONL writes one compact JSON object per line.
- JSON streams array elements and completes array framing during
Close.
Processor ownership determines who closes it:
- A
GlazeCommand.RunIntoGlazeProcessorimplementation receives a builder-owned processor. It must emit rows and return without closing the processor; the CobraRunEpath closes it exactly once. - Code that directly creates a processor with
SetupStructuredOutput,SetupStructuredProcessor, orCreateStructuredOutputProcessorFromCobraowns that processor and must close it exactly once after emission.
Closing runs table middleware and finalizes formatter framing. Closing a processor twice is invalid: buffered formats can be emitted twice and streaming JSON can receive duplicate closing syntax.
Custom sections
Custom sections remain appropriate for reusable domain configuration such as database, authentication, or logging settings:
Add custom sections through cmds.WithSections. Do not duplicate a section on both a parent and child when that would mount the same flags twice.
Root initialization
A complete Glazed root initializes logging and embedded help:
The root owns shared logging and help registration. Child packages should register command groups without creating independent help systems.
If a custom parser MiddlewaresFunc replaces the default source chain, re-add every required source explicitly. Setting AppName does not restore environment loading after replacing the chain.
Command tree layout
For larger applications, mirror the CLI tree in folders:
If users type myapp records list, place list.go under cmds/records. Each group should expose one registration function or Cobra constructor.
Testing requirements
At minimum, test:
- Settings decode into the correct default section.
- The command emits expected rows and propagates processor errors.
BuildCobraCommandFromCommandaddsformat,output-fields, andmax-output-rowsfor aGlazeCommand.- Domain fields do not collide with framework fields.
- Typed errors reach
root.Execute()when exit-code mapping matters. - Sparse rows preserve requested tabular projection order.
- Streaming commands stop under context cancellation.
For sparse projection, include a case equivalent to:
Validation
Run from the module root. This repository may be nested under a mismatched workspace, so use GOWORK=off when the module toolchain must take precedence.
Before committing, inspect help for representative commands and confirm the structured-output group contains only the three universal flags.
Repository references
Read these files when the task needs more detail:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/glazed-command-authoring/SKILL.md
Popularity
- Repository stars
- 59
- Repository forks
- 6
- 7-day trend score
- 20
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/go-go-golems/glazed/glazed-command-authoring)