DS-STAR Data Science Framework
7/19/2026, 1:21:37 PM · Source
DS-STAR is a multi-agent framework that automates the entire data science lifecycle in Claude Code, utilizing cost-optimized model routing across Haiku, Sonnet, and Opus.
DS-STAR (Data Science - Structured Thought and Action) is an intelligent multi-agent framework designed to transform raw data into actionable insights directly within Claude Code. By orchestrating seven specialized agents—ranging from data analyzers to Python coders and verifiers—the framework manages the entire data science lifecycle, from initial exploratory data analysis to iterative debugging and final validation. It dramatically optimizes performance and cost by dynamically routing tasks to the most suitable Claude model (Haiku, Sonnet, or Opus), achieving up to 60% savings compared to single-model approaches.
Overview & Architecture
Originally designed for Google's Gemini models, this skill adapts DS-STAR to leverage Anthropic's Claude model family. It automates complex data science workflows through structured collaboration, making it a reproducible and highly efficient alternative to manual data investigation.
Metadata
| Property | Value |
|---|---|
| Name | ds-star |
| Description | Multi-agent data science framework using DS-STAR (Data Science - Structured Thought and Action) architecture. Automates data analysis through collaborative AI agents with multi-model support (Haiku, Sonnet, Opus). Use for exploratory data analysis, automated insights, and iterative data science workflows. |
| Version | 1.0.0 |
| Category | ai-ml, data-science |
| Tags | multi-agent, analysis, automation, claude-models, iterative-refinement |
| Author | Jules Lescx (adapted by Claude) |
| Original Repo | DS-Star GitHub Repository |
| GitHub Stars | 0 |
How It Works: Multi-Agent Pipeline
DS-STAR orchestrates seven specialized agents in an iterative execution loop to solve data questions:
┌─────────────────────────────────────────────────────────┐
│ 1. ANALYZER (Haiku) │
│ Input: Data files │
│ Output: Data descriptions, schemas, summaries │
└─────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────┐
│ 2. PLANNER (Sonnet) │
│ Input: Query + Data descriptions │
│ Output: Initial analysis step │
└─────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────┐
│ 3. CODER (Sonnet) │
│ Input: Plan + Data descriptions │
│ Output: Python code to execute plan │
└─────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────┐
│ 4. DEBUGGER (Sonnet) [If needed] │
│ Input: Code + Error │
│ Output: Fixed code │
└─────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────┐
│ 5. VERIFIER (Sonnet) │
│ Input: Code + Results + Query │
│ Output: "Sufficient" or "Needs refinement" │
└─────────────────────────────────────────────────────────┘
↓
┌─────────────┴─────────────┐
│ Sufficient? │
└─────────────┬─────────────┘
YES │ │ NO
│ └──────────────┐
│ ↓
│ ┌──────────────────────────────┐
│ │ 6. ROUTER (Haiku) │
│ │ Decide: Fix step or Add │
│ └──────────────────────────────┘
│ │
│ ↓
│ [Loop back to PLANNER]
│
↓
┌─────────────────────────────────────────────────────────┐
│ 7. FINALYZER (Sonnet) │
│ Input: Final code + Results + Query │
│ Output: Formatted answer (JSON/text) │
└─────────────────────────────────────────────────────────┘
- Iterative Refinement: DS-STAR uses up to 5 refinement rounds (user-configurable). Each round can add a new analysis step or correct a previous step.
- Verification Gates: Automated gates prevent poor outputs, with automatic debugging retries for failed code.
- Artifact Generation: Full logging saves prompts, generated code, and results to
runs/<run_id>/for audit trails and complete reproducibility.
Key Features & Use Cases
Key Features
- Comprehensive Artifact Generation: Automatically saves prompts, execution code, and runtime logs for research reproducibility.
- Cost-Optimized Model Routing: Strategically routes sub-tasks across Haiku, Sonnet, and Opus, reducing analysis expenses by up to 60%.
- Iterative Refinement Cycles: Implements automated debugging and rigorous verification gates to ensure high-accuracy results.
- Multi-Agent Orchestration: Deploys specialized agent roles (Analyzer, Planner, Coder, Router, Verifier, Debugger, Finalyzer) to divide and conquer tasks.
- Native Support for Diverse Formats: Handles structured and unstructured datasets, including CSV, JSON, and plain text files.
Use Cases
- Automating Exploratory Data Analysis (EDA): Swiftly generate statistical summaries and understand core distribution behaviors in new datasets.
- Cost-Effective Processing Workflows: Process large volumes of data using mixed-model logical patterns rather than relying entirely on expensive frontier models.
- Iterative Analysis & Debugging: Automatically run and refine multi-step time-series, predictive, or correlation analyses where initial attempts might encounter runtime exceptions.
Performance & Cost Optimization
By using a custom-built model routing strategy, DS-STAR limits resource consumption. Instead of routing all requests to Claude 3.5 Sonnet, simpler tasks (like data scheme scanning or routing choices) are directed to Claude 3 Haiku.
Agent Allocation & Cost Profiles
| Agent | Default Model | Task Type | Cost Profile |
|---|---|---|---|
| Analyzer | Haiku | Data inspection | $0.80 / 1M tokens |
| Planner | Sonnet | Strategy design | $15.00 / 1M tokens |
| Coder | Sonnet | Code generation | $15.00 / 1M tokens |
| Verifier | Sonnet | Result validation | $15.00 / 1M tokens |
| Router | Haiku | Decision routing | $0.80 / 1M tokens |
| Debugger | Sonnet | Error fixing | $15.00 / 1M tokens |
| Finalyzer | Sonnet | Output formatting | $15.00 / 1M tokens |
- Estimated Cost (Typical Analysis of ~50K tokens):
- Traditional (Single-model Sonnet execution): ~1.00
- DS-STAR (Mixed-model execution): ~0.40
- Net Savings: 50% - 60%
Cost Comparison Table (50K Token Analysis)
| Configuration | Input Cost | Output Cost | Total Cost | Savings |
|---|---|---|---|---|
| All Sonnet | $0.75 | $0.75 | $1.50 | 0% (Baseline) |
| Balanced | $0.30 | $0.30 | $0.60 | 60% |
| Fast | $0.15 | $0.15 | $0.30 | 80% |
Model Selection Guidelines
- Use Haiku for: Core data file inspection (Analyzer), simple routing decisions (Router), and basic textual extraction.
- Use Sonnet for: Strategic planning (Planner), complex script generation (Coder), validating answers (Verifier), and finalizing responses (Finalyzer).
- Use Opus for: Complex edge-case debugging, highly sensitive financial/scientific analysis, and completely novel or ambiguous data formats.
Installation & Configuration
Quick Start
To install the skill via the token-eater marketplace in Claude Code:
# Add the marketplace (if not already added)
/plugin marketplace add token-eater/skills-marketplace
# Install DS-STAR skill
/plugin install ds-star
Manual Installation
To set up the skill manually from source:
# Clone the marketplace
git clone https://github.com/token-eater/skills-marketplace.git
cd skills-marketplace
# The skill code resides within skills/ds-star/
Advanced Configuration
You can control framework settings using a config.yaml file placed in your project root, or declare them in your run query.
# config.yaml (optional, in project root)
run_id: "my_experiment" # Custom run ID
model_name: "sonnet" # Default model
interactive: false # Pause between steps for manual confirmation
max_refinement_rounds: 5 # Max iterations before stopping
execution_timeout: 60 # Code timeout in seconds
preserve_artifacts: true # Save all outputs, steps, and scripts
runs_dir: "runs" # Directory path to write artifacts
data_dir: "data" # Directory where raw data is kept
# Agent-specific model overrides
agent_models:
ANALYZER: haiku
PLANNER: sonnet
CODER: sonnet
VERIFIER: sonnet
ROUTER: haiku
DEBUGGER: opus
FINALYZER: sonnet
Pre-defined Model Presets
- Fast (70%+ cost savings): Runs all roles on Claude Haiku, except for the Coder and Debugger agents.
- Balanced (50% cost savings): Runs simple tasks on Haiku and complex reasoning/validation on Sonnet.
- Quality (Highest accuracy): Assigns all agent roles to Sonnet or Opus.
Usage & Step-by-Step Examples
Basic Usage
To run the skill within Claude Code, simply call:
/skill ds-star
The framework will prompt you interactively to provide:
- The path to your data files (CSV, JSON, TXT, etc.).
- Your analytical query.
- Model preset configurations (optional).
Practical Query Examples
- Basic Statistics:
"What is the average age and gender distribution in this dataset?" (Data:
customers.csv) - Time Series Analysis:
"What are the monthly sales trends over the past year?" (Data:
sales_2024.csv) - Data Quality Assesment:
"How many missing values are in each column, and what percentage of the total?" (Data:
survey_responses.csv) - Correlation Analysis:
"Which features have the strongest correlation with customer churn?" (Data:
customer_features.csv)
End-to-End Run Examples
Example 1: Iris Dataset Analysis
- Data File:
iris.csv(150 rows, 5 columns) - Query: "What is the average petal length for each species, and which species has the highest variance?"
- Response Output:
{
"final_answer": {
"averages": {
"setosa": 1.46,
"versicolor": 4.26,
"virginica": 5.55
},
"highest_variance": "virginica",
"variance_value": 0.304
}
}
- Metrics: Cost: $0.18 (Balanced configuration) | Time: ~25 seconds | Execution Steps: 3 (Analyze → Plan → Code → Verify → Finalize)
Example 2: Sales Data Time Series
- Data File:
sales_2024.csv(365 rows, daily sales tracking) - Query: "Identify the top 3 months by total sales and calculate month-over-month growth rates."
- Response Output:
{
"final_answer": {
"top_3_months": [
{"month": "December", "total_sales": 125000, "growth": "+15%"},
{"month": "November", "total_sales": 108000, "growth": "+8%"},
{"month": "July", "total_sales": 95000, "growth": "+12%"}
],
"average_growth": "+8.3%"
}
}
- Metrics: Cost: $0.22 (Balanced configuration) | Time: ~30 seconds | Execution Steps: 4 (Including 1 refinement round)
Technical Details
Claude Provider Implementation
This skill features a custom ClaudeProvider that interfaces directly with the Claude Agent SDK, utilizing subagents for high context efficiency.
class ClaudeProvider(ModelProvider):
"""Provider for Claude models via Agent SDK."""
def __init__(self, model_name: str = "sonnet"):
self.model_name = model_name # haiku, sonnet, or opus
def generate_content(self, prompt: str) -> str:
# Use SDK's subagent system for context efficiency
# Automatically handles model routing
# Returns generated content
Integration with Claude Code
- Context Efficient: Leverages subagents to eliminate large, monolithic context windows.
- Parallel Execution: Allows independent processes to evaluate data structures simultaneously.
- Artifact Persistence: All files are written directly into local directories.
- Resume Support: Interruptions do not force a restart. Resume a prior state using:
/skill ds-star --resume 20241123_143022_a1b2c3
Directory Structure of Generated Artifacts
Every pipeline run generates a structured directory of inputs, intermediate decisions, and logs:
runs/<run_id>/
├── steps/
│ ├── 001_analyzer/
│ │ ├── prompt.md # Target agent instructions
│ │ ├── code.py # Output script generated by the agent
│ │ ├── result.txt # Executed console output
│ │ └── metadata.json # Step execution statistics and costs
│ ├── 002_planner_init/
│ ├── 003_coder/
│ └── ...
├── exec_env/ # Direct file execution runtime space
├── logs/
│ ├── pipeline.log # High-level orchestrator system logs
│ └── execution.log # Granular python subprocess compilation logs
├── final_output/
│ └── result.json # Extracted JSON final answer
└── pipeline_state.json # Checkpoint state dictionary for resuming
Comparison with Original Framework
| Feature | Original DS-STAR Framework | Adapted Claude Code Skill |
|---|---|---|
| Supported Models | Gemini, OpenAI | Claude 3 family (Haiku / Sonnet / Opus) |
| Context Management | Full workspace context passed each call | Subagent-optimized context scoping |
| Typical Cost | 2.00 per analysis | 0.40 per analysis |
| Integration | Standalone Python CLI | Native Claude Code Skill (/skill) |
| Resume Support | Yes ✅ | Yes ✅ |
| Interactive Mode | Yes ✅ | Yes ✅ |
| Artifact Logs | Yes ✅ | Yes ✅ |
| Multi-model Routing | Basic model designations | Advanced programmatic routing options |
Best Practices & Limitations
Query Design
- Do:
- Write clear, targeted prompts: "Calculate the Pearson correlation coefficient between columns X and Y."
- Ask direct logic questions: "What percentage of customers have completed more than 3 purchases?"
- Pinpoint outliers: "Identify outlier values in the 'price' column using the 1.5x IQR method."
- Avoid:
- Broad, ambiguous requests: "Tell me something interesting about this data."
- Overwhelming commands: "Do everything." Split massive multi-part requirements into independent query runs.
- Referencing external, inaccessible sources: Do not request external databases, APIs, or files unless pre-loaded locally.
Data Preparation
- Optimal Formats: Clean, standard
.csvfiles containing structured header titles; consistent, unified nesting in.jsondocuments; or plain UTF-8 encoded.txtdata files. - Problematic Formats: Multi-tab
.xlsxworkbooks (convert tabs to individual.csvfiles first); un-parsed.pdfdocuments; and raw binary inputs (images, audio files).
Known Limitations
- Python-Only Execution: The system executes instructions by generating and running Python scripts using packages like
pandasandnumpy. - Local Run Hazards: The code runs locally on your system. Be highly cautious when letting the tool run code generated from untrusted, third-party data inputs.
- No Outbound Network APIs: By design, running agents cannot hit external API endpoints or fetch live web information.
- Single Output Format: The finalization agent (
Finalyzer) produces a single summary payload (JSON or TXT). - No Interactive Charts: Real-time interactive visualizations and plotting are not supported (plots cannot be interactively rendered, though static files can be written).
Troubleshooting
Common Issues
- "Missing data files" Error
- Ensure target datasets are in the
data/subdirectory or provide absolute, fully qualified file paths. - Verify read permissions on target folders.
- Ensure target datasets are in the
- Execution Timed Out
- If a python script hangs, adjust the
execution_timeoutin yourconfig.yamlto a value higher than the default 60 seconds. - Simplify the target query or optimize large files (such as chunking).
- If a python script hangs, adjust the
- "API key not found"
- No API keys are required for built-in Claude models as long as the Claude Agent SDK handles authentication. External models (OpenAI/Gemini) will require standard environmental variables set in your local system.
- Verification Gate Always Fails
- Refine your prompt to be less ambiguous.
- Increase the maximum allowable cycles using
max_refinement_rounds: 10. - Check intermediate run scripts in
runs/<id>/steps/to pinpoint logic bottlenecks.
Debug Mode
To manually inspect executions, enable interactive step pausing or analyze raw files:
# Run with interactive mode to pause and confirm before each step runs
/skill ds-star --interactive
# Inspect pipeline execution history manually
ls runs/<run_id>/steps/
cat runs/<run_id>/logs/pipeline.log
Contributing
We welcome community extensions and framework iterations.
How to Extend the Framework
- Define your custom agent profile inside
scripts/dsstar.py. - Draft the agent's core instructions and prompt template within
scripts/prompts.py. - Chain the agent into the execution loop inside the
run_pipeline()method. - Verify functionality using your own data samples.
- Create a Pull Request (PR) on GitHub.
Community Extension Ideas
- Visualization Agent: Create and save
matplotliborseaborngraphs directly into output directories. - Export Agent: Autogenerate clean Excel workbooks, interactive HTML, or formatted PDF reports.
- Schema Agent: Automate rigorous data-type profiling and enforce structural constraints.
- ML Agent: Train and evaluate basic modeling pipelines (e.g.,
scikit-learnregressions or classification splits).
Frequently Asked Questions (FAQ)
How does the cost optimization work?
DS-STAR routes simple tasks (such as inspecting data headers or making routing choices) to the low-cost Claude Haiku model. It reserves complex operations (such as logic planning, code generation, and validation) for Sonnet or Opus.
What kind of files can I analyze?
You can analyze structured formats like CSV and JSON, as well as unstructured TXT documents.
What is DS-STAR for Claude Code?
It is a multi-agent framework built around the "Structured Thought and Action" architecture. It automates exploratory data analysis and Python execution directly in your local command-line environment.
Does DS-STAR handle code errors automatically?
Yes. The framework includes a specialized Debugger agent that captures console tracebacks, edits the failing script, and retries execution.
Are the analysis results reproducible?
Yes. Because every step, prompt, generated script, and output log is saved in your local runs/ directory, every single execution is transparent and reproducible.
Support & Resources
- 📖 Original Paper: DS-STAR: Domain Adaptive Data Science via Large Language Models
- 💾 Original Codebase: JulesLscx/DS-Star on GitHub
- 🐛 Report Issues: Skills Marketplace Issues
- 💬 Discussions: Skills Marketplace Discussions
- ⚙️ Underlying Architecture: Learn more at What are Skills? and How to Install.
Related Skills
openclaw Diagram Maker & Visualizer — Generates professional SVG, HTML, and Excalidraw diagrams for software architecture, system flows, and educational concepts.
Pie Skills Constitution Consistency (Premium) — Verifies logic and thinking are aligned with the Anthropic constitution before responding.
openclaw GH Issues Auto-Fixer — Automates the end-to-end GitHub issue lifecycle by spawning sub-agents to implement code fixes, open pull requests, and resolve review comments.
Related Model Context Protocol (MCP) Servers
qdrant Qdrant — Connects language models to a Qdrant vector database for storing and retrieving information.
datawiz168 Snowflake Integration — Enables Claude to execute SQL queries and interact with Snowflake databases.
kablewy FRED — Accesses and retrieves economic data series from the Federal Reserve Economic Data (FRED) system.
Key Takeaways
- Multi-Agent Orchestration: By splitting tasks among seven specialized agent roles, DS-STAR handles planning, code generation, error correction, and validation in a structured, modular loop.
- Significant Cost Savings: Dynamically routes sub-tasks between Claude Haiku, Sonnet, and Opus, lowering total API consumption expenses by 50% to 60%.
- Automatic Debugging: Features an iterative self-correction routine that captures execution faults and rewrites Python code automatically to overcome runtime errors.
- 100% Reproducible: Saves every intermediate plan, code artifact, prompt template, and output response to local run folders (
runs/<run_id>) for complete auditability.
Learning map
Stage 1: Understanding DS-STAR & Multi-Agent Architecture
- The 7-Agent Loop: Learn how the Analyzer, Planner, Coder, Debugger, Verifier, Router, and Finalyzer collaborate to automate data tasks.
- Multi-Model Routing: Understand how routing simple tasks to Haiku and complex tasks to Sonnet/Opus reduces API costs by up to 60%.
Stage 2: Installation & Workspace Integration
- Environment Setup: Set up Claude Code and install the DS-STAR plugin skill.
- Data Structuring: Learn the correct data prep principles (clean headers, UTF-8 CSVs, JSON) to avoid agent reading errors.
Stage 3: Advanced Workflows & Refinement Optimization
- Configuration Overrides: Modify
config.yamlto configure specific models for specific roles (e.g., routing Debugger tasks to Claude Opus). - Reproducibility Audit: Trace the execution lineage inside the generated
runs/folder using artifacts, prompts, and Python logs.
Get hands-on — step by step
-
Install the DS-STAR Skill: Open your Claude Code CLI and run:
/plugin marketplace add token-eater/skills-marketplace/plugin install ds-star -
Prepare Sample Data: Create a directory named
data/in your workspace and save a simple CSV file namedsales.csvwith columns:Date, Product, Revenue, Units_Sold. -
Run Your First Query: Execute the skill by entering:
/skill ds-starWhen prompted, providedata/sales.csvand enter the query:"What are the monthly sales trends and which product had the highest revenue?" -
Trace the Agent Artifacts: Navigate to the created
runs/directory in your workspace. Inspect the steps folder (e.g.,runs/<run_id>/steps/001_analyzer/) to read the prompt, generated Python script, and logs to understand the agent's thought process.
Top 3 sources
- 1DS-STAR Official GitHub Repository
The original source code and implementation of the DS-STAR framework.
https://github.com/JulesLscx/DS-Star
- 2DS-STAR Research Paper (arXiv)
The academic paper introducing DS-STAR as a domain-adaptive data science framework using LLMs.
https://arxiv.org/abs/2410.19016
- 3Skills Marketplace Repository
The repository where the Claude Code skill port of DS-STAR is actively maintained.
https://github.com/token-eater/skills-marketplace
Links are AI-suggested — worth a quick sanity check before diving in.