Claude-skill-registry feature-flags
Use when feature flag tests fail, flags need updating, understanding @gate pragmas, debugging channel-specific test failures, or adding new flags to React.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/feature-flags-chltjs1921-udemy-github-tags-de" ~/.claude/skills/majiayu000-claude-skill-registry-feature-flags && rm -rf "$T"
manifest:
skills/data/feature-flags-chltjs1921-udemy-github-tags-de/SKILL.mdsource content
React Feature Flags
Flag Files
| File | Purpose |
|---|---|
| Default flags (canary), overrides |
| www channel, overrides |
| React Native, overrides |
| Test renderer |
Gating Tests
@gate
pragma (test-level)
@gateUse when the feature is completely unavailable without the flag:
// @gate enableViewTransition it('supports view transitions', () => { // This test only runs when enableViewTransition is true // and is SKIPPED (not failed) when false });
gate()
inline (assertion-level)
gate()Use when the feature exists but behavior differs based on flag:
it('renders component', async () => { await act(() => root.render(<App />)); if (gate(flags => flags.enableNewBehavior)) { expect(container.textContent).toBe('new output'); } else { expect(container.textContent).toBe('legacy output'); } });
Adding a New Flag
- Add to
with default valueReactFeatureFlags.js - Add to each fork file (
,*.www.js
, etc.)*.native-fb.js - If it should vary in www/RN, set to
in the fork file__VARIANT__ - Gate tests with
or inline@gate flagNamegate()
Checking Flag States
Use
/flags to view states across channels. See the flags skill for full command options.
__VARIANT__
Flags (GKs)
__VARIANT__Flags set to
__VARIANT__ simulate gatekeepers - tested twice (true and false):
/test www <pattern> # __VARIANT__ = true /test www variant false <pattern> # __VARIANT__ = false
Debugging Channel-Specific Failures
- Run
to compare values/flags --diff <channel1> <channel2> - Check
conditions - test may be gated to specific channels@gate - Run
to isolate the failure/test <channel> <pattern> - Verify flag exists in all fork files if newly added
Common Mistakes
- Forgetting both variants - Always test
ANDwww
forwww variant false
flags__VARIANT__ - Using @gate for behavior differences - Use inline
if both paths should rungate() - Missing fork files - New flags must be added to ALL fork files, not just the main one
- Wrong gate syntax - It's
, notgate(flags => flags.name)gate('name')