sql-cli

Execute SQL queries against MySQL and PostgreSQL databases from the command line.

17|8|Updated Oct 21, 2025
One-click install
npx skills add https://github.com/Interstellar-code/claud-skills --skill sql-cli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-cli
Source: https://github.com/Interstellar-code/claud-skills/tree/main/generic-claude-framework/skills/sql-cli
Command: npx skills add https://github.com/Interstellar-code/claud-skills --skill sql-cli

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires mysql, mycli, bat.

What problem does it solve?

This skill eliminates the overhead of heavy ORM contexts by enabling direct SQL execution against MySQL and PostgreSQL databases from the command line, delivering faster results with fewer tokens.

Core Features & Use Cases

  • Direct SQL execution: run ad-hoc queries without loading ORM context to obtain quick insights.
  • Cross-database support: works with MySQL and PostgreSQL across Windows, macOS, and Linux environments.
  • Auto-credentials: reads connection details from the project .env to simplify setup.
  • UX enhancements: optional mycli for auto-completion and bat for syntax-highlighted output.
  • Use Case: quickly count users, inspect table schemas, and export query results to CSV.

Quick Start

  • Install required CLI tools (MySQL client; optional: mycli and bat).
  • From your project root, run: sql-cli.sh interactive
  • Or run a test query: sql-cli.sh query "SELECT COUNT(*) FROM users WHERE status='active'"

Frequently Asked Questions about sql-cli

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run ad-hoc SQL queries without loading heavy ORM contexts to save tokens?

Direct SQL execution from the command line bypasses heavy ORM contexts to save tokens and deliver faster query results. You can run ad-hoc analytics, explore schemas, and perform quick data checks efficiently without bloating your context window.

How do I execute a quick count query against a PostgreSQL or MySQL database from the CLI?

Execute a quick count query by running sql-cli.sh query followed by your SQL statement. The script auto-reads database connection credentials from the project .env file to instantly query PostgreSQL or MySQL without manual authentication.

Does this direct SQL execution approach support both MySQL and PostgreSQL on Windows?

Yes, direct SQL execution supports both MySQL and PostgreSQL across Windows, macOS, and Linux environments. It utilizes standard CLI tools like the MySQL client, integrating seamlessly across platforms while optionally using mycli and bat for enhanced UX.

Do I need to manually configure database credentials to run command line SQL queries?

No, manual credential configuration is unnecessary for command line SQL queries. The tool auto-reads connection details directly from the project .env file, simplifying setup and enabling immediate database access for ad-hoc analytics.

What is the best way to get auto-completion and syntax highlighting for CLI database queries?

The best way to achieve auto-completion and syntax highlighting for CLI database queries is by installing mycli and bat. These optional dependencies integrate with the SQL script to provide interactive auto-completion and syntax-highlighted output.

What are the limitations of using a CLI script for direct SQL execution instead of an ORM?

Using a CLI script for direct SQL execution lacks the object-relational mapping and automated schema migrations an ORM provides. It is optimized for quick ad-hoc analytics and data checks rather than managing complex application data layers.