Skip to main content
ClaudeWave
Slash Command413 repo starsupdated 5mo ago

hypothesis

The `/hypothesis` command generates testable research hypotheses and experimental designs by analyzing patterns in a specified dataset within a chosen domain such as user behavior, business impact, or technical performance. Use this command when you need to formulate rigorous hypotheses grounded in data, design experiments to test them, and establish validation strategies including statistical approaches and success metrics.

Install in Claude Code
Copy
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/liangdabiao/claude-data-analysis/HEAD/.claude/commands/hypothesis.md -o ~/.claude/commands/hypothesis.md
Then start a new Claude Code session; the slash command loads automatically.

hypothesis.md

# Hypothesis Generation Command

Generate research hypotheses and experimental designs for dataset `$1` in domain `$2` using the hypothesis-generator subagent.

## Context
- Dataset location: @data_storage/$1
- Analysis domain: $2 (user-behavior, business-impact, technical-performance, custom)
- Current working directory: !`pwd`
- Output directory: ./hypothesis_reports/
- Available research methodologies and experimental designs
- Statistical analysis capabilities

## Your Task

Use the hypothesis-generator subagent to create rigorous, testable hypotheses:

### 1. Pattern Analysis
- Identify significant correlations and relationships
- Detect temporal patterns and trends
- Discover clusters and segments in the data
- Recognize anomalies and unusual patterns

### 2. Hypothesis Formulation
- Create clear, testable hypotheses
- Define null and alternative hypotheses
- Specify variables and their relationships
- Establish measurable outcomes and success criteria

### 3. Experimental Design
- Select appropriate research methodologies
- Design experimental approaches to test hypotheses
- Determine sample size and power requirements
- Plan data collection and measurement procedures

### 4. Validation Strategy
- Define statistical testing approaches
- Establish success criteria and metrics
- Plan for replication and verification
- Consider alternative explanations and approaches

## Analysis Domains

### User Behavior
- **Engagement Patterns**: User interaction and engagement hypotheses
- **Conversion Optimization**: Conversion rate and funnel analysis hypotheses
- **Retention and Churn**: User retention and churn prediction hypotheses
- **Segmentation**: User behavior segmentation hypotheses
- **Journey Analysis**: User journey and path analysis hypotheses

### Business Impact
- **Revenue Optimization**: Revenue generation and growth hypotheses
- **Cost Reduction**: Cost efficiency and optimization hypotheses
- **Market Expansion**: Market growth and expansion hypotheses
- **Customer Satisfaction**: Customer experience and satisfaction hypotheses
- **Operational Efficiency**: Process improvement and efficiency hypotheses

### Technical Performance
- **System Optimization**: Performance and scalability hypotheses
- **Reliability**: System stability and reliability hypotheses
- **Security**: Security vulnerability and protection hypotheses
- **User Experience**: Technical UX and performance hypotheses
- **Integration**: System integration and compatibility hypotheses

### Custom
- **Domain-Specific**: Custom domain-specific hypotheses
- **Research-Oriented**: Academic and research hypotheses
- **Experimental**: Novel experimental hypotheses
- **Predictive**: Predictive modeling hypotheses

## Hypothesis Types

### Descriptive Hypotheses
Describe patterns and relationships in the data without inferring causation.

**Example**: "There is a positive correlation between user engagement time and conversion rates."

### Explanatory Hypotheses
Explain underlying mechanisms and causal relationships.

**Example**: "Increased user engagement time leads to higher conversion rates due to improved product understanding."

### Predictive Hypotheses
Forecast future outcomes based on current patterns.

**Example**: "Users with engagement time > 5 minutes are 3x more likely to convert within 30 days."

### Prescriptive Hypotheses
Recommend optimal actions and interventions.

**Example**: "Implementing personalized recommendations will increase user engagement by 25%."

## Research Methodologies

### Experimental Designs
- **A/B Testing**: Randomized controlled experiments
- **Multivariate Testing**: Multiple variable experiments
- **Longitudinal Studies**: Time-series analysis
- **Cross-sectional Studies**: Point-in-time analysis
- **Quasi-experiments**: Non-randomized designs
- **Case Studies**: In-depth analysis of specific cases

### Statistical Approaches
- **Hypothesis Testing**: Statistical significance testing
- **Confidence Intervals**: Estimation of effect sizes
- **Bayesian Methods**: Bayesian hypothesis testing
- **Power Analysis**: Statistical power calculation
- **Effect Size Measurement**: Quantifying relationship strength

### Validation Methods
- **Cross-validation**: Model validation techniques
- **Bootstrapping**: Resampling validation
- **Sensitivity Analysis**: Testing robustness
- **Replication Studies**: Independent verification
- **Meta-analysis**: Synthesis of multiple studies

## Expected Output

### Hypothesis Documentation
- `hypothesis_reports/$1_$2_hypotheses.md` - Hypothesis documentation
- `hypothesis_reports/$1_$2_experimental_design.md` - Experimental design
- `hypothesis_reports/$1_$2_validation_plan.md` - Validation strategy
- `hypothesis_reports/$1_$2_research_proposal.md` - Research proposal

### Hypothesis Structure
Each hypothesis includes:
- **Clear Statement**: Testable hypothesis statement
- **Rationale**: Justification and theoretical foundation
- **Variables**: Independent and dependent variables
- **Methodology**: Proposed testing approach
- **Success Criteria**: Metrics for validation
- **Expected Outcomes**: Predicted results
- **Alternative Explanations**: Other possible explanations

### Experimental Design
Comprehensive experimental design including:
- **Research Questions**: Clear research questions
- **Methodology**: Detailed experimental approach
- **Sample Size**: Power analysis and justification
- **Variables**: Measurement and operationalization
- **Procedure**: Step-by-step experimental process
- **Analysis Plan**: Statistical analysis approach
- **Timeline**: Project schedule and milestones
- **Resources**: Required resources and budget

## Working Process

### 1. Data Pattern Discovery
```python
import pandas as pd
import numpy as np
from scipy import stats
from sklearn.cluster import KMeans
from sklearn.preprocessing import StandardScaler

def discover_research_patterns(data):
    """Discover patterns that suggest research hypotheses"""
    patterns = {
code-generatorSubagent

Expert code generation specialist for creating high-quality, production-ready analysis code in multiple programming languages. Use proactively for any code generation task requiring clean, efficient, and maintainable code for data analysis, machine learning, and visualization.

data-explorerSubagent

Advanced data exploration and analysis specialist for statistical analysis, pattern discovery, machine learning insights, and actionable business intelligence. Use proactively for any data analysis task requiring deep insights and comprehensive understanding.

hypothesis-generatorSubagent

Research hypothesis generation specialist for creating testable hypotheses, experimental designs, and research methodologies. Use proactively when data analysis suggests deeper investigation or when planning new research initiatives.

quality-assuranceSubagent

Data quality and validation specialist ensuring data integrity, analysis accuracy, and result reliability. Use proactively for any data validation, quality checks, or result verification tasks.

report-writerSubagent

Expert report writer specializing in comprehensive data analysis documentation, executive summaries, and technical documentation. Use proactively to create polished, professional reports.

visualization-specialistSubagent

Expert data visualization specialist for creating interactive, insightful, and publication-quality visualizations with advanced analytics integration and storytelling capabilities. Use proactively when data analysis would benefit from visual representation or when communicating complex insights to stakeholders.

analyzeSlash Command

Perform comprehensive data analysis on specified dataset

do-allSlash Command

自动化完成整个数据分析工作流程,从数据质量检查到最终报告生成