Put a change behind a feature flag
Wraps new behaviour behind a feature flag with a safe default, a kill switch, tests for both paths and a cleanup ticket. Use when shipping a risky change incrementally.
A flag is only a safety net if turning it off really restores the old behaviour, and only cheap if it is removed once the rollout ends. Flags go wrong when the default is the new code, when an outage of the flag service flips everyone to the untested path, when the check is scattered across a dozen if statements that drift apart, when a schema change makes the old path impossible, or when nobody owns the removal and the flag lives for years.
Put this change behind a feature flag:
Flag system: (with the default, use the flag system the repo already has; if it has none, use an environment variable read through the existing config layer).
- Find how the repo already defines, names, reads and tests flags. Follow that exactly, including the naming convention.
- Classify the flag (release toggle, ops kill switch, experiment or permission) and choose its lifetime from that.
- The default and every failure mode, such as the flag service being unreachable or the flag missing, must evaluate to the old behaviour.
- Evaluate the flag once per request or unit of work, at the highest sensible point, and branch there. Do not scatter checks through the call tree or evaluate inside hot loops. Pass the decision down if deeper code needs it. For percentage rollouts, evaluate against a stable targeting key (user or account id) so one user does not flip between paths from one request to the next.
- Keep both paths complete and independently correct. If the change touches persisted data or a schema, make sure both paths can read what the other writes (expand then contract). If they cannot, say so plainly: a flag cannot protect that part.
- Record which path ran, using the project's logging or metrics conventions, so the rollout can be watched.
- Tests: the old path with the flag off, the new path with the flag on, and the old path when flag evaluation fails. Reuse the existing test helpers for overriding flags.
- Run the tests.
- Do not change the old path's behaviour, even to tidy it.
- Do not use a flag to gate a security fix; say so if the change is one.
- Targeting rules (percentages, user segments) only if the flag system supports them; do not build your own.
- Do only what was asked. If you notice something else worth changing, mention it in one line at the end instead of changing it.
- Keep the change as small as it can be while still being correct.
- Before saying the work is done, run the check that proves it (tests, build, type check or the command the user gave) and report the real result.
- If you could not run a check, say so plainly and say which one.
Flag
| Name | Type | Default | Evaluated at | Failure behaviour | Suggested expiry |
Changes
One line per file.
Tests
One line per test: which path and condition.
Rollout and kill switch
Numbered steps to enable gradually, the signals to watch, and exactly how to turn it off without a deploy (or a warning if the chosen system needs a deploy).
Cleanup ticket
Ready to paste: title, owner placeholder, due date placeholder, every code location to delete, and the tests to remove or keep.
1 required value still a placeholder; the assistant will ask for it.
details
- kind
- Prompt: a task you run by name to get one finished thing back
- domain
- Software engineering
- category
- Implementation
- level
- Intermediate
- made for
- Software engineer, Full-stack engineer, Tech lead / staff engineer
- needs
- repo-read, file-write, shell
- risk
- runs-commands
- version
- v1.0.0 · incubating
- reviewed
- 2026-10-02
- works in
- Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Antigravity, OpenCode, Windsurf, Zed, Continue, AGENTS.md
use in
npx @hermes-hq/hodios install add-feature-flag --target claude-codenpx skills add hermes-hq/hodios-dist --skill add-feature-flag -a claude-codeclaude plugin marketplace add hermes-hq/hodios-distclaude plugin install hodios-software-engineering@hodiosThe plugin brings every entry in this domain at once.
more in implementation
All of ImplementationAdd rate limiting to an API
Adds rate limiting to API endpoints with a fitting algorithm, keys, per-tier limits, standard headers, 429 responses and tests. Use when protecting endpoints from abuse or overload.
add-rate-limitingBackend engineer
Acts as a backend engineer focused on correct data handling, clear API contracts, explicit failure modes and services that are easy to operate. Use as a builder or reviewer persona for server code.
backend-engineerBuild a REST endpoint end to end
Implements one HTTP endpoint with route, input validation, handler, error mapping and tests in the project's own framework and conventions. Use when adding an API route.
build-rest-endpointBuild a reusable UI component
Builds a typed, accessible UI component from a description or screenshot, with loading, empty and error states and a usage example. Use when adding a component to a frontend.
build-ui-componentBuild a webhook handler
Implements a webhook receiver with signature checks, replay protection, idempotent processing, fast acknowledgement, async work, retries and tests. Use when integrating Stripe, GitHub or similar.
build-webhook-handlerFrontend engineer
Acts as a frontend engineer who balances UX, accessibility, performance and maintainable components, and checks work in a real browser. Use to build or review web UI.
frontend-engineer