Hacker
Devanshu Kinkar
@devanshhh
Elsewhere
Projects
flagsmith-flag-debt: Safe Flag Debt Cleanup Agent Skill
Flagsmith Experimentation HackathonNov 2026
Teams using feature flags accumulate dead if/else checks in their codebase long after rollouts finish. Cleaning them up manually is slow and risky: removing the wrong branch or archiving a flag in Flagsmith before the cleanup PR merges breaks production. I built flagsmith-flag-debt, an agentskills.io-compliant Agent Skill powered by Flagsmith CLI v2 that automates the full cleanup workflow safely and with minimal context tokens: 1. Low-token cross-environment audit (audit_stale_flags.py): Queries Development, Staging, and Production via flagsmith --json --jq to find truly stale flags (all ON or all OFF with 0 overrides) while automatically skipping active A/B experiments, environment drift (Dev != Prod), segment/identity overrides, and dynamic flag keys in code. 2. Pre-edit snapshot and merge gate (snapshot_flags.py): Saves full pre-cleanup state to .flagsmith-reaper/snapshot-*.json, generates rollback-flags.py, and creates post-merge-archive.py which blocks archiving in Flagsmith (exit code 2) until the cleanup branch is merged to main/master. 3. Verification (verify_clean.py): Confirms zero leftover code references (including unquoted JS/TS object keys) and passes the project test suite before opening a PR.