go-command-designing

Standardize Go CLI design with go-command using declarative constraints and layered architecture.

23|2|Updated Jun 9, 2025
One-click install
npx skills add https://github.com/kaptinlin/gozod --skill go-command-designing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-command-designing
Source: https://github.com/kaptinlin/gozod/tree/main/.agents/skills/go-command-designing
Command: npx skills add https://github.com/kaptinlin/gozod --skill go-command-designing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Go project CLIs often suffer from inconsistent command structures, unclear flag vs positional usage, and brittle handlers. This Skill provides a design blueprint for building world-class CLIs with the go-command framework, covering command patterns, constraints, grouping, help text, and agent-friendly outputs.

Core Features & Use Cases

  • Noun-Verb Hierarchy: Structure commands as <noun> <verb> with clear targets.
  • Declarative Constraints: Use Exclusive, RequiredTogether, Requires, and Conflicts to declare behavior instead of writing bespoke validation.
  • Layered Architecture: Thin handlers in commands, dedicated services, and clean separation of internal and pkg code.
  • Agent-Ready Patterns: Structured outputs with Respond[T], mode awareness, and self-documenting command schemas for automation.
  • Help & Grouping: Progressive disclosure, Examples, Option.Group, and command grouping for large CLIs.

Quick Start

Design a new CLI command by applying the go-command design principles described here, including a noun-verb structure, proper flag vs positional usage, and thin, testable handlers.

Frequently Asked Questions about go-command-designing

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

FAQPage Schema
How do I structure a Go CLI with subcommands and flags consistently?

Structure a Go CLI with subcommands and flags using a noun-verb hierarchy and declarative constraints. This ensures consistent command structure, proper flag placement, and developer-friendly help text across new projects or major rewrites.

What is the best way to validate flag dependencies in a Go CLI?

The best way to validate flag dependencies in a Go CLI is using declarative constraints like Exclusive, RequiredTogether, Requires, and Conflicts. This enforces behavior declaratively instead of writing bespoke validation logic inside handlers.

How do I organize Go CLI handlers to keep them testable?

Organize Go CLI handlers by keeping them thin within a four-layer architecture across cmd, services, internal, and pkg. This separates dedicated services and clean internal code, ensuring handlers remain testable and maintainable.

Can I generate agent-friendly outputs for Go command line tools?

Yes, you can generate agent-friendly outputs for Go command line tools using structured Respond[T] patterns. This includes mode awareness and self-documenting command schemas to support automation and consistent structured responses.

Does this Go CLI design pattern work for large command line applications?

Yes, this Go CLI design pattern works for large command line applications by utilizing progressive disclosure, Examples, Option.Group, and command grouping. These features manage complexity and ensure help text remains navigable for large CLIs.