Agent skill

Define Feature Flag

by macro-inc in macro-inc/macro

Define a frontend feature flag with defineFlag and wire its readers.

AGPL-3.0Auto-check passedFrontend & Design

Install Define Feature Flag

skills CLI
$ npx skills add macro-inc/macro --skill define-feature-flag -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install macro-inc/macro define-feature-flag --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/macro-inc/macro.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/define-feature-flag .claude/skills/define-feature-flag && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
define-feature-flag
GitHub stars
4.6k
Token cost
~780 tokens
SKILL.md length
321 words
Files
1
Skills in repo
19
Repo updated
First seen
Licence
AGPL-3.0

At a glance

Define a frontend feature flag with defineFlag and wire its readers.

  • Works in 3 steps: Remote or env-only? → Define it → Read it
  • Changing a feature flag
  • SKILL.md covers 1. Remote or env-only?, 2. Define it, 3. Read it and Don't
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Define Feature Flag is an agent skill from macro-inc/macro. Define a frontend feature flag with defineFlag and wire its readers. Use when adding, suggesting, or changing a feature flag, PostHog flag, ENABLE env flag, useFeatureFlag, isFeatureEnabled, or ShowFeatureFlag.

Its SKILL.md is about 780 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Frontend & Design. It works with PostHog. The repository describes itself as: Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory. The licence is AGPL-3.0.

When your agent uses it

  • Changing a feature flag
  • ENABLE env flag
  • IsFeatureEnabled
  • ShowFeatureFlag

Example prompts

  • “/define-feature-flag”

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Remote or env-only?
  2. Define it
  3. Read it

What it can do on your machine

Read from SKILL.md and the folder at commit 39f3c91. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Define Feature Flag loads about 780 tokens when it runs. Until then it costs about 61 tokens; SKILL.md has 321 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~61
When it runs · the whole SKILL.md, loaded when a task matches
~780

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from macro-inc/macro at commit 39f3c91, republished under its AGPL-3.0 licence (© macro-inc). 321 words, ~780 tokens.

Download SKILL.mdSave it as .claude/skills/define-feature-flag/SKILL.md (or your agent's skills folder).
name
define-feature-flag
description
Define a frontend feature flag with `defineFlag` and wire its readers. Use when adding, suggesting, or changing a feature flag, PostHog flag, `ENABLE_*` env flag, `useFeatureFlag`, `isFeatureEnabled`, or `ShowFeatureFlag`.

Define a frontend feature flag

Frontend only. Registry: apps/web/src/lib/core/constant/featureFlags.ts. There is no shared backend flag system.

1. Remote or env-only?

RemoteEnv-only
Source of truthPostHog in deployed envsdefault, optionally overridden by env
Discriminatorkey presentno key
envoptional local overrideoptional override of default
defaultomit / undefined to fall through to PostHogrequired
ReadersuseFeatureFlag, ShowFeatureFlag, isFeatureEnabledisFeatureEnabled only

Most product rollouts are remote. Use env-only when there is no PostHog flag and never will be (compile-time / local kill switch).

Ask before assuming. If the user said "flag it" and did not mention PostHog, prefer remote and confirm.

2. Define it

Add one defineFlag next to its neighbors. Do not add ENABLE_*_FLAG / _OVERRIDE / ENABLE_*() triples or a raw PostHog string at the call site.

  • key (remote): kebab-case, named after the question (enable-foo, disable-browser-turso-cache). Export the object in matching camelCase (enableFoo).
  • env: the name after VITE_, e.g. 'ENABLE_FOO' → VITE_ENABLE_FOO.
  • default: used when env is unset. On a remote flag, false is a real override and skips PostHog. On-in-dev / on-in-local is DEV_MODE_ENV || undefined or LOCAL_ONLY || undefined, not the boolean itself.
  • Never invert on the flag object. If the product question is "disable X", invert at the call site (!isFeatureEnabled(disableX)).
  • Env-only exports that are used as if (ENABLE_FOO) must be the boolean: defineFlag({ env, default }).enabled. The object is always truthy.
ts
export const enableFoo = defineFlag({
  key: 'enable-foo',
  env: 'ENABLE_FOO',
  default: DEV_MODE_ENV || undefined,
});

export const ENABLE_BAR = defineFlag({
  env: 'ENABLE_BAR',
  default: false,
}).enabled;

Do not create the PostHog flag. Ask which project / environment it should live in and wait.

3. Read it

ts
const foo = useFeatureFlag(enableFoo); // component: foo().enabled
<ShowFeatureFlag flag={enableFoo}>{...}</ShowFeatureFlag>
isFeatureEnabled(enableFoo)            // queries, helpers, env-only

A thin useXFlag wrapper around useFeatureFlag(flag) is fine when several call sites share the same read. Compose flags in the wrapper (calendar search requires calendar UI), not on the flag object.

useFeatureFlag / ShowFeatureFlag take a RemoteFlag. Passing an env-only flag is a type error.

Don't

  • Migrate existing FLAG / OVERRIDE / string useFeatureFlag call sites unless you are already changing that flag or were asked to.
  • Invent a second helper (resolveFeatureFlag for new flags, a global flags.foo map, .use() / .Show() on the object).

© macro-inc, AGPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/define-feature-flag of macro-inc/macro.

Open the folder on GitHubat commit 39f3c91

Compare with similar skills

Define Feature Flag next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Define Feature Flag compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Define Feature Flag this skillmacro-inc/macro4.6k—~780Automated safety check: PassAGPL-3.0
Compare Array Bundle SizePostHog/posthog-js613—~599Automated safety check: PassCustom licence
Integration Astro Staticwill-be-done/will-be-done152—~636Automated safety check: PassAGPL-3.0
Posthog Instrumentationtrycompai/crm11k—~420Automated safety check: PassMIT
Designlang TokensManavarya09/design-extract4.2k—~214Automated safety check: PassMIT
Quill CodePostHog/code179—~1.1kAutomated safety check: PassMIT

Similar skills

  • Compare Array Bundle Size

    PostHog/posthog-js

    Official

    Quickly compare the posthog-js array.js bundle size in the current working tree against a git baseline using the repository's esbuild proxy.

    613 GitHub stars~599 tokensUpdated today
    Frontend & DesignAuto-check passed
  • Integration Astro Static

    will-be-done/will-be-done

    PostHog integration for static Astro sites using SSG. An agent skill from will-be-done/will-be-done.

    152 GitHub stars~636 tokensUpdated 5 days ago
    Frontend & DesignAuto-check passed
  • Automatically add PostHog analytics instrumentation to code.

    11k GitHub stars~420 tokensUpdated 26 days ago
    Frontend & DesignAuto-check passed
  • Designlang Tokens

    Manavarya09/design-extract

    A skill your agent uses when styling UI for posthog.com — references the extracted design system tokens instead of inventing colors, spacing, or typography.

    4.2k GitHub stars~214 tokensUpdated 8 days ago
    Frontend & DesignAuto-check passed
  • Quill Code

    PostHog/code

    Official

    Edit the @posthog/quill design system locally and consume the change in this repo (posthog-code) before it is published to npm.

    179 GitHub stars~1.1k tokensUpdated 2 mo ago
    Frontend & DesignAuto-check passed
  • Storybook Stories

    PostHog/code

    Official

    Write Storybook stories for PostHog UI components. An agent skill from PostHog/code.

    179 GitHub stars~929 tokensUpdated 2 mo ago
    Frontend & DesignAuto-check passed

More from macro-inc/macro

All 19 skills in this repo
  • Mintlify API

    macro-inc/macro

    Interact with the Mintlify REST API to manage deployments, trigger builds, and query documentation site metadata programmatically.

    4.6k GitHub starsUsed in 2 repos~333 tokens
    Auto-check passed
  • Add Tour

    macro-inc/macro

    Add or change an in-app feature tour (a view's guided flyover) in the web app.

    4.6k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Run App

    macro-inc/macro

    Run the Macro app on Cursor Cloud and pick up edits. An agent skill from macro-inc/macro.

    4.6k GitHub stars~712 tokensUpdated today
    Auto-check passed
  • Add SDK Endpoint

    macro-inc/macro

    Wrap a new backend endpoint in the TypeScript SDK (packages/sdk), or record it as skipped.

    4.6k GitHub stars~1k tokensUpdated today
    Auto-check: notes
  • Enforce hexagonal architecture in the Rust backend. An agent skill from macro-inc/macro.

    4.6k GitHub stars~3k tokensUpdated today
    Auto-check passed
  • Collab Surface Core

    macro-inc/macro

    A skill your agent uses when adding collaborative markdown, notes, or descriptions to a feature with collab surfaces.

    4.6k GitHub stars~639 tokensUpdated today
    Auto-check passed

Works with

Questions about Define Feature Flag

What does Define Feature Flag do?

Define a frontend feature flag with defineFlag and wire its readers. Define Feature Flag is an agent skill from macro-inc/macro. Define a frontend feature flag with defineFlag and wire its readers.

When should I use Define Feature Flag?

Define Feature Flag fits situations like: changing a feature flag; ENABLE env flag; isFeatureEnabled; showFeatureFlag.

How do I install Define Feature Flag in Claude Code?

Run `npx skills add macro-inc/macro --skill define-feature-flag -a claude-code`. Or copy the skill folder (.claude/skills/define-feature-flag in macro-inc/macro) into .claude/skills/define-feature-flag in your project. Claude Code loads it when a task matches its description.

How do I install Define Feature Flag in Codex?

Run `npx skills add macro-inc/macro --skill define-feature-flag -a codex`. Or copy the skill folder (.claude/skills/define-feature-flag in macro-inc/macro) into .agents/skills/define-feature-flag in your project. Codex loads it when a task matches its description.

Can I use Define Feature Flag in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add macro-inc/macro --skill define-feature-flag -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/define-feature-flag, .gemini/skills/define-feature-flag, .github/skills/define-feature-flag and .opencode/skills/define-feature-flag in your project.

What does Define Feature Flag need to run?

SKILL.md names no scripts, command-line tools or credentials: Define Feature Flag is instructions for the agent only.

Does Define Feature Flag access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Define Feature Flag safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Define Feature Flag use?

Define Feature Flag is published under the AGPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Define Feature Flag use?

About 780 tokens (SKILL.md is roughly 3.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Define Feature Flag?

Skills that share tags, products or a category with Define Feature Flag: Compare Array Bundle Size (PostHog/posthog-js, 613 stars), Integration Astro Static (will-be-done/will-be-done, 152 stars), Posthog Instrumentation (trycompai/crm, 11k stars) and Designlang Tokens (Manavarya09/design-extract, 4.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Define Feature Flag?

macro-inc (a GitHub organization) maintains it in macro-inc/macro, which has 4,578 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on October 7, 2026.

Source: macro-inc/macro on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.