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

/service

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

Implement Encore.ts services and lay out an application using `encore.service.ts`, service directories, systems, and `~encore/clients`. For service boundaries and architecture decisions, use `encore-architecture`.

  • 1 file
  • 3.1 KB
  • Updated 3 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/encoredev/skills/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. ≈632 when used: this file.

Description uses 7.8% 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 ≈622 characters, or 7.8%.

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 Service Structure

Instructions

Creating a Service

Every Encore service needs an encore.service.ts file:

// encore.service.ts
import { Service } from "encore.dev/service";

export default new Service("my-service");

Minimal Service Structure

my-service/
├── encore.service.ts    # Service definition (required)
├── api.ts               # API endpoints
└── db.ts                # Database (if needed)

Application Patterns

Single Service

A service can be defined at the application root:

my-app/
├── package.json
├── encore.app
├── encore.service.ts
├── api.ts
├── db.ts
└── migrations/
    └── 001_initial.up.sql

Multi-Service

Each service lives in its own directory:

my-app/
├── encore.app
├── package.json
├── user/
│   ├── encore.service.ts
│   ├── api.ts
│   └── db.ts
├── order/
│   ├── encore.service.ts
│   ├── api.ts
│   └── db.ts
└── notification/
    ├── encore.service.ts
    └── api.ts

Large Application (System-based)

Group related services into systems:

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

Service-to-Service Calls

Import other services from ~encore/clients:

import { user } from "~encore/clients";

export const getOrderWithUser = api(
  { method: "GET", path: "/orders/:id", expose: true },
  async ({ id }): Promise<OrderWithUser> => {
    const order = await getOrder(id);
    const orderUser = await user.get({ id: order.userId });
    return { ...order, user: orderUser };
  }
);

Guidelines

  • Services cannot be nested within other services
  • Use ~encore/clients for cross-service calls (never direct imports)
  • Each service can have its own database
  • Service names should be lowercase, descriptive
  • Don't create services just for code organization - use folders 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.ts service or microservice, implement an already-chosen service layout, organize service files and directories, group services into system folders, or call another service. Trigger phrases: "add a service", "create a service", "add a microservice", "encore.service.ts", "lay out these services", "service directory", "systems folder", "~encore/clients".
  • TypeScript
  • encore
  • microservices
  • service-architecture
  • directory-structure
  • domain-driven-design
  • monolith
  • service-boundaries
  • system-design

README badge

README badge for encoredev/skills/service

Helps architects plan Encore.ts application structure by defining service boundaries, directory layouts, and multi-service patterns. Covers single-service setups, multi-service decomposition with domain boundaries, system-based hierarchies, and service-to-service communication via the `~encore/clients` pattern.

Generated from the current SKILL.md.

When should I split my Encore app into multiple services?
Split when services have different scaling needs, different deployment cycles, or clear domain boundaries. Keep services together if they share database tables or have tightly coupled logic. Use folders instead of services if you're just organizing code.
Can services be nested within other services?
No. Services cannot be nested within other services in Encore.
How do services communicate with each other?
Import other services from the `~encore/clients` generated package and call their exported APIs directly. Never use direct imports between services.
Do I need a database for every service?
No. Each service can have its own database if needed, but it's optional. Services can be API-only.
What's the minimum required file for an Encore service?
An `encore.service.ts` file that exports a Service instance. You can add `api.ts` and `db.ts` as needed.

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