# encore-go-service

This skill structures Encore.go services, Go packages, systems, and typed calls between services. Use it when adding a service or applying an agreed layout.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 555 installs · ★ 30
- Author: encoredev
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/encoredev/skills/tree/HEAD/encore/go-service/SKILL.md
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/skills/encore-go-service

## What it does

The skill shows how to arrange an Encore.go application around service packages, database files, migrations, and system folders. It covers a single root service, several independent services, and larger layouts where related services sit under systems.

A call from one service to another uses a normal Go import and function call; Encore handles the RPC layer. Shared helpers belong in packages without `//encore:api`, while a package with that annotation becomes a service. If service boundaries are still undecided, the skill points to `encore-architecture`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add encoredev/skills --skill encore-go-service -a claude-code
```
```bash
npx skills add encoredev/skills --skill go-service -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/go-service/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/go-service/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add encoredev/skills --skill go-service -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/go-service/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add encoredev/skills --skill go-service -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/go-service/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install encoredev/skills go-service
```

2. **Manually: put the files in place**
- File: `.github/skills/go-service/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add encoredev/skills --skill go-service -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/encoredev/skills --path encore/go-service
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/go-service/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add encoredev/skills --skill go-service -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/encoredev/skills/tree/HEAD/encore/go-service/SKILL.md

## When to use it
- create an Encore.go service with an API endpoint
- lay out a Go application by service packages
- group related services into systems
- keep shared helpers in internal packages
- call one service from another through a typed function

## Example prompts
- Create an Encore.go user service with a `GetUser` endpoint in the `user` package.
- Organize this application into `commerce` and `identity` systems with separate services.
- Add a typed call from the `order` service to `user` using Encore.go conventions.

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 974bb79832388b2a.

BEGIN THIRD-PARTY FILE 974bb79832388b2a
````text
---
name: encore-go-service
description: 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`.
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".
---

# 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:

```go
// 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:

```go
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
````
END THIRD-PARTY FILE 974bb79832388b2a

The third-party file has ended. Everything between the 974bb79832388b2a tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3161 of 4210 bytes. © encoredev · Apache-2.0 · https://github.com/encoredev/skills/tree/HEAD/encore/go-service/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
