Instrumented Service Scaffold
Use this workflow when authoring or reviewing a new service, worker, daemon,
API, or other long-running software component.
Baseline
From the first commit, the service must include:
- OpenTelemetry traces, metrics, and structured logs wired through a real
exporter.
- A runtime flag client (e.g. OpenFeature) backed by a flag source that can be
reviewed and rolled back without a redeploy.
- A formatter, linter, and type/static-analysis gate using the language's
standard tools.
- Complexity and nesting budgets that stop new outliers before they turn into
review-time style debates.
- A test harness: unit tests, contract tests where interfaces matter, at least
one feature check for promised behavior, and a coverage gate sized to the
service's risk.
- PR-only delivery with branch protection and required checks for tests,
coverage, release policy, and build/deploy validation.
- State-changing delivery workflows (deploy, apply, image-publish) that
serialize per target via a concurrency group with
cancel-in-progress: false;
read-only CI may cancel superseded runs.
- Conventional release or changelog metadata when the repo uses automated
versioning.
- For state where change history matters (quotas, balances, membership,
config), record changes as replayable events rather than only the latest
value; compose with
event-sourcing
(https://github.com/selamy-labs/agent-skills/tree/main/skills/event-sourcing).
Do not defer these to a later hardening pass. If the service is too small to
justify them, document that decision and keep it short-lived or non-production.
Self-Debug Loop
The owner of the service needs the ability to:
- Observe its own traces, metrics, and structured logs.
- Form a concrete hypothesis from that telemetry.
- Change behavior through a reviewed runtime flag or a normal PR.
- Verify the user/system artifact and the telemetry after the change.
The loop is incomplete if it depends on a human manually spelunking logs on the
owner's behalf.
Conformance Check
Before claiming the service is ready, grep the real repository for each item —
not the intent, the artifact:
- OpenTelemetry init code and at least one meaningful span or metric on a
business-critical flow.
- Runtime flag client init pointing at a reviewed flag source.
- Formatter, linter, static-analysis, complexity, and coverage config enforced
by CI (the config files plus the CI job that runs them).
- At least one feature-level behavior check for the primary promise, not only
line coverage.
- State-changing workflows (deploy, apply, release, image-publish) that declare
queue-not-cancel concurrency scoped to serialize each target environment,
state file, or published artifact.
- Required PR checks and release-policy checks present in the repo settings or
IaC source of truth.
- For any state the service declared history-bearing: an append-only
event/change record plus the code path that emits it — not only a
latest-value column or gauge.
- Docs that explain how to observe the service and change a flag.
Record any gap as a blocker or an explicit temporary waiver with a removal date.
Do not call the service production-ready while the baseline is missing.
1---2name: instrumented-service-scaffold3description: Use when creating or reviewing a new long-running service so observability, runtime flags, tests, coverage gates, and release controls exist from the first commit.4---56# Instrumented Service Scaffold78Use this workflow when authoring or reviewing a new service, worker, daemon,9API, or other long-running software component.1011## Baseline1213From the first commit, the service must include:1415- OpenTelemetry traces, metrics, and structured logs wired through a real16 exporter.17- A runtime flag client (e.g. OpenFeature) backed by a flag source that can be18 reviewed and rolled back without a redeploy.19- A formatter, linter, and type/static-analysis gate using the language's20 standard tools.21- Complexity and nesting budgets that stop new outliers before they turn into22 review-time style debates.23- A test harness: unit tests, contract tests where interfaces matter, at least24 one feature check for promised behavior, and a coverage gate sized to the25 service's risk.26- PR-only delivery with branch protection and required checks for tests,27 coverage, release policy, and build/deploy validation.28- State-changing delivery workflows (deploy, apply, image-publish) that29 serialize per target via a concurrency group with `cancel-in-progress: false`;30 read-only CI may cancel superseded runs.31- Conventional release or changelog metadata when the repo uses automated32 versioning.33- For state where change history matters (quotas, balances, membership,34 config), record changes as replayable events rather than only the latest35 value; compose with `event-sourcing`36 (https://github.com/selamy-labs/agent-skills/tree/main/skills/event-sourcing).3738Do not defer these to a later hardening pass. If the service is too small to39justify them, document that decision and keep it short-lived or non-production.4041## Self-Debug Loop4243The owner of the service needs the ability to:44451. Observe its own traces, metrics, and structured logs.462. Form a concrete hypothesis from that telemetry.473. Change behavior through a reviewed runtime flag or a normal PR.484. Verify the user/system artifact and the telemetry after the change.4950The loop is incomplete if it depends on a human manually spelunking logs on the51owner's behalf.5253## Conformance Check5455Before claiming the service is ready, grep the real repository for each item —56not the intent, the artifact:5758- OpenTelemetry init code and at least one meaningful span or metric on a59 business-critical flow.60- Runtime flag client init pointing at a reviewed flag source.61- Formatter, linter, static-analysis, complexity, and coverage config enforced62 by CI (the config files plus the CI job that runs them).63- At least one feature-level behavior check for the primary promise, not only64 line coverage.65- State-changing workflows (deploy, apply, release, image-publish) that declare66 queue-not-cancel concurrency scoped to serialize each target environment,67 state file, or published artifact.68- Required PR checks and release-policy checks present in the repo settings or69 IaC source of truth.70- For any state the service declared history-bearing: an append-only71 event/change record plus the code path that emits it — not only a72 latest-value column or gauge.73- Docs that explain how to observe the service and change a flag.7475Record any gap as a blocker or an explicit temporary waiver with a removal date.76Do not call the service production-ready while the baseline is missing.