feature-flags

feature-flags is a skill for Claude Code, Codex from cass-2003/local-workflow-skill. It costs 157 tokens per session (2,878 once invoked), scanned A, original, MIT.

A guide to feature flags, which let software choose whether a feature is active for particular users or groups. Flags can also support gradual releases, experiments, and emergency switches.

In plain words
What is it for?
Use it to plan rollouts, A/B tests, customer previews, kill switches, targeting rules, and the cleanup of old flags.
Why use it?
It lets teams release changes gradually or turn them off without rebuilding and deploying the application again.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to plan rollouts, A/B tests, customer previews, kill switches, targeting rules, and the cleanup of old flags.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cass-2003/local-workflow-skill/feature-flags
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add cass-2003/local-workflow-skill --skill feature-flags
Clone the repo
git clone --depth 1 https://github.com/cass-2003/local-workflow-skill

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for feature-flags

README.md
[![agentmods](https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/feature-flags/github.svg)](https://agentmods.dev/skills/cass-2003/local-workflow-skill/feature-flags)
Your own site
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/feature-flags"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/feature-flags/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for feature-flags

Your own site · 80×15
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/feature-flags"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/feature-flags.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 157 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,878 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00157 $0.02878
Opus 5 $0.00078 $0.01439
Sonnet 5 $0.00031 $0.00576
Haiku 4.5 $0.00016 $0.00288

Measured 7d ago against content hash 830840350de3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

feature-flags scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/engineering-core/ours/feature-flags/SKILL.md · 283 lines

How it starts

The opening of the file, as written. The whole thing — 283 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Feature Flags Skill — 特性开关

何时使用

  • 想发布一个功能但能立即关闭(不重新部署)
  • 灰度放量(先 1% 用户 → 10% → 50% → 100%)
  • A/B 测试不同版本效果
  • 给特定客户 / 内部用户开放预览
  • 故障应急:紧急关闭某条线路
  • 业务参数调优(库存阈值 / 限额 / 折扣率)不想发版

一、五类 Toggle(Pete Hodgson 分类)

类型 寿命 例子 清理紧迫性
Release Toggle 短(数天-周) "新支付流程" 灰度 高 — 上线后立刻清
Experiment Toggle 中(实验周期) A/B 测试两种结账 UI 中 — 实验结束清
Ops Toggle 长(月-永久) "降级关闭推荐算法" 低 — kill switch 永久保留
Permission Toggle 长(永久) "premium 用户看新报表" 低 — 业务逻辑
Kill Switch 永久 "支付通道熔断" 永久保留

核心原则Release Toggle 必须有清理 deadline。否则代码库充满死代码,开关数指数膨胀。

二、Toggle Point 抽象

// ✅ 抽象层
interface FeatureFlags {
  isEnabled(key: string, ctx: EvalContext): Promise<boolean>
  getVariant(key: string, ctx: EvalContext): Promise<string>     // 多变体
  getNumber(key: string, ctx: EvalContext, dflt: number): Promise<number>
  getJSON<T>(key: string, ctx: EvalContext, dflt: T): Promise<T>
}

// 业务代码不直接读环境变量 / 配置文件 / Redis
if (await flags.isEnabled('new-checkout-flow', { userId, country })) {
  return newCheckoutFlow()
}
return oldCheckoutFlow()

调用点叫 Toggle Point,决策代码(取值 / targeting)叫 Toggle Router业务代码只见 Toggle Point

三、Targeting Rules(决策规则)

{
  "key": "new-checkout-flow",
  "default": false,
  "rules": [
    // 优先级从上到下
    { "if": { "userId": { "in": ["u_admin", "u_test1"] } }, "then": true },
    { "if": { "country": { "eq": "JP" } }, "then": false },     // 日本暂不开
    { "if": { "isPremium": true }, "then": true },              // premium 用户先开
    { "if": { "userId": { "rolloutPercentage": 10 } }, "then": true },  // 其余 10%
    { "if": { "anyOf": [...] }, "then": true }
  ]
}

Percentage rollout 的稳定性

// ❌ 错:Math.random() — 同一用户每次结果不同
function isInRollout(pct: number) {
  return Math.random() * 100 < pct
}

// ✅ 对:基于 user ID hash — 同用户始终同结果
function isInRollout(userId: string, flagKey: string, pct: number) {
  const hash = crc32(`${flagKey}:${userId}`)
  return (hash % 100) < pct
}

Read the full file on GitHub · 283 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 283 lines · 157 tokens per session scan A 830840350de3

Subscribe to this mod's changes

feature-flags is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 2mo ago), licensed MIT. It adds 157 tokens to every session and 2,878 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories