agentleFS
ai-analyst-labai-analyst-lab/ai-analyst/.claude/skills/switch-dataset/SKILL.md

switch-dataset

Skill304 starsChanged 2 months agoMITView on GitHub

Change the active dataset to switch between different data sources for analysis. Use this skill whenever the user wants to analyze a different dataset, switch to another database, change data sources, work with different tables, or explicitly invokes /switch-dataset. This skill handles the full switch workflow: validating the target dataset exists, checking for in-progress work that might be lost, updating the active pointer, and confirming the switch with a summary of the new dataset. Apply when users say things like "switch to sales data", "use the other dataset", "change to production database", "work with the marketing tables instead", "let's look at last month's data instead", "/switch-dataset analytics", or any request to change which dataset is currently being analyzed. Also trigger when starting a new analysis if the user mentions a dataset name that differs from the currently active one.

The file

Show its rules and text

We split this skill into the rules it gives an agent

19 rules. About 0 are common, 10 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If {name} matches exactly (case-insensitive), proceed to Step 2

    line 21
  2. Distinctive:

    If not found, try fuzzy matching:

    line 22
  3. Very specific:

    Check if {name} is a substring of any dataset name (e.g., "marketing" would match "marketing-prod")

    line 23
  4. Distinctive:

    If exactly one match found, use that dataset and inform user: "Matched '{name}' to '{actual_dataset_name}'"

    line 25
  5. Distinctive:

    If multiple matches found, list all matches and ask user to choose

    line 26
  6. Very specific:

    If still not found, list all available datasets with brief descriptions (from manifests) and ask user to choose or suggest running …

    line 27
  7. Very specific:

    Read .knowledge/active.yaml to get the current active_dataset

    line 31
  8. Very specific:

    If {name} matches the current active dataset (case-insensitive):

    line 32
  9. Distinctive:

    STOP here (do not proceed to Step 3)

    line 36
  10. Very specific:

    Check that .knowledge/datasets/{name}/manifest.yaml exists

    line 40
  11. Very specific:

    If it doesn't exist, suggest: "Dataset '{name}' directory exists but has no manifest.

    line 41
  12. Distinctive:

    If manifest is missing, STOP (do not proceed)

    line 42
  13. Distinctive:

    If 3 or more files exist:

    line 51
  14. Distinctive:

    If user says "no" or "cancel" or "wait": STOP immediately and inform them the switch was cancelled

    line 57
  15. Distinctive:

    If user says "yes" or "continue" or "proceed": Continue to Step 5

    line 58
  16. Distinctive:

    If fewer than 3 files exist, proceed directly to Step 5 (no confirmation needed — minimal risk of context loss)

    line 59
  17. Very specific:

    Update active_dataset to {name} (use the exact case from the manifest)

    line 64
  18. Very specific:

    Read the target dataset's manifest.yaml and display a confirmation summary using this format:

    line 69
  19. Distinctive:

    If the user had in-progress work and proceeded anyway, add a reminder for how to switch back:

    line 90

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. List available datasets by checking .knowledge/datasets/ directory for subdirectories with manifest.yaml files
  2. Normalize the target name to lowercase for comparison (handles SALES-DATA → sales-data)
  3. If {name} matches exactly (case-insensitive), proceed to Step 2
  4. 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
  5. If still not found, list all available datasets with brief descriptions (from manifests) and ask user to choose or suggest running /connect-data to add a new dataset

Step 2: Check if already active

  1. Read .knowledge/active.yaml to get the current active_dataset
  2. 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

  1. Check that .knowledge/datasets/{name}/manifest.yaml exists
  2. If it doesn't exist, suggest: "Dataset '{name}' directory exists but has no manifest. Run /connect-data to set it up."
  3. 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.

  1. List all files in working/ directory (exclude .gitkeep and hidden files like .DS_Store)
  2. 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
  3. 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

  1. Read .knowledge/active.yaml
  2. Update active_dataset to {name} (use the exact case from the manifest)
  3. 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

  1. Never silently switch — always confirm with a summary
  2. Never skip the in-progress work check — if working/ has 3+ artifacts, HALT and require explicit user confirmation before proceeding
  3. Never infer the dataset — only switch when explicitly requested via this skill
  4. Never fail on case mismatch — normalize to lowercase for comparison (SALES-DATA should match sales-data)
  5. Never assume data_sources.yaml exists or is populated — it may be empty, use .knowledge/datasets/ directory listing as source of truth
  6. Never re-switch to an already-active dataset — detect this in Step 2 and inform user instead of performing redundant operations

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.