home / skills / aidotnet / moyucode / sql-executor
This skill executes SQL queries across databases with formatted results and export options for quick data extraction.
npx playbooks add skill aidotnet/moyucode --skill sql-executorReview the files below or copy the command above to add this skill to your agents.
---
name: sql-executor
description: 对SQLite、PostgreSQL、MySQL数据库执行SQL查询,支持结果格式化和导出。
metadata:
short-description: 执行SQL查询
source:
repository: https://github.com/python/cpython
license: PSF
---
# SQL Executor Tool
## Description
Execute SQL queries against various databases with formatted output and export capabilities.
## Trigger
- `/sql` command
- User needs to run database queries
- User wants to export query results
## Usage
```bash
# Query SQLite database
python scripts/sql_executor.py database.db "SELECT * FROM users"
# Export to CSV
python scripts/sql_executor.py database.db "SELECT * FROM orders" --output orders.csv
# Execute SQL file
python scripts/sql_executor.py database.db --file queries.sql
```
## Tags
`sql`, `database`, `sqlite`, `query`, `data`
## Compatibility
- Codex: ✅
- Claude Code: ✅
This skill executes SQL queries against SQLite, PostgreSQL, and MySQL databases with options to format and export results. It provides command-style triggers for ad-hoc queries, batch execution from files, and direct CSV export for downstream analysis. The implementation is TypeScript-based and focused on reliable query execution and clean output.
You invoke the tool with a database connection and a SQL statement or file; it connects, runs the query, and returns a formatted table of results. Options include writing output to CSV and choosing input from a SQL file for batch runs. Error reporting returns SQL errors and connection diagnostics so you can quickly iterate on queries.
Which databases are supported?
SQLite, PostgreSQL, and MySQL are supported.
Can I export results to CSV?
Yes. There is an option to write query results directly to a CSV file.