flag-cleanup
Skill2 starsChanged 5 months agoMITView on GitHub
Remove a feature flag from code after it's been 100% for the cleanup_after window. Greps call sites, replaces `if (flags.X)` branches with the new path, deletes the flag from the provider, archives the spec/initiative reference.
In this repository60 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- analyzeSkill
- animation-disciplineSkill
- api-versioningSkill
- autopilotSkill
- browser-e2eSkill
- characterizeSkill
- clarifySkill
- codemodSkill
- constitution-compactSkill
- constitutionSkill
- context-budgetSkill
- creative-webSkill
- db-migrationSkill
- debugSkill
- detect-stackSkill
- dispatch-criteriaSkill
- dreamSkill
- experimentSkill
- fastapiSkill
- flag-rolloutSkill
- flask-realtimeSkill
- framework-detectorSkill
- front-end-designSkill
- grill-meSkill
- handoffSkill
- image-generationSkill
- implementSkill
- initiativeSkill
- instinctSkill
- loopSkill
- nextjsSkill
- observabilitySkill
- okr-alignSkill
- parallel-swarmSkill
- pivotSkill
- planSkill
- pr-bodySkill
- prime-disciplineSkill
- prod-observabilitySkill
- react-nodeSkill
- react-viteSkill
- release-trainSkill
- researchSkill
- reviewSkill
- security-guardSkill
- self-healSkill
- shipSkill
- skill-creatorSkill
- specifySkill
- tailwind-disciplineSkill
- tasksSkill
- tdd-loopSkill
- token-budgetSkill
- typographySkill
- verify-loopSkill
- verifySkill
- wip-checkpointSkill
- <kebab-case-skill-name>Skill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
No related flags depend on this one
- Distinctive: line 19
No incidents in the last 14 days mentioning this flag's namespace
- Distinctive: line 28
Remove the OFF path (the old behavior) if it has no other reference
- Distinctive: line 29
Delete any "old behavior" helper functions made dead by removal
- Distinctive: line 35
Single PR per flag: Don't batch — the diff stays reviewable.
- Distinctive: line 39
Don't auto-delete the flag definition: before the PR merges. The flag-provider entry is the safety net during PR review.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Flag Cleanup
A 100% flag still in code is debt. This skill inlines the new path and removes the conditional.
Eligibility
A flag is cleanup-ready when ALL of:
- Provider shows 100% for ≥
cleanup_after(per spec's Rollout section; default 30 days) - No related flags depend on this one
- No incidents in the last 14 days mentioning this flag's namespace
- Spec status is
shipped
Process
- Verify eligibility (above checks).
- Find all call sites — grep for
flag.name,useFlag('X'),getBooleanValue('X'),if(features.X), etc. - For each call site:
- Inline the ON path (the new behavior)
- Remove the OFF path (the old behavior) if it has no other reference
- Delete any "old behavior" helper functions made dead by removal
- Update tests — remove tests that exercise the OFF path
- Update the flag provider — delete the flag definition or mark archived
- Update spec — append cleanup note; final-status the rollout
- Open a PR with title
chore(flags): remove flag.X — 100% since YYYY-MM-DD - CI must pass — coverage and integration tests must stay green
- Single PR per flag. Don't batch — the diff stays reviewable.
Hard rules
- Don't auto-delete the flag definition before the PR merges. The flag-provider entry is the safety net during PR review.
- Don't remove "old behavior" code unless it has no callers outside this flag. Search broadly.
- Don't merge if any test is removed. Each removed test must have a replacement that exercises the now-default path.
- Don't combine cleanups. Each flag is a separate PR.
Output
.claude/memory/playbooks/flag-cleanup-log.md (appended per flag)
PR: chore(flags): remove flag.checkout_v2 — 100% since 2026-09-15Recurring scan
A nightly cron (or /cleanup extension) scans the flag-provider for flags that have been 100% for > cleanup_after, then opens cleanup tasks. Tasks are eligible for autopilot pickup.
References
- Martin Fowler "Feature Toggles" — cleanup is part of the lifecycle, not optional
- Charity Majors on flag debt (https://www.honeycomb.io/blog/feature-flags)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

