본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)41k · #6883

cleaning-up-stale-feature-flags

하는 일

이 스킬은 오래되었거나 완전히 출시된 기능 플래그를 찾고, 여전히 그것을 확인하는 코드를 제거합니다. 오래된 플래그 어수선함을 줄이려는 개발자와 팀을 위한 것입니다.

사용하는 경우

  • ✓안전하게 제거할 수 있는 기능 플래그가 무엇인지 알고 싶을 때.
  • ✓플래그가 오랫동안 완전히 출시되었는데 코드가 여전히 그것을 확인할 때.
  • ✓기능 플래그 어수선함을 줄이기 위해 정기 검토를 할 때.

스킬 링크

https://github.com/PostHog/posthog/blob/master/products/feature_flags/skills/cleaning-up-stale-feature-flags/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/PostHog/posthog/blob/master/products/feature_flags/skills/cleaning-up-stale-feature-flags/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 기능 플래그 중 무엇을 제거할 수 있나요? 그것을 확인하는 코드도 정리해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

사용되지 않거나 완전히 출시된 플래그를 찾은 뒤 코드를 먼저 정리합니다. 플래그 자체는 그 코드 변경이 배포된 후에야 PostHog에서 바뀝니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Cleaning up stale feature flags

This skill guides you through finding feature flags that no longer serve a purpose and removing them safely. The ordering is fixed: clean up the code, wait for that cleanup to deploy, and only then change the flag in PostHog.

When to use this skill

  • The user asks to clean up, audit, review, or remove their feature flags
  • The user wants to find flags that are stale, unused, or fully rolled out
  • The user asks "which feature flags can I remove?" or similar
  • The user wants to reduce tech debt from old feature flags
  • The user asks for a feature flag hygiene review
  • The user runs a weekly or recurring flag cleanup

Do not activate for an unrelated coding task that merely mentions a feature flag. Cleaning up a flag is its own job, requested by the user.

What makes a flag stale

A feature flag is considered stale when it's no longer doing useful work. PostHog tracks this with two signals:

  1. Usage-based staleness: The flag has last_called_at data, but hasn't been evaluated in 30+ days. This means PostHog has not received recent calls. Local evaluation or disabled event capture can hide continued use.
  2. Configuration-based staleness: The flag has no usage data (last_called_at is null), is 30+ days old, and is 100% rolled out (boolean at 100% with no property filters, or a multivariate flag with one variant at 100%). A fully rolled out flag with no conditions is equivalent to a hardcoded value — it can be replaced by removing the flag check from code.

Disabled flags (active: false) are not considered stale — they were intentionally turned off and may be kept for reactivation.

Treat configuration-based staleness more cautiously than old evaluation evidence: $feature_flag_called events can be missing when local evaluation is used or event capture is disabled, and a config-only signal says nothing about whether code still checks the flag.

Stale means cleanup candidate, never proof that removal is safe.

Establish what you can do

First separate assessment from cleanup. A request to review or assess a flag authorizes reads and recommendations, not code edits. Only an explicit cleanup request authorizes repository changes, subject to the checks below. Then work out which path you can complete in this session:

  1. PostHog read access only (no repository): assess candidates, then produce the tailored handoff prompt (see "Hand off when you cannot edit the repository").
  2. Repository read access: additionally inspect the exact call sites and turn the handoff into a repository-specific plan.
  3. Repository write access: make the code changes yourself and test them locally.
  4. Authorized publishing: also open one draft PR per flag, following the host's branch, commit, and PR policy.

Filesystem access is not permission to publish. The agent host's review, commit, and PR policy always wins over this skill.

Whichever path applies, never change the flag in PostHog during this workflow. Archiving the flag belongs to a later continuation, after the user confirms the code cleanup deployed (see "After the cleanup is deployed").

When the user's request clearly authorizes cleanup and you can edit the repository, execute: pick the safest deterministic candidate and clean it up directly. Do not stop to generate a copy-paste prompt, and do not add confirmation steps for local, uncommitted code changes. One action still needs approval in the user's own words: pushing a branch or opening a PR. The availability of a git or GitHub tool is not that approval, and a push to a repository cannot be taken back. The flag itself is never changed in this workflow, with or without approval.

Workflow

1. Establish scope

  • Confirm which PostHog project you are assessing flags in.
  • Confirm the current repository is a plausible owner of the flag (the key appears in it, or the user says it does).
  • Ask about other repositories, services, mobile apps, or workers when the flag may span independently deployed code. One repository cleanup is not proof that every deployed consumer is gone.
  • Default to cleaning one high-confidence flag first, unless the user explicitly asked for a known set. For a set, finish one flag (through validation and its PR) before starting the next.

2. Find and assess candidates

When the user names a specific flag, start from posthog:feature-flag-get-definition-by-key, which returns the numeric id and the full definition in

자주 묻는 질문

무엇이 플래그를 오래된 것으로 만드나요?

30일 이상 호출되지 않았거나 완전히 켜진 플래그는 오래된 것이며, 사용 데이터가 없습니다.

스킬이 코드를 스스로 제거하나요?

에이전트가 저장소를 읽고 편집할 수 있으면, 코드 정리를 직접 합니다.

플래그를 왜 마지막에 바꾸나요?

플래그를 먼저 제거하면 여전히 그것을 확인하는 코드가 깨질 수 있으므로, 코드를 먼저 정리하고 배포한 뒤 플래그를 바꿉니다.

상세 정보

작성자의 원본 설명

Identify stale feature flags in a PostHog project and clean up the code that checks them. Use when the user wants to find, audit, or remove unused, fully rolled out, or abandoned feature flags, run a feature flag hygiene review or a weekly cleanup, reduce feature flag tech debt, or asks "which flags can I remove?". When the agent can read and edit a repository it performs the code cleanup itself: tested local changes, and one draft PR per flag when the user authorizes publishing. Agents without repository access generate a tailored cleanup prompt instead. Covers staleness detection, dependency

repo: PostHog/posthog

인기도

GitHub 스타
41k
순위
#6883
라이선스
—
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬