skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
vinzscam/backstage-skills49 installs

using-backstage-backend-services

Use when a Backstage backend plugin or module needs a core service — logger, config, http router, database, scheduler, lifecycle, cache, urlReader, discovery, auth, httpAuth, or userInfo. Triggers on imports of coreServices.* refs from @backstage/backend-plugin-api or any deps map in a plugin/module register block.

How do I install this agent skill?

npx skills add https://github.com/vinzscam/backstage-skills --skill using-backstage-backend-services
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    The skill provides a set of reference materials and code templates for developing Backstage backend plugins. It demonstrates how to interact with core services like logging, configuration, databases, and authentication using the recommended patterns of the Backstage framework. The provided code emphasizes security best practices such as schema validation and isolated service scoping.

  • Socketpass

    No alerts

  • Snykwarn

    Risk: MEDIUM · 1 issue

What does this agent skill do?

Backstage Backend Services

When to use this skill

  • Plugin or module needs logging, configuration, HTTP routing, database, scheduling, caching, URL fetching, service discovery, or auth
  • User mentions any specific coreServices.* ref
  • Adding a new dep to a register({ deps: {...} }) block

Defaults

  • All HTTP routes are authenticated by default. Normal plugin endpoints need no auth configuration — the frontend's fetchApi handles tokens automatically. Never use addAuthPolicy({ allow: 'unauthenticated' }) for normal data endpoints; see references/http-router.md → Auth policies.

Choose the right service

NeedServiceReference
LoggingcoreServices.logger (plugin-scoped, pre-tagged with pluginId)references/logger-and-config.md
Read app-config.yamlcoreServices.rootConfigreferences/logger-and-config.md
Register HTTP routescoreServices.httpRouterreferences/http-router.md
Knex DB accesscoreServices.database (plugin-scoped, isolated schema)references/database.md
Periodic / cron taskscoreServices.schedulerreferences/scheduler-and-lifecycle.md
Startup / shutdown hookscoreServices.lifecycle (plugin) or coreServices.rootLifecycle (root)references/scheduler-and-lifecycle.md
Service-to-service tokenscoreServices.authreferences/auth.md
Authenticate incoming requestscoreServices.httpAuthreferences/auth.md
Resolve current user from credentialscoreServices.userInforeferences/auth.md
Read external URLs (GitHub, GitLab, etc.)coreServices.urlReaderreferences/urlReader-and-discovery.md
Resolve a backend plugin's base URLcoreServices.discoveryreferences/urlReader-and-discovery.md
Key-value cachecoreServices.cachereferences/cache.md

Two invocation modes

  • Standalone: adding a service dep to an existing plugin or module.
  • Post-scaffold (called by creating-backstage-plugin for backend templates): include coreServices.logger and coreServices.httpRouter as defaults; surface additional services if intent suggests them (e.g. "stores X" → database; "polls every N minutes" → scheduler).

Common gotchas

  • All refs come from @backstage/backend-plugin-api. The actual implementations come from @backstage/backend-defaults, but plugins consume the refs only.
  • Plugin-scoped services give each plugin an isolated instance — coreServices.database returns a Knex client scoped to a per-plugin schema; coreServices.logger is pre-tagged with pluginId. Don't try to share a Knex instance across plugins by passing it around — call cross-plugin via coreServices.discovery + HTTP instead.
  • The auth, httpAuth, and userInfo services are easy to confuse. auth mints/verifies tokens for service-to-service calls; httpAuth authenticates an incoming Express request; userInfo resolves a user identity from credentials returned by httpAuth.
  • coreServices.scheduler schedules durable tasks across replicas — don't use setInterval for production tasks.
  • For tests: use mockServices.<name>(...) to get an instance for unit tests; use mockServices.<name>.factory(...) when passing to startTestBackend({ features: [...] }). Not every service has a factory — httpRouter, cache, urlReader, lifecycle are typically provided by the test backend's defaults.
  • When calling another Backstage plugin via discovery + auth (cross-plugin HTTP), handle non-OK responses with throw await ResponseError.fromResponse(response) from @backstage/errors. It parses the response body for structured error info and produces a typed error other Backstage layers (logging, error reporting, frontend <ResponseErrorPanel>) understand. Never just throw new Error(\Failed: ${response.status}`)`.
  • Inside route handlers, throw typed errors from @backstage/errors (NotFoundError, InputError, NotAllowedError, ConflictError, ServiceUnavailableError, ForwardedError, etc.) — the default backend error middleware turns them into properly-formatted HTTP responses. Don't res.status(...).json(...) for error cases. See references/http-router.md.

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/vinzscam/backstage-skills/using-backstage-backend-services">View using-backstage-backend-services on skillZs</a>