Index of every page on this site: llms.txt
All skills
encoredev avatar

/go-service

@e86a3ab official
by Encoreencoredev/skills30 stars
6
Run it yourself

Implement Encore.go services and lay out an application using service packages, internal subpackages, systems, and typed service calls. For service boundaries and architecture decisions, use `encore-architecture`.

  • 1 file
  • 4.1 KB
  • Updated 3 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/encoredev/skills/go-service

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈56 tokens for metadata: the name and description. ≈884 when used: this file.

Description uses 7.9% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈631 characters, or 7.9%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Encore.go Service Structure

Instructions

In Encore.go, each package with an API endpoint is automatically a service. No special configuration needed.

Creating a Service

Simply create a package with at least one //encore:api endpoint:

// user/user.go
package user

import "context"

type User struct {
    ID    string `json:"id"`
    Email string `json:"email"`
    Name  string `json:"name"`
}

//encore:api public method=GET path=/users/:id
func GetUser(ctx context.Context, params *GetUserParams) (*User, error) {
    // This makes "user" a service
}

Minimal Service Structure

user/
├── user.go          # API endpoints
├── db.go            # Database (if needed)
└── migrations/      # SQL migrations
    └── 1_create_users.up.sql

Application Patterns

Single Service

An application can define its APIs in one root service package:

my-app/
├── encore.app
├── go.mod
├── api.go           # All endpoints
├── db.go            # Database
└── migrations/
    └── 1_initial.up.sql

Multi-Service

Each service lives in its own package:

my-app/
├── encore.app
├── go.mod
├── user/
│   ├── user.go
│   ├── db.go
│   └── migrations/
├── order/
│   ├── order.go
│   ├── db.go
│   └── migrations/
└── notification/
    └── notification.go

Large Application (System-based)

Group related services into systems:

my-app/
├── encore.app
├── go.mod
├── commerce/
│   ├── order/
│   │   └── order.go
│   ├── cart/
│   │   └── cart.go
│   └── payment/
│       └── payment.go
├── identity/
│   ├── user/
│   │   └── user.go
│   └── auth/
│       └── auth.go
└── comms/
    ├── email/
    │   └── email.go
    └── push/
        └── push.go

Service-to-Service Calls

Just import and call the function directly - Encore handles the RPC:

package order

import (
    "context"
    "encore.app/user"  // Import the user service
)

//encore:api auth method=GET path=/orders/:id
func GetOrderWithUser(ctx context.Context, params *GetOrderParams) (*OrderWithUser, error) {
    order, err := getOrder(ctx, params.ID)
    if err != nil {
        return nil, err
    }
    
    // This becomes an RPC call - Encore handles it
    orderUser, err := user.GetUser(ctx, &user.GetUserParams{ID: order.UserID})
    if err != nil {
        return nil, err
    }
    
    return &OrderWithUser{Order: order, User: orderUser}, nil
}

Internal Helpers (Non-Service Packages)

Create packages without //encore:api endpoints for shared code:

my-app/
├── user/
│   └── user.go       # Service (has API)
├── order/
│   └── order.go      # Service (has API)
└── internal/
    ├── util/
    │   └── util.go   # Not a service (no API)
    └── validation/
        └── validate.go

Guidelines

  • A package becomes a service when it has //encore:api endpoints
  • Services cannot be nested within other services
  • Cross-service calls look like regular function calls
  • Each service can have its own database
  • Package names should be lowercase, descriptive
  • Don't create services just for code organization - use sub-packages instead
  • Use encore-architecture when the service boundaries have not been decided

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

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

Last checked against GitHub 4 weeks ago.

Activeupdated 3 months ago
Other metadata
when_to_use
User wants to add or modify an Encore.go service or microservice, implement an already-chosen service layout, organize packages and directories, group services into system folders, or call another service. Trigger phrases: "add a Go service", "create a Go service", "add a microservice", "service package", "lay out these services", "Go package layout", "internal package", "call another service".
  • Go
  • encore
  • microservices
  • service-architecture
  • directory-structure
  • domain-driven-design
  • monolith
  • api-design
  • package-layout

README badge

README badge for encoredev/skills/go-service

Guides decomposition and directory layout for multi-service Encore Go applications. Covers monolith vs. microservices decisions, service boundary definition, and Go package structure — from single-service projects to systems-of-services hierarchies with domain grouping.

Generated from the current SKILL.md.

When should I split my Encore Go app into multiple services?
Split when you have different scaling needs, different deployment cycles, or clear domain boundaries. Keep code together if it shares database tables or is tightly coupled. Use sub-packages instead of services just for code organization.
How do I make a package into an Encore service?
Any package with at least one `//encore:api` endpoint automatically becomes a service. No special configuration needed beyond adding the API annotation to a function.
Can services call each other in Encore Go?
Yes. Import another service's package and call its functions directly. Encore automatically converts these into RPC calls at runtime.
Can I have shared code that isn't a service?
Yes. Create packages without `//encore:api` endpoints for internal helpers, utilities, and shared logic. These won't become services.

Generated from the current SKILL.md. These answers refresh after source changes.