adding-warehouse-perso…
Sync columns from a synced data warehouse table onto PostHog person or group properties, so warehouse data becomes usable anywhere person and group properties…
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.
$ npx -y skills add PostHog/ai-plugin --skill finding-deleted-feature-flags --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/finding-deleted-feature-flagsContext preview
The summary Claude sees to decide when to auto-load this skill.
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.
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.'
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.
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.
`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.
"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.
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.
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:
If you sample fewer than the full set, say so in the report and offer to walk the rest as a follow-up.
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.
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:
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.
Official PostHog plugin for AI clients. Access PostHog products directly from your AI coding tool.
Repo: PostHog/ai-plugin
Sync columns from a synced data warehouse table onto PostHog person or group properties, so warehouse data becomes usable anywhere person and group properties…
Analyze the most expensive users in AI observability and explain why they cost so much. Use when the user asks about top spenders, expensive users, per-user…
Analyze session replay patterns across experiment variants to understand user behavior differences. Use when the user wants to see how users interact with…
Split a completed PostHog task run into activity records — what the agent tried, whether it worked, what blocked it — and record each one through the…
Assesses what a page's heatmap is telling you and recommends concrete changes. Pulls click / rageclick / scroll-depth data for a URL, names the hot elements by…
Audit every endpoint in a PostHog project for staleness, failed materialisations, and unused materialised versions. Use when the user asks "what endpoints can…