12-services-layer — Claude Code prompt: wire up background services
12-services-layer — a prompt that configures Claude Code CLI background services: analytics, policy limits, remote settings, session memory, and bootstrap data.
no license ★ 3,444 updated 2026-10-14
.claude/commands/12-services-layer.mdWhat 12-services-layer does
The prompt walks through wiring six services that run in the background of the CLI: GrowthBook for feature flags and OpenTelemetry traces, rate and quota checks from the Anthropic backend, server-pushed configuration, conversation history persistence across invocations, initial data from the API, and token cost tracking. Most of these call Anthropic servers and will fail in a dev build.
It breaks the task into seven parts: first it asks you to document the init sequence in src/entrypoints/init.ts, then makes GrowthBook optional (feature checks return false on failure), stubs policyLimits so it does not block requests, ensures remote settings and bootstrap fall back to defaults, verifies that SessionMemory works with the local filesystem, and wires up cost-tracker.ts to display locally without remote reporting. Bootstrap will fail without an API key — the prompt requires sensible defaults in that case.
At the end you create scripts/test-services.ts: a script that runs init() and logs which service broke. The check is bun scripts/test-services.ts completing without a crash, unavailable services log warnings, and the app starts even when Anthropic's backend is unreachable.
What it helps with
- connect GrowthBook, policy limits, remote settings, session memory, and bootstrap to the CLI
- keep services from crashing the app when Anthropic backend is down
- set up token cost tracking for local display
- write a smoke test for all background services
Example prompts for the agent
- Walk through the 12-services-layer prompt and set up the services layer
- Create
scripts/test-services.tsfollowing the 12-services-layer instructions - Stub policy limits so they don't block requests in dev builds
How to install 12-services-layer
Manually: put the files in place
.claude/commands/12-services-layer.mdHow to use
Paste the text at the start of a chat or into project instructions
Questions about 12-services-layer
How do I install 12-services-layer in Claude Code?
Copy the prompt to .claude/commands/12-services-layer.md and call it in chat.
What does the 12-services-layer prompt do?
It configures six background services in Claude Code CLI: GrowthBook analytics, request limits, remote config, session memory, bootstrap API, and cost tracking. It makes them work in dev builds without a real Anthropic backend.
What happens if Anthropic's backend is unreachable?
The prompt requires each service to return defaults or log warnings instead of crashing. GrowthBook returns false for feature flags, policy limits pass requests through, remote settings use built-in values.