Skill: Switch Dataset
Purpose
Change the active dataset. Updates the active pointer, validates the target dataset exists, and confirms with a summary of what's now active.
When to Use
Invoke as /switch-dataset {name} when the user wants to analyze a different dataset than the currently active one.
Instructions
Step 1: Validate the target dataset
- List available datasets by checking
.knowledge/datasets/directory for subdirectories withmanifest.yamlfiles - Normalize the target name to lowercase for comparison (handles SALES-DATA → sales-data)
- If
{name}matches exactly (case-insensitive), proceed to Step 2 - If not found, try fuzzy matching:
- Check if
{name}is a substring of any dataset name (e.g., "marketing" would match "marketing-prod") - Case-insensitive partial match
- If exactly one match found, use that dataset and inform user: "Matched '{name}' to '{actual_dataset_name}'"
- If multiple matches found, list all matches and ask user to choose
- Check if
- If still not found, list all available datasets with brief descriptions (from manifests) and ask user to choose or suggest running
/connect-datato add a new dataset
Step 2: Check if already active
- Read
.knowledge/active.yamlto get the currentactive_dataset - If
{name}matches the current active dataset (case-insensitive):- Inform the user: "The {name} dataset is already active."
- Display the current dataset summary (same format as Step 6)
- List other available datasets they could switch to instead
- STOP here (do not proceed to Step 3)
Step 3: Validate the data brain exists
- Check that
.knowledge/datasets/{name}/manifest.yamlexists - If it doesn't exist, suggest: "Dataset '{name}' directory exists but has no manifest. Run
/connect-datato set it up." - If manifest is missing, STOP (do not proceed)
Step 4: Check for in-progress work (CRITICAL SAFETY CHECK)
This step prevents accidental loss of analytical work. When you switch datasets, files in working/ become contextually orphaned — they contain SQL queries, charts, and data tied to the OLD dataset's schema and tables, which won't match the NEW dataset's structure. This doesn't delete the files, but it makes resuming that work much harder because the context has changed.
Why explicit confirmation is required: Users often have hours of work in the working/ directory. A dataset switch mid-analysis can make that work difficult or impossible to resume without manually reconnecting the artifacts to the original dataset.
- List all files in
working/directory (exclude.gitkeepand hidden files like.DS_Store) - If 3 or more files exist:
- Warn: "⚠️ You have {count} files in progress for {old_dataset}, including: [list first 3-5 files]. Switching datasets now may make that work harder to resume. Continue anyway?"
- Provide two explicit options:
- "Type 'yes' to proceed with the switch"
- "Type 'no' to cancel and stay on {old_dataset}"
- HALT and wait for user response
- If user says "no" or "cancel" or "wait": STOP immediately and inform them the switch was cancelled
- If user says "yes" or "continue" or "proceed": Continue to Step 5
- If fewer than 3 files exist, proceed directly to Step 5 (no confirmation needed — minimal risk of context loss)
Step 5: Update the active pointer
- Read
.knowledge/active.yaml - Update
active_datasetto{name}(use the exact case from the manifest) - Write updated
.knowledge/active.yaml
Step 6: Confirm the switch
Read the target dataset's manifest.yaml and display a confirmation summary using this format:
✓ Switched to: {name}
Tables: {count of tables in manifest}
Date range: {date_range.start} to {date_range.end} (or "not specified" if missing)
Connection: {connection_type}
Last analysis: {last_used or "never"}
Row counts: {summary of top 3 tables by row count with table names, or list all if ≤3 tables}
Example:
✓ Switched to: analytics_prod
Tables: 6
Date range: 2024-01-01 to 2026-03-31
Connection: snowflake
Last analysis: 2026-04-01
Row counts: fct_orders (245K), fct_sessions (1.2M), dim_users (89K)
If the user had in-progress work and proceeded anyway, add a reminder for how to switch back:
→ To return to {old_dataset}, run: /switch-dataset {old_dataset}
Anti-Patterns
- Never silently switch — always confirm with a summary
- Never skip the in-progress work check — if working/ has 3+ artifacts, HALT and require explicit user confirmation before proceeding
- Never infer the dataset — only switch when explicitly requested via this skill
- Never fail on case mismatch — normalize to lowercase for comparison (SALES-DATA should match sales-data)
- Never assume data_sources.yaml exists or is populated — it may be empty, use
.knowledge/datasets/directory listing as source of truth - Never re-switch to an already-active dataset — detect this in Step 2 and inform user instead of performing redundant operations