Claude Code Plugins

Community-maintained marketplace

Feedback
1
0

Helps query and analyze PostgreSQL databases. Use when the user asks about database queries, schema inspection, table relationships, or data analysis tasks. Can connect to local or remote PostgreSQL instances and execute safe, parameterized queries. Supports schema exploration, query optimization suggestions, and data export.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name database-query-helper
description Helps query and analyze PostgreSQL databases. Use when the user asks about database queries, schema inspection, table relationships, or data analysis tasks. Can connect to local or remote PostgreSQL instances and execute safe, parameterized queries. Supports schema exploration, query optimization suggestions, and data export.
allowed-tools Read, Write, Bash, Grep, Glob

Database Query Helper - Claude Code Skill

This skill provides intelligent PostgreSQL database interaction capabilities through a secure MCP server.

Core Capabilities

Schema Inspection

Explore database structures, table definitions, column types, and relationships:

Example requests:

  • "Show me the schema for the users table"
  • "What columns exist in the orders table?"
  • "List all tables in the database"
  • "Show me the relationships between users and orders tables"

Safe Query Execution

Execute parameterized queries with automatic SQL injection protection:

Example requests:

  • "Find all users created in the last 30 days"
  • "Count orders by status"
  • "Show me the top 10 customers by order value"
  • "Get all products with price greater than $50"

Query Optimization

Analyze and suggest improvements for slow queries:

Example requests:

  • "Optimize this query: SELECT * FROM large_table WHERE date > '2023-01-01'"
  • "Why is this query slow?"
  • "Suggest indexes for better performance"

Data Analysis

Aggregate, group, and analyze data patterns:

Example requests:

  • "Show monthly revenue trends"
  • "Which products have the highest return rate?"
  • "Calculate customer lifetime value"

Safety Features

All queries executed through this skill include:

  • Parameterized queries: Automatic SQL injection prevention
  • Query timeout protection: 30-second default timeout
  • Transaction rollback: Automatic rollback on errors
  • Read-only mode available: Can be configured for safe exploration
  • Connection pooling: Efficient resource management

Configuration

The skill uses environment variables for database connection:

  • DB_HOST: PostgreSQL server hostname (default: localhost)
  • DB_PORT: PostgreSQL port (default: 5432)
  • DB_NAME: Database name
  • DB_USER: Database username
  • DB_PASSWORD: Database password
  • DB_CONNECTION_TIMEOUT: Connection timeout in milliseconds (default: 30000)

Claude Code Specific Notes

This skill integrates with the database-mcp-server MCP server, which is automatically configured in the marketplace.json manifest. The MCP server provides the following tools:

  • execute_query: Execute safe SQL queries with parameters
  • get_schema: Retrieve table structure information
  • list_tables: Get all tables in the database
  • analyze_query: Get query execution plans and optimization suggestions

Usage Tips

  1. Start with schema inspection before writing queries
  2. Use natural language - I'll translate to SQL
  3. Ask for explanations of results or query plans
  4. Request optimizations if queries seem slow
  5. Export results to CSV or JSON if needed

Examples

Basic Query

User: "Show me all users who registered this week"
Claude: I'll query the users table with a date filter...

Schema Exploration

User: "What's the structure of the products table?"
Claude: Let me get the schema information...

Data Analysis

User: "Calculate average order value by customer segment"
Claude: I'll write a query with GROUP BY and AVG...

For detailed API documentation and advanced usage, see shared/reference.md