一键导入
go-test-fixer
Fix Go unit tests to comply to best practices. Use this when you're asked to modernise tests.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Fix Go unit tests to comply to best practices. Use this when you're asked to modernise tests.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Batch-fix all open bugs in parallel, iterate on PR reviews until clean, then squash-merge each PR sequentially. Extends bug-blitz with automated review cycles and merge. Fetches bug-type tasks from Transit, creates worktrees, spawns parallel fix agents, runs /pr-review-fixer in a loop until no blockers/critical/major issues remain, then merges PRs one by one with squash-and-merge.
Initialize Claude Code project settings with standard language-specific permissions. Use when setting up a new project for Claude Code or adding standard configuration to an existing project.
Capture reusable cross-project technical knowledge into the user's Obsidian vault as a markdown note. Use whenever the user wants to save a learning, pattern, recipe, or how-to that would help future projects — phrases like "save this to my vault", "write this up as a note", "capture this for future reference", "document how X works", "remember this pattern", "add to my knowledge base", or any time after solving something non-obvious in their current repo. Examples are "how to set up an MCP server in a Swift app", "the GraphQL pagination pattern we used here", "how Transit wires up its dependency injection". Use this skill PROACTIVELY whenever the user finishes investigating something they'd plausibly want to reuse on a different project, even if they don't say "save it" explicitly — offer to capture it. Do NOT use for project-specific notes that only make sense inside one repo (those belong in that project's own notes), and do NOT use for daily/journal entries.
Push a branch, open a change request, iterate on reviews until clean, then squash-merge. Runs /pr-review-fixer in a loop until no blockers/critical/major issues remain, rebases onto latest origin/main, and squash-merges. Works on both GitHub (gh) and GitLab (glab) — it detects the forge from the git remote. Works with or without Transit tickets. Use when you want to shepherd a PR/MR from push to merge, e.g. "push and merge this", "get this merged", "review-fix-merge loop".
Fetch unresolved change-request review threads (both diff-anchored and CR-level), validate issues, and fix them. Also checks CI status and fixes failing tests, lint errors, and build issues. Works on both GitHub (gh) and GitLab (glab) — it detects the forge from the git remote. Use when reviewing and addressing PR/MR feedback. Filters out resolved threads, keeps only the last Claude review comment per thread (matching the `<!-- claude-local-review -->` sentinel from the local-review agent), validates issues, posts a review report as a CR comment, then fixes validated issues.
Skill for preparing the project for a release
| name | go-test-fixer |
| description | Fix Go unit tests to comply to best practices. Use this when you're asked to modernise tests. |
This skill helps fix and improve Go test files according to best practices defined in language-rules/go.md.
This skill can:
.claude/scripts/test-conversion/main.gogo run .claude/scripts/test-conversion/main.go <test_file.go>go run .claude/scripts/test-conversion/main.go <directory>tests := []struct{...} to tests := map[string]struct{...}name field from test structs (becomes map key)for _, tt := range tests to for name, tt := range testst.Run(tt.name, ...) to t.Run(name, ...).claude/scripts/move_code_section.pypython .claude/scripts/move_code_section.py <source_file> <start_line> <end_line> <dest_file> [--create-if-missing]Always follow these key principles from ~/.claude/language-rules/go.md:
map[string]struct for test cases to ensure unique names and catch interdependenciest.Run() for subtestshandler_auth_test.go, handler_validation_test.got.Helper()t.Cleanup() over defertc for test cases in table-driven testsWhen fixing Go tests, follow this workflow:
If the file contains slice-based table tests:
go run scripts/test-conversion/main.go <test_file.go>
If the file exceeds 500-800 lines:
a. Identify logical groupings (e.g., by function being tested, by test type) b. Determine split points (line numbers for each section) c. Create new test files:
# Example: Move lines 150-300 to a new file
python scripts/move_code_section.py original_test.go 150 300 new_focused_test.go --create-if-missing
d. Name new files descriptively (e.g., handler_auth_test.go, handler_validation_test.go)
After modifications:
# Format the code
go fmt ./...
# Run tests to ensure nothing broke
go test ./...
# Run linters
golangci-lint run
Check the modified tests against language rules:
t.Run() for subtestst.Helper()t.Cleanup()tc variable for test casestests := []struct {
name string
input int
want int
}{
{name: "positive", input: 5, want: 5},
{name: "negative", input: -3, want: 3},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := abs(tt.input)
if got != tt.want {
t.Errorf("got %d, want %d", got, tt.want)
}
})
}
tests := map[string]struct {
input int
want int
}{
"positive": {input: 5, want: 5},
"negative": {input: -3, want: 3},
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
got := abs(tc.input)
if got != tc.want {
t.Errorf("got %d, want %d", got, tc.want)
}
})
}
t.Parallel()) for independent tests after conversion