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

finding-deleted-feature-flags

하는 일

이 스킬은 선택한 시간 창 안에 프로젝트에서 제거된 기능 플래그를 찾습니다. 최근 플래그 삭제에 대한 감사가 필요한 사람을 위한 것입니다.

사용하는 경우

  • ✓지난주에 어떤 기능 플래그가 삭제되었는지 알고 싶을 때.
  • ✓특정 플래그를 누가 언제 삭제했는지 찾아야 할 때.
  • ✓감사를 위해 기능 플래그의 최근 변경을 검토할 때.

스킬 링크

https://github.com/PostHog/posthog/blob/master/products/feature_flags/skills/finding-deleted-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/finding-deleted-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에게 요청하는 예시

“지난 14일 동안 어떤 기능 플래그가 삭제되었고, 누가 삭제했나요?”

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

작동 방식

PostHog는 삭제 시각을 플래그 자체에 저장하지 않으므로, 스킬은 먼저 삭제된 플래그를 나열한 뒤, 각 플래그의 활동 기록에서 삭제 이벤트를 확인합니다.

기술 내용 (원본 SKILL.md)

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

Finding recently deleted feature flags

This skill produces a list of feature flags that were soft-deleted in the active project within a user-specified time window, along with who deleted each one and when.

When to use this skill

  • The user asks "what flags got deleted last week / in the last N days?"
  • The user wants an audit of recent flag deletions (who, when, what was removed)
  • The user wants to find when a specific flag was deleted, or by whom
  • Any "recently deleted feature flags" framing

Don't use this for active stale-flag cleanup — that's cleaning-up-stale-feature-flags. This skill is for flags that have already been removed.

The gotcha that makes this non-trivial

system.feature_flags exposes deleted as a boolean but does not expose deleted_at, updated_at, or last_modified_at. There's no way to filter soft-deleted flags by deletion time in a single SQL query — trying to use those columns will return Unable to resolve field.

The actual deletion timestamp lives in the per-flag activity log, reachable only via posthog:feature-flags-activity-retrieve (one call per flag id). There is no bulk activity endpoint.

So the workflow is two-stage: SQL to enumerate candidates, then parallel activity-log lookups to find each deletion event.

Workflow

1. Clarify the window if ambiguous

"Last week" is ambiguous — it can mean rolling 7 days from now, or the previous calendar week (Mon–Sun). If the user wasn't explicit, ask, or surface both interpretations in the final report.

Always compute the cutoff in UTC and keep the user's local interpretation in your head separately.

2. Enumerate soft-deleted flags via SQL

Query system.feature_flags for deleted = true in the active project, ordered by created_at DESC:

SELECT id, key, created_at
FROM system.feature_flags
WHERE team_id = <team_id> AND deleted = true
ORDER BY created_at DESC
LIMIT 100

Order by created_at DESC because deletions empirically cluster near creation — most flags get deleted within a few days of being created — so walking the most-recently-created candidates first finds recent deletions fastest. But this is a heuristic, not a guarantee: an older flag deleted recently won't be at the top of this list. Be explicit about that limitation when you report.

team_id defaults to the active project, but include it explicitly for clarity.

3. Fan out activity-log lookups in parallel

For each candidate id, call posthog:feature-flags-activity-retrieve with limit: 5, page: 1. Issue all calls in one message so they run concurrently — sequential calls are dramatically slower.

call feature-flags-activity-retrieve {"id": <flag_id>, "limit": 5, "page": 1}

Reasonable batch sizes:

  • "last 7 days" → top 20–25 candidates
  • "last 30 days" → top 50
  • "last 90 days" → walk the full ~100

If you sample fewer than the full set, say so in the report and offer to walk the rest as a follow-up.

4. Extract the deletion event from each response

In each response, find the entry where activity == "deleted". That entry's created_at is the actual deletion time, and user.email / user.first_name identify the deleter. These fields are reliable on every delete path.

For most flags there's exactly one delete event. If a flag has been deleted-and-restored multiple times, take the most recent activity: deleted event within the window.

5. Recover the original key and report

Feature flags are renamed to <original>:deleted:<flag_id> when soft-deleted while still referenced elsewhere (e.g. a stopped experiment) — the id-based suffix frees the original key for reuse. Don't try to recover the original from the activity log's own fields: detail.changes only carries the rename on UI/ORM deletes (and is often empty, or missing the key entry, on API/MCP/programmatic deletes), and detail.name just mirrors whatever the current key is — tombstoned or not.

Instead, strip the suffix deterministically with scripts/strip_deleted_suffix.py. Pass it the whole step 2 candidate list as JSON in one call — not one invocation per flag:

echo '[{"id": 1001, "key": "example-banner:deleted:1001"}]' | python3 scripts/strip_deleted_suffix.py
# prints the same array back (pretty-printed), each object gaining an "original_key" field:
# "original_key": "example-banner"

Filter the collected deletion events to those whose created_at falls inside

자주 묻는 질문

왜 두 단계 과정인가요?

삭제 시각은 각 플래그의 활동 기록에만 저장되므로, 스킬은 플래그를 하나씩 확인합니다.

이 스킬이 오래된 플래그를 정리하나요?

아니요. 이미 제거된 플래그를 찾으며, 정리 스킬은 아직 활성인 플래그를 다룹니다.

지난주가 무엇을 뜻하는지는 어떻게 정하나요?

시간 창이 불분명하면 스킬이 명확히 해 달라고 묻습니다. 예를 들어 최근 7일인지 달력상의 주인지 확인합니다.

상세 정보

작성자의 원본 설명

Find feature flags that were soft-deleted in the active project within a recent time window. Use when the user asks "what flags were deleted in the last N days", "show me recently deleted feature flags", "who deleted flag X", "audit recent flag deletions", or anything similar. Handles the non-obvious gotcha that system.feature_flags exposes the deleted boolean but does not expose a deletion timestamp — the actual deleted-at time lives in the per-flag activity log and must be cross-referenced.

repo: PostHog/posthog

인기도

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

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬