dino-cosic/flagrm / skills/flagrm-remove
flagrm-remove
VerifiedUse when the user asks to remove, retire, deprecate or clean up a feature flag or feature toggle, says a flag is fully rolled out, or runs /flagrm-remove <flag>, in a repository with a flagrm.config.yaml. Works for Angular, .NET and other stacks: IFeatureManager, [FeatureGate], appsettings FeatureManagement, LaunchDarkly-style calls, flags objects, enums, signals, *ngIf/@if templates.
Remove a feature flag
The flag is permanently ON. Keep the ON path, delete the OFF path and everything only it used. Behavior with the flag ON must not change.
You find and edit the code. flagrm records the state before you start and
decides when you are done: done means flagrm verify <flag> --json exited 0.
Run it as npx --no-install flagrm, one command per call, no || (plain npx flagrm is another package).
Several flags (/flagrm-remove A B C): read batch.md first; it runs this workflow once per flag.
1. Preconditions
flagrm doctormust not warn about uncommitted files (flagrm's own setup files andexcluded paths don't count). Otherwise ask the user to commit or stash. A removal "committed but never verified": show it and ask whether to verify or delete it.- No
flagrm.config.yaml: runflagrm initand fill in project paths and build/test commands with the user. Its doctor reports a missing SDK,cargoor Docker: show it. Forcargo/Docker, offerflagrm scope;--writeonly on a yes. flagrm list --json: find the flag inflags[]. Not there: show the closest names and ask.stateisoff,mixedorconditional: name the environments inconfig[]that change and get a yes, or stop.unconfigured(set in a flag service): withlaunchdarkly:in the config,flagrm stale <flag> --json; verdictremoveconfirms ON, another verdict: stop and show itsreasons. No section, orstaleexits non-zero (show its message): ask if it is ON everywhere. The removal request is not that answer.- Read
CLAUDE.mdorAGENTS.mdif present, for conventions and build commands.
2. Baseline
flagrm baseline <flag> --json records the git commit, build and test results and the flag's names[].
A checks[] entry with a non-zero exitCode and a failure: a setup problem. Show the user failure.message (and flagrm scope); once fixed, rerun with --force.
Without failure: a build, stop. Tests: stop if the failures (results.failedTests) could cover the flag's code; else ask the user to accept them as known, and on a yes run flagrm baseline <flag> --accept failures.
3. Find every usage
- Grep for each name in
names[]: code, templates, config and tests.parameterizedTests[]are test calls passing ON/OFF. suggestedNames[]: values of the flag with generic names. Record each that carries only this flag, a local, parameter or field with--file <its file>(repeat--filefor each file; a component's template is added for you).- Follow the value further: a method or property returning it, a field or local holding it, a parameter
it's passed as, a DI-registered bool. Record each so
verifychecks it, then grep for it:flagrm baseline <flag> --name IsNewCheckoutEnabledAsync --kind wrapper(--kind aliasfor a constant likeFlags.NewCheckout).
4. Remove
Read patterns.md in this skill's directory when a case is unclear.
- Condition: keep the ON branch, delete the OFF branch, drop the check.
a && flag→a,a || !flag→a. Never touch other flags. - Wrapper: replace each call with
trueand simplify, then delete the wrapper, its interface member and DI registration. - Passed as a parameter: pass
trueand simplify the callee. Once no caller passes anything else, remove the parameter and the argument at every caller. - Code only the OFF path used (methods, classes, fields, constructor parameters, DI registrations, imports/usings, files): delete it. Keep what anything else uses.
- Definition and config: remove the constant, enum member or flags-object key, and the key in every environment's config file. Remove a section left empty. Keep a key the service sends to other apps (a known-flags list behind a config endpoint): they'd read OFF.
- Tests: delete tests of the OFF path. In the others, remove the flag setup (mocks, spies, overrides) and drop the flag from the test name. A test parameterized over ON/OFF keeps only the ON case.
- Keep the flag system itself (the flag service or client and its generic methods), public API of a library package, and anything that also defines other flags. Mention them in your report.
5. Verify until it passes
flagrm verify <flag> --json. Fix every check with status: "fail", run it again.
| Check | Fix |
|---|---|
leftovers | Remove each reference listed. A comment is a warning: reword or delete it. A test checking text you deleted tests the OFF path: delete it. ON text no test checks: say so in your report |
dead-code | Delete what the removal left unused. A declaration "referenced only where it is declared" (warning): delete it if only the OFF path used it; else say why it stays |
build | Fix the error your edit caused; don't touch unrelated code. tsc skips templates: grep .html for each member you removed or renamed |
tests | A new failure means ON behavior changed: fix the edit, not the test. Known failures (failed at the baseline) only warn. A test listed as no longer running (unexplained) must be one you removed on purpose: say why. A changed test file whose tests didn't run: run them yourself and report it |
lint | Fix what your edit caused. An already-failing lint fails only on new error lines: fix those; other new lines it lists only warn |
coverage | Tell the user which changed files no command checks; don't add or change commands yourself |
Exit 2 is a usage or config error: read the message. Exit 4 is a bug in flagrm: show the user the error and stop. --skip build,tests,lint,coverage is fine for a quick check in between; only a full run counts, and the Stop hook won't let you finish on one with --skip. After three failed attempts on one check, show the user the findings. Don't run code generators or formatters after the passing verify; if you must, verify again.
6. Hand back
flagrm verify <flag> --mdon the final tree (it reuses the passing build, test and lint runs; edit nothing after it): show its output exactly as printed; don't reword it or change its numbers. It must pass: the Stop hook checks it.- Notes, 3–5 lines: what you kept on purpose, each remaining warning with its reason, follow-ups in the flag service. If
statewasn'tonand nobody confirmed ON, start with "Assumed ON everywhere". End with: optional, for an independent review, run/flagrm-review <flag>in a new session. - The commit message:
Proposed commit message, in a code block:
chore: remove <flag> feature flag
<one or two sentences: which path stays and what was deleted>
- Follow the repository's convention instead when
git log --oneline -10shows a different one. - A ticket in the branch name (
feature/feat-24586): add it the way the log does (#24586,FEAT-24586), else(#24586)after the subject. - Wrap the body at 72 columns.
Commit only when the user asked (in a batch: their answer at the start).
Rules
- Never lift code out of the OFF path into live code.
- Match the file's formatting; don't refactor unrelated code.
- Never edit
.flagrm/. Rerunflagrm baseline <flag>only with--name, or with--forcebefore your first edit (it refuses after). - Never
--skipa failing check, and never change a test's expected value or the build, test or lint commands orcoversto pass. If the user changes the config mid-removal (say, to leave out tests that need services), runflagrm baseline <flag> --accept configonce they confirm. baselineandverifyreuse a passing verify's build, test and lint results on the same tree and commands. If the user changed the machine (SDK, Docker, services) since, add--no-reuse.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |