finding-deleted-feature-flags
This skill finds feature flags that were soft-deleted in a PostHog project within a specified time window, revealing who deleted each flag and when.
Identity proven by GitHub's verified organisation badge (PostHog)
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode
- License
- MIT (permissive)
- Pin
- 244c70dpinned Oct 9, 2026
- Context cost
- about 1,800 tokenswhen the skill loads
- GitHub stars
- 40,191on posthog/posthog
- Scripts
- 1 script
What it does
“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.”
Generated summary from the skill's own text
This skill finds feature flags that were soft-deleted in a PostHog project within a specified time window, revealing who deleted each flag and when. It queries the feature flags table to identify deleted flags, then retrieves the per-flag activity log to pinpoint exact deletion timestamps, since deletion times are not directly available in the flags table.
When to use it
- User asks what flags were deleted in last N days or weeks
- User wants audit trail of recent flag deletions with names and authors
- User needs to find when a specific flag was removed or who removed it
- Compliance or troubleshooting work on deleted feature flags
When not to
- Finding and cleaning up active but unused stale flags instead
- Looking for flags deleted many months or years ago with high volume
- Need real-time deletion notifications rather than historical audit
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add posthog/posthog --skill finding-deleted-feature-flagsInstalls from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install posthog/posthog finding-deleted-feature-flags@244c70d066c0b441e3b8cc6875f914c5e09c42b3Installs the commit we checked (244c70d).
Copy by hand
Download the folder at 244c70d and put it in .claude/skills/finding-deleted-feature-flags for Claude Code and in .agents/skills/finding-deleted-feature-flags for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Claude Code plugin
/plugin install posthog@claude-plugins-officialThe publisher's plugin in Claude's official marketplace. It may hold more than this skill, and we have not pinned it.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "finding-deleted-feature-flags" by PostHog. Source, pinned to commit 244c70d066c0b441e3b8cc6875f914c5e09c42b3: https://github.com/posthog/posthog/tree/244c70d066c0b441e3b8cc6875f914c5e09c42b3/products/feature_flags/skills/finding-deleted-feature-flags 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/finding-deleted-feature-flags/ for Claude Code and .agents/skills/finding-deleted-feature-flags/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/posthog/finding-deleted-feature-flags-posthog
SKILL.md at the pin
---
name: finding-deleted-feature-flags
description: '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.'
---
# 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`:
```sql
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.
```text
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`](./scripts/strip_deleted_suffix.py). Pass it the whole step 2 candidate list as JSON in one call — not one invocation per flag:
```bash
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 the requested window. Present as a table, using each row's recovered original key (not the raw tombstoned form) for the "Key" column:
| Flag ID | Key | Deleted at (UTC) | Deleted by |
State your methodology in the report (how many candidates you walked vs. how many soft-deleted flags exist total), so the user knows what was and wasn't checked.
## Watch-outs
- **Borderline cases**: if a deletion is within ~1 hour of the window cutoff, surface it as borderline rather than silently dropping it.
- **Don't trust `created_at` as a proxy for deletion time**: a flag created in 2024 can still have been deleted last week. The activity log is the only authority.
- **Renamed keys are normal**: a flag with key `foo:deleted:12345` was the flag originally keyed `foo` — see step 5 for how to recover it.
- **Walking all candidates is possible but slow**: ~100 parallel activity-log calls is doable. Offer it as a follow-up rather than the default for short windows.
## Example interaction
User: "what flags got deleted in the last week?"
1. Clarify if needed, or note both interpretations: "rolling 7 days ending now (UTC), in the active project"
2. Run the SQL enumeration to get up to 100 soft-deleted candidates ordered by `created_at DESC`
3. Fan out activity-log lookups in parallel across the top ~25 candidates
4. Extract `activity: deleted` entries; filter to those whose `created_at >= now - 7 days`
5. Recover original keys with `scripts/strip_deleted_suffix.py` and report.
The values below are illustrative, not real project data:
```text
Found 2 feature flags deleted in the last 7 days (rolling, ending 2026-08-14 09:30 UTC):
| Flag ID | Key | Deleted at (UTC) | Deleted by |
|---------|-------------------------|----------------------|-------------|
| 1001 | example-banner | 2026-08-13 15:12 | Jane D. |
| 1002 | example-checkout-test | 2026-08-09 21:48 | John S. |
Methodology: walked the activity log for the 25 most-recently-created soft-deleted flags.
The step 2 query hit its 100-row cap, so the project may have more soft-deleted flags than that.
The other 75 returned candidates were created before late June 2026 and were not checked.
Want me to walk the rest?
```
## Related tools
- `posthog:execute-sql`: Used in step 2 to enumerate soft-deleted candidates against `system.feature_flags`
- `posthog:feature-flags-activity-retrieve`: Used in step 3 to find the actual deletion event for each candidate
- `posthog:feature-flag-get-definition`: Useful if the user then wants to inspect what the deleted flag looked like
## Scripts
- [`scripts/strip_deleted_suffix.py`](./scripts/strip_deleted_suffix.py): recovers original flag keys — see step 5.
From posthog/posthog at 244c70d, shown as plain text under its license: MIT (permissive). The license text is in LICENSE.
View SKILL.md on GitHub at 244c70dFiles
- SKILL.md7.9 KB · 8f030768f1e9
- scripts/
- strip_deleted_suffix.py1.6 KB · d5889f2e4f48
2 files, 9.5 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at 244c70dAlso in
The same SKILL.md content appears in these places too. We list it once and credit the oldest public source.
More from PostHog
analyzing-experiment-session-replays
This skill enables agents to analyze session recordings from experiment variants to identify behavioral differences between control and test groups.
Claude Code, Codex, Cursor +4 · about 2.3K tokens · pinned 6 days ago
analyzing-offline-evaluations
This skill inspects and compares offline AI evaluation experiments stored in PostHog, diagnoses case-level regressions, and tracks scorer changes across…
Claude Code, Codex, Cursor +4 · about 1.5K tokens · pinned 6 days ago
auditing-warehouse-view-health
Audits materialized views in a PostHog data warehouse to identify failed views and flag unused ones that waste compute resources.
Claude Code, Codex, Cursor +4 · about 1.4K tokens · pinned 6 days ago
authoring-data-quality-checks
This skill adds data quality checks (like dbt tests) on warehouse tables, views, and HogQL metrics, supporting assertions such as not-null, uniqueness…
Claude Code, Codex, Cursor +4 · about 2.5K tokens · pinned 6 days ago
authoring-scouts
This skill helps engineers write, edit, and adapt PostHog Signals scouts, scheduled agents that scan projects and report findings to an inbox.
Claude Code, Codex, Cursor +4 · about 10.6K tokens · pinned 6 days ago
building-a-dashboard
This skill constructs or modifies PostHog dashboards by selecting and arranging insight tiles.
Claude Code, Codex, Cursor +4 · about 2.1K tokens · pinned 6 days ago
Related in Data and databases
data-table-manager
This skill manages n8n Data Tables through creation, import, querying, and mutation operations.
by n8nOfficial publisher
Claude Code, Codex, Cursor +3 · about 2.1K tokens · pinned 6 days ago
algolia-automation
This skill automates Algolia search and indexing operations through the Rube MCP interface.
by ComposioOfficial publisher
Claude Code, Codex, Cursor +3 · about 690 tokens · pinned 6 days ago
expo-sqlite
This skill enables SQLite database operations in Expo and React Native apps for structured data storage, offline queues, and persistent caches.
by ExpoOfficial publisher
Claude Code, Codex, Cursor +4 · about 2.6K tokens · pinned 6 days ago
prisma-8
This skill helps agents work with Prisma 8, a contract-first data layer for TypeScript projects.
by PrismaOfficial publisher
Contains scripts
Claude Code, Codex, Cursor +3 · about 3.5K tokens · pinned 6 days ago
configuring-experiment-analytics
Configures how PostHog measures experiment impact by setting exposure criteria (who counts in the analysis), choosing metrics to track (mean, funnel, ratio…
by PostHogOfficial publisher
Claude Code, Codex, Cursor +4 · about 3.4K tokens · pinned 6 days ago
configuring-experiment-rollout
Configures variant split and overall rollout percentage for PostHog experiments, determining who sees which test variant and what percentage of users enter…
by PostHogOfficial publisher
Claude Code, Codex, Cursor +4 · about 3.6K tokens · pinned 6 days ago