agentleFS
eosphoros-aieosphoros-ai/DB-GPT/skills/sql-data-analysis/SKILL.md

sql-data-analysis

Skill20k starsChanged 3 years agoMITView on GitHub

Comprehensive SQL data analysis skill for executing queries, analyzing results, and generating visualizations. Use when Claude needs to: (1) Execute SQL queries against databases, (2) Analyze query results and generate insights, (3) Create data visualizations (charts, graphs) from query results, (4) Perform data aggregation and reporting, (5) Work with database connections and query optimization. Supports MySQL, PostgreSQL, SQLite, and other SQL databases.

Trending

Less talk lately.about the whole repository

Jan 2026: 1 mentionFeb 2026: 1 mentionMar 2026: 1 mentionApr 2026: 0 mentionsMay 2026: 3 mentionsJun 2026: 2 mentionsJul 2026: 1 mentionAug 2026: 6 mentionsSep 2026: 3 mentionsOct 2026: 2 mentionsNov 2026: 3 mentionsDec 2026: 0 mentions
Jan 2026Jul 2026Dec 2026
Mentions a month of the eosphoros-ai/DB-GPT repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about eosphoros-ai/DB-GPT

The biggest 5 of 63 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 63

Talked about on GitHub, YouTube, Bluesky and the web (63 times).

On GitHub · 35

30 more on GitHub

On YouTube · 25

20 more on YouTube

On the web · 1

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

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

    Use the execute_query.py script to run SQL queries:

    line 18
  2. Very specific:

    Use the visualize_data.py script to create charts from query results:

    line 27
  3. Distinctive:

    Connection failed: Verify host, port, and credentials

    line 199
  4. Distinctive:

    Table not found: Check database name and table existence

    line 200
  5. Distinctive:

    Permission denied: Ensure user has required privileges

    line 201
  6. Very specific:

    Add --debug flag to scripts for detailed error messages:

    line 206
  7. Distinctive:

    Never hardcode passwords in scripts

    line 214
  8. Distinctive:

    Use environment variables for sensitive data

    line 215
  9. Distinctive:

    Use read-only database users for analysis queries

    line 216
  10. Distinctive:

    Use parameterized queries to prevent SQL injection

    line 218

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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

SQL Data Analysis

Quick Start

Execute a Query

Use the execute_query.py script to run SQL queries:

python scripts/execute_query.py --db-type postgresql --host localhost --port 5432 \
  --database mydb --user myuser --password mypass --query "SELECT * FROM users LIMIT 10"

Generate Visualization

Use the visualize_data.py script to create charts from query results:

python scripts/visualize_data.py \
  --data "[{"name": "A", "value": 10}, {"name": "B", "value": 20}]" \
  --chart-type {bar|line|pie|scatter} \
  --x-column name --y-column value \
  --title "My Chart" --output chart.png

Database Connection

Connection Parameters

Required parameters for database connections:

  • --db-type: Database type (postgresql, mysql, sqlite)
  • --host: Database host (not required for SQLite)
  • --port: Database port (default: 5432 for PostgreSQL, 3306 for MySQL)
  • --database: Database name
  • --user: Username (not required for SQLite)
  • --password: Password (not required for SQLite)

SQLite Example

python scripts/execute_query.py --db-type sqlite --database /path/to/db.sqlite \
  --query "SELECT * FROM table_name"

Query Execution

Basic Query

python scripts/execute_query.py --db-type postgresql --host localhost \
  --database mydb --user myuser --password mypass \
  --query "SELECT id, name FROM users WHERE active = true"

Query with Output File

python scripts/execute_query.py --db-type postgresql --host localhost \
  --database mydb --user myuser --password mypass \
  --query "SELECT * FROM orders" --output results.json

Parameterized Query

python scripts/execute_query.py --db-type postgresql --host localhost \
  --database mydb --user myuser --password mypass \
  --query "SELECT * FROM users WHERE id = %s" --params "[1]"

Data Visualization

Supported Chart Types

  • bar: Bar chart for categorical data comparison
  • line: Line chart for trends over time
  • pie: Pie chart for proportional data
  • scatter: Scatter plot for correlation analysis

Bar Chart Example

python scripts/visualize_data.py \
  --data "[{"category": "A", "count": 100}, {"category": "B", "count": 150}]" \
  --chart-type bar --x-column category --y-column count \
  --title "Category Distribution" --output bar_chart.png

Line Chart Example

python scripts/visualize_data.py \
  --data "[{"month": "Jan", "sales": 1000}, {"month": "Feb", "sales": 1200}]" \
  --chart-type line --x-column month --y-column sales \
  --title "Monthly Sales Trend" --output trend.png

Pie Chart Example

python scripts/visualize_data.py \
  --data "[{"product": "A", "share": 30}, {"product": "B", "share": 70}]" \
  --chart-type pie --x-column product --y-column share \
  --title "Market Share" --output pie.png

Common Analysis Patterns

Time Series Analysis

SELECT 
  DATE(created_at) as date,
  COUNT(*) as count,
  SUM(amount) as total
FROM orders
WHERE created_at >= '2024-01-01'
GROUP BY DATE(created_at)
ORDER BY date;

Top N Analysis

SELECT 
  product_id,
  COUNT(*) as order_count,
  SUM(amount) as revenue
FROM orders
GROUP BY product_id
ORDER BY revenue DESC
LIMIT 10;

Cohort Analysis

SELECT 
  DATE(first_order) as cohort,
  COUNT(DISTINCT user_id) as users,
  COUNT(*) as total_orders
FROM (
  SELECT 
    user_id,
    MIN(created_at) as first_order,
    created_at
  FROM orders
  GROUP BY user_id, created_at
) user_orders
GROUP BY cohort
ORDER BY cohort;

Funnel Analysis

WITH funnel AS (
  SELECT 
    user_id,
    COUNT(CASE WHEN step = 'view' THEN 1 END) as views,
    COUNT(CASE WHEN step = 'cart' THEN 1 END) as carts,
    COUNT(CASE WHEN step = 'purchase' THEN 1 END) as purchases
  FROM events
  WHERE event_date >= '2024-01-01'
  GROUP BY user_id
)
SELECT 
  COUNT(*) as total_users,
  SUM(CASE WHEN views > 0 THEN 1 ELSE 0 END) as viewed,
  SUM(CASE WHEN carts > 0 THEN 1 ELSE 0 END) as added_to_cart,
  SUM(CASE WHEN purchases > 0 THEN 1 ELSE 0 END) as purchased
FROM funnel;

Reference Materials

For detailed guidance, consult these references:

  • API Reference: Complete API documentation for all scripts
  • SQL Patterns: Common SQL query patterns and examples
  • Best Practices: Query optimization and security guidelines

Error Handling

Common Issues

  1. Connection failed: Verify host, port, and credentials
  2. Table not found: Check database name and table existence
  3. Permission denied: Ensure user has required privileges
  4. Syntax error: Validate SQL syntax for specific database type

Debug Mode

Add --debug flag to scripts for detailed error messages:

python scripts/execute_query.py --debug --query "SELECT * FROM users"

Security Notes

  • Never hardcode passwords in scripts
  • Use environment variables for sensitive data
  • Use read-only database users for analysis queries
  • Validate all user inputs before query execution
  • Use parameterized queries to prevent SQL injection

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.