/ship-pipeline:feature-flagsfrom ship-pipeline
Feature-flag lifecycle, using PostHog as the worked backend - naming, deciding rollout flag versus kill switch, staged rollout percentages, wiring kill switches to an alert, testing both code paths, and a stale-flag cleanup pass that removes code before disabling the flag. Use when asked to "add a feature flag", "roll out a feature gradually", "add a kill switch", or "clean up old flags".
Ships in ship-pipeline. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Flags serve two purposes: progressive rollout (de-risking a launch) and kill switches (turning a risky path off without a deploy). Both decay into flag debt if nobody cleans them up. This skill covers the whole lifecycle: creation, rollout, testing, and the cleanup pass most teams skip.
PostHog is the worked example. The lifecycle applies to any flag service (LaunchDarkly, Unleash, GrowthBook, a config table); swap in its equivalents. If the repository defines its own feature-flags skill or flag conventions, follow those instead.
Kebab-case, area first, then feature: billing-annual-plan-prompt, editor-ai-summary. Avoid generic names (new-feature, test-flag); six months later nobody remembers what test-flag gates. Prefix kill-switch flags with kill- so their purpose shows in the flag list without opening each one: kill-ai-summary-generation. If the repository already has a naming convention, match it.
Decide the flag's purpose before creating it:
Start the rollout low. A typical progression is 5% → 25% → 50% → 100%, holding each step for at least 24 to 48 hours when the feature has real usage, and longer when it affects billing or paid-API costs; those need more signal before the next step. A low-risk cosmetic change can go 25% → 100%. Anything touching payments, user data, or stored credentials never skips the low-percentage soak.
Wire each kill switch to something observable. A switch nobody knows to flip is not wired. Pair it with:
Test both code paths. Every flag needs coverage for on and off. A stale else branch nobody has run since week one is where regressions hide: the flag gets flipped back during an incident and the "safe" fallback is broken too. In end-to-end tests, parametrize the flag state instead of duplicating test files.
Before going to 100%: the error rate and cost metric are stable at the current percentage for the full soak window, no open bugs are tied to the feature, and for AI-generation or billing flags, cost per user is not climbing as the percentage rises.
Stale-flag cleanup pass (monthly, or when asked):
active=STALE and fetch every page. Source: PostHog, Cleaning up stale feature flags.kill- prefix if needed, and leave it).Adding an AI summary feature that calls a paid model API.
editor-ai-summary (rollout flag, removal planned four weeks after reaching 100%) and kill-ai-summary-generation (kill switch around the model call).editor-ai-summary on and off; a unit test confirms the kill switch returns the "summary unavailable" state without calling the API.editor-ai-summary shows as stale (100%, no filters, 30+ days). A PR removes the flag check and the off-branch; after it deploys, the flag is disabled in PostHog. kill-ai-summary-generation stays.For creation: the flag configuration (name, purpose, rollout stages, kill-switch alert) plus the PR implementing both code paths. For cleanup: a table of stale flags (name, rollout, last evaluated, recommended action) and one PR per flag removed.
What SKILL.md sets; muted values are Claude Code's defaults
16 skills in this plugin
/analytics-instrumentationPostHog event taxonomy and instrumentation review - object_verb naming, flat property schemas, identify/reset/group calls, PII exclusion, LLM usage events, a starter dashboard set (activation, retention, feature funnel), and a per-feature checklist. Use when instrumenting a new feature, auditing existing PostHog events, or setting up analytics for a new product, e.g. "add tracking", "what events should we fire", "review our PostHog events", "is there PII in analytics"./api-designREST conventions for Next.js App Router route handlers — resource naming, versioning, cursor pagination, one error envelope, Zod request/response validation, status-code rules, OpenAPI generated from Zod, and response scrubbing (no secrets, hashes, or other users' data). Use when asked to "design an API route", "add a new endpoint", "review this route handler", "fix our error responses", or "generate API docs"./backup-verifyConfirm database backups exist AND actually restore, by enumerating Neon branch snapshots / Supabase scheduled backups / pg_dump artifacts, restoring into a scratch branch, running smoke queries, and recording timestamped evidence. Use before any risky migration or production mutation, and on a monthly cadence regardless.npx claudepluginhub stylusnexus/agent-plugins --plugin ship-pipeline