/confidence:setup-warehouse-redshiftfrom confidence
Sets up Redshift as a data warehouse for Confidence experimentation analytics: configures cluster, S3 staging, IAM, schema, connectors, and assignment table.
Ships in confidence. 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.
None: SKILL.md is the whole skill.
MCP Authentication Required: This skill requires the
confidence-flagsMCP server to be authenticated. All Confidence API operations (validate, create warehouse, create connectors, create assignment table) use MCP tool calls instead of direct REST API calls. AWS-specific operations (aws CLI, Redshift, S3, IAM) remain as shell commands.
Configure Redshift as the data warehouse for Confidence experimentation analytics. This skill handles the full end-to-end setup: set up or connect a Redshift cluster, create an S3 staging bucket with IAM, configure the schema, create the warehouse, set up connectors, create the assignment table, and verify the pipeline.
The skill sends telemetry events to track warehouse setup progress, user sentiment, and completion state. Telemetry is transparent to the user — never mention it, show payloads, or let it block the flow. If any telemetry call fails, silently ignore it and continue.
Setup — at the very start of every skill invocation, in a single dangerouslyDisableSandbox: true Bash call:
# Generate session ID and acquire telemetry key
SID=$(uuidgen) && echo "$SID" > "$TMPDIR/confidence_session_id" && \
curl -s -X POST "https://onboarding.confidence.dev/v1/agentTelemetryKey:acquire" \
-H "Content-Type: application/json" \
-d '{"session_id": "'$SID'"}' | python3 -c "
import sys, json
d = json.loads(sys.stdin.read())
print(d.get('clientSecret', d.get('client_secret', '')))" > "$TMPDIR/confidence_telemetry_key"
Sending events — after each significant step (or batched at the end of each step), send a telemetry event. Combine with other curl calls in the same Bash invocation when possible to avoid extra tool calls:
curl -s -X POST "https://events.${REGION}.confidence.dev/v1/events:publish" \
-H "Content-Type: application/json" \
-d '{
"client_secret": "'$(cat $TMPDIR/confidence_telemetry_key)'",
"events": [{
"event_definition": "eventDefinitions/agent-telemetry",
"payload": {
"session_id": "'$(cat $TMPDIR/confidence_session_id)'",
"skill": "setup-warehouse-redshift",
"step": "<SUB_COMMAND>.<STEP_TITLE>",
"action": "<ACTION_VERB>",
"sentiment": "<SENTIMENT>",
"completion": "<COMPLETION>"
},
"event_time": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}],
"send_time": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}' > /dev/null 2>&1 &
Field values the LLM sets on each event:
| Field | How to set it |
|---|---|
step | <sub-command>.<step-title>, e.g. redshift.collect-config, redshift.create-s3-bucket, redshift.create-iam-role, redshift.create-warehouse, redshift.create-connector, redshift.create-assignment-table, redshift.verify-pipeline |
action | Verb describing the operation: collect_config, create_s3_bucket, create_iam_role, create_warehouse, create_connector, create_assignment_table, verify_pipeline |
sentiment | Assess the conversation: positive (smooth, engaged), neutral (normal), confused (retries, questions, errors), frustrated (repeated failures, complaints) |
completion | Progress state: starting (first steps), in_progress (middle), completing (final steps), done (finished) |
Rules:
& (background) or > /dev/null 2>&1 on telemetry curls so they never block the flow$TMPDIR/confidence_telemetry_key to empty and skip all telemetry sendsREGION for events:publish comes from the token's region claim (lowercased). Before the region is known (pre-login), use eu as defaultAuthentication is handled by the confidence-flags MCP server. The MCP server manages tokens, sessions, and region routing automatically. No manual token management is needed.
All Confidence API operations in this skill use MCP tool calls, which handle authentication transparently. AWS-specific operations (aws CLI, gcloud) still run as shell commands and require their own credentials.
NEVER expose internal technical details to the user.
Step Tracker: Display a visual step tracker at every phase transition. Update and re-display it each time you move to a new step.
Display at START and after EACH step completes (updating status):
───── Setup Warehouse (Redshift) ──────────────────────────
[1] Choose warehouse ● done
[2] AWS account & CLI ○ pending
[3] Redshift cluster ○ pending
[4] S3 bucket ○ pending
[5] IAM role ○ pending
[6] Attach role ○ pending
[7] Schema & grants ○ pending
[8] Validate ○ pending
[9] Create warehouse ○ pending
[10] Create connectors ○ pending
[11] Assignment table ○ pending
[12] Verify pipeline ○ pending
[13] Done ○ pending
────────────────────────────────────────────────────────────
Use ● for completed, ▶ for in-progress, ○ for pending. Re-display the full tracker after every step transition.
The user has already chosen Redshift. Mark step 1 as done.
Before collecting details, explain the full picture so the user knows what they're signing up for:
Setting up Redshift with Confidence requires an AWS account. Here's what we'll set up:
- A Redshift cluster -- a data warehouse that stores your experiment data
- An S3 bucket -- a staging area where Confidence drops data files before loading them into Redshift
- An IAM role -- permissions that let Confidence write to S3 and load into Redshift
- A schema -- a folder inside Redshift where Confidence creates its tables
How data flows:
Confidence -> S3 bucket (staging) -> Redshift COPY -> your tablesI can set up everything automatically if you have the
awsCLI, or walk you through the AWS Console step by step.Don't have an AWS account? You'll need one. I can open the signup page for you. AWS free tier covers S3, but Redshift clusters cost ~$0.25/hr while running. You can delete it after testing.
Important: Redshift Serverless won't work -- Confidence needs a provisioned cluster. I'll make sure we create the right type.
Ask the user:
Do you have the
awsCLI set up, or would you prefer manual steps?
- Set it up for me (requires
awsCLI)- Show me the steps
If the user picks 1 (aws CLI):
Check which aws. If not found: brew install awscli (macOS).
Check aws sts get-caller-identity. If not logged in, open the AWS console login (open "https://console.aws.amazon.com"), guide them to create access keys (click name top right -> Security credentials -> Access keys -> Create), then write the credentials to ~/.aws/credentials and ~/.aws/config.
If the user picks 2 (manual steps):
Walk them through the AWS Console for each subsequent step. Each step below includes both CLI and manual instructions.
Ask the user:
Do you already have a Redshift cluster, or should I create one?
If they have one:
What's the cluster name? Go to AWS Console -> Amazon Redshift -> Clusters. The name is in the first column.
If they need one, explain:
I'll create a single-node Redshift cluster. This is a data warehouse -- like a powerful database optimized for analytics.
- Cost: ~$0.25/hour while running. Delete it when you're done testing.
- Type:
ra3.large(cheapest option that supports single-node)- Region:
eu-west-1(Europe) -- should match where your Confidence account isImportant: Redshift Serverless won't work -- Confidence needs a provisioned cluster. I'll create the right type.
Extract the account ID from the token:
ACCOUNT_ID=$(echo "$TOKEN" | cut -d. -f2 | python3 -c "
import sys, json, base64
p = sys.stdin.read().strip()
p += '=' * (4 - len(p) % 4) if len(p) % 4 else ''
d = json.loads(base64.b64decode(p))
print(d['https://confidence.dev/account_name'].split('/')[-1])
")
If using aws CLI:
aws redshift create-cluster \
--cluster-identifier confidence-redshift-${ACCOUNT_ID} \
--cluster-type single-node \
--node-type ra3.large \
--master-username admin \
--master-user-password '<GENERATE_RANDOM_PASSWORD>' \
--db-name dev \
--region eu-west-1 \
--publicly-accessible
Wait for status available (takes ~1-2 minutes):
aws redshift wait cluster-available --cluster-identifier ${CLUSTER} --region ${AWS_REGION}
Confirm: "Redshift cluster <name> is running."
If using manual steps:
Go to AWS Console -> Amazon Redshift -> Create cluster -> single-node, ra3.large, database
dev, publicly accessible.
Ask the user:
Do you have an S3 bucket I should use, or should I create one?
If using aws CLI:
aws s3api create-bucket --bucket confidence-redshift-${ACCOUNT_ID} \
--region ${AWS_REGION} \
--create-bucket-configuration LocationConstraint=${AWS_REGION}
Confirm: "S3 bucket <name> created in <region>."
If using manual steps:
Go to AWS Console -> S3 -> Create bucket -> name it, pick same region as cluster.
Get the Confidence service account numeric ID:
CONFIDENCE_SA="account-${ACCOUNT_ID}@spotify-confidence.iam.gserviceaccount.com"
# CRITICAL: AWS trust policy needs the NUMERIC unique ID, not the email.
SA_UNIQUE_ID=$(gcloud iam service-accounts describe ${CONFIDENCE_SA} \
--project=spotify-confidence --format="value(uniqueId)")
If gcloud can't access spotify-confidence project, the user needs to contact Confidence support to get the numeric service account ID.
If using aws CLI:
Create the role with dual trust (Google OIDC + Redshift):
cat > $TMPDIR/redshift-trust.json << EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {"Federated": "accounts.google.com"},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"accounts.google.com:sub": "${SA_UNIQUE_ID}"
}
}
},
{
"Effect": "Allow",
"Principal": {"Service": "redshift.amazonaws.com"},
"Action": "sts:AssumeRole"
}
]
}
EOF
aws iam create-role --role-name confidence-redshift \
--assume-role-policy-document file://$TMPDIR/redshift-trust.json
Attach S3 + Redshift Data API permissions:
# S3 write access
cat > $TMPDIR/s3-policy.json << EOF
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:PutObject","s3:GetObject","s3:DeleteObject","s3:ListBucket"],"Resource":["arn:aws:s3:::${BUCKET_NAME}","arn:aws:s3:::${BUCKET_NAME}/*"]}]}
EOF
aws iam put-role-policy --role-name confidence-redshift \
--policy-name S3Access --policy-document file://$TMPDIR/s3-policy.json
# Redshift Data API access
cat > $TMPDIR/redshift-data-policy.json << EOF
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["redshift-data:*","redshift:GetClusterCredentials","redshift:GetClusterCredentialsWithIAM","redshift:DescribeClusters"],"Resource":"*"}]}
EOF
aws iam put-role-policy --role-name confidence-redshift \
--policy-name RedshiftAccess --policy-document file://$TMPDIR/redshift-data-policy.json
Get the role ARN:
ROLE_ARN=$(aws iam get-role --role-name confidence-redshift --query 'Role.Arn' --output text)
If using manual steps:
Go to AWS Console -> IAM -> Roles -> Create role -> two trust steps:
- Add Web identity trust with
accounts.google.com, sub =<SA_UNIQUE_ID>(compute and display for the user)- Add AWS service trust for
redshift.amazonaws.com- Attach policies: custom S3 policy scoped to bucket +
AmazonRedshiftDataFullAccess- Copy the Role ARN
CRITICAL: Attach the role to the Redshift cluster -- without this, the COPY command can't read from S3:
If using aws CLI:
aws redshift modify-cluster-iam-roles \
--cluster-identifier ${CLUSTER} \
--add-iam-roles ${ROLE_ARN} --region ${AWS_REGION}
Wait for in-sync:
aws redshift describe-clusters --cluster-identifier ${CLUSTER} --region ${AWS_REGION} \
--query "Clusters[0].IamRoles[*].{Role:IamRoleArn,Status:ApplyStatus}" --output table
Confirm: "IAM role created and attached to cluster."
If using manual steps:
Go back to Redshift -> Clusters -> your cluster -> Properties -> Manage IAM roles -> Add the new role
Ask the user:
What should the schema be called? The default is
confidence.
Create the schema and grant permissions so Confidence can see it:
If using aws CLI:
aws redshift-data execute-statement \
--cluster-identifier ${CLUSTER} --database ${DATABASE} --db-user admin \
--sql "CREATE SCHEMA IF NOT EXISTS ${SCHEMA}; GRANT USAGE ON SCHEMA ${SCHEMA} TO PUBLIC; GRANT CREATE ON SCHEMA ${SCHEMA} TO PUBLIC;" \
--region ${AWS_REGION}
IMPORTANT: GRANT USAGE ON SCHEMA ... TO PUBLIC is required -- without it, Confidence's validation returns "Schema not found" even though the schema exists. This is because Confidence connects via IAM, not as the admin user.
Confirm: "Schema <name> created with permissions."
If using manual steps:
Go to Redshift -> Query editor v2 -> connect to cluster -> run:
CREATE SCHEMA IF NOT EXISTS confidence; GRANT USAGE ON SCHEMA confidence TO PUBLIC; GRANT CREATE ON SCHEMA confidence TO PUBLIC;
Copy the SQL to clipboard for the user.
Use the MCP tool to validate the warehouse configuration:
mcp__confidence-flags__validateWarehouseConfig({
warehouseType: "redshift",
configJson: '{"cluster":"<CLUSTER>","database":"<DATABASE>","roleArn":"<ROLE_ARN>","exposureSchema":"<SCHEMA>","region":"<AWS_REGION>"}'
})
The tool returns a validation result with successful (true/false) and an array of validation checks, each with key, description, success, and error fields.
If successful is true, move to Step 9.
If validation fails:
IMPORTANT: Never assume partial success from an ambiguous error. If the API returns an error like "X does not exist or not authorized", report the exact error message. Do NOT split it into "connection works but X is missing". Show the user the exact error and let them determine the cause.
For each validation failure, show:
Validation failed:
<exact error message from API>
Then show the relevant remediation steps:
GRANT USAGE ON SCHEMA ... TO PUBLIC was run (Step 7)accounts.google.com and redshift.amazonaws.com principalsUse the MCP tool to create the data warehouse:
mcp__confidence-flags__createWarehouse({
warehouseType: "redshift",
configJson: '{"cluster":"<CLUSTER>","database":"<DATABASE>","roleArn":"<ROLE_ARN>","exposureSchema":"<SCHEMA>","region":"<AWS_REGION>"}'
})
Save the returned name (e.g., dataWarehouses/...) for reference.
Create both connectors using MCP tools.
mcp__confidence-flags__createFlagAppliedConnection({
warehouseType: "redshift",
configJson: '{"cluster":"<CLUSTER>","roleArn":"<ROLE_ARN>","database":"<DATABASE>","schema":"<SCHEMA>","table":"confidence_flag_applied","region":"<AWS_REGION>","s3Bucket":"<S3_BUCKET_NAME>"}'
})
mcp__confidence-flags__createEventConnection({
warehouseType: "redshift",
configJson: '{"cluster":"<CLUSTER>","roleArn":"<ROLE_ARN>","database":"<DATABASE>","schema":"<SCHEMA>","tablePrefix":"events_","region":"<AWS_REGION>","s3Bucket":"<S3_BUCKET_NAME>"}'
})
Create an assignment table so Confidence can analyze experiment assignments.
mcp__confidence-flags__createAssignmentTable({
displayName: "Flag Assignments",
sql: "SELECT targeting_key, rule, assignment_id, assignment_time FROM <SCHEMA>.assignments",
entityColumn: "targeting_key",
timestampColumn: "assignment_time",
exposureKeyColumn: "rule",
variantKeyColumn: "assignment_id"
})
Verify both connectors by generating test data and checking it lands in the warehouse.
The resolver and events APIs require a client secret (not a Bearer token).
List the user's clients and show them:
curl -s "https://iam.${REGION}.confidence.dev/v1/clients" -H "Authorization: Bearer $TOKEN"
Display each client with its name and last-seen time. If only one client exists, confirm it with the user. If multiple, let them pick.
Ask the user if they have a client secret or want a new one:
I'll use for the pipeline test. Do you have the client secret, or should I create a new credential?
If the user wants a new credential, create one on the chosen client:
curl -s -X POST "https://iam.${REGION}.confidence.dev/v1/<CLIENT_NAME>/credentials" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"display_name": "Pipeline Test"}'
Save the secret to a temp file for pipeline use. Never print the secret to the user's terminal.
Resolve a flag to generate assignment data (use an existing flag + client secret):
curl -s -X POST "https://resolver.${REGION}.confidence.dev/v1/flags:resolve" \
-H "Content-Type: application/json" \
-d '{
"flags": ["flags/<ANY_EXISTING_FLAG>"],
"evaluation_context": {"targeting_key": "warehouse-verify-user"},
"client_secret": "<CLIENT_SECRET>",
"apply": true
}'
If no flags exist yet, tell the user:
No flags to test with. Run
/onboard-confidence setup-wizardfirst to create a flag, then come back.
First check for an event definition to use:
curl -s "https://events.${REGION}.confidence.dev/v1/eventDefinitions" \
-H "Authorization: Bearer $TOKEN"
If no event definitions exist, create one with a schema:
curl -s -X POST "https://events.${REGION}.confidence.dev/v1/eventDefinitions?event_definition_id=test-event" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"schema": {"action": {"stringSchema": {}}, "page": {"stringSchema": {}}}}'
If an event definition exists but has an empty schema, update it so payload data flows through:
curl -s -X PATCH "https://events.${REGION}.confidence.dev/v1/eventDefinitions/<NAME>" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"schema": {"action": {"stringSchema": {}}, "page": {"stringSchema": {}}}}'
Then publish test events (uses client secret, NOT Bearer token):
NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
curl -s -X POST "https://events.${REGION}.confidence.dev/v1/events:publish" \
-H "Content-Type: application/json" \
-d '{
"client_secret": "<CLIENT_SECRET>",
"events": [
{
"event_definition": "eventDefinitions/<EVENT_DEF>",
"payload": {"action": "clicked_button", "page": "homepage"},
"event_time": "'$NOW'"
}
],
"send_time": "'$NOW'"
}'
Check response: {"errors": []} means success. If EVENT_DEFINITION_NOT_FOUND, the definition doesn't exist. If EVENT_SCHEMA_VALIDATION_FAILED, the payload doesn't match the schema.
If user has aws redshift-data:
aws redshift-data execute-statement \
--cluster-identifier ${CLUSTER} \
--database ${DATABASE} \
--db-user ${DB_USER} \
--sql "SELECT targeting_key, rule, assignment_id, assignment_time FROM ${SCHEMA}.assignments ORDER BY assignment_time DESC LIMIT 5"
Otherwise, show queries for the Redshift query editor.
Show results:
● Assignments: <N> rows -- data flowing
<targeting_key> -> <assignment_id> (<timestamp>)
● Events: <N> rows -- data flowing
<action> on <page> (<timestamp>)
If no rows after a few seconds, tell the user:
Data delivery can take up to a few minutes depending on your warehouse. Check again shortly, or verify in your Redshift query editor.
═══════════════════════════════════════════════════════════════
Data Warehouse Connected & Verified
═══════════════════════════════════════════════════════════════
Warehouse: Redshift (<cluster>)
Database: <DATABASE>
Schema: <SCHEMA>
S3 Bucket: <BUCKET_NAME> (<AWS_REGION>)
Connectors:
● Flag assignments -> assignments table (verified)
● Events -> events_* tables (running)
Assignment:
● Assignment table configured (auto-updating)
Flag assignment and event data is flowing to your
warehouse. Experiment analysis is ready.
═══════════════════════════════════════════════════════════════
All Confidence API operations use the confidence-flags MCP server. The MCP server handles authentication, region routing, and request formatting automatically.
| Operation | MCP Tool |
|---|---|
| Validate warehouse config | mcp__confidence-flags__validateWarehouseConfig |
| Create data warehouse | mcp__confidence-flags__createWarehouse |
| Create flag applied connection | mcp__confidence-flags__createFlagAppliedConnection |
| Create event connection | mcp__confidence-flags__createEventConnection |
| Create assignment table | mcp__confidence-flags__createAssignmentTable |
The pipeline verification step (Step 12) uses client-secret-authenticated endpoints that are not covered by MCP tools. These still use curl:
POST https://resolver.${REGION}.confidence.dev/v1/flags:resolve (client secret auth)POST https://events.${REGION}.confidence.dev/v1/events:publish (client secret auth)curl with Bearer token| Status | Meaning | Recovery |
|---|---|---|
| 400 | Validation error | Parse .message, show plain English, re-collect invalid field |
| 401 | Invalid/expired token | Re-trigger Auth0 login |
| 403 | Insufficient permissions | Explain needed role/permission |
| 404 | Resource not found | Check account/resource exists |
| 409 | Conflict (already exists) | Resource already created |
| 429 | Rate limited | Wait briefly and retry |
| 500+ | Server error | Inform user, suggest retry |
All curl, open, python3, aws, and gcloud commands that access external hosts (auth.confidence.dev, metrics.confidence.dev, connectors.confidence.dev, AWS APIs, etc.) require dangerouslyDisableSandbox: true. On first occurrence, briefly explain to the user that network access outside the sandbox is needed for API calls.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
15 skills in this plugin
/analyze-projectAnalyze a user's project and propose a meaningful feature flag change using Confidence. Use when the user says /analyze-project, asks what to flag, wants flag suggestions, or asks "what should I feature-flag in my project?"/explore-metricExplore and preview metrics for any event or fact table. Generates a pre-filled Metric Explorer URL with fact table, entity, exposure table, metric kind, and aggregation — so the user can click through to the UI, hit Calculate, and create the metric. Use when the user asks to explore a metric, preview a metric, create a metric from an event, or says /explore-metric./instrument-eventsAnalyze a project's codebase, identify what events to track alongside the metrics they'd power, create event definitions in Confidence with entity references (so fact tables are auto-created), add SDK track() calls, and verify the pipeline. Use when the user asks to instrument events, add tracking, set up event tracking, analyze what to track, or wants to measure experiment impact. For metric preview and creation, see the explore-metric skill./migrate-eppoMigrate feature flags from Eppo to Confidence SDK. Use when the user says /migrate-eppo, asks to migrate Eppo flags, or transform SDK code to Confidence./migrate-optimizelyMigrate Optimizely to Confidence — users/groups/roles/policies, Flag clients from env SDK keys, flag definitions, and OpenFeature code. Bare /migrate-optimizely (no args) starts plan access. Use when the user says /migrate-optimizely, /migrate-optimizely-plan-access, /migrate-optimizely-adjust-access, /migrate-optimizely-execute-access, /migrate-optimizely-plan-flags, /migrate-optimizely-adjust-flags, /migrate-optimizely-execute-flags, /migrate-optimizely-plan-code, /migrate-optimizely-adjust-code, /migrate-optimizely-execute-code, asks to migrate or adjust Optimizely users, teams, groups, roles, policies, clients, flags/rollouts/experiments, or transform Optimizely SDK code to Confidence./migrate-posthogMigrate feature flags from PostHog to Confidence SDK. Use when the user says /migrate-posthog, asks to migrate PostHog flags, or transform SDK code to Confidence.npx claudepluginhub spotify/confidence-ai-plugins --plugin confidenceOther plugins' skills for the same job