sql-cli
FreeRuns bundled scriptsNot checkedToken-efficient MySQL/PostgreSQL operations using mycli and native CLI tools (Windows/Mac/Linux compatible). Replaces Artisan Tinker for database queries with…
About this skill
SQL-CLI Skill
Purpose: Fast, efficient database operations without agent overhead
Auto-Activation Triggers
Primary Keywords:
- "database", "sql", "mysql", "postgres", "query database"
- "show tables", "count rows", "table structure"
- "subscription data", "user data", "payment data"
- "run query", "execute sql", "database schema"
Context-Aware Triggers:
- User asks to check data: "show active subscriptions"
- User needs counts: "how many users are active"
- User wants schema info: "what fields does users table have"
- User mentions Artisan Tinker: automatically suggest sql-cli instead
Example Activations:
- "Show me all active subscriptions" → Use sql-cli skill
- "Count users registered in last 30 days" → Use sql-cli skill
- "What tables are in the database?" → Use sql-cli skill
- "Describe the users table structure" → Use sql-cli skill
🎨 VISUAL OUTPUT FORMATTING
CRITICAL: All sql-cli output MUST use the colored-output formatter skill!
Use Colored-Output Skill
Every response MUST start with:
bash .claude/skills/colored-output/color.sh skill-header "sql-cli" "Message here..."
Example formatted output:
bash .claude/skills/colored-output/color.sh skill-header "sql-cli" "Executing database query..."
bash .claude/skills/colored-output/color.sh progress "" "Connecting to database"
bash .claude/skills/colored-output/color.sh info "" "Found 142 rows"
bash .claude/skills/colored-output/color.sh success "" "Query completed successfully"
WHY: Using the centralized formatter ensures consistent colors across ALL components!
Replaces
❌ Old Method: Artisan Tinker
php artisan tinker
> User::where('status', 'active')->count()
> Subscription::latest()->limit(10)->get()
Problems:
- 1,500+ tokens to load Eloquent context
- 100-200ms overhead
- Requires PHP/Laravel knowledge
- No syntax highlighting
- Slow interactive REPL
✅ New Method: SQL-CLI Skill
bash .claude/skills/sql-cli/sql-cli.sh query "SELECT COUNT(*) FROM users WHERE status='active'"
bash .claude/skills/sql-cli/sql-cli.sh query "SELECT * FROM subs_subscriptions ORDER BY created_at DESC LIMIT 10"
Benefits:
- 200 tokens (87% reduction)
- 10-20ms execution (10x faster)
- Direct SQL (universal knowledge)
- Syntax highlighting with bat
- Instant results
Commands
Interactive Mode (mycli)
bash .claude/skills/sql-cli/sql-cli.sh interactive
# Opens mycli with:
# - Auto-completion for tables/columns
# - Syntax highlighting
# - Smart query suggestions
# - History navigation
When to Use: Exploring unfamiliar tables, experimenting with queries
Query Execution
bash .claude/skills/sql-cli/sql-cli.sh query "SELECT * FROM users WHERE status='active' LIMIT 10"
When to Use: One-off data checks, answering user questions about data
List Tables
bash .claude/skills/sql-cli/sql-cli.sh tables
Output: Table name, row count, data size, index size (sorted by rows)
When to Use: Understanding database structure, finding tables
Describe Table
bash .claude/skills/sql-cli/sql-cli.sh describe users
Output: Column names, types, nullability, keys, defaults
When to Use: Understanding schema before writing queries
Count Rows
# All rows
bash .claude/skills/sql-cli/sql-cli.sh count subs_subscriptions
# With WHERE clause
bash .claude/skills/sql-cli/sql-cli.sh count users "status='active'"
bash .claude/skills/sql-cli/sql-cli.sh count subs_subscriptions "renewal_date > NOW()"
When to Use: Quick data statistics, answering "how many" questions
Export to CSV
bash .claude/skills/sql-cli/sql-cli.sh export-csv "SELECT * FROM users WHERE created_at >= '2025-01-01'" users_2025.csv
When to Use: Generating reports, data analysis, sharing data
Explain Query
bash .claude/skills/sql-cli/sql-cli.sh explain "SELECT * FROM users WHERE email='[email protected]'"
Output: Execution plan, index usage, row estimates
When to Use: Performance debugging, optimizing slow queries
Workflow Integration
Pattern 1: User Asks for Data
User: "How many active subscriptions do we have?"
Claude:
1. Auto-activates sql-cli skill (keyword: "active subscriptions")
2. Runs: bash .claude/skills/sql-cli/sql-cli.sh count subs_subscriptions "status='active'"
3. Shows result: "✅ You have 1,247 active subscriptions"
Token Usage: 200 tokens (vs 1,500+ with Tinker)
Time: 15ms (vs 150ms with Tinker)
Pattern 2: Schema Exploration
User: "What fields does the users table have?"
Claude:
1. Auto-activates sql-cli skill (keyword: "users table")
2. Runs: bash .claude/skills/sql-cli/sql-cli.sh describe users
3. Shows formatted table structure with bat highlighting
Token Usage: 180 tokens
Time: 12ms
Pattern 3: Complex Analysis
User: "Show me users who joined in the last 7 days"
Claude:
1. Auto-activates sql-cli skill (key
Install sql-cli in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the sql-cli skill do?
Token-efficient MySQL/PostgreSQL operations using mycli and native CLI tools (Windows/Mac/Linux compatible). Replaces Artisan Tinker for database queries with 87% token savings.
How do I install the sql-cli skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the sql-cli skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
by Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
by Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropic