golang-design-patterns
Skill15 starsChanged 9 months agoMITView on GitHub
Go design patterns and refactoring skill. Use when refactoring complex code, reducing technical debt, or applying design patterns. Detects code smells and suggests pattern-based solutions.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- samber/cc-skills-golangtheir own version, first seen Oct 1, 2026
- rzisso/golang-skillstheir own version, first seen Sep 16, 2026
- gccli/skillstheir own version, first seen Jul 27, 2026
- alexastrum/skltheir own version, first seen Jun 12, 2026
- damacus/agent-skillstheir own version, first seen May 20, 2026
- guynhsichngeodiec/cc-skills-golangtheir own version, first seen Apr 7, 2026
Used with
Projects with it also use golang-cli, golang-context and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
guynhsichngeodiecSkillgolang-cli
Golang CLI application development. Use when building, modifying, or reviewing a Go CLI tool — especially for command structure, flag handling, configuration layering, version embedding, exit codes, I/O patterns, signal handling, shell completion, argument validation, and CLI unit testing. Also triggers when code uses cobra, viper, or urfave/cli.
Also in 5 projects that use this
guynhsichngeodiecSkillgolang-context
Idiomatic context.Context usage in Golang — creation, propagation, cancellation, timeouts, deadlines, context values, and cross-service tracing. Apply when working with context.Context in any Go code.
Also in 5 projects that use this
- +10 more from guynhsichngeodiec
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- samber/cc-skills-golang★ 3.4ksame name
- alexastrum/skl★ 10same name
- damacus/agent-skills★ 2same name
- gccli/skills★ 0same name
- guynhsichngeodiec/cc-skills-golang★ 0same name
- rzisso/golang-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Use this skill when:
- Distinctive: line 109
Verify tests still pass
- Distinctive: line 110
Check for improved readability
- Distinctive: line 116
Ensure pattern improves, not complicates code
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Golang Design Patterns & Refactoring
Expert-level code refactoring and design pattern application for Go. Detects code smells, suggests refactoring strategies, and applies proven design patterns to improve maintainability.
When to Apply
Use this skill when:
- Refactoring complex or legacy code
- Reducing technical debt
- Extracting reusable patterns
- Simplifying large functions (God Objects)
- Improving code maintainability
- Applying Gang of Four patterns to Go
Rule Categories by Priority
| Priority | Count | Focus |
| High | 2 | Critical refactoring needs |
| Medium | 11 | Code quality improvements |
Rules Covered (13 total)
High-Impact Patterns (2)
high-god-object- Extract logic from 300+ line functionshigh-extract-method- Name complex code blocks with descriptive methods
Medium Improvements (11)
medium-primitive-obsession- Replace primitives with value objectsmedium-long-parameter-list- Use parameter objects for >5 paramsmedium-data-clumps- Extract repeated parameter groupsmedium-feature-envy- Move logic closer to datamedium-magic-constants- Replace magic numbers with named constantsmedium-builder-pattern- Fluent API for complex constructionmedium-factory-constructor- Validated object creationmedium-introduce-parameter-object- Group related parametersmedium-switch-to-strategy- Replace type switches with interfacesmedium-middleware-decorator- Decorator pattern for http.Handlermedium-law-of-demeter- Reduce coupling, avoid message chains
Common Refactoring Patterns
God Object → Extracted Methods
// ❌ 500 line function
func (u *Usecase) Process() { ... }
// ✅ Extracted methods
func (u *Usecase) Process() {
u.validate()
u.transform()
u.persist()
}Primitive Obsession → Value Object
// ❌ Primitive types
func CreateUser(email string) { ... }
// ✅ Value object
type Email struct { value string }
func CreateUser(email Email) { ... }Type Switch → Strategy Pattern
// ❌ Type switch
switch v := val.(type) { ... }
// ✅ Strategy pattern
type Processor interface { Process() }Trigger Phrases
This skill activates when you say:
- "Refactor this code"
- "Reduce complexity"
- "Extract methods from large function"
- "Apply design patterns"
- "Improve maintainability"
- "Simplify this usecase"
- "Find code smells"
How to Use
For Code Refactoring
- Identify code smells (God Objects, long parameter lists, etc.)
- Apply appropriate refactoring pattern
- Verify tests still pass
- Check for improved readability
For Pattern Application
- Identify appropriate pattern for use case
- Apply pattern incrementally
- Ensure pattern improves, not complicates code
Output Format
## High Priority Refactoring: X
### [Rule Name] (Line Y)
**Code Smell**: God Object / Long Parameter List / Primitive Obsession
**Impact**: Hard to maintain / Test / Understand
**Refactoring**: Extract Method / Introduce Parameter Object / Create Value Object
**Example**:
```go
// Refactored codeRelated Skills
- golang-clean-architecture - For usecase complexity patterns
- golang-idiomatic-go - For interface design
Philosophy
Based on Martin Fowler's Refactoring:
- Code smells indicate problems - Detect and address systematically
- Refactor incrementally - Small, safe steps
- Patterns are solutions - Apply when appropriate, not dogmatically
- Maintainability matters - Code is read more than written
Notes
- Focus on common Go refactoring patterns
- All patterns adapted for Go idioms
- Emphasizes readability and maintainability
- Includes Gang of Four patterns applicable to Go
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

