agentleFS
Google CloudKnown publisherGoogleCloudPlatform/devrel-demos/agents/skills/go-project-setup/SKILL.md

go-project-setup

Skill397 starsChanged 9 days agoApache-2.0View on GitHub

Standardized setup for new Go (Golang) projects and services. Activate to ensure clean, idiomatic project structures (Standard Layout) and implement production-ready patterns (graceful shutdown, package separation) from day one.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Standard Layout Only: Use the official Go project layout (cmd/, internal/).

    line 12
  2. Very specific:

    NEVER: create a pkg/ directory. (It is an anti-pattern common in Kubernetes but not idiomatic Go).

    line 13
  3. Very specific:

    Flat by Default: Start with a flat structure (all files in root) for simple apps.

    line 14
  4. Very specific:

    Modern Go: Ensure go.mod specifies the latest stable Go version (currently 1.24+).

    line 15
  5. Distinctive:

    Ask the user: "Is this a simple tool, a library, or a multi-service repo?"

    line 20
  6. Very specific:

    Verify: Run go mod tidy and go build ./....

    line 39

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Go Project Setup

This skill guides the creation of clean, idiomatic Go project structures.

Core Mandates

  1. Standard Layout Only: Use the official Go project layout (cmd/, internal/).
    • NEVER create a pkg/ directory. (It is an anti-pattern common in Kubernetes but not idiomatic Go).
  2. Flat by Default: Start with a flat structure (all files in root) for simple apps. Only introduce cmd/ and internal/ when multiple binaries or private packages are needed.
  3. Modern Go: Ensure go.mod specifies the latest stable Go version (currently 1.24+).

Workflow

1. Determine Scope

Ask the user: "Is this a simple tool, a library, or a multi-service repo?"

2. Select and Use Template

MANDATORY: You MUST read and use the templates provided in the assets/ directory. They establish idiomatic patterns like graceful shutdown, run functions, and package separation.

  • Simple CLI / Tool: assets/cli-simple. Flat structure.
  • Cobra CLI: assets/cli-cobra. For complex CLI tools.
  • Library: assets/library. Package in root, internal/ for hidden logic.
  • Application / Service: assets/webservice.
    • cmd/app-name/main.go: Entry point using the run function pattern.
    • internal/: Private application logic.
  • MCP Server: assets/mcp-server.
  • Game: assets/game. Using Ebitengine.

3. Initialize

  1. Create Directory: mkdir my-app
  2. Init Module: go mod init github.com/user/my-app
  3. Linting: (Optional) Initialize .golangci.yml if the project requires rigorous style enforcement.
  4. Apply Template: Copy and adapt the files from the chosen template in assets/. Ensure module names are updated.
  5. Verify: Run go mod tidy and go build ./....

References

  • references/project_layout.md: Official Go Module Layout guide.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.