Skip to main content

flagship

Build, debug, or review code that uses Cloudflare Flagship feature flags from Workers, OpenFeature SDKs, the evaluation API, or Wrangler. Use for the Flagship binding, targeting rules, percentage rollouts and A/B splits, kill switches, local flag stores, and flag-related API tokens.

v1.0.0New

Install this skill

No account required. Pick your tool, or use the command that detects it for you.

Run in your terminal. It detects your AI tool.

npx @skills-hub-ai/cli install cloudflare-flagship
Or get the file:
Browse all CLI commands →
Manual setup by platform

Claude Code

~/.claude/skills/cloudflare-flagship/SKILL.md

Setup guide →

Signing

SignedSLSA L2
Signed by
skills-hub.ai distributor
Method
Distributor-signed by skills-hub.aiCryptographically signed by the skills-hub.ai distributor key at publish time.
Signed
0Save

Instructions

Cloudflare Flagship

Flagship is Cloudflare's feature flag service: apps group flags, flags have typed variants and ordered targeting rules, and evaluation runs at the edge against propagated configuration. Your knowledge of the Flagship API may be outdated or missing. Prefer retrieval over pre-training: read the matching page below before writing code or commands, and treat the docs and generated types as the source of truth over this skill.

Documentation

TaskDocsCheck for
Understand the modelConceptsApps, flags, variant types, rule order, evaluation context, propagation
Evaluate flags in a WorkerGet started, Configuration, Binding methods, TypesBinding config, typed and *Details methods, context value types
Evaluate outside Workers or through OpenFeatureOpenFeature SDK, TypeScript server, TypeScript client, Python, Go, RustPackage names, provider options, caching, minimum versions for structured context
Evaluate over HTTP without an SDKEvaluation APIGET for scalar context, POST for structured context, token permissions
Target users or roll out graduallyTargeting rules, Operators, Percentage rolloutsRule shape, nested attribute paths, bucketing attribute, cumulative A/B thresholds
Manage flags from the CLIWrangler commands--rule syntax, rollout, split, enable/disable, --local, --json
Manage flags over HTTPAPI referenceApps, flags, and flag changelog endpoints; rules live on the flag object. Update flag is a PUT that clears omitted fields, so read the flag before writing
Create tokens for SDKs or automationAPI tokensAccount-wide vs app-scoped tokens, Evaluate vs Read vs Write
Debug unexpected valuesEvaluation reasons and error codesreason and errorCode values
Plan rollouts and cleanupBest practices, LimitsRollout steps, flag removal order, key and context limits

For the full page list, read Flagship llms.txt. After adding a binding, run npx wrangler types and read the Flagship declarations in the generated worker-configuration.d.ts; they match the installed Wrangler version.

Gotchas

These follow from the pages above and are the usual causes of flags that look broken but are working as documented.

  • Use the binding inside Workers. It authenticates automatically and needs no API token. Outside Workers, use an OpenFeature provider with an Evaluate token; local evaluation in any server SDK needs a Read token instead. Only the TypeScript server provider accepts the binding: in a Worker that wants OpenFeature APIs, pass the binding to FlagshipServerProvider. Do not ship the TypeScript client provider in public-facing apps: it requires an API token that would be visible in client code.
  • Known evaluation failures return your default silently. The typed binding methods return defaultValue for known failures such as a missing flag, type mismatch, or invalid context. Unexpected runtime failures can still throw, and get() without a defaultValue throws on known failures. Other clients differ: the Rust SDK returns a Result, and the evaluation API POST returns 400 for invalid context. Pick a default that is the safe, existing behavior, and use the matching *Details method to see reason and errorCode when a value looks wrong.
  • Local development starts with an empty flag store. wrangler dev, the Vite plugin, the Vitest integration, and cf dev evaluate against a local store, so every flag returns its default until you seed it. Run npx wrangler flagship flags pull <APP_ID>, create flags with --local, or set "remote": true on the binding. pull overwrites local flags with matching keys and writes to .wrangler/state, which wrangler dev and the Vite plugin 1.x use. cf dev and the Vite plugin 2.0 use .cloudflare/state, so for them pass --persist-to .cloudflare/state to pull, or every flag still returns its default. cf cannot copy flags from the remote app, so seed it with wrangler flagship flags pull. On flag commands other than pull, --persist-to requires --local. Check Configuration for the minimum tool versions.
  • Rollouts need a stable bucketing value. The bucketing attribute defaults to targetingKey. If it is missing or null, each evaluation gets a random bucket, so the same user can flip between values. Pass the same stable identifier under the same attribute name on every call, and use targetingKey with OpenFeature SDKs.
  • Rules are ordered and rollout misses fall through. The first matching rule wins. A context that matches a rule's conditions but falls outside its rollout percentage continues to the next rule. Put specific rules before broad ones, and use cumulative thresholds that end at 100 for API-managed A/B/n splits, or wrangler flagship flags split, which calculates them.
  • Changes take up to 30 seconds to propagate. Do not expect the next evaluation to reflect an update immediately; for scripted checks, allow for the propagation window.
  • flags update --rule, rollout, and split replace every rule. rollout and split overwrite the flag's entire rule set with the rules they generate, and prompt first only when existing rules have conditions; --force skips the prompt. Use --add-rule to append, or rules update and rules delete to change one rule by priority. Wrangler commands take the app ID as an argument and do not read it from the Worker binding.
  • Keep context small and JSON-only. Send only attributes that rules or bucketing use, and no sensitive data. Serialize Date values to ISO 8601 strings for the binding in TypeScript. A condition whose attribute is absent from the context never matches, including with negative operators such as not_equals. Evaluate a flag once per request and reuse the value instead of calling it in a loop.
  • Disabling a flag is the kill switch. A disabled flag always serves its default variant, regardless of targeting rules.
  • Delete flags last. Disable the flag, watch for problems, remove the evaluation code, deploy, then delete the flag. A deleted flag that is still evaluated silently returns its default.

Skill feedback

If the user reports that this skill gave incorrect or outdated guidance, or is missing information, read references/skill-feedback.md.

This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Browse all →
k2Build and troubleshoot Cloudflare K2 or K2 Streams durable logs. Use for stream setup, producing from Workers or HTTP, configuring retention and inputs, and consuming through subscriptions.0 installssandbox-migrate-to-nextMigrate Cloudflare Sandbox apps from stable @cloudflare/sandbox to @cloudflare/sandbox@next (SDK 1.0 preview). Use sandbox-next for apps already on the preview.0 installscloudflare-app-bootstrapGet a Cloudflare Workers app to a working local request by connecting its bindings, secrets, and initial data, then verifying real application behavior. Use for app setup or onboarding after the project exists; use frameworks-on-cloudflare or cf-cli to create or configure the project, and wrangler or cf-cli for isolated commands.0 installsworkers-profilingProfile or debug CPU usage and memory allocation in deployed Cloudflare Workers and Durable Objects. Then use this information to optimize your code.0 installsnextjs-on-cloudflareBuild, migrate, and deploy Next.js apps on Cloudflare Workers with vinext. Use when starting a Next.js project on Cloudflare, moving an existing app to Workers, choosing between vinext and OpenNext, or setting up vinext for Workers. For setup, migration, or deployment, install vinext's upstream skills with `npx skills add cloudflare/vinext` if missing, then read and follow the applicable skill and docs.0 installswranglerRun or troubleshoot Wrangler CLI commands in projects that have a wrangler.jsonc, wrangler.json, or wrangler.toml file, including local development, Previews, deployment, and resource management. For new projects and projects without a Wrangler configuration file, use the cf CLI instead.0 installs

More from Cloudflare

View source →

More Build skills

Browse category →
senior-frontendBuild and review React, Next.js, TypeScript or Tailwind frontends: components, scaffolding, performance and bundle size. Use whenever the user wants a new component or app, a page feels slow, the bundle is too big, or asks for a frontend code review.635 installsui-design-systemUse when building a design system: tokens, component docs, responsive scales or developer handoff. Generates tokens with design_token_generator.py.535 installsfrontend-designGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.346 installssenior-backendBuild and fix backend services: REST or GraphQL APIs, auth, microservices, PostgreSQL queries, migrations and load tests. Use whenever the user's API is slow or broken, needs login or auth added, a schema change, or a new endpoint or service scaffolded.246 installsself-improving-agentCurate what the agent has learned into durable project knowledge. Reviews Claude Code auto-memory (MEMORY.md and its topic files) for learnings worth keeping, promotes proven ones into CLAUDE.md or .claude/rules/, records a correction as a lesson that persists across sessions, prunes stale or duplicate entries, and turns a recurring fix into a reusable skill. Use whenever the user asks what you have learned or saved about the project, which memories should become permanent rules, to remember a lesson or stop repeating a mistake, or to clean up, audit or check memory health.173 installsusing-superpowersUse when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions145 installs

Frequently asked questions about flagship

What does the flagship skill do?

Build, debug, or review code that uses Cloudflare Flagship feature flags from Workers, OpenFeature SDKs, the evaluation API, or Wrangler. Use for the Flagship binding, targeting rules, percentage rollouts and A/B splits, kill switches, local flag stores, and flag-related API tokens. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the flagship skill?

Run `npx @skills-hub-ai/cli install cloudflare-flagship` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/cloudflare-flagship/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does flagship work with?

flagship runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the flagship skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use flagship after installing it?

In Claude Code, type `/cloudflare-flagship` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the flagship skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.