Go Patterns Skill
Umbrella skill for Go development: Google style, testing, concurrency, error handling,
failure modes, code review, SAP CC conventions, and quality gates. Load the references
relevant to the task.
Google Style Precedence
Use this precedence when guidance differs:
- The target repository's explicit rules and required compatibility constraints.
- The Google Go Style Guide's canonical rules.
- Google Go Style Decisions' normative guidance.
- Google Go Style Best Practices' non-canonical recommendations.
- Task-specific references below.
Prefer local consistency only where the Google guide allows judgment. Do not create
unrelated churn merely to restyle existing code. For new and nearby changed code,
follow the current pinned guidance. Record a conscious exception when repository rules,
generated-code constraints, or compatibility requirements require one.
Reference Loading Table
| Signal |
Load These Files |
Why |
| Google-specific style decisions |
Relevant sections under google-style-guide/ |
Check the pinned conventions needed for the task |
| Testing |
testing.md |
Writing, fixing, or reviewing Go tests |
| Concurrency |
concurrency.md |
Goroutines, channels, sync primitives, race conditions |
| Error handling |
error-handling.md |
Error wrapping, sentinels, custom types, errors.Is/As |
| Review patterns |
preferred-patterns.md |
Detecting code smells, over-engineering, bad Go patterns |
| Code review |
code-review.md |
Reviewing Go code or PRs for quality |
| SAP CC conventions |
sapcc-conventions.md |
Working in sapcc/* repos with go-bits |
| Quality gate |
quality-gate.md |
Running make check, linting, pre-commit validation |
Instructions
Step 1: Identify the Go Domain
Classify the task into one or more domains, then load the corresponding reference files.
Only load what is needed -- do not load all references for every task.
| Domain |
Load Reference |
When |
| Testing |
references/testing.md |
Writing, fixing, or reviewing Go tests |
| Concurrency |
references/concurrency.md |
Goroutines, channels, sync primitives, race conditions |
| Error handling |
references/error-handling.md |
Error wrapping, sentinels, custom types, errors.Is/As |
| Review patterns |
references/preferred-patterns.md |
Detecting code smells, over-engineering, bad Go patterns |
| Code review |
references/code-review.md |
Reviewing Go code or PRs for quality |
| SAP CC conventions |
references/sapcc-conventions.md |
Working in sapcc/* repos with go-bits |
| Quality gate |
references/quality-gate.md |
Running make check, linting, pre-commit validation |
Multiple domains may apply. For example, reviewing a PR that includes concurrency code
should load both code-review.md and concurrency.md.
Step 2: Load and Follow the Reference
Read the selected reference file(s) using ${CLAUDE_SKILL_DIR}/references/<name>.md.
Each reference contains the full methodology, phases, code examples, and error handling
for that domain. Follow the instructions in the reference as if they were this skill's
instructions.
Step 3: Use Domain-Specific Sub-References
Some references point to their own sub-reference files for extended patterns:
Testing sub-references:
${CLAUDE_SKILL_DIR}/references/testing/go-test-patterns.md -- Full table-driven test, helper, mock examples
${CLAUDE_SKILL_DIR}/references/testing/go-benchmark-and-concurrency.md -- b.Loop() benchmarks, synctest
Concurrency sub-references:
${CLAUDE_SKILL_DIR}/references/concurrency/concurrency-patterns.md -- Worker pool, fan-out/fan-in, pipeline, rate limiter, graceful shutdown
Error handling sub-references:
${CLAUDE_SKILL_DIR}/references/error-handling/patterns.md -- gopls tracing, HTTP handler patterns, error wrapping in middleware
Review-pattern sub-references:
${CLAUDE_SKILL_DIR}/references/preferred-patterns/code-examples.md -- Extended before/after for all 7 failure modes
Code review sub-references:
${CLAUDE_SKILL_DIR}/references/code-review/common-review-comments.md -- Go code patterns with good/bad examples
SAP CC conventions sub-references:
${CLAUDE_SKILL_DIR}/references/sapcc-conventions/sapcc-code-patterns.md -- Primary reference: code patterns, testing patterns, failure modes (merged from testing-patterns-detailed.md and preferred-patterns.md)
${CLAUDE_SKILL_DIR}/references/sapcc-conventions/library-reference.md -- Complete approved/restricted library table
${CLAUDE_SKILL_DIR}/references/sapcc-conventions/architecture-patterns.md -- Full 102-rule architecture spec
${CLAUDE_SKILL_DIR}/references/sapcc-conventions/review-standards.md -- Lead + secondary review standards (merged)
${CLAUDE_SKILL_DIR}/references/sapcc-conventions/extended-patterns.md -- Security, K8s, PR hygiene patterns
- Plus:
api-design-detailed.md, build-ci-detailed.md, error-handling-detailed.md,
go-bits-philosophy-detailed.md, pr-mining-insights.md
Quality gate sub-references:
${CLAUDE_SKILL_DIR}/references/quality-gate/common-lint-errors.json -- Linter descriptions and fix suggestions
${CLAUDE_SKILL_DIR}/references/quality-gate/makefile-targets.json -- Available make targets
${CLAUDE_SKILL_DIR}/references/quality-gate/expert-review-patterns.md -- Manual review patterns
${CLAUDE_SKILL_DIR}/references/quality-gate/examples.md -- Detailed usage examples
Step 4: Execute
Follow the loaded reference methodology. Each reference has its own phases, gates,
and completion criteria. Apply them as written.
Available Scripts
Scripts are organized by domain in sub-directories:
- Testing:
scripts/gen-table-test.sh, scripts/bench-compare.sh
- Error handling:
scripts/check-errors.sh
- Code review:
scripts/check-interface-compliance.sh
- SAP CC conventions:
scripts/check-sapcc-identify-endpoint.sh, scripts/check-sapcc-auth-ordering.sh,
scripts/check-sapcc-json-strict.sh, scripts/check-sapcc-time-now.sh, scripts/check-sapcc-httptest.sh,
scripts/check-sapcc-todo-format.sh
- Quality gate:
scripts/quality_checker.py, scripts/validate.py
- Google style snapshot:
scripts/sync-google-style-guide.py (pinned upstream refresh; requires review before revision changes)
Error Handling
Errors are domain-specific. Load the relevant reference file and check its Error Handling
section for troubleshooting guidance.
1---2name: go-patterns3description: Go development patterns: testing, concurrency, errors, review, and conventions.4---56# Go Patterns Skill78Umbrella skill for Go development: Google style, testing, concurrency, error handling,9failure modes, code review, SAP CC conventions, and quality gates. Load the references10relevant to the task.1112## Google Style Precedence1314Use this precedence when guidance differs:15161. The target repository's explicit rules and required compatibility constraints.172. The Google Go Style Guide's canonical rules.183. Google Go Style Decisions' normative guidance.194. Google Go Style Best Practices' non-canonical recommendations.205. Task-specific references below.2122Prefer local consistency only where the Google guide allows judgment. Do not create23unrelated churn merely to restyle existing code. For new and nearby changed code,24follow the current pinned guidance. Record a conscious exception when repository rules,25generated-code constraints, or compatibility requirements require one.2627## Reference Loading Table2829| Signal | Load These Files | Why |30|---|---|---|31| Google-specific style decisions | Relevant sections under `google-style-guide/` | Check the pinned conventions needed for the task |32| Testing | `testing.md` | Writing, fixing, or reviewing Go tests |33| Concurrency | `concurrency.md` | Goroutines, channels, sync primitives, race conditions |34| Error handling | `error-handling.md` | Error wrapping, sentinels, custom types, errors.Is/As |35| Review patterns | `preferred-patterns.md` | Detecting code smells, over-engineering, bad Go patterns |36| Code review | `code-review.md` | Reviewing Go code or PRs for quality |37| SAP CC conventions | `sapcc-conventions.md` | Working in sapcc/* repos with go-bits |38| Quality gate | `quality-gate.md` | Running make check, linting, pre-commit validation |3940## Instructions4142### Step 1: Identify the Go Domain4344Classify the task into one or more domains, then load the corresponding reference files.45Only load what is needed -- do not load all references for every task.4647| Domain | Load Reference | When |48|--------|---------------|------|49| Testing | `references/testing.md` | Writing, fixing, or reviewing Go tests |50| Concurrency | `references/concurrency.md` | Goroutines, channels, sync primitives, race conditions |51| Error handling | `references/error-handling.md` | Error wrapping, sentinels, custom types, errors.Is/As |52| Review patterns | `references/preferred-patterns.md` | Detecting code smells, over-engineering, bad Go patterns |53| Code review | `references/code-review.md` | Reviewing Go code or PRs for quality |54| SAP CC conventions | `references/sapcc-conventions.md` | Working in sapcc/* repos with go-bits |55| Quality gate | `references/quality-gate.md` | Running make check, linting, pre-commit validation |5657Multiple domains may apply. For example, reviewing a PR that includes concurrency code58should load both `code-review.md` and `concurrency.md`.5960### Step 2: Load and Follow the Reference6162Read the selected reference file(s) using `${CLAUDE_SKILL_DIR}/references/<name>.md`.63Each reference contains the full methodology, phases, code examples, and error handling64for that domain. Follow the instructions in the reference as if they were this skill's65instructions.6667### Step 3: Use Domain-Specific Sub-References6869Some references point to their own sub-reference files for extended patterns:7071**Testing** sub-references:72- `${CLAUDE_SKILL_DIR}/references/testing/go-test-patterns.md` -- Full table-driven test, helper, mock examples73- `${CLAUDE_SKILL_DIR}/references/testing/go-benchmark-and-concurrency.md` -- b.Loop() benchmarks, synctest7475**Concurrency** sub-references:76- `${CLAUDE_SKILL_DIR}/references/concurrency/concurrency-patterns.md` -- Worker pool, fan-out/fan-in, pipeline, rate limiter, graceful shutdown7778**Error handling** sub-references:79- `${CLAUDE_SKILL_DIR}/references/error-handling/patterns.md` -- gopls tracing, HTTP handler patterns, error wrapping in middleware8081**Review-pattern** sub-references:82- `${CLAUDE_SKILL_DIR}/references/preferred-patterns/code-examples.md` -- Extended before/after for all 7 failure modes8384**Code review** sub-references:85- `${CLAUDE_SKILL_DIR}/references/code-review/common-review-comments.md` -- Go code patterns with good/bad examples8687**SAP CC conventions** sub-references:88- `${CLAUDE_SKILL_DIR}/references/sapcc-conventions/sapcc-code-patterns.md` -- Primary reference: code patterns, testing patterns, failure modes (merged from testing-patterns-detailed.md and preferred-patterns.md)89- `${CLAUDE_SKILL_DIR}/references/sapcc-conventions/library-reference.md` -- Complete approved/restricted library table90- `${CLAUDE_SKILL_DIR}/references/sapcc-conventions/architecture-patterns.md` -- Full 102-rule architecture spec91- `${CLAUDE_SKILL_DIR}/references/sapcc-conventions/review-standards.md` -- Lead + secondary review standards (merged)92- `${CLAUDE_SKILL_DIR}/references/sapcc-conventions/extended-patterns.md` -- Security, K8s, PR hygiene patterns93- Plus: `api-design-detailed.md`, `build-ci-detailed.md`, `error-handling-detailed.md`,94 `go-bits-philosophy-detailed.md`, `pr-mining-insights.md`9596**Quality gate** sub-references:97- `${CLAUDE_SKILL_DIR}/references/quality-gate/common-lint-errors.json` -- Linter descriptions and fix suggestions98- `${CLAUDE_SKILL_DIR}/references/quality-gate/makefile-targets.json` -- Available make targets99- `${CLAUDE_SKILL_DIR}/references/quality-gate/expert-review-patterns.md` -- Manual review patterns100- `${CLAUDE_SKILL_DIR}/references/quality-gate/examples.md` -- Detailed usage examples101102### Step 4: Execute103104Follow the loaded reference methodology. Each reference has its own phases, gates,105and completion criteria. Apply them as written.106107## Available Scripts108109Scripts are organized by domain in sub-directories:110111- **Testing**: `scripts/gen-table-test.sh`, `scripts/bench-compare.sh`112- **Error handling**: `scripts/check-errors.sh`113- **Code review**: `scripts/check-interface-compliance.sh`114- **SAP CC conventions**: `scripts/check-sapcc-identify-endpoint.sh`, `scripts/check-sapcc-auth-ordering.sh`,115 `scripts/check-sapcc-json-strict.sh`, `scripts/check-sapcc-time-now.sh`, `scripts/check-sapcc-httptest.sh`,116 `scripts/check-sapcc-todo-format.sh`117- **Quality gate**: `scripts/quality_checker.py`, `scripts/validate.py`118- **Google style snapshot**: `scripts/sync-google-style-guide.py` (pinned upstream refresh; requires review before revision changes)119120## Error Handling121122Errors are domain-specific. Load the relevant reference file and check its Error Handling123section for troubleshooting guidance.