skills/43-wentorai-research-plugins/skills/analysis/wrangling/data-cog-guide/SKILL.md
Upload messy CSVs with minimal prompting for deep automated analysis
npx skillsauth add brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research data-cog-guideInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
An intelligent data analysis assistant that accepts messy, poorly documented CSV files and automatically infers structure, cleans anomalies, and produces deep analytical reports with minimal user prompting. Designed for researchers who need quick insights from unfamiliar or inherited datasets without spending hours on manual data preparation.
Researchers frequently receive datasets from collaborators, public repositories, or legacy systems that lack documentation, use inconsistent formatting, and contain mixed data quality. Traditional analysis requires significant upfront effort to understand and prepare such data. Data Cog automates this process by applying heuristic inference, pattern recognition, and iterative cleaning to produce analysis-ready data along with a comprehensive profile report.
The skill implements a "zero-configuration" philosophy: provide the CSV file path and an optional research question, and it handles encoding detection, delimiter inference, type casting, missingness assessment, and initial exploratory statistics automatically.
import pandas as pd
import chardet
import io
def smart_load_csv(filepath: str) -> tuple:
"""
Intelligently load a CSV file, auto-detecting encoding,
delimiter, header row, and comment lines.
"""
# Step 1: Detect encoding
with open(filepath, 'rb') as f:
raw = f.read(100000)
encoding = chardet.detect(raw)['encoding']
# Step 2: Detect delimiter
import csv
with open(filepath, 'r', encoding=encoding, errors='replace') as f:
sample = f.read(8192)
sniffer = csv.Sniffer()
try:
dialect = sniffer.sniff(sample)
delimiter = dialect.delimiter
except csv.Error:
delimiter = ','
# Step 3: Detect header row (skip comment lines)
skip_rows = 0
with open(filepath, 'r', encoding=encoding, errors='replace') as f:
for line in f:
if line.startswith('#') or line.startswith('//') or line.strip() == '':
skip_rows += 1
else:
break
# Step 4: Load with inferred parameters
df = pd.read_csv(
filepath, encoding=encoding, delimiter=delimiter,
skiprows=skip_rows, low_memory=False
)
metadata = {
'encoding': encoding,
'delimiter': repr(delimiter),
'skipped_rows': skip_rows,
'shape': df.shape
}
return df, metadata
def auto_cast_columns(df: pd.DataFrame) -> pd.DataFrame:
"""
Automatically cast columns to their most appropriate types.
Handles dates, numerics stored as strings, booleans, and categories.
"""
for col in df.columns:
# Try numeric conversion
numeric = pd.to_numeric(df[col], errors='coerce')
if numeric.notna().mean() > 0.85:
df[col] = numeric
continue
# Try datetime conversion
datetime = pd.to_datetime(df[col], errors='coerce', infer_datetime_format=True)
if datetime.notna().mean() > 0.85:
df[col] = datetime
continue
# Try boolean detection
unique_lower = df[col].dropna().astype(str).str.lower().unique()
if set(unique_lower).issubset({'true', 'false', 'yes', 'no', '1', '0', 'y', 'n'}):
df[col] = df[col].astype(str).str.lower().map(
{'true': True, 'false': False, 'yes': True, 'no': False,
'1': True, '0': False, 'y': True, 'n': False}
)
continue
# Convert low-cardinality strings to category
if df[col].nunique() / len(df) < 0.05 and df[col].nunique() < 50:
df[col] = df[col].astype('category')
return df
The profiling stage produces a structured report covering:
| Metric | Numeric Columns | Categorical Columns | |--------|----------------|-------------------| | Central tendency | Mean, median, mode | Mode, frequency | | Dispersion | Std, IQR, range, CV | Unique count, entropy | | Shape | Skewness, kurtosis | Imbalance ratio | | Quality | Missing %, zero %, outlier % | Missing %, rare labels % |
The recommended workflow requires only three inputs:
User: Analyze /data/survey_results_2025.csv
Question: What factors predict participant satisfaction?
Output: full_report
Data Cog will:
1. Load and profile the dataset (auto-detect everything)
2. Clean and transform (handle missing data, encode categoricals)
3. Run correlation analysis focused on satisfaction-related columns
4. Generate regression models predicting satisfaction
5. Produce a structured report with findings and visualizations
After the initial automated analysis, you can refine by asking targeted follow-up questions:
development
Conduct rigorous thematic analysis (TA) of qualitative data following Braun and Clarke's (2006) six-phase framework. Use whenever the user mentions 'thematic analysis', 'TA', 'Braun and Clarke', 'qualitative coding', 'identifying themes', or asks for help analysing interviews, focus groups, open-ended survey responses, or transcripts to identify patterns. Also trigger for questions about inductive vs theoretical coding, semantic vs latent themes, essentialist vs constructionist epistemology, building a thematic map, or writing up a qualitative findings section. Covers all six phases, the four upfront analytic decisions, the 15-point quality checklist, and the five common pitfalls. Produces a Word document write-up and an annotated thematic map. Does NOT cover IPA, grounded theory, discourse analysis, conversation analysis, or narrative analysis — use a different method for those.
development
Guide users through writing a systematic literature review (SLR) following the PRISMA 2020 framework. Use this skill whenever the user mentions 'systematic review', 'systematic literature review', 'SLR', 'PRISMA', 'PRISMA 2020', 'PRISMA flow diagram', 'PRISMA checklist', or asks for help writing, structuring, or auditing a literature review that follows reporting guidelines. Also trigger when the user asks about inclusion/exclusion criteria for a review, search strategies for databases like Scopus/WoS/PubMed, study selection processes, risk of bias assessment, or narrative synthesis for a review paper. This skill covers the full PRISMA 2020 checklist (27 items), produces a Word document manuscript in strict journal article format, generates an annotated PRISMA flow diagram, and enforces APA 7th Edition referencing throughout. It does NOT cover meta-analysis or statistical pooling. By Chuah Kee Man.
testing
Performs placebo-in-time sensitivity analysis with hierarchical null model and optional Bayesian assurance. Use when checking model robustness, verifying lack of pre-intervention effects, or estimating study power.
data-ai
Fit, summarize, plot, and interpret a chosen CausalPy experiment. Use after the causal method has been selected, including when configuring PyMC/sklearn models and scale-aware custom priors.