본문으로 건너뛰기
cccskills
무료GitHub에 공개

analytics

Run SQL queries against psql, BigQuery, or MySQL from the terminal, including natural-language-to-SQL and schema exploration. Use when analyzing data, inspecting DB state, or debugging tables. Trigger on "query the database", "SQL", "show me data from", "explore table".

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md4.7 KB
  • config.yaml742 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Analytics Helper

Help write and run database queries from the terminal.

Usage

/analytics "show user signups by month"    # Natural language query
/analytics explore users                    # Explore table schema
/analytics psql                             # Set database context
/analytics connect mydb                     # Connect to named database

Supported Databases

TypeCLIConnection Source
PostgreSQLpsql$DATABASE_URL or connection string
BigQuerybqgcloud auth (project from $GOOGLE_CLOUD_PROJECT)
MySQLmysql$MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD
SQLitesqlite3File path

Commands

Natural Language Queries

Describe what you want in plain English:

/analytics "count users by country"
/analytics "show orders over $100 from last month"
/analytics "find duplicate emails in customers table"

I'll:

  1. Generate appropriate SQL
  2. Show it for your approval
  3. Run via CLI
  4. Format output as a table

Schema Exploration

/analytics explore              # List all tables
/analytics explore users        # Describe users table
/analytics explore users.email  # Show column details

PostgreSQL

psql -c "\dt"                   # List tables
psql -c "\d+ tablename"         # Describe table with details
psql -c "\di"                   # List indexes

BigQuery

bq ls dataset                   # List tables
bq show dataset.table           # Describe table
bq show --schema dataset.table  # Show schema only

MySQL

mysql -e "SHOW TABLES"
mysql -e "DESCRIBE tablename"
mysql -e "SHOW INDEX FROM tablename"

Database Context

Set which database you're working with:

/analytics psql              # Use PostgreSQL
/analytics bq                # Use BigQuery
/analytics mysql             # Use MySQL
/analytics sqlite mydb.db    # Use SQLite file

Context persists for the session.

Query Templates

Time Series

SELECT
  DATE_TRUNC('month', created_at) as month,
  COUNT(*) as count
FROM table
GROUP BY 1
ORDER BY 1;

Top N

SELECT column, COUNT(*) as count
FROM table
GROUP BY 1
ORDER BY 2 DESC
LIMIT 10;

Duplicates

SELECT email, COUNT(*) as count
FROM users
GROUP BY email
HAVING COUNT(*) > 1
ORDER BY count DESC;

Recent Records

SELECT *
FROM table
WHERE created_at >= NOW() - INTERVAL '7 days'
ORDER BY created_at DESC
LIMIT 100;

Join Pattern

SELECT
  u.name,
  COUNT(o.id) as order_count,
  SUM(o.total) as total_spent
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
GROUP BY u.id, u.name
ORDER BY total_spent DESC;

Safety Rules

  1. Show before run: Always display the generated SQL before execution
  2. Read-only default: SELECT queries run immediately after approval
  3. Mutation warning: UPDATE/DELETE require explicit confirmation
  4. No destructive DDL: Never run DROP, TRUNCATE without explicit user request
  5. Timeout: Queries timeout after 30 seconds by default
  6. Row limit: Add LIMIT 1000 to unbounded SELECTs to prevent memory issues

Configuration

Create ~/.claude/skills/analytics/config.yaml:

# Named connections
connections:
  prod:
    type: psql
    url: postgres://user:pass@host:5432/dbname
  staging:
    type: psql
    url: postgres://user:pass@staging:5432/dbname
  analytics:
    type: bq
    project: my-gcp-project
    dataset: analytics

# Default connection
default: staging

# Query timeout (seconds)
timeout: 30

# Max rows to return
max_rows: 1000

# Save query history
history: true
history_file: ~/.claude/analytics_history.sql

Output Formatting

Results are formatted as markdown tables:

| id | name | created_at |
|----|------|------------|
| 1 | Alice | 2026-01-15 |
| 2 | Bob | 2026-01-16 |

(2 rows, 0.045s)

For large results, offer to:

  • Export to CSV
  • Paginate output
  • Summarize with counts

Error Handling

  • Connection failures: Show connection string (redacted) and suggest fixes
  • Syntax errors: Show error position and suggest corrections
  • Timeout: Offer to increase timeout or add LIMIT
  • Permission denied: Suggest checking credentials or role

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Validate WCAG 2.1 Level AA compliance and accessibility best practices. Use when performing accessibility audits and WCAG certification.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matteocervelli/llms252026년 5월 22일 업데이트

analysis

무료

Analyze feature requirements, dependencies, and security considerations. Use when starting feature implementation from GitHub issues to understand scope, technical feasibility, and risks.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matteocervelli/llms252026년 5월 22일 업데이트

Design REST APIs or function contracts with clear request/response specifications, error handling patterns, authentication strategies, and comprehensive documentation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matteocervelli/llms252026년 5월 22일 업데이트

Generate comprehensive API endpoint tests for REST and GraphQL APIs. Creates tests for all HTTP methods, status codes, authentication, and validation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matteocervelli/llms252026년 5월 22일 업데이트

Design component architecture and module structure using established architectural patterns for clean, maintainable, and scalable systems.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matteocervelli/llms252026년 5월 22일 업데이트

Generate CHANGELOG entries following conventional commits format with semantic versioning. Use when finalizing features to maintain proper change history.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

matteocervelli/llms252026년 5월 22일 업데이트

matteocervelli의 스킬 모두 보기

이 스킬의 문제 신고