sql-cli_skill
- Python
11
GitHub Stars
3
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill interstellar-code/claud-skills --skill sql-cli- README.md2.6 KB
- SKILL.md10.8 KB
- sql-cli.sh7.4 KB
Overview
This skill provides token-efficient MySQL/PostgreSQL operations using mycli and native CLI tools on Windows, Mac, and Linux. It replaces heavy REPL workflows like Artisan Tinker with fast direct SQL commands, reducing token usage and execution time. It auto-reads project .env credentials and formats output consistently with the colored-output formatter.
How this skill works
The skill runs lightweight shell wrappers that execute SQL commands via mysql/mycli and optional tools like bat for syntax highlighting. It automatically extracts DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, and DB_PASSWORD from the project .env and falls back to standard clients if optional tools are missing. Every response is emitted through the centralized colored-output formatter to ensure consistent headers, progress, and status messages.
When to use it
- Quick counts and one-off data checks (e.g., active users)
- Schema exploration and table descriptions before writing queries
- Ad-hoc reports and CSV exports for analysis
- Performance debugging using EXPLAIN plans
- Interactive data exploration via mycli with autocompletion
- Replacing Artisan Tinker for simple SQL tasks to save tokens/time
Best practices
- Run commands from the Laravel project root so .env is found
- Prefer SQL-CLI for direct SQL checks; use Eloquent models for complex business logic
- Use describe/tables before writing queries to avoid mistakes
- Install mycli and bat for enhanced interactive and highlighted output
- Avoid using SQL-CLI for transactional operations that require rollbacks; use tinker or application code instead
Example use cases
- Count active subscriptions: sql-cli.sh count subs_subscriptions "status='active'"
- Describe a table schema: sql-cli.sh describe users
- Run a quick query: sql-cli.sh query "SELECT id,email FROM users WHERE created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)"
- Export query results to CSV for reporting: sql-cli.sh export-csv "SELECT * FROM users WHERE status='active'" active_users.csv
- Open interactive session with autocompletion: sql-cli.sh interactive
FAQ
The skill shows a clear error and asks you to run from the project root where .env exists.
Do I need mycli or bat installed?
No. mycli and bat are optional enhancements. The skill falls back to the standard mysql client and plain output if they are not installed.