cli

Migrate Cobra-based CLIs and Go libraries into Forge project structures.

4|1|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/reliant-labs/forge --skill cli-reliant-labs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cli
Source: https://github.com/reliant-labs/forge/tree/main/internal/templates/project/skills/forge/migration/cli
Command: npx skills add https://github.com/reliant-labs/forge --skill cli-reliant-labs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps you migrate an existing Cobra-based CLI binary or Go library into the Forge project layout so you can keep evolving with Forge conventions, config, and generation workflows.

Core Features & Use Cases

  • Scaffolds the right Forge skeleton for CLI/library migration: creates the Forge project with --kind cli (or --kind library) so you start with the expected modules, workspace layout, and forge.yaml.
  • Defines how the Cobra entrypoint and binary naming should align during cutover: points you to the generated Cobra root file location and how to handle the -next suffix at final renaming.
  • Guides contract-bearing package migration and mock generation: explains when forge generate is mostly a no-op for CLI kind, and when it still must be run to refresh mocks for internal/*/contract.go.

Quick Start

Ask your AI assistant to scaffold your repository as a Forge CLI migration by running: forge new <name>-next --kind cli --mod github.com/<owner>/<name>-next.

Frequently Asked Questions about cli

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

FAQPage Schema
How do I migrate an existing Cobra CLI to a Forge project structure?

To migrate a Cobra CLI to a Forge project structure, run the scaffold command with `--kind cli` or `--kind library`, then port your existing commands into internal packages. This aligns your project with Forge conventions and generation workflows.

Can I use Forge generation to refresh mocks for internal contract files?

Yes, you can use Forge generation to refresh mocks for internal contract files. While `forge generate` is mostly a no-op for CLI projects, it must still be run to refresh mocks defined in `internal/*/contract.go` files.

What is the correct way to handle binary naming when cutting over to Forge?

The correct way to handle binary naming during a Forge cutover is to initially scaffold the project with a `-next` suffix. You then point to the generated Cobra root file location and handle the suffix removal at final renaming.

Does a Go library migration require a different Forge scaffold than a Cobra CLI?

A Go library migration requires a different Forge scaffold than a Cobra CLI. You must use `--kind library` for pure Go libraries and `--kind cli` for Cobra-based binaries to ensure the correct modules and workspace layout are created.

Why does my Forge project need Go workspaces for a CLI migration?

Your Forge project needs Go workspaces during a CLI migration to correctly structure the expected modules. Scaffolding with `--kind cli` creates the required workspace layout and `forge.yaml` configuration.

When should I not use the Forge CLI kind for a Go project migration?

You should not use the Forge CLI kind for a Go project migration if your source is a pure Go library without Cobra commands. In that case, scaffolding with `--kind library` is the correct approach.