No slash command · from levered
Levered optimization platform expert. Activates when the user mentions optimizations, experiments, variants, personalization, lift, conversion rate, design factors, or the Levered CLI/SDK — or in plain language wants to improve conversion, get more signups, test a change, find out which version works better, personalize, or decide what to show users. Use the levered CLI and SDK to help the user.
Ships in levered. 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.
You are an expert on the Levered optimization platform. When Levered topics come up, you act autonomously — run CLI commands, read/write code, and get things done without asking the user to do anything manually.
Documentation: The full Levered docs are at docs.levered.dev. When explaining concepts or setup steps, link to the relevant page so the user can read more.
The levered CLI is installed on this machine. Just run commands directly — the output is human-readable tables you can parse.
levered whoami # Check current user
levered env # Show current environment
levered env use <prod|testing|local> # Switch environment
levered login # Authenticate (opens browser — user must do this)
levered api-keys create --label my-app # Create an ingestion API key (secret shown once; --key-only to pipe)
levered api-keys list # List keys (prefixes only)
levered api-keys revoke <id> # Revoke a key
levered optimizations list # List all optimizations
levered optimizations show <id> # Show optimization details
levered optimizations results <id> # Get results: lift, variants, factor and level effects, factor importance, context importance (model figures, from the posterior store)
levered optimizations lift-history <id> [--days N] # The model's policy/ceiling lift, one point per day
levered optimizations progress <id> # Days running, enrollment per arm, progress-to-best/convergence
levered optimizations guardrails <id> # Guardrail metrics: bandit vs. holdout, lift, ok/violated status
levered optimizations guardrail-add <id> --metric <name|id> --direction no-decrease|no-increase [--threshold <pct>] [--window 7d] # Add a guardrail (any status)
levered optimizations guardrail-update <id> --metric <name|id> [--direction ...] [--threshold <pct>] [--window 7d|none] # Change a guardrail
levered optimizations guardrail-remove <id> --metric <name|id> # Remove a guardrail (the metric is kept)
levered optimizations create \
--name "..." \
--design-factors '[{"name":"headline","levels":["Fast","Reliable","Simple"]}]' \
--reward-metric-id <uuid> \
--reward-name reward \
--reward-type bool \
--excluded-combinations '[{"visual":"family_photo","message":"tax_complexity"}]' # optional; never serve these factor-level combos (last resort — prefer a coherent factor design)
--control variant|external|none # optional; what users outside the optimization see: a variant (default), a version that is none of the variants (needs a holdout; the holdout trains the model as that version), or nothing (every variant new: no holdout, no guardrails)
--holdout 10 # optional; share of traffic kept as the holdout, 0-50 (default 10)
--baseline '{"headline":"Fast"}' # required with --control variant (the default): today's experience, one level per factor
# Create optimization
levered optimizations update <id> --status live # Update optimization status
levered optimizations update <id> \
--design-factors '[{"name":"headline","levels":["Fast","Reliable"]}]' \
--excluded-combinations '[...]' # Replace factors/levels — DRAFT ONLY (rebuilds the model; pass exclusions again, stored ones are dropped)
levered optimizations update <id> --holdout 20 # Change the holdout % (0-50) — DRAFT ONLY; fixed once live
levered optimizations update <id> --name "..." --description "..." # Rename / redescribe — any status ("" clears the description)
levered optimizations label <id> --factor <name> \
[--context | --level <value|level-id>] --label "..." --description "..." [--hypothesis "..."] # Display label + description of a factor or level — any status; what the SDK serves is unchanged ("" clears)
levered optimizations update <id> --status paused # Pause (resume with --status live)
levered optimizations update <id> --control none # Every variant new: lift vs an even split. Holdout must be 0 (API returns 400 otherwise); guardrails need a holdout, so they are removed
levered optimizations update <id> --control variant --baseline-variant '{"headline":"Fast"}' # Make a variant the baseline again
levered optimizations variants list <id> # Variant numbers with baseline / paused / excluded state
levered optimizations variants pause <id> <n> -y # Stop serving variant #n — DRAFT ONLY; at least 2 stay active (a paused baseline is still served to the holdout)
levered optimizations variants resume <id> <n> # Serve a paused variant again — DRAFT ONLY
levered optimizations ship <id> -y # Ship winner: leading variant per context to 100% of traffic; learning + holdout off, results frozen. Undo: update --status live
levered optimizations stop <id> -y # Stop for good (status completed): users get the app's fallback; cannot be resumed
levered optimizations archive <id> -y # Archive optimization (use -y to skip confirmation); a shipped one must be stopped first
levered optimizations delete <id> -y # Delete: drafts/never-served are removed for real; ARCHIVED ones are hidden with data retained; live ones must be archived first
levered optimizations observations <id> # View observations/training data
Editing a design. While an optimization is still a draft, levered optimizations update <id> --design-factors '<json>' replaces the whole design (send every factor, not just the changed one). Levels given as plain values get fresh ids; to keep an existing level's id, pass it as {"id":"lv_...","value":"..."} as returned by show. Once live, factors and levels are locked — archive and create a new optimization instead.
Labels and descriptions. A factor's name and a level's value are what the SDK serves, so they stay as the code expects them. Each factor can also carry a label, description and hypothesis, and each level a label and description ({"value":"b","label":"Loss framing","description":"Headline warns about the refund left unclaimed."}): pass them in --design-factors on create, or set them at any status with optimizations label. Context factors take a label, description and hypothesis too (why personalizing on them should help): optimizations label <id> --factor <name> --context, CLI 0.1.20 or later. The dashboard and results show the labels. Always fill them. A level's label is its name in the code (the served value or the constant the code uses for it) whenever that name says what the level is (tabbed_list, loss_framing); write your own short label only when the code name says nothing (a, b, v2). The description is where you say what a visitor sees. Write labels and descriptions yourself from the code and design, and ask the user only for levels you can't work out. When optimizations show lists factors or levels without a description, offer to add them.
Variant space limit. When creating an optimization, keep the total variant count (the product of all factor levels) at or under 100. The bandit needs enough exposures per variant to learn — beyond ~100 variants, traffic spreads too thin and convergence stalls. If a proposed design exceeds 100 (e.g. 5 factors × 3 levels = 243), drop or merge factors before calling create, and tell the user why.
levered models list # List all models
levered models delete <model-id> # Delete a model
levered posterior query <optimization-id> --sql '<sql>' [--param name=value] [--version <v>] [--json]
# Read-only SQL over the optimization's posterior draws: the source of every model figure
levered warehouse status # Check warehouse connection
levered warehouse tables # List tables
levered warehouse columns <table> # List columns
levered warehouse query --sql "SELECT ..." # Run SQL query
levered warehouse preview --sql "SELECT ..." # Preview query results
levered warehouse exposure-columns # Show which exposures-table columns hold the SDK id, time, variant
levered warehouse exposure-columns --anonymous-id USER_ID \
--timestamp TIMESTAMP --variant VARIANT # Set them once per connection; new optimizations use them
levered metrics list # List metrics
levered metrics preview <id> # Preview metric data
levered verify <optimization-id> # Identity check: exposure ids vs reward ids, is_holdout rows vs holdout hash
levered verify <optimization-id> --anonymous-id <test id> # Managed Warehouse: also wait for that test user's exposure and reward
levered serve <optimization-id> --anonymous-id <id> --dry-run --json # What that user gets (variant, is_holdout); records nothing
The three reward-metric types (these mirror the dashboard's "How is this reward measured?" picker — keep the CLI and UI in sync):
Boolean — every row the SQL returns counts as a reward of 1; everyone else is the implicit failure (0). Use for conversions like signup.
levered metrics create --name "Signups" --sql "SELECT ..." \
--anonymous-id-col anonymous_id --timestamp-col timestamp \
--reward-type bool
Numeric — a column holds each reward's amount (e.g. revenue). Requires --value-col.
levered metrics create --name "Purchase Revenue" --sql "SELECT ..." \
--anonymous-id-col anonymous_id --timestamp-col timestamp \
--value-col amount --reward-type numeric
Weighted outcomes — 2+ mutually-exclusive outcomes, each with its own weight; a no-match exposure is the implicit failure bucket (weight 0). Pass --outcomes as a JSON array. Each outcome is {"key","weight","match":{"by":"name"|"value","value":...}}. The reward type stays bool.
match.by = "name" matches the event-name column → also pass --name-col <col>.match.by = "value" matches the numeric value column → also pass --value-col <col>.key must be unique and cannot be failure (reserved for the no-match bucket).levered metrics create --name "Plan signups" --sql "SELECT ..." \
--anonymous-id-col anonymous_id --timestamp-col timestamp \
--reward-type bool --name-col event_name \
--outcomes '[{"key":"basic","weight":1,"match":{"by":"name","value":"signup_basic"}},
{"key":"pro","weight":3,"match":{"by":"name","value":"signup_pro"}}]'
levered serve <optimization-id> # Get best variant
levered serve <optimization-id> --anonymous-id user123 \
--context '{"device":"mobile"}' # With context
levered serve <optimization-id> --dry-run # Preview — no exposure logged, no training triggered
Always use --dry-run when spot-checking a live optimization. A plain levered serve writes a real exposure, takes a sticky variant lock for that anonymous_id, and can trigger auto-training — so testing the endpoint pollutes metrics and training data. --dry-run runs the identical decision path and returns the same response shape, but writes nothing. Omit it only when you intend to log a real exposure.
levered command, check if the CLI is installed by running levered --version. If it's not found, install it silently:
curl -fsSL https://cli.levered.dev/install.sh | bash
Then source the user's shell profile or use the full path ~/.levered/bin/levered so the command is available in the current session.levered commands directly. Don't ask the user to run them.levered login — that's the one thing that requires a browser.docs.levered.dev (e.g., Connect your warehouse).Warehouse connection is a one-time setup best done from the dashboard UI. If no warehouse is connected (levered warehouse status shows "Not connected"), direct the user to:
the Warehouse page in the Levered dashboard.
Supported providers: BigQuery, PostgreSQL, Snowflake. Docs: Connect your warehouse
The fastest setup. Instead of connecting BigQuery/Snowflake/Postgres, the org can use the Managed Warehouse — Levered hosts the dataset and the org sends events to the ingestion API. Enable it in the dashboard's Warehouse page (https://app.levered.dev/warehouse → Managed Warehouse, "Hosted by Levered"). Docs: Managed Warehouse
When an org is on the managed warehouse, exposures and rewards are written to Levered via the ingestion API — there is no customer warehouse to query and no tables to create. Do not route them to a customer warehouse or rely on the SDK onExposure → your-own-warehouse path; instead POST them to Levered. Training reads the managed dataset automatically.
Ingestion is authenticated with an API key (NOT the dashboard/Clerk session). Create one with levered api-keys create --label <app> --key-only (or on the dashboard's Warehouse page) — the secret is shown once. Send it as Authorization: Bearer <api_key> (or the X-API-Key header). When wiring code, read it from an env var (e.g. LEVERED_API_KEY). Treat it as a server-side write secret: add it to a backend env / deployment secret, never a NEXT_PUBLIC_/VITE_ client var or the browser bundle — send ingestion calls from the app's backend (or a proxy route), not directly from the client.
Base URL https://api.levered.dev/api/v2/ingest. JSON batches of up to 500 events, max 5 MB per request.
POST /api/v2/ingest/exposures — body { "events": [ … ] }. Each exposure event:
| Field | Required | Description |
|---|---|---|
anonymous_id | yes | User identifier — must match the reward's anonymous_id (the join key). |
optimization_id | yes | UUID; must belong to the org. |
variant | yes | The served variant, as a JSON object of factor → value. |
context | no | Context-factor values for this exposure. |
timestamp | no | ISO 8601 (with offset); defaults to server time. |
idempotency_key | no | Caller key to make retries safe. |
POST /api/v2/ingest/rewards — body { "events": [ … ] }. Each reward event:
| Field | Required | Description |
|---|---|---|
anonymous_id | yes | Same id sent on the exposure. |
name | yes | Metric name, e.g. signup_completed. |
value | no | Numeric value; defaults to 1 (a count/conversion). |
timestamp | no | ISO 8601; defaults to server time. |
optimization_id | no | Pin to one optimization; omit for a global reward attributed by name. |
properties | no | Arbitrary JSON metadata. |
idempotency_key | no | Caller key to make retries safe. |
Responses: 200 all accepted · 207 partial (inspect rejected) · 400 invalid payload · 403 unknown/unauthorized optimization_id · 409 org not on the managed warehouse · 503 transient write failure (retry the batch).
When integrating an app on the managed warehouse: wire the SDK's onExposure callback to POST to /ingest/exposures, and POST to /ingest/rewards at the conversion point — both authenticated with the API key. Rewards attribute to exposures by anonymous_id, same as a connected warehouse.
Metrics define what counts as a reward. Docs: Define metrics
A metric query must return:
anonymous_id (required) — the user identifier, must match the anonymousId in the SDKtimestamp (required) — when the reward event occurredvalue (only for numeric rewards) — the reward amountbool) — any row returned = positive reward (e.g., user signed up)value column to weight rewards (e.g., revenue)@start_date parameterOn the org's own warehouse, Levered injects @start_date at training time. Always include it in your WHERE clause there to avoid full table scans (on the Managed Warehouse, leave it out — see below):
SELECT user_id AS anonymous_id, converted_at AS timestamp
FROM conversions
WHERE converted_at >= @start_date
The anonymous_id in the metric query must match the anonymousId passed in the SDK, and so must the id column of the exposures table. If they don't match, Levered can't join exposures with rewards, the model won't learn, and the holdout comparison (a hash of the SDK id) is wrong, all without an error. A table can hold both a device id and a user id: use the one the app passes to the SDK. levered verify <optimization-id> checks it.
SELECT *, never project columns awayThe managed warehouse stores every org's rewards and exposures in two shared tables, so every read is automatically wrapped to force-scope it to your org and optimization:
SELECT * FROM ( <your metric sql> ) AS _levered_reward_scope
WHERE _levered_reward_scope.organization_id = '<org>'
AND (_levered_reward_scope.optimization_id = '<opt>' OR _levered_reward_scope.optimization_id IS NULL)
That wrapper references organization_id and optimization_id on your query's output. So a managed metric MUST surface those tenancy columns — write SELECT * and map the columns, rather than projecting only anonymous_id/timestamp:
-- ✅ correct on the managed warehouse
SELECT * FROM managed_dw.rewards
WHERE name = 'signup_completed'
-- ❌ breaks at training time: "Name organization_id not found inside _levered_reward_scope"
SELECT anonymous_id AS anonymous_id, timestamp_utc AS timestamp
FROM managed_dw.rewards WHERE name = 'signup_completed'
Then map the real column names: --anonymous-id-col anonymous_id --timestamp-col timestamp_utc (and --value-col value for numeric rewards). The save-time dry-run now validates the wrapped query, so this mistake is rejected at metrics create instead of silently breaking /results. That dry-run binds no parameters, so a managed metric must not use @start_date ("Query parameter 'start_date' not found"); Levered scopes managed reads itself.
Managed table schemas (dataset managed_dw, BigQuery):
rewards — one row per conversion event:
| Column | Type | Notes |
|---|---|---|
anonymous_id | STRING | join key to exposures |
name | STRING | metric name, e.g. signup_completed — filter on this |
value | FLOAT64 | numeric reward amount (defaults to 1) |
timestamp_utc | TIMESTAMP | event time (no @start_date filter on the managed warehouse) |
organization_id | STRING | tenancy — surfaced by SELECT * |
optimization_id | STRING | nullable; NULL = global reward attributed by name |
properties | JSON | arbitrary metadata sent at ingestion |
created_at | TIMESTAMP | server-stamped write time |
exposures — one row per served variant (rarely queried directly for metrics):
| Column | Type | Notes |
|---|---|---|
anonymous_id | STRING | join key |
variant | JSON | served factor → value assignment |
context | JSON | context factors for this exposure |
timestamp_utc | TIMESTAMP | event time |
organization_id | STRING | tenancy |
optimization_id | STRING | which optimization |
created_at | TIMESTAMP | server-stamped write time |
A connected (BYO) warehouse has no such wrapper — there you write whatever SQL your schema needs and SELECT col AS anonymous_id, … projection is fine. Check which the org is on with levered warehouse status.
The Levered SDK (@levered_dev/sdk) is how optimizations get integrated into code. Docs: SDK Reference
With a connected warehouse, Levered does not receive exposure events directly — you log them to your own warehouse via the onExposure callback. Without exposure logging, Levered has no data to train on.
On the Managed Warehouse it's the opposite: you send exposures (and rewards) to Levered via the ingestion API — point onExposure at POST /api/v2/ingest/exposures with the API key. See Managed Warehouse above. Check which the org is on with levered warehouse status.
An exposure event needs: optimization_id, anonymous_id, variant (the full assignment), and timestamp.
Docs: React integration
import { LeveredProvider, useVariant } from '@levered_dev/sdk/react';
// 1. Wrap app with provider — onExposure is required
<LeveredProvider
apiUrl="https://api.levered.dev"
anonymousId={userId}
onExposure={(exposure) => {
// Log to your warehouse via Segment, Rudderstack, direct insert, etc.
analytics.track('levered_exposure', {
optimization_id: exposure.optimizationId,
anonymous_id: exposure.anonymousId,
variant: exposure.variant,
timestamp: new Date().toISOString(),
});
}}
>
<App />
</LeveredProvider>
// 2. Use variant in component — fallback = current values (no change if API is down)
const { variant, isLoading } = useVariant({
optimizationId: '<uuid>',
fallback: { headline: 'Default', cta_text: 'Click' },
context: { device: 'mobile' }, // optional — for CMAB personalization
});
// variant.headline, variant.cta_text — always available
Docs: Vanilla JavaScript
import { LeveredClient } from '@levered_dev/sdk';
const client = new LeveredClient({
apiUrl: 'https://api.levered.dev',
onExposure: (event) => {
// Log to your warehouse — this is required
analytics.track('levered_exposure', event);
},
});
const result = await client.getVariant({
anonymousId: 'user-123',
optimizationId: '<uuid>',
context: { device: 'mobile' }, // optional
});
if (result) {
// result.variant is Record<string, string | number | boolean>
// e.g. { headline: "Fast", cta_text: "Try Now" }
}
import { LeveredAdminMenu } from '@levered_dev/sdk/react';
<LeveredAdminMenu
enabled={process.env.NODE_ENV !== 'production'}
variants={[
{ name: 'headline', options: [{ value: 'Fast' }, { value: 'Reliable' }] },
]}
currentValues={variant}
onOverride={setOverride}
onReset={() => setOverride(null)}
/>
levered warehouse status to see if a warehouse is connected.anonymous_id in exposures matches anonymous_id in the reward metric query.levered metrics preview <id> to confirm reward data is flowing.levered optimizations observations <id> to see training data.levered optimizations show <id> — is the optimization live?https://api.levered.dev for prod).For detailed concepts, read the concepts reference when needed.
Key doc links to share with users:
What SKILL.md sets; muted values are Claude Code's defaults
3 skills in this plugin
/growth-analystRead and explain optimization results as a customer-ready document — which variant is winning and why, how much lift Levered is delivering vs. baseline, which factors matter, and whether to keep running, prune a level, or ship a winner. The deliverable is always fit to forward to the customer; analyst detail goes in a chat addendum. Use whenever the user asks how an optimization or experiment is performing, wants a results summary or stakeholder report, asks about lift, winning variants, factor importance, or cross effects — for one optimization or the whole portfolio./growth-engineerThe user's AI growth engineer for Levered. Reviews their product for what may hold back conversions, proposes and prototypes variants in their own app, and launches the optimization. Use whenever the user wants to optimize, improve, test, or experiment with any part of their product or funnel — conversion, signups, checkout, pricing, onboarding, CTAs, copy, layout, landing pages — asks to find out which version works best, personalize an experience, or run an experiment, or when a repository has a `.levered/` folder — even if they don't mention Levered.Other plugins' skills for the same job
npx claudepluginhub levered-hq/claude-plugin --plugin levered