一键导入
go-best-practices
Go coding best practices. Use when writing or reviewing Go code. Covers error handling, concurrency, and idiomatic patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Go coding best practices. Use when writing or reviewing Go code. Covers error handling, concurrency, and idiomatic patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Hybrid architecture combining Ralph's PRD format with Planning-with-Files' structured approach. Auto-generates PRDs from task descriptions, manages parallel story execution with dependency resolution, and provides context-filtered agents for efficient multi-story development.
Project-level multi-task orchestration system. Manages multiple hybrid:worktree features in parallel with dependency resolution, coordinated PRD generation, and unified merge workflow.
Implements Manus-style file-based planning for complex tasks. Creates task_plan.md, findings.md, and progress.md. Use when starting complex multi-step tasks, research projects, or any task requiring >5 tool calls. Now with automatic session recovery after /clear and optional Git worktree mode.
Java coding best practices. Use when writing or reviewing Java code (17+). Covers modern features, error handling, and patterns.
Python coding best practices. Use when writing or reviewing Python code. Covers type hints, error handling, and common patterns.
TypeScript/Node.js best practices. Use when writing or reviewing TypeScript code. Covers type safety, async patterns, and error handling.
| name | go-best-practices |
| description | Go coding best practices. Use when writing or reviewing Go code. Covers error handling, concurrency, and idiomatic patterns. |
| license | MIT |
| metadata | {"author":"plan-cascade","version":"1.0.0"} |
| Rule | Guideline |
|---|---|
| Formatter | gofmt or goimports |
| Linter | golangci-lint |
| Naming | Short, clear; avoid stuttering |
| Comments | Godoc for exported items |
| Rule | Guideline |
|---|---|
| Always check | Never ignore errors |
| Wrap context | fmt.Errorf("ctx: %w", err) |
| Sentinel errors | var ErrNotFound = errors.New(...) |
func Load(path string) (*Config, error) {
data, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("load config %s: %w", path, err)
}
// ...
}
cmd/appname/main.go
internal/config/
internal/service/
go.mod
| Pattern | Usage |
|---|---|
context.Context | Cancellation, timeouts |
sync.WaitGroup | Wait for goroutines |
errgroup.Group | Goroutines with errors |
func Process(ctx context.Context, items []Item) error {
for _, item := range items {
select {
case <-ctx.Done():
return ctx.Err()
default:
if err := process(item); err != nil { return err }
}
}
return nil
}
| Avoid | Use Instead |
|---|---|
| Naked returns | Explicit returns |
panic for errors | Return errors |
| Large interfaces | Small, focused |
init() | Explicit init |
func TestParse(t *testing.T) {
tests := []struct{ name, input string; want int; wantErr bool }{
{"valid", "42", 42, false},
{"invalid", "abc", 0, true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := Parse(tt.input)
if (err != nil) != tt.wantErr { t.Errorf("err=%v, want=%v", err, tt.wantErr) }
if got != tt.want { t.Errorf("got=%v, want=%v", got, tt.want) }
})
}
}