0
0
# Install this skill:
npx skills add wilmanbarrios/skills --skill "run-sql"

Install specific skill from multi-skill repository

# Description

Execute SQL on the local development database. Auto-detects connection method from project context.

# SKILL.md


name: run-sql
description: Execute SQL on the local development database. Auto-detects connection method from project context.
version: 1.0.0


Execute SQL on the local development database. Auto-detects connection method from project context.

SQL Runner

  • DB Engine: auto-detect (see Step 1)
  • Schema File: .claude/natural-sql/schema.tsv (if exists)

Claim Conditions

I claim the query when:
- User explicitly mentions "local", "localhost", "docker", "my db", "dev db"
- User does NOT mention a remote environment (production, staging, etc.)
- No other runner has claimed the query (I am the default fallback)
- User mentions project-specific tables without specifying a remote environment β€” this means local

Key rule: If the user says "traeme los usuarios en telespine user" without mentioning prod/stg/dev, I claim it and run it against the local DB. I infer the connection from the project context (Docker, Django settings, etc.).

Step 1 β€” Determine Connection Method

Priority order:

  1. .claude/natural-sql/config.md exists with ## Query Command β†’ use it as-is
  2. Auto-detect from project:
  3. docker-compose.yml / compose.yml:
    • mysql/mariadb image β†’ docker compose exec <service> mysql -u <user> -p<pass> <dbname> --table -e "{sql}"
    • postgres image β†’ docker compose exec <service> psql -U <user> -d <dbname> -c "{sql}"
  4. Django DATABASES setting β†’ build CLI command from ENGINE/HOST/NAME/USER/PASSWORD
  5. Rails config/database.yml β†’ extract dev config
  6. db.sqlite3 exists β†’ sqlite3 db.sqlite3 "{sql}"
  7. Can't detect β†’ ask user, suggest saving to .claude/natural-sql/config.md

Step 2 β€” Execute

Run the determined command with the SQL.

Step 3 β€” Display Results

Format and show the output to the user.

Safety Rules

  • READ-ONLY by default. Warn on write operations (INSERT, UPDATE, DELETE, DROP, ALTER, TRUNCATE, CREATE).
  • Never run DROP DATABASE or TRUNCATE.
  • Escape quotes properly for shell transit.

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.