All skills
psiace avatar

/modular-go

@f80ef5a
by Chojan Shangpsiace/skills172 stars
7

Practical guidance for Go package design with minimal public APIs, single-responsibility boundaries, stateless-first flow, one-way state transitions, and orchestration-to-capability separation. Use when creating, refactoring, or reviewing Go architecture, package boundaries, interfaces, handlers, managers, builders, and execution flows.

Use this Skill: https://skilld.dev/gh/psiace/skills/modular-go

This session only. Nothing lands on disk.

referencesgrpc-practices.md

≈464 tokens on demand. Your agent reads this file only when SKILL.md points to it.

gRPC Practices

Goals

  • Keep transport concerns isolated from domain logic.
  • Make gRPC services easy to test without starting a real server.

Guidance

  • GRPC service impls are translators: unmarshal request, call domain service, marshal response.
  • Keep all business decisions in injected XXXManager or domain XXXHandler dependencies, not in the GRPC service.go itself.
  • Convert domain errors to gRPC status codes at the handler boundary in one centralized place.
  • Use context.Context from the incoming RPC for cancellation and deadline propagation; do not create detached contexts.
  • When handlers accumulate enough complexity, extract them into a dedicated package alongside the server definition.
  • Let server initialization & GRPC service impl to be different packages: server package focus on dependency injection & initialization, service package focus on request / response translation.
  • Register services through a constructor that accepts domain dependencies explicitly; avoid global state or init-time registration.

Structuring a gRPC Package

  • server.go: Server constructor, listener setup, graceful shutdown.
  • service.go: Handler methods implementing the generated interface.
  • Keep proto-generated code in its own module or a proto/ subdirectory; do not mix generated and hand-written code.

Review Bullets

  • Does each handler method fit the pattern: unmarshal → delegate → marshal?
  • Is business logic free of any gRPC-specific types (codes, status, proto messages)?
  • Is error-to-status conversion centralized rather than scattered across handlers?
  • Are domain dependencies injected via the constructor, not accessed through globals?
  • Is context.Context from the RPC propagated to downstream calls?

Source: SKILL.md on GitHub

No alerts8d4 checks · Risk SAFE
  • Gen Agent Trust Hub8d

    The skill provides architectural guidance for Go package design and does not contain any executable code or security risks.

  • Socket8d

    No alerts

  • Snyk8d

    Risk: LOW · No issues

  • Runlayer6mo

    6 files scanned · No issues

Signed by skilld at f80ef5a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Activeupdated 7 months ago

README badge

README badge for psiace/skills/modular-go