agentleFS
strikersamstrikersam/autonomous-ai-agency/.agents/skills/feature-flag/SKILL.md

feature-flag

Skill9 starsChanged 3 months agoMITView on GitHub

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 7 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write tests for BOTH flag states:

    line 56
  2. Distinctive:

    Delete the disabled path and the flag check entirely

    line 79
  3. Very specific:

    Default to false (off) for new feature flags

    line 82
  4. Distinctive:

    Every flag must have a planned removal date

    line 83
  5. Distinctive:

    Never ship permanent flags — they are always temporary

    line 84
  6. Distinctive:

    Test both code paths, always

    line 85
  7. Distinctive:

    Keep flag logic at the boundary (entry point), not scattered through business logic

    line 86
  8. Distinctive:

    Never nest feature flags more than 1 level deep

    line 87

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: feature-flag

Purpose

Implement new features behind feature flags to enable safe, gradual rollouts and easy rollbacks without code deployments.

Trigger

Use when:

  • Implementing a risky or large feature
  • A feature needs gradual rollout
  • A/B testing is desired
  • The feature might need to be disabled quickly in production

Process

Step 1: Assess Flag Need

Determine if a feature flag is appropriate:

  • Always flag: breaking changes, major UI changes, experimental features
  • Consider flagging: new integrations, significant logic changes
  • Skip flagging: bug fixes, minor improvements, refactors

Step 2: Define the Flag

# Flag definition
FLAG_NAME = "feature_[descriptive_name]"
FLAG_DEFAULT = False  # default to OFF for new features
FLAG_DESCRIPTION = "[what this flag controls]"
FLAG_OWNER = "[team or person responsible]"
FLAG_CREATED = "[date]"
FLAG_PLANNED_REMOVAL = "[date or milestone when flag should be cleaned up]"

Step 3: Implement the Guard

# Python example
from agent.config import get_feature_flag

def some_feature():
    if not get_feature_flag("feature_new_thing"):
        return existing_behavior()
    return new_behavior()
// TypeScript example
import { isFeatureEnabled } from './config/flags';

function someFeature() {
    if (!isFeatureEnabled('feature_new_thing')) {
        return existingBehavior();
    }
    return newBehavior();
}

Step 4: Test Both Paths

Write tests for BOTH flag states:

def test_feature_disabled(monkeypatch):
    monkeypatch.setenv("FEATURE_NEW_THING", "false")
    assert some_feature() == expected_old_behavior

def test_feature_enabled(monkeypatch):
    monkeypatch.setenv("FEATURE_NEW_THING", "true")
    assert some_feature() == expected_new_behavior

Step 5: Document the Flag

Add to docs/feature-flags.md:

| Flag | Default | Description | Owner | Remove By |
|------|---------|-------------|-------|-----------|
| feature_new_thing | false | [description] | [owner] | [milestone] |

Step 6: Plan Removal

Feature flags are technical debt. Schedule cleanup:

  • Set a calendar reminder or create an issue for flag removal
  • Flag removal = merge the "enabled" path as the only path
  • Delete the disabled path and the flag check entirely

Rules

  • Default to false (off) for new feature flags
  • Every flag must have a planned removal date
  • Never ship permanent flags — they are always temporary
  • Test both code paths, always
  • Keep flag logic at the boundary (entry point), not scattered through business logic
  • Never nest feature flags more than 1 level deep

Anti-Patterns

  • Flags that have been on for >6 months without a removal plan
  • Flags that control more than one conceptually distinct feature
  • Business logic that reads flags directly (flags belong at the interface layer)
  • Flags without tests for both states

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.