add-feature-flag
Skill0 starsChanged 7 months agoApache-2.0View on GitHub
위험한 기능을 feature flag로 보호하면서 점진 배포. 새 기능을 0% 트래픽 → 1% → 10% → 100%로 단계 노출, 사고 시 즉시 끄기, 양쪽 코드 경로 동시 유지·수명 관리. SaaS의 모든 위험한 변경(결제 흐름, DB 쓰기, 외부 API 통합)에 사용.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- black12-ag/wefttheir own version, first seen Aug 19, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- black12-ag/weft★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository8 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- landing/llms.txtllms.txt
- a11y-auditSkill
- db-migration-safelySkill
- generate-kormarcSkill
- incident-responseSkill
- payment-handlingSkill
- tdd-workflowSkill
The file
Files
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에 분기별로 정리 일정.
사고 시 (롤백)
- 플래그를 0%로 (즉시 효과)
- 사용자 영향 측정
learnings.md에 사고 기록 + 어떤 모니터링이 빨리 잡았어야 하는지
플래그가 없었다면 코드 revert + 재배포 = 5-30분. 플래그면 5초.
체크리스트
[ ] 플래그명 정의 (의도 드러나는 이름)
[ ] 양쪽 코드 경로 작동 (테스트 통과)
[ ] 모니터링 지표 정의 (어느 metric이 무너지면 롤백)
[ ] 롤백 절차 문서화 (누가, 어디서, 어떻게)
[ ] 정리 일정 등록 (캘린더 또는 GitHub issue)
[ ] 사용자 대상 변경이면 고객 공지 시점 정함주의
- 플래그 자체가 새 의존성이다. 도구 다운되면? 기본값 신중히 선택 (보통 false=옛 동작).
- 플래그 누적 = 매트릭스 복잡도 폭발. 동시 활성 플래그 5개 이하 유지.
- 테스트 환경에서는 모든 플래그 on: 새 코드 경로가 회귀 테스트에 노출되도록.
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
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.

