feature-flags-ruby

feature-flags-ruby is a skill for Claude Code from PostHog/skills. It costs 14 tokens per session (464 once invoked), scanned A, a copy of feature-flags-api, MIT.

A Ruby guide for adding PostHog feature flags, which let you turn code-controlled features on or off.

In plain words
What is it for?
Use it to install PostHog feature flags in Ruby and add boolean or other documented flag checks.
Why use it?
It helps add feature checks while preserving existing code and keeping access keys out of the source.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the posthog-all plugin — 62 skills, 1 hook shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/posthog/skills/feature-flags-ruby
Any agent
npx skills add PostHog/skills --skill feature-flags-ruby
Clone the repo
git clone --depth 1 https://github.com/PostHog/skills

Made for: Claude Code.

Or install posthog-all, the plugin that ships this one along with the rest of its 62 skills, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for feature-flags-ruby

README.md
[![agentmods](https://agentmods.dev/badge/skills/posthog/skills/feature-flags-ruby.svg)](https://agentmods.dev/skills/posthog/skills/feature-flags-ruby)
Your own site
<a href="https://agentmods.dev/skills/posthog/skills/feature-flags-ruby"><img src="https://agentmods.dev/badge/skills/posthog/skills/feature-flags-ruby.svg" alt="Measured on agentmods" height="20"></a>
Per session 14 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 464 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 80% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00014 $0.00464
Opus 5 $0.00007 $0.00232
Sonnet 5 $0.00003 $0.00093
Haiku 4.5 $0.00001 $0.00046

Measured 3d ago against content hash 4a9df7d6e559, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

feature-flags-ruby scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

80% identical to feature-flags-api — 17 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/posthog/all/skills/feature-flags-ruby/SKILL.md · 40 lines

What it actually says

PostHog feature flags for Ruby

This skill helps you add PostHog feature flags to Ruby applications.

Reference files

  • references/ruby.md - Ruby 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

  • posthog-ruby is the Ruby SDK gem name (add gem 'posthog-ruby' to Gemfile) but require it with require 'posthog' (NOT require 'posthog-ruby')
  • Use PostHog::Client.new(api_key: key, host: host) for instance-based initialization in scripts and CLIs
  • In CLIs and scripts: MUST call client.shutdown before exit or all events are lost
  • Use begin/rescue/ensure with shutdown in the ensure block for proper cleanup
  • capture and identify take a single hash argument: client.capture(distinct_id: 'user_123', event: 'my_event', properties: { key: 'value' })
  • capture_exception takes POSITIONAL args (not keyword): client.capture_exception(exception, distinct_id, additional_properties) — do NOT use distinct_id: keyword syntax
Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 40 lines · 14 tokens per session scan A 4a9df7d6e559

Subscribe to this mod's changes

feature-flags-ruby is a skill published in the GitHub repository PostHog/skills (60 stars, last pushed today), licensed MIT. It adds 14 tokens to every session and 464 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 80% identical to feature-flags-api, differing in 17 lines, and is treated as a copy.

Related

Other skills, from other repositories

new

Create a new project to start development quickly.

clacky-ai/openclacky · 10 tokens

rspec-conventions

Rootstrap RSpec conventions. Use when writing, reviewing, or editing RSpec test files (spec//spec.rb, spec/railshelper.rb, spec/spechelper.rb, spec/support//.rb) or factories. Covers describe/context structure, let/subject, matchers, factories, mocking/stubbing, shared examples, and spec types (model, request…

rootstrap/rails_api_base · 82 tokens

ruby-patterns

Ruby/Rails: blocks, metaprogramming, ActiveRecord, Sidekiq, RSpec, Sorbet, Hanami. Triggers: Ruby, Rails, ActiveRecord, Sidekiq, RSpec, Gemfile, bundler, Hanami, Sorbet.

softspark/ai-toolkit · 60 tokens

ruby-rules

Ruby coding rules: style, patterns, security, testing. Triggers: .rb, Gemfile, .gemspec, Rails, ActiveRecord, Sidekiq, RSpec, Sorbet, rubocop.

softspark/ai-toolkit · 48 tokens

ruby-expert

Expert-level Ruby development with Rails, modern features, testing, and best practices. Use when the user mentions Ruby on Rails, RSpec, gem, Sinatra, or metaprogramming, or when the task involves Ruby 3+ Features, Object-Oriented, Functional Features, or Pattern Matching.

personamanagmentlayer/pcl · 64 tokens

activerecord

This skill should be used when the user asks to "write a migration", "add a column", "add column to table", "create an index", "add a foreign key", "set up associations", "fix N+1 queries", "optimize queries", "add validations", "create callbacks", "use eager loading", or mentions ActiveRecord, belongsto, hasmany…

hoblin/claude-ruby-marketplace · 180 tokens