matdev83/golang-curated-agent-skills/golang-project-layout

Claude Code and agent skill by matdev83/golang-curated-agent-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Go repository structure: right-sized packages, commands, internal visibility, modules, workspaces, tests, and configuration.

Install

npx vskill@latest install matdev83/golang-curated-agent-skills/golang-project-layout

SKILL.md

The same SKILL.md was published earlier as matdev83/golang-curated-agent-skills/golang-project-layout.

Go project layout

Choose structure from the project's users, deployment units, and expected reuse. A small command may be one package; a service or library may need boundaries that can be tested independently. The directory names below are conventions and tools, not language requirements.

Decide the boundaries

Identify the module or modules, public API, executable entry points, generated code, deployment artifacts, and test fixtures. Keep dependencies directed toward stable contracts and put orchestration at the application boundary. Add a package when it gives a useful ownership or API boundary, not merely to create more files.

Common choices:

NeedPossible layout
One small commandgo.mod, main.go, adjacent tests and docs.
Several commandscmd/<name>/main.go plus shared packages; cmd/ is a convention, not a requirement.
Reusable libraryRoot or named public package; internal/ for implementation details.
ServiceCommand entry point, internal transport/application/domain packages, migrations/config as needed.
Multiple modulesSeparate go.mod files and an optional go.work for local development.

Keep main thin when there is substantial business logic: parse configuration, construct dependencies, run the application, and handle shutdown. A flat package is appropriate when that is clearer.

Module and package rules

Choose a module path that matches how consumers fetch it when the module is published; private modules can use the organization's configured path. Lowercase import paths are conventional and major versions >=2 require a /vN suffix. Avoid a generic utils package and name packages for the domain they own. Package names normally match the directory's package declaration but need not mirror every repository folder.

internal visibility is defined by the parent directory tree: code can import an internal package only from within the tree rooted at its parent. It is not simply “private to the module.” pkg/ is also a convention; use it only when it communicates a stable public boundary in this repository.

Tests, fixtures, and generated files

Keep tests near the code they exercise. Any _test.go file is recognized by Go; names such as _bench_test.go or _example_test.go are optional organizational conventions. Benchmark and example function names (BenchmarkX, ExampleX) determine discovery. Keep external fixtures in testdata/ when they should not be imported as packages, and clearly mark generated files and their command/version.

Modules and workspaces

Use one module for one release/versioning boundary unless independent modules are genuinely needed. Use go.work to develop related modules together, but test each module with GOWORK=off before publishing so local replacements do not hide missing requirements. Document whether go.work and go.work.sum are committed or ignored according to repository policy.

Configuration and repository files

Add only files the project uses. A Makefile, .gitignore, linter config, CI workflows, Dockerfile, and release config are useful when their commands are real and documented; none is required by Go. Keep configuration precedence explicit (defaults, config files, environment, flags, or application-specific overrides) and validate it at startup. See config.

Initialization checklist

  • define the public API and deployment boundaries;
  • choose a module path and Go version deliberately;
  • keep commands and orchestration thin where that improves testing;
  • add internal only for a real visibility boundary;
  • place tests/fixtures/generated code predictably;
  • document workspace and replacement behavior;
  • run gofmt, go test, go vet, and repository-specific checks;
  • avoid introducing a framework or DI library before its lifecycle and maintenance benefits are demonstrated.

See directory layouts, testing layout, workspaces, and configuration.

Related local skills: golang-cli, golang-design-patterns, golang-dependency-management, golang-testing, and golang-code-style.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/matdev83/golang-curated-agent-skills/golang-project-layout/badge)](https://verified-skill.com/skills/matdev83/golang-curated-agent-skills/golang-project-layout)

Something wrong with this skill or its page? Tell us.