$npx -y skills add szsip239/teamclaw --skill data-analystData visualization, report generation, SQL queries, and spreadsheet automation. Transform your AI agent into a data-savvy analyst that turns raw data into actionable insights.
| 1 | # Data Analyst Skill 📊 |
| 2 | |
| 3 | **Turn your AI agent into a data analysis powerhouse.** |
| 4 | |
| 5 | Query databases, analyze spreadsheets, create visualizations, and generate insights that drive decisions. |
| 6 | |
| 7 | --- |
| 8 | |
| 9 | ## What This Skill Does |
| 10 | |
| 11 | ✅ **SQL Queries** — Write and execute queries against databases |
| 12 | ✅ **Spreadsheet Analysis** — Process CSV, Excel, Google Sheets data |
| 13 | ✅ **Data Visualization** — Create charts, graphs, and dashboards |
| 14 | ✅ **Report Generation** — Automated reports with insights |
| 15 | ✅ **Data Cleaning** — Handle missing data, outliers, formatting |
| 16 | ✅ **Statistical Analysis** — Descriptive stats, trends, correlations |
| 17 | |
| 18 | --- |
| 19 | |
| 20 | ## Quick Start |
| 21 | |
| 22 | 1. Configure your data sources in `TOOLS.md`: |
| 23 | ```markdown |
| 24 | ### Data Sources |
| 25 | - Primary DB: [Connection string or description] |
| 26 | - Spreadsheets: [Google Sheets URL / local path] |
| 27 | - Data warehouse: [BigQuery/Snowflake/etc.] |
| 28 | ``` |
| 29 | |
| 30 | 2. Set up your workspace: |
| 31 | ```bash |
| 32 | ./scripts/data-init.sh |
| 33 | ``` |
| 34 | |
| 35 | 3. Start analyzing! |
| 36 | |
| 37 | --- |
| 38 | |
| 39 | ## SQL Query Patterns |
| 40 | |
| 41 | ### Common Query Templates |
| 42 | |
| 43 | **Basic Data Exploration** |
| 44 | ```sql |
| 45 | -- Row count |
| 46 | SELECT COUNT(*) FROM table_name; |
| 47 | |
| 48 | -- Sample data |
| 49 | SELECT * FROM table_name LIMIT 10; |
| 50 | |
| 51 | -- Column statistics |
| 52 | SELECT |
| 53 | column_name, |
| 54 | COUNT(*) as count, |
| 55 | COUNT(DISTINCT column_name) as unique_values, |
| 56 | MIN(column_name) as min_val, |
| 57 | MAX(column_name) as max_val |
| 58 | FROM table_name |
| 59 | GROUP BY column_name; |
| 60 | ``` |
| 61 | |
| 62 | **Time-Based Analysis** |
| 63 | ```sql |
| 64 | -- Daily aggregation |
| 65 | SELECT |
| 66 | DATE(created_at) as date, |
| 67 | COUNT(*) as daily_count, |
| 68 | SUM(amount) as daily_total |
| 69 | FROM transactions |
| 70 | GROUP BY DATE(created_at) |
| 71 | ORDER BY date DESC; |
| 72 | |
| 73 | -- Month-over-month comparison |
| 74 | SELECT |
| 75 | DATE_TRUNC('month', created_at) as month, |
| 76 | COUNT(*) as count, |
| 77 | LAG(COUNT(*)) OVER (ORDER BY DATE_TRUNC('month', created_at)) as prev_month, |
| 78 | (COUNT(*) - LAG(COUNT(*)) OVER (ORDER BY DATE_TRUNC('month', created_at))) / |
| 79 | NULLIF(LAG(COUNT(*)) OVER (ORDER BY DATE_TRUNC('month', created_at)), 0) * 100 as growth_pct |
| 80 | FROM transactions |
| 81 | GROUP BY DATE_TRUNC('month', created_at) |
| 82 | ORDER BY month; |
| 83 | ``` |
| 84 | |
| 85 | **Cohort Analysis** |
| 86 | ```sql |
| 87 | -- User cohort by signup month |
| 88 | SELECT |
| 89 | DATE_TRUNC('month', u.created_at) as cohort_month, |
| 90 | DATE_TRUNC('month', o.created_at) as activity_month, |
| 91 | COUNT(DISTINCT u.id) as users |
| 92 | FROM users u |
| 93 | LEFT JOIN orders o ON u.id = o.user_id |
| 94 | GROUP BY cohort_month, activity_month |
| 95 | ORDER BY cohort_month, activity_month; |
| 96 | ``` |
| 97 | |
| 98 | **Funnel Analysis** |
| 99 | ```sql |
| 100 | -- Conversion funnel |
| 101 | WITH funnel AS ( |
| 102 | SELECT |
| 103 | COUNT(DISTINCT CASE WHEN event = 'page_view' THEN user_id END) as views, |
| 104 | COUNT(DISTINCT CASE WHEN event = 'signup' THEN user_id END) as signups, |
| 105 | COUNT(DISTINCT CASE WHEN event = 'purchase' THEN user_id END) as purchases |
| 106 | FROM events |
| 107 | WHERE date >= CURRENT_DATE - INTERVAL '30 days' |
| 108 | ) |
| 109 | SELECT |
| 110 | views, |
| 111 | signups, |
| 112 | ROUND(signups * 100.0 / NULLIF(views, 0), 2) as signup_rate, |
| 113 | purchases, |
| 114 | ROUND(purchases * 100.0 / NULLIF(signups, 0), 2) as purchase_rate |
| 115 | FROM funnel; |
| 116 | ``` |
| 117 | |
| 118 | --- |
| 119 | |
| 120 | ## Data Cleaning |
| 121 | |
| 122 | ### Common Data Quality Issues |
| 123 | |
| 124 | | Issue | Detection | Solution | |
| 125 | |-------|-----------|----------| |
| 126 | | **Missing values** | `IS NULL` or empty string | Impute, drop, or flag | |
| 127 | | **Duplicates** | `GROUP BY` with `HAVING COUNT(*) > 1` | Deduplicate with rules | |
| 128 | | **Outliers** | Z-score > 3 or IQR method | Investigate, cap, or exclude | |
| 129 | | **Inconsistent formats** | Sample and pattern match | Standardize with transforms | |
| 130 | | **Invalid values** | Range checks, referential integrity | Validate and correct | |
| 131 | |
| 132 | ### Data Cleaning SQL Patterns |
| 133 | |
| 134 | ```sql |
| 135 | -- Find duplicates |
| 136 | SELECT email, COUNT(*) |
| 137 | FROM users |
| 138 | GROUP BY email |
| 139 | HAVING COUNT(*) > 1; |
| 140 | |
| 141 | -- Find nulls |
| 142 | SELECT |
| 143 | COUNT(*) as total, |
| 144 | SUM(CASE WHEN email IS NULL THEN 1 ELSE 0 END) as null_emails, |
| 145 | SUM(CASE WHEN name IS NULL THEN 1 ELSE 0 END) as null_names |
| 146 | FROM users; |
| 147 | |
| 148 | -- Standardize text |
| 149 | UPDATE products |
| 150 | SET category = LOWER(TRIM(category)); |
| 151 | |
| 152 | -- Remove outliers (IQR method) |
| 153 | WITH stats AS ( |
| 154 | SELECT |
| 155 | PERCENTILE_CONT(0.25) WITHIN GROUP (ORDER BY value) as q1, |
| 156 | PERCENTILE_CONT(0.75) WITHIN GROUP (ORDER BY value) as q3 |
| 157 | FROM data |
| 158 | ) |
| 159 | SELECT * FROM data, stats |
| 160 | WHERE value BETWEEN q1 - 1.5*(q3-q1) AND q3 + 1.5*(q3-q1); |
| 161 | ``` |
| 162 | |
| 163 | ### Data Cleaning Checklist |
| 164 | |
| 165 | ```markdown |
| 166 | # Data Quality Audit: [Dataset] |
| 167 | |
| 168 | ## Row-Level Checks |
| 169 | - [ ] Total row count: [X] |
| 170 | - [ ] Duplicate rows: [X] |
| 171 | - [ ] Rows with any null: [X] |
| 172 | |
| 173 | ## Column-Level Checks |
| 174 | | Column | Type | Nulls | Unique | Min | Max | Issues | |
| 175 | |--------|------|-------|--------|-----|-----|--------| |
| 176 | | [col] | [type] | [n] | [n] | [v] | [v] | [notes] | |
| 177 | |
| 178 | ## Data Lineage |
| 179 | - Source: [Where data came from] |
| 180 | - Last updated: [Date] |
| 181 | - Known issues: [List] |
| 182 | |
| 183 | ## Cleaning Actions Taken |
| 184 | 1. [Action and reason] |
| 185 | 2. [Action and reason] |
| 186 | ``` |
| 187 | |
| 188 | --- |
| 189 | |
| 190 | ## Spreadsheet Analysis |
| 191 | |
| 192 | ### CSV/ |