Skills
Chapter 19 of 28
Manage API keys, credentials, and other secrets in Encore Go using a package-level secrets struct.
1 minute · 128 words · 6 sections
Secrets are encrypted, environment-scoped values managed by Encore. Declare them as a package-level secrets struct — Encore reads the field names and resolves each to the right value at runtime.
package email
var secrets struct {
SendGridAPIKey string
SMTPPassword string
}
func sendEmail() error {
apiKey := secrets.SendGridAPIKey
// Use the secret...
return nil
}Secret keys are globally unique across the application — SendGridAPIKey resolves to the same value regardless of which package declares it.
# Set per environment type
encore secret set --type prod SendGridAPIKey
encore secret set --type dev SendGridAPIKey
encore secret set --type local SendGridAPIKeyEnvironment types: production (alias prod), development (alias dev), preview (alias pr), local.
For local development without going through encore secret set, create a .secrets.local.cue file at the repo root (gitignore it):
SendGridAPIKey: "SG.local-test-key"
GitHubAPIToken: "ghp_local_..."package github
import (
"context"
"net/http"
)
var secrets struct {
GitHubAPIToken string
}
func callGitHub(ctx context.Context) error {
req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.github.com/user", nil)
req.Header.Set("Authorization", "token "+secrets.GitHubAPIToken)
resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
return nil
}package webhooks
var secrets struct {
StripeWebhookSecret string
}
// Verify Stripe signature using secrets.StripeWebhookSecret in a raw endpoint.secrets struct, not as individual secret(...) calls.encore secret set.encore secret set --type <env>..secrets.local.cue for local overrides and gitignore it.encore-go-webhook skill.Install this repository
npx skills add encoredev/skills/plugin marketplace add encoredev/skillsSkills install per repository, not per chapter — the CLI has no documented per-skill form, so we do not print one.
Manage API keys, credentials, and other secrets in Encore Go using a package-level `secrets` struct.
The verbatim description from this skill’s front matter — the string an agent matches on to decide whether to load it.
main, last pushed 15 May 2026.SKILL.md, not by matching a directory convention. One layout observed: encore/*/SKILL.md.h1 and no skipped levels:.claude-plugin/marketplace.json by Encore, declaring 1 plugin. It is read for editorial metadata only — never as the skill index, which is always the repository tree./encoredev/skills.md, and each chapter at its own .md URL.