Quickstartsplitch://quickstart
Zero to a resolving Flag.
This page walks the CLI path, and every step ends on a verify round-trip.
Building with a coding agent?
Install the Splitch skill in the consumer repository. Codex, Claude Code, and OpenCode will use the CLI and its stable JSON output instead of operating the Control Panel in a browser.
npx skills add https://github.com/zaks-io/splitch/tree/main/skills/splitchFor an agent with native MCP support, you can also connect the remote server directly.
claude mcp add --transport http splitch https://mcp.splitch.devYour agent calls that endpoint and signs in on its first tool call, so there is no key to copy.
authenticate → pick an Org → create an App (dev+prod Envs auto-provisioned)
→ select the dev Environment → get a Client Key → create a Flag
→ enable + rollout → VERIFY (reason SPLIT) → wire the SDK → first real ExposureStep 1 / 9
Install and authenticate
The CLI ships on npm. Log in with the device flow: it prints a verification URL and polls until approved.
npm install --global @splitch/cli splitch loginStep 2 / 9
Pick an Organization
Discover the Organizations your token can reach, then pick one.
splitch orgs listStep 3 / 9
Create an App
A dev and a prod Environment are auto-provisioned. You do not create Environments by hand for the common case.
splitch apps create --org <orgId> --name "My App"Step 4 / 9
Select the dev Environment
Active context fills in IDs on every later call. It is convenience only and never widens authorization.
splitch use --app my-app --env devStep 5 / 9
Get your credential
The Client Key is public and safe to ship in a browser. The API Key is secret, surfaced once, for trusted servers. New Client Keys start open to all origins so they work immediately; lock them to your origins before production.
splitch client-key getStep 6 / 9
Create a Flag
Flag definition is App-level; serving config is per-Environment. A fresh Flag starts disabled with rollout null — it only ever serves the Default Variant until you flip Configuration.
splitch flags create --key new-checkout --variants on,offStep 7 / 9
Enable and roll out
Turn the Flag on and set the baseline rollout to 100% so every Targeting Key in this Environment gets the non-default Variant. Configuration fields are documented at /docs/flags.
splitch flag-config update new-checkout --enabled true --rollout 100Step 8 / 9
Verify
Confirm the Flag resolves for a Targeting Key without firing an Exposure. reason "DISABLED" means the Flag is still inert (enabled false) — that is not a pass. After the enable step you should see reason "SPLIT" and value true. One green round-trip with SPLIT proves auth, Environment, credential, and Flag config all line up.
splitch flags verify new-checkout --targeting-key test-user-1 --json # before enable: {"value":false,"variantName":"off","reason":"DISABLED"} # after enable: {"value":true,"variantName":"on","reason":"SPLIT"}Step 9 / 9
Wire the SDK
evaluate() fires the first real Exposure and closes the loop. Fail-loud is one check: an error resolution names its code instead of hiding behind a default.
import { createSplitchClient } from "@splitch/sdk"; // Paste keyMaterial from `splitch client-key get` (pk_…; not the ck_… keyId). const splitch = createSplitchClient({ clientKey: "pk_..." }); const d = await splitch.evaluateDetails("new-checkout", { targetingKey: userId, }); if (d.reason === "ERROR") renderFallback(d.errorCode); else render(d.value);
When a step fails
splitch fails loud, then guides. Every operational 409 carries a machine-stable recommendedAction token. Branch on the token, not on prose.
| You hit | It means | Do |
|---|---|---|
| APPROVAL_REVIEW_REQUIRED | the Environment Policy gates this change | review the durable request |
| VARIANT_NOT_AVAILABLE | the Variant is not promoted to this Environment | promote the Variant to this Environment, then retry |
| RUN_FROZEN | the edit touches a running Run | clone into a new draft Run |
| APP_MISMATCH | wrong key for this App or Environment | fetch the credential for this Env |
| 401 / 403 | bad or revoked key, or origin not allowed | check the key and its origin allow-list |
splitch