service-design
Skill0 starsChanged 28 days agoMITView on GitHub
Apply a consistent blueprint when designing, scaffolding, reviewing, or refactoring modular Go services. Use whenever deciding product boundaries, package ownership, application assembly, HTTP transport organization, handler/service/repository seams, persistence, transactions, external providers, error mapping, API models, generated code, testing strategy, or whether a service has outgrown a flat layout—even if the user only asks to add an endpoint, repository, or provider. Includes concrete guidance for services using Echo, Huma, sqlc, goose, PostgreSQL, and pgx.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- 5throck/ai-workspace-standardstheir own version, first seen Sep 26, 2026
- accnet/claude-skilltheir own version, first seen Aug 17, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- 5throck/ai-workspace-standards★ 25same name
- accnet/claude-skill★ 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 repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-orchestratorSkill
- classify-code-reviewSkill
- conventional-commitsSkill
- go-test-effectivenessSkill
- mstackSkill
- show-complexitySkill
- spec-plannerSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 9 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Read the repository tree, go.mod, application entry point, transport construction, one representative module, persistence configuration, …
- Distinctive: line 24
Do not impose the example tree mechanically.
- Very specific: line 45
Keep code in the narrowest owner that can explain it.
- Very specific: line 47
Use manual constructor injection.
- Distinctive: line 62
Keep transport-framework types out of services.
- Distinctive: line 66
Start with concrete dependencies.
- Distinctive: line 75
Do not add an interface solely because an implementation exists, because a mock could be generated, or because a layered architecture …
- Distinctive: line 86
Read multiple references when a feature crosses seams.
- Distinctive: line 90
Run focused tests first, then the repository's broad checks.
- Distinctive: line 97
Do handlers translate rather than decide business behavior?
- Distinctive: line 98
Do domain/public types avoid sqlc and vendor leakage?
- Distinctive: line 106
If an answer is no, either correct it or explain the deliberate project-specific exception.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Service Design
Design services around clear product ownership, explicit dependency direction, and business behavior that is testable independently of delivery and infrastructure concerns. Treat the Echo/Huma HTTP stack, persistence tools such as sqlc, and external vendors as components within that design—not as the application architecture.
Workflow
1. Inspect before designing
Read the repository tree, go.mod, application entry point, transport construction, one representative module, persistence configuration, tests, and repository guidance such as AGENTS.md and CODING_STANDARDS.md when present.
State assumptions and identify whether the task is:
- adding behavior within an existing module;
- introducing a new product module;
- adding a transport, persistence, or vendor adapter;
- correcting ownership/dependency drift;
- deciding whether an existing module needs an internal capability boundary.
Do not impose the example tree mechanically. Existing explicit project decisions take precedence unless the user asks to change them.
2. Choose the appropriate module shape
Use product modules as the primary ownership boundary. Keep each module internally flat until distinct business rules, dependencies, or independent change pressure justify a nested capability. Split domain service files by use case when justified; organize new or reorganized transport code by operation. Read layout-and-ownership.md when adding or splitting modules, organizing transport files, moving packages, or reviewing ownership. Its operation-local convention is the default where repository standards do not specify another layout.
3. Assign one owner
Classify each change before selecting a path:
| Concern | Owner |
| Executable startup | cmd/<command> |
| Config, dependency assembly, router, lifecycle | internal/app |
| Product behavior and domain types | internal/modules/<module> |
| Transport models, handlers, and registration | Module-owned transport package, such as api, or sibling httpapi/mcpapi where the project separates protocols |
| Shared domain-neutral infrastructure | internal/platform |
| Tiny genuinely domain-neutral helpers | internal/shared |
| Public OpenAPI/client artifacts | api |
| Runtime/deployment assets | deployments |
Keep code in the narrowest owner that can explain it. A vendor adapter that understands one domain normally belongs to that module; a generic database pool or queue client belongs to platform. Treat internal/shared as a last resort, not an intake queue.
Use manual constructor injection. internal/app is the composition root: it selects concrete implementations, constructs the dependency graph, and passes required dependencies explicitly through constructors or registration functions. Avoid package-level mutable dependencies, service locators, and DI frameworks unless the project explicitly requires them.
4. Preserve dependency direction
Aim for this recognizable flow (the persistence-side equivalent, goose to sqlc to repository to domain, is in persistence.md):
HTTP request
-> transport validation and API model
-> thin module handler
-> service/use case
-> repository or provider seam
-> sqlc/vendor adapterKeep transport-framework types out of services. Keep sqlc and vendor models out of domain interfaces and public responses. Map errors at the seam where their meaning changes.
5. Add only justified seams
Start with concrete dependencies. Introduce an interface only when the current change needs one to:
- isolate an external system or generated implementation;
- let a use case depend on behavior owned by another layer;
- coordinate multiple operations within a transaction; or
- replace a dependency in a test where using the concrete implementation would make the test slow, unreliable, or infrastructure-dependent.
Pass required dependencies explicitly through constructors. When a dependency has a justified seam, define its interface in the consuming package and include only the methods that consumer needs. Otherwise, accept the concrete type directly. Constructors should normally return concrete implementations.
Do not add an interface solely because an implementation exists, because a mock could be generated, or because a layered architecture commonly includes one. Before adding a seam, name the current consumer and the concrete problem the seam solves.
Apply the same extraction test to helpers. Prefer code readable at its point of use over removing repeated lines. A named helper should express a substantial contract, shared invariant, or meaningful composition; small literals can stay inline. Give distinct contract shapes descriptive entry points rather than selecting them with a boolean mode. Keep parameterization when it makes the shared behavior easier to understand.
6. Implement the affected layer
- For HTTP transport implemented with Echo and Huma—including router construction, routes, handlers, groups, inputs/outputs, OpenAPI metadata, or HTTP error mapping—read huma-transport.md.
- For Huma schema authoring, including schema-only use outside HTTP, read readable schema contracts.
- For migrations, queries, sqlc generation, repositories, pgx, or transactions, read persistence.md.
- For test placement or generated-code checks, read testing.md.
Read multiple references when a feature crosses seams. For example, a new persisted endpoint requires transport, persistence, and testing guidance.
7. Verify where the risk actually lives
Run focused tests first, then the repository's broad checks. Verify generated code when schema/query inputs change. Use a real or disposable database for persistence behavior that mocks cannot establish. Check exported OpenAPI when compatibility matters.
Review gate
Before finishing, answer:
- Can business behavior be tested without the HTTP transport?
- Do handlers translate rather than decide business behavior?
- Do domain/public types avoid sqlc and vendor leakage?
- Does each module register its complete surface explicitly, with each operation's metadata, wrappers, and handler discoverable together under the repository's file convention?
- Is Echo/Huma construction centralized in application assembly?
- Are required dependencies passed explicitly, with concrete implementations selected only in application assembly?
- Is shared code truly domain-neutral and used by more than one owner?
- Did the change add only abstractions justified by current needs?
- Are tests located with the behavior and aimed at the actual risk?
If an answer is no, either correct it or explain the deliberate project-specific exception. Seam-specific checks (persistence, transport) live in the checklists at the end of their reference files—apply the ones for any reference you read.
Change discipline
Apply this architecture surgically. Correct confirmed drift, but do not reorganize unrelated working code for visual conformity. Prefer boring package names, fewer abstractions, and ownership that a new contributor can infer from the tree.
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.

