agentleFS
okwhrlgma-bitokwhrlgma-bit/library/.claude/skills/add-feature-flag/SKILL.md

add-feature-flag

Skill0 starsChanged 7 months agoApache-2.0View on GitHub

위험한 기능을 feature flag로 보호하면서 점진 배포. 새 기능을 0% 트래픽 → 1% → 10% → 100%로 단계 노출, 사고 시 즉시 끄기, 양쪽 코드 경로 동시 유지·수명 관리. SaaS의 모든 위험한 변경(결제 흐름, DB 쓰기, 외부 API 통합)에 사용.

9 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use add-telemetry, promote-feature and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • zerx-labSkill

    add-telemetry

    Add telemetry events to track user behavior or system events in the Warp codebase. Use when instrumenting new features, debugging issues, or measuring product metrics.

    Also in 6 projects that use this

  • zerx-labSkill

    promote-feature

    Promote a feature-flagged feature to Dogfood, Preview, or Stable in the Warp codebase. Use when a feature behind a FeatureFlag is ready to roll out to a broader audience, including wiring up the compile-time/runtime bridge and deferring flag cleanup safely.

    Also in 6 projects that use this

  • black12-agSkill

    classify-changelog-pr

    Reference guidance for classifying whether an unmarked PR should appear in the changelog and under which category. Used inline by the changelog-draft skill — not dispatched as a separate agent.

    Also in 4 projects that use this

  • black12-agSkill

    cross-platform-cloud-verification

    Orchestrates cost-conscious cloud verification across available operating-system and architecture runners after cheaper checks pass. Use whenever a code change, bug fix, build, packaging flow, native dependency, UI behavior, filesystem behavior, or test has material cross-platform implications, even if the user only asks to verify or test the change. Consult domain verification skills for what to test; use this skill to choose and access the smallest relevant set of platforms.

    Also in 4 projects that use this

  • +3 more from zerx-lab
  • +5 more from black12-ag

The file

Files
SKILL.md

Feature Flag Workflow

위험한 기능을 production 코드에 머지하되 사용자에겐 끄둔 채 배포 → 모니터링 → 점진 활성화. 사고 시 즉시 끔.

언제 쓰나

필수:

  • 결제 흐름 변경
  • DB 쓰기 패턴 변경
  • 외부 API 통합 (Stripe, 이메일 등)
  • 인증·권한 로직 변경
  • 성능 영향 큰 쿼리

선택:

  • UI 큰 변경 (A/B 테스트 겸용)
  • 새 페이지·라우트

불필요:

  • 명백한 버그 수정
  • 문서·로그 변경
  • 내부 도구

플래그 도구 선택

도구적합 상황
환경변수 (FEATURE_X=true)단순, 모든 사용자 동시 on/off
DB 테이블사용자별 on/off, 코드 배포 없이 변경
LaunchDarkly·PostHog·Statsig점진 노출(%), A/B 테스트, 빠른 롤백

스타터 단계에선 PostHog feature flag 추천 (이미 분석에 쓰고 있음).

표준 패턴

1. 플래그 정의

// src/lib/flags.ts
export const FLAGS = {
  NEW_CHECKOUT_FLOW: 'new-checkout-flow',
} as const;

2. 코드에 분기

import { posthog } from '@/lib/analytics';

const useNewFlow = posthog.isFeatureEnabled(FLAGS.NEW_CHECKOUT_FLOW);

if (useNewFlow) {
  // 새 코드
} else {
  // 기존 코드 (그대로 유지)
}

3. 양쪽 모두 테스트

  • 단위 테스트: 두 분기 모두 커버
  • E2E: 플래그 on/off 둘 다 시나리오

4. 단계 활성화

1. 머지 (모든 사용자 off)
2. 내부 사용자만 on (자기 계정으로 검증)
3. 1% on (24시간 모니터링: 에러율, 응답시간, 비즈니스 지표)
4. 10% on (24시간)
5. 50% on (24시간)
6. 100% on (3-7일)

각 단계 사이에 반드시 모니터링 시간. 자동 진행 금지.

5. 정리 (가장 자주 빠뜨림)

플래그 100% on 후 7일 안정화되면:

  • 옛 코드 경로 제거
  • FLAGS 정의 제거
  • 플래그 도구에서 제거

플래그가 30일 이상 100% on이면 코드 부채. learnings.md에 분기별로 정리 일정.

사고 시 (롤백)

  1. 플래그를 0%로 (즉시 효과)
  2. 사용자 영향 측정
  3. learnings.md에 사고 기록 + 어떤 모니터링이 빨리 잡았어야 하는지

플래그가 없었다면 코드 revert + 재배포 = 5-30분. 플래그면 5초.

체크리스트

[ ] 플래그명 정의 (의도 드러나는 이름)
[ ] 양쪽 코드 경로 작동 (테스트 통과)
[ ] 모니터링 지표 정의 (어느 metric이 무너지면 롤백)
[ ] 롤백 절차 문서화 (누가, 어디서, 어떻게)
[ ] 정리 일정 등록 (캘린더 또는 GitHub issue)
[ ] 사용자 대상 변경이면 고객 공지 시점 정함

주의

  • 플래그 자체가 새 의존성이다. 도구 다운되면? 기본값 신중히 선택 (보통 false=옛 동작).
  • 플래그 누적 = 매트릭스 복잡도 폭발. 동시 활성 플래그 5개 이하 유지.
  • 테스트 환경에서는 모든 플래그 on: 새 코드 경로가 회귀 테스트에 노출되도록.

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.