ワンクリックで
go-project-layout
Go module structure and project organization patterns. When setting up a new Go project or organizing existing Go code
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Go module structure and project organization patterns. When setting up a new Go project or organizing existing Go code
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Go code review checklist based on official Go style guides. When reviewing Go code for style, idioms, and best practices
Guide for creating custom opencode agents with proper configuration, permissions, path-based delegation, work splitting, and strict status envelopes. Use when creating or updating agents for coordination, implementation, review, deployment, verification, documentation, or specialized workflows.
TDD for process documentation - test with subagents before writing, iterate until bulletproof. When you discover a technique, pattern, or tool worth documenting for reuse. When editing existing skills. When asked to modify skill documentation. When you've written a skill and need to verify it works before deploying. When skills fail to help agents, when documentation is unclear, when new patterns emerge that need standardization.
Create and setup a new OpenAI Agents SDK application with interactive guidance for language choice, agent type selection (Basic, Voice, Realtime), project setup, and automatic verification.
Create and setup a new Claude Agent SDK application with interactive guidance for language choice, project setup, and automatic verification.
Problem-Solving Dispatch; Dispatch to the right problem-solving technique based on how you're stuck; Stuck on a problem. Conventional approaches not working. Need to pick the right problem-solving technique. Not sure which skill applies.
| name | go-project-layout |
| description | Go module structure and project organization patterns. When setting up a new Go project or organizing existing Go code |
| metadata | {"languages":"go"} |
Module structure and organization patterns for Go projects.
For deeper information, fetch these URLs:
# Create new module
mkdir myproject
cd myproject
go mod init github.com/user/myproject
module github.com/user/myproject
go 1.23 // Use Go 1.23+ for iter package and range-over-func
require (
github.com/gin-gonic/gin v1.9.1
github.com/stretchr/testify v1.8.4
)
Go Version Requirements:
go 1.18+ - Generics supportgo 1.21+ - slices and maps packages in stdlibgo 1.23+ - iter package and range-over-function iteratorsgo mod tidy # Add missing, remove unused
go mod download # Download dependencies
go mod verify # Verify dependencies
go mod graph # View dependency graph
go get ./... # Update dependencies
go get pkg@version # Get specific version
myproject/
├── go.mod
├── go.sum
├── main.go # Simple single-file projects
└── main_test.go
myproject/
├── cmd/
│ └── myapp/
│ └── main.go # Application entry point
├── internal/
│ ├── server/
│ │ └── server.go # HTTP server
│ ├── handler/
│ │ └── handler.go # Request handlers
│ └── model/
│ └── model.go # Data models
├── go.mod
├── go.sum
└── README.md
mylib/
├── go.mod
├── go.sum
├── mylib.go # Main package code
├── mylib_test.go # Tests
├── helper.go # Additional files
└── README.md
myproject/
├── cmd/
│ ├── myapp/
│ │ └── main.go
│ └── mytool/
│ └── main.go
├── internal/
│ ├── pkg/ # Private shared packages
│ │ └── database/
│ └── app/
│ └── myapp/
├── pkg/ # Public packages (if any)
│ └── api/
├── api/ # API definitions (OpenAPI, proto)
├── configs/ # Configuration files
├── scripts/ # Build scripts
├── test/ # Additional test data
├── go.mod
├── go.sum
├── Makefile
└── README.md
Application entry points. Each subdirectory is a separate binary.
// cmd/myapp/main.go
package main
import (
"github.com/user/myproject/internal/server"
)
func main() {
s := server.New()
s.Run()
}
Private packages. Cannot be imported by external projects.
// internal/server/server.go
package server
type Server struct {
// ...
}
func New() *Server {
return &Server{}
}
Public packages. Can be imported by external projects. Note: Only use if you explicitly want to share code.
API definitions: OpenAPI specs, Protocol Buffers, etc.
Each directory is one package. All .go files in a directory must have the same package statement.
util, common, misc// Good
package server
package handler
package model
// Bad
package serverPkg
package server_utils
package common
Import path = module path + subdirectory.
// go.mod: module github.com/user/myproject
// Import internal package
import "github.com/user/myproject/internal/server"
// Import cmd package (rare, usually just main)
import "github.com/user/myproject/cmd/myapp"
# Build current directory
go build
# Build specific package
go build ./cmd/myapp
# Build all packages
go build ./...
# Install binary
go install ./cmd/myapp
# Run without installing
go run ./cmd/myapp
# Build for Linux
GOOS=linux GOARCH=amd64 go build -o myapp-linux ./cmd/myapp
# Build for Windows
GOOS=windows GOARCH=amd64 go build -o myapp.exe ./cmd/myapp
# Build for macOS ARM
GOOS=darwin GOARCH=arm64 go build -o myapp-darwin ./cmd/myapp
cmd/
├── api-server/
│ └── main.go
├── worker/
│ └── main.go
└── cli-tool/
└── main.go
internal/
├── config/ # Configuration loading
│ └── config.go
├── database/ # Database connection
│ └── db.go
└── model/ # Shared models
└── user.go
internal/
├── handler/ # HTTP handlers
├── service/ # Business logic
├── repository/ # Data access
└── model/ # Data structures
Tests live alongside code with _test.go suffix.
internal/
└── server/
├── server.go
└── server_test.go
test/
├── testdata/
│ └── fixtures/
└── integration/
// server_test.go - test from outside perspective
package server_test
import (
"testing"
"github.com/user/myproject/internal/server"
)
func TestServer(t *testing.T) {
s := server.New()
// ...
}
.PHONY: build test lint clean
build:
go build -o bin/myapp ./cmd/myapp
test:
go test ./...
lint:
go vet ./...
golangci-lint run
clean:
rm -rf bin/
run:
go run ./cmd/myapp
| Directory | Purpose | Importable |
|---|---|---|
| /cmd | Entry points | No (main packages) |
| /internal | Private packages | Only within module |
| /pkg | Public packages | Yes |
| /api | API definitions | N/A |
| /configs | Config files | N/A |
| /test | Test helpers | N/A |
When setting up a new project, consider which modern Go features you'll use:
| Feature | Minimum Go Version |
|---|---|
| Generics | Go 1.18 |
slices package | Go 1.21 |
maps package | Go 1.21 |
iter package | Go 1.23 |
| Range-over-func | Go 1.23 |
Set your go.mod version accordingly to leverage these features:
// For full modern Go feature support
go 1.23
// For generics + slices/maps but no iterators
go 1.21
References: