sherlock

michaelbromley's avatarfrom michaelbromley

Allows read-only access to SQL databases for querying and analysis using natural language

⭐3stars🔀1forks📁View on GitHub🕐Updated Jan 8, 2026

When & Why to Use This Skill

Sherlock is a powerful Claude skill that enables secure, read-only access to SQL databases, allowing users to perform complex data querying and analysis using natural language. By bridging the gap between technical database structures and intuitive conversation, it simplifies data exploration, schema introspection, and reporting without compromising data integrity.

Use Cases

  • Natural Language Querying: Transform plain English questions into accurate SQL queries to retrieve specific information from PostgreSQL, MySQL, or SQLite databases without writing code.
  • Database Schema Discovery: Quickly understand complex data models by listing tables, describing schemas, and visualizing foreign key relationships through simple commands.
  • Data Profiling and Quality Checks: Use the 'stats' and 'sample' features to analyze data distributions, identify null values, and preview records to ensure data quality before analysis.
  • Read-Only Auditing and Troubleshooting: Safely inspect production or staging data to verify record statuses or investigate issues without the risk of accidental data modification.
  • Automated Report Generation: Extract datasets and format them into clean markdown tables for immediate use in documentation, presentations, or team updates.
namesherlock
descriptionAllows read-only access to SQL databases for querying and analysis using natural language
- Bash(~/.claude/skills/sherlock/sherlock*)

Sherlock

Read-only SQL database access. Binary: ~/.claude/skills/sherlock/sherlock

Commands

All DB commands require -c <connection>. Output is JSON by default, use -f markdown for tables.

sherlock connections                    # List available connections
sherlock -c <conn> tables               # List tables
sherlock -c <conn> describe <table>     # Table schema
sherlock -c <conn> introspect           # Full schema (cached)
sherlock -c <conn> introspect --refresh # Refresh cached schema
sherlock -c <conn> query "SELECT ..."   # Execute read-only query
sherlock -c <conn> sample <table> -n 10 # Random sample rows
sherlock -c <conn> stats <table>        # Data profiling (nulls, distinct counts)
sherlock -c <conn> indexes <table>      # Table indexes
sherlock -c <conn> fk <table>           # Foreign key relationships
sherlock                                # Show help (all available commands)

Constraints

  • Read-only: Only SELECT, SHOW, DESCRIBE, EXPLAIN, WITH allowed
  • Connection required: Always specify -c <connection> (no default)
  • Quoting: PostgreSQL/SQLite use "identifier", MySQL uses `identifier`

Workflow

  1. Run connections to see available databases
  2. Use tables or introspect to understand schema (introspect is cached per-connection)
  3. Use fk to understand table relationships before writing JOINs
  4. Use sample to see real data examples before writing queries
  5. Write SQL based on user's question and schema
  6. Execute with query, present results clearly

Tips

  • Always use LIMIT to avoid large result sets
  • Use stats for data profiling (row counts, null counts, distinct values)
  • Use -f markdown for human-readable table output
  • Warn user before potentially expensive queries (JOINs on large tables, no WHERE clause)
  • Config: ~/.claude/skills/sherlock/config.json