flag-cleanup

Inventories feature flags, removes stale ones on an isolated branch, and opens a verified PR.

20.2k|3.4k|Updated Oct 5, 2024
One-click install
npx skills add https://github.com/kortix-ai/suna --skill flag-cleanup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: flag-cleanup
Source: https://github.com/kortix-ai/suna/tree/main/packages/starter/templates/marketplace/runtime/skills/flag-cleanup
Command: npx skills add https://github.com/kortix-ai/suna --skill flag-cleanup

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Feature flags accumulate in a codebase long after rollouts finish, leaving dead conditional branches and stale declarations that slow development. This Skill automates the weekly audit and safe removal of stale flags without ever touching flags still mid-rollout.

Core Features & Use Cases

  • Full flag inventory and classification: Scans the repository for flag declarations and call sites, then classifies each as fully rolled out, long dead, partial rollout, or active experiment.
  • Safe automated removal: Removes only provably safe flags on an isolated branch, inlining surviving branches and deleting dead code, then gates the change behind typecheck, lint, build, and test suites.
  • PR-based delivery with a durable ledger: Opens a single labeled PR per run and maintains a persistent ledger of classifications, removals, and items flagged for human review.
  • Use Case: A team with dozens of accumulated LaunchDarkly-style flags schedules a weekly run that removes fully-rolled-out flags, leaves active experiments untouched, and delivers a green-CI PR for human merge.

Quick Start

Ask the agent to audit the repository for stale feature flags, remove the ones that are fully rolled out or long dead, and open a PR with the verified cleanup.

Frequently Asked Questions about flag-cleanup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automatically remove stale feature flags from my codebase?

Run a scheduled sweep that greps the repo for flag declarations and call sites, classifies each flag by rollout state, and removes fully-rolled-out or long-dead flags on an isolated branch. The change is verified by the full test suite before a PR is opened for human merge.

How to clean up feature flags without breaking an active rollout?

Classify flags before removing anything: partial rollouts and active experiments are never touched and are logged for human review instead. Only flags at 100% rollout or with no live call sites and no recent changes are eligible for removal.

Can feature flag removal be automated with GitHub pull requests?

Yes. The cleanup runs on an isolated branch, pushes it, and opens a labeled PR via the GitHub CLI only after typecheck, lint, build, and tests all pass. A human always owns the merge; the agent never pushes to the default branch.

What happens when a flag's rollout state cannot be determined?

Ambiguous flags, such as those controlled by an external system the agent cannot access, are treated as unsafe to remove. They are logged in a persistent ledger for human review rather than guessed at.

Why does a flag cleanup fail CI after removing a branch?

Failures usually come from mechanical fallout like unused imports or dangling types from the removed branch, which can be fixed directly. Non-mechanical failures cause that single flag's removal to be reverted and deferred while the rest of the batch proceeds.