cli-to-go-migration
Reusable agent skill for migrating command-line interfaces from any programming language to Go.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Reusable agent skill for migrating command-line interfaces from any programming language to Go.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Remove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, passive voice, negative parallelisms, and filler phrases.
Golang benchmarking, profiling, and performance measurement. Use when writing, running, or comparing Go benchmarks, profiling hot paths with pprof, interpreting CPU/memory/trace profiles, analyzing results with benchstat, setting up CI benchmark regression detection, or investigating production performance with Prometheus runtime metrics. Also use when the developer needs deep analysis on a specific performance indicator - this skill provides the measurement methodology, while `samber/cc-skills-golang@golang-performance` provides the optimization patterns.
CI/CD pipeline configuration using GitHub Actions for Golang projects — testing, linting, SAST, security scanning, code coverage, Dependabot, Renovate, GoReleaser, code review automation, and release pipelines. Use when setting up or improving Go project CI, configuring GitHub Actions workflows, adding linters or security scanners, automating dependency updates, or adding quality gates.
Dependency management strategies for Golang projects — go.mod management, installing/upgrading packages, Minimal Version Selection, vulnerability scanning, outdated dependency tracking, binary size analysis, Dependabot/Renovate setup, conflict resolution, and go.work workspaces. Use when adding, removing, or upgrading Go dependencies, auditing vulnerabilities, resolving version conflicts, or setting up automated dependency updates.
Comprehensive documentation guide for Golang projects, covering godoc comments, README, CONTRIBUTING, CHANGELOG, Go Playground, Example tests, API docs, and llms.txt. Use when writing or reviewing doc comments, documentation, adding code examples, setting up doc sites, or discussing documentation best practices. Triggers for both libraries and applications/CLIs.
Compile-time dependency injection in Golang using google/wire — wire.NewSet, wire.Build, wire.Bind (interface→concrete), wire.Struct, wire.Value, wire.InterfaceValue, wire.FieldsOf, cleanup functions, //go:build wireinject injector files, and generated wire_gen.go. Apply when using or adopting google/wire, when the codebase imports `github.com/google/wire`, or when wiring an application graph at compile time via `wire.Build`. For runtime DI with reflection, see `samber/cc-skills-golang@golang-uber-dig` skill.
| name | cli-to-go-migration |
| description | Reusable agent skill for migrating command-line interfaces from any programming language to Go. |
This skill guides the end-to-end (E2E) migration of a command-line interface (CLI) tool from any source language (e.g., TypeScript/Node, Python, Ruby) to Go. Use it to minimize runtime dependencies, maximize native performance, ensure filesystem security, and write robust, multi-platform binaries.
The migration follows nine sequential phases. Each phase requires specific human-AI coordination. Explicit breakpoints are defined where the AI agent must stop and prompt the user for validation.
graph TD
P0[Phase 0: Intake & Suitability Research] -->|Breakpoint: Suitability Approval| P1[Phase 1: Grounding via Go Skills]
P1 --> P2[Phase 2: Architecture & Goals]
P2 --> P3[Phase 3: Configuration & Path Mapping]
P3 --> P4[Phase 4: Test-First TDD & Error Rules]
P4 --> P5[Phase 5: Concurrency via Subagents]
P5 -->|Breakpoint: Scan Hangs| P6[Phase 6: Package Layout & CI Matrix]
P6 -->|Breakpoint: CI Matrix Omissions| P7[Phase 7: Error Cleanup Audit]
P7 --> P8[Phase 8: Release Attestation & Signing]
P8 -->|Breakpoint: Gatekeeper/SmartScreen| End[Completed Zero-Dependency Go CLI]
Before initiating any migration, research the target codebase to verify if the proposed language is a suitable replacement.
Research online and identify 3-5 stack alternatives to use over [current stack] and explain why (e.g., performance, security) with specific examples and links
I want to port [tool/repository] to [target language]. Did anyone do this before?
Identify 3-5 patterns on how to / how NOT use [target language] and explain them to me
package.json or requirements.txt) to assess dependency overhead and vulnerability vectors.Prepare the workspace environment and verify that all necessary grounding files are in place.
git init) to establish a clean change history. The agent must do this itself rather than instructing the user to run the command, but must request user confirmation before initializing the repository..agents/skills/) and global directories for the standard Go skills cluster. Proactively check for community options and install them:
what are the top community agent skills for `go`?
add all skills samber/cc-skills-golang
skl add or copying the skill directories to the workspace). The agent must ask the user for confirmation before executing the install/copy command or making any other persistent changes to the workspace. Do not proceed to subsequent phases until these grounding skills are active in the workspace.Define the core boundaries of the new Go CLI.
readability-by-strangers is prioritized as a core code quality metric for team collaboration.Plan 100% functionality port of `npx skills` to Go, focusing on safety, best practices, and with 90% unit test coverage. Pull the repo and map things out. Ask me any questions
And:
For the MVP, we target Antigravity 2 support as default and fallback to universal through the standards-compliant '.agents' directory (if multiple agents detected)
gopkg.in/yaml.v3 or github.com/pelletier/go-toml).Map how the existing CLI discovers and targets application environments.
AgentConfig, AgentType) in types.go.os.UserHomeDir() to target user home folders on Unix/macOS.os.Getenv("APPDATA") or os.Getenv("USERPROFILE") to target Windows folders.os.Getenv("XDG_CONFIG_HOME") (falling back to ~/.config) for Linux standard paths.Establish a test-driven development (TDD) harness using Go's standard test tools.
Apply principles from https://preslav.me/2026/05/19/10-golang-error-handling-commandments/
*_test.go file using table-driven test patterns before implementing any logic. Ensure go test ./... fails gracefully due to missing dependencies.if err != nil.fmt.Errorf("action: %w", err) to preserve trace logs.To migrate a large subcommand surface area efficiently, parallelize development using isolated subagents.
main.go and define option structs.init, add, list, etc.).did you cover 100% of the original CLI?
have subagents research each option individually and each test and fill in the gaps
[!WARNING]
User Intervention Breakpoint 1: Recursive Traversal CPU Hangs
Trigger: When translating directory scanner or copying commands, the model may execute unconstrained recursive lookups that enter deep hidden folders (such as
.git/ornode_modules/), pegging the CPU at 100%. Action: Stop work and ask the user to verify traversal exclusions. Implement these limits in the traversal loop:
- Restrict recursive scanning to a maximum folder depth of 2.
- Explicitly ignore
.git/,node_modules/, and standard build output paths.
Structure the repository for direct distribution and configure the continuous integration pipeline.
main.go directly at the root of the module (rather than inside a nested subfolder like cmd/tool/) to keep the layout flat and support direct native installation:
go install github.com/username/repo@latest
Isolate all core domain packages inside a subdirectory (e.g. src/skl/)..github/workflows/ci.yml.[!IMPORTANT]
User Intervention Breakpoint 2: CI Matrix Omissions
Trigger: AI models frequently generate a standard
ci.ymlthat only compiles for the host Linux runner (ubuntu-latest), neglecting multi-platform compilation verification. Action: Pause and request user approval to updateci.ymlwith a multi-platform runner matrix:strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest]Verify that tests run successfully and native binaries compile natively on all target runners.
Refactor error messages to focus on concise, action-oriented descriptions of failures.
replace [verbose] with a simple emoji and use concise logs. see https://preslav.me/2026/05/19/10-golang-error-handling-commandments/ for best practices
failed to get current working directory: %w or failed to extract downloaded zip: %w).failed to download remote repository: %w -> download remote: %wfailed to get current working directory: %w -> get working directory: %wfailed to extract downloaded zip: %w -> extract zip: %wManage the target operating system security filters for compiled releases.
[!CAUTION]
User Intervention Breakpoint 3: macOS Gatekeeper & Windows SmartScreen Quarantine Blocks
Trigger: While Go successfully cross-compiles binaries, standard CI builders cannot sign releases. When distributed, macOS Gatekeeper quarantines unsigned binaries (
com.apple.quarantine), and Windows SmartScreen flags them. Action: Stop and coordinate with the user to establish trust pipelines:
- macOS Signing: Compile production macOS releases locally on the developer's workstation where Keychain credentials reside. Run
codesignnatively to sign the binary before pushing it to release assets.- Windows Attribution: Cross-compile the Windows target and document the manual unblocking instructions (
Unblock-File -Path .\skl-windows-amd64.exeor clicking "Run anyway" under SmartScreen) in the project README.md.
Establish clear documentation boundaries to guide users and other agents working within the repository.
summarize findings for humans in README.md, considerations for agents in AGENTS.md
/humanizer skill to human-facing files (like README.md or CLI usage --help documentation). Do NOT run the /humanizer skill on AGENTS.md, since it is designed to be parsed as strict agentic context grounding metadata by AI models.xattr -d com.apple.quarantine) and Windows (Unblock-File).