
Finding Deleted Feature Flags
FreeQuickly audit soft-deleted feature flags in your project.
Free · Opens the source repo
What Finding Deleted Feature Flags does
The Finding Deleted Feature Flags skill enables users to retrieve a list of feature flags that have been soft-deleted within a specified time frame in their active PostHog project. This skill is particularly useful for teams that need to track changes in their feature flag configurations, ensuring they can audit who deleted which flags and when. By utilizing this skill, users can efficiently respond to queries about recently deleted flags, enhancing their project management and oversight capabilities.
The skill operates by first clarifying the time window for deletions, as terms like "last week" can be ambiguous. It then performs a SQL query on the system.feature_flags table to identify soft-deleted flags, leveraging the deleted boolean. However, due to limitations in the PostHog API, the actual deletion timestamps are not directly accessible from this table. Instead, the skill cross-references the activity log for each flag to determine the exact deletion time and the user responsible for the action.
To optimize performance, the skill retrieves deletion events in parallel, reducing the time required to gather information. Once the deletion events are collected, it processes them to present a clear report that includes the original flag keys, which are renamed upon deletion. This ensures that users receive a comprehensive overview of the deletions, including any flags that may have been renamed, and the skill handles the complexities of the PostHog API to deliver accurate results.
This skill is essential for developers and project managers who need to maintain oversight of feature flags in their projects. It provides a reliable method for auditing deletions, ensuring that teams can quickly respond to inquiries about changes in their feature flag configurations, thus improving overall project transparency and accountability.
When to use it
Use this skill when you need to find out which feature flags were deleted recently, including details on who deleted them and when.
When not to use it
This skill is not suitable for managing active feature flags or for cleaning up stale flags, as it specifically focuses on those that have already been removed.
What you can build with it
Audit Recent Deletions
Use this skill to generate a report of all feature flags deleted in the last month, including who deleted them.
Investigate Specific Deletions
When a team member asks about a specific flag deletion, this skill can quickly provide the deletion details.
Clarify Ambiguous Time Frames
If a user asks about deletions in the last week, this skill clarifies whether they mean the last 7 days or the previous calendar week.
How to install Finding Deleted Feature Flags
View source1. Install with the skills CLI
npx skills add posthog/posthog/finding-deleted-feature-flags --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by posthogFinding 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": 687432, "key": "high_frequency_alerts:deleted:687432"}]' | python3 scripts/strip_deleted_suffix.py
# prints the same array back (pretty-printed), each object gaining an "original_key" field:
# "original_key": "high_frequency_alerts"
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_atas 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:12345was the flag originally keyedfoo— 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?"
-
Clarify if needed, or note both interpretations: "rolling 7 days ending now (UTC), in the active project"
-
Run the SQL enumeration to get up to 100 soft-deleted candidates ordered by
created_at DESC -
Fan out activity-log lookups in parallel across the top ~25 candidates
-
Extract
activity: deletedentries; filter to those whosecreated_at >= now - 7 days -
Recover original keys with
scripts/strip_deleted_suffix.pyand report:Found 2 feature flags deleted in the last 7 days (rolling, ending 2026-05-22 19:04 UTC): | Flag ID | Key | Deleted at (UTC) | Deleted by | |---------|-------------------------------------------|----------------------|-------------| | 687432 | high_frequency_alerts | 2026-05-22 17:23 | Matt P. | | 676665 | tasks-sendblue-prewarmed-sandbox-pool | 2026-05-15 13:45 | Alessandro | Methodology: walked the activity log for the 25 most-recently-created soft-deleted flags. Team 2 has ~100 soft-deleted flags total; the remaining ~75 were created before mid-March 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 againstsystem.feature_flagsposthog:feature-flags-activity-retrieve: Used in step 3 to find the actual deletion event for each candidateposthog:feature-flag-get-definition: Useful if the user then wants to inspect what the deleted flag looked like
Scripts
scripts/strip_deleted_suffix.py: recovers original flag keys — see step 5.
Frequently asked questions about Finding Deleted Feature Flags
Similar skills
Spring Boot Testing
Master testing techniques for Spring Boot 4 applications.
GitHub Issues
Manage GitHub issues efficiently with MCP tools.
Geofeed Tuner
Optimize your IP geolocation feeds in CSV format.
Batch Files
Master Windows batch scripting for automation and task management.
Adobe Illustrator Scripting
Automate your Illustrator workflows with ExtendScript.
Plugin Structure
Create and organize Claude Code plugins effectively.
