feature-flags-api — Claude Code skill for PostHog flags
The feature-flags-api skill guides agents through adding PostHog feature flag checks to API applications. Use it when you want to introduce flags without restructuring existing code.
MIT 111 installs ★ 80 updated 2026-10-24
npx skills add PostHog/skills --skill feature-flags-api -a claude-codeWhat feature-flags-api does
The skill guides changes to API code that add feature flag checks alongside the current logic. It favors boolean checks unless you ask for multivariate flags, and recommends server-side evaluation when possible to avoid UI flicker. Keep PostHog keys in environment variables; the skill says not to hardcode them.
Reference files cover API flag setup, adding flag checks, and feature flag practices. There are no framework-specific patterns in the skill, so the guidance stays general. When a PostHog MCP server is connected, the agent can use its tools to create, list, update, or delete flags in PostHog.
What it helps with
- add a PostHog flag check to API code
- preserve existing logic while introducing flags
- choose a boolean check for a feature flag
- manage flags through PostHog MCP tools
Example prompts for the agent
- Add a boolean PostHog feature flag check to this API without restructuring its existing logic.
- Show how to add PostHog feature flags to this API and keep the keys in environment variables.
- Check for a connected PostHog MCP server and create a flag for this API with its tools.
How to install feature-flags-api
1Skills CLI (Vercel)
npx skills add PostHog/skills --skill feature-flags-api -a claude-code2Manually: put the files in place
~/.claude/skills/feature-flags-api/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/feature-flags-api/
1Skills CLI (Vercel)
npx skills add PostHog/skills --skill feature-flags-api -a codex2Manually: put the files in place
.agents/skills/feature-flags-api/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add PostHog/skills --skill feature-flags-api -a cursor2Manually: put the files in place
.cursor/skills/feature-flags-api/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install PostHog/skills skills/posthog/all/skills/feature-flags-api2Manually: put the files in place
.github/skills/feature-flags-api/SKILL.md1Skills CLI (Vercel)
npx skills add PostHog/skills --skill feature-flags-api -a gemini-cli2Platform CLI
gemini skills install https://github.com/PostHog/skills --path skills/posthog/all/skills/feature-flags-apiManually: put the files in place
.devin/skills/feature-flags-api/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add PostHog/skills --skill feature-flags-api -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about feature-flags-api
How do I install feature-flags-api in Claude Code?
Run npx skills add PostHog/skills --skill feature-flags-api -a claude-code. The skill file is at ~/.claude/skills/feature-flags-api/SKILL.md.
What does feature-flags-api do?
It guides agents adding PostHog feature flag checks to API applications while keeping existing logic in place. It favors boolean checks and server-side evaluation when possible.
Where should I keep PostHog keys, and can the skill manage flags?
Store PostHog keys in environment variables rather than in code. If a PostHog MCP server is connected, the agent can use its tools to manage flags.
Source text
SKILL.md · MIT
--- name: feature-flags-api description: PostHog feature flags for API applications metadata: author: PostHog version: 1.9.4 --- # PostHog feature flags for API This skill helps you add PostHog feature flags to API applications. ## Reference files - `references/api.md` - API feature flags installation - docs - `references/adding-feature-flag-code.md` - Adding feature flag code - docs - `references/best-practices.md` - Feature flag best practices - docs Consult the documentation for API details and framework-specific patterns. ## Key principles - **Environment variables**: Always use environment variables for PostHog keys. Never hardcode them. - **Minimal changes**: Add feature flag code alongside existing logic. Don't replace or restructure existing code. - **Boolean flags first**: Default to boolean flag checks unless the user specifically asks for multivariate flags. - **Server-side when possible**: Prefer server-side flag evaluation to avoid UI flicker. ## PostHog MCP tools Check if a PostHog MCP server is connected. If available, look for tools related to feature flag management (creating, listing, updating, deleting flags). Use these tools to manage flags directly in PostHog rather than requiring the user to do it manually in the dashboard. ## Framework guidelines _No specific framework guidelines._
© PostHog · MIT · PostHog/skills