Skip to content
cccskills
FreePublished on GitHub

db

Connect to any database — Cloud SQL, PostgreSQL, Snowflake, Databricks, Athena, Presto, or Oracle.

The English summary is being prepared. Showing the original description.

See how to install

Files included (9)

  • SKILL.md8.1 KB
  • db-engines/_router.md906 B
  • db-engines/athena.md630 B
  • db-engines/cloud-sql.md754 B
  • db-engines/databricks.md559 B
  • db-engines/oracle.md512 B
  • db-engines/postgres.md666 B
  • db-engines/presto.md518 B
  • db-engines/snowflake.md574 B

SKILL.md (original)

Review the instructions the agent will receive before you install.

DB — Universal Database Access

Reads connection config from .claude/100xprism.yml (preferred — kept out of the always-on context), falling back to the project instruction file (CLAUDE.md, AGENTS.md, .cursorrules, or equivalent), then ~/.claude/db-connections.json (global registry).

Scope: /db executes specific SQL or migrations against named connections. For analytics in plain English, use /query.

Supported engines

cloud-sql | postgres | snowflake | databricks | athena | presto | oracle

Usage

  • /db — default audit query for current project DB
  • /db "SELECT count(*) FROM users" — arbitrary SQL on current project DB
  • /db migrate — run pending migrations
  • /db prod-snowflake — named connection from global registry
  • /db prod-snowflake "SELECT ..." — named connection + custom SQL

Step 0 — Parse arguments

# If first arg looks like a connection name (no spaces, no SQL keywords), treat as named connection
ARGS="${1:-}"
if echo "$ARGS" | grep -qE '^[a-zA-Z0-9_-]+$' && ! echo "$ARGS" | grep -qiE '^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER|SHOW|DESCRIBE|migrate)'; then
  NAMED_CONNECTION=$(echo "$ARGS" | awk '{print $1}')
  SQL=$(echo "$ARGS" | cut -s -d' ' -f2-)
else
  NAMED_CONNECTION=""
  SQL="$ARGS"
fi

Step 1 — Load connection config

# Detect project instruction file
INSTRUCTION_FILE=$(ROOT=$(git rev-parse --show-toplevel 2>/dev/null); for f in .claude/100xprism.yml CLAUDE.md AGENTS.md .cursorrules; do [ -f "$ROOT/$f" ] && echo "$ROOT/$f" && break; done)
DB_CONNECTIONS="$HOME/.claude/db-connections.json"

if [ -n "$NAMED_CONNECTION" ]; then
  ENGINE=$(python3 -c "import json; d=json.load(open('$DB_CONNECTIONS')); c=d.get('$NAMED_CONNECTION',{}); print(c.get('engine',''))" 2>/dev/null)
  CONFIG_SOURCE="registry:$NAMED_CONNECTION"

elif [ -n "$INSTRUCTION_FILE" ] && grep -q "^engine:" "$INSTRUCTION_FILE" 2>/dev/null; then
  ENGINE=$(grep "^engine:" "$INSTRUCTION_FILE" | head -1 | cut -d: -f2 | tr -d ' ')
  CONNECTION_NAME=$(grep "^connection:" "$INSTRUCTION_FILE" | head -1 | cut -d: -f2 | tr -d ' ')
  CONFIG_SOURCE="instruction-file"

elif [ -f "$DB_CONNECTIONS" ]; then
  echo "No DB config found in project instruction file. Available connections:"
  python3 -c "
import json
d = json.load(open('$DB_CONNECTIONS'))
for i, (name, cfg) in enumerate(d.items(), 1):
    print(f'  {i}) {name} ({cfg.get(\"engine\",\"unknown\")})')
"
  read -rp "Select connection (number or name): " SELECTION
  NAMED_CONNECTION=$(python3 -c "
import json, sys
d = json.load(open('$DB_CONNECTIONS'))
keys = list(d.keys())
sel = '$SELECTION'
if sel.isdigit() and 1 <= int(sel) <= len(keys):
    print(keys[int(sel)-1])
elif sel in d:
    print(sel)
else:
    print('', end='')
" 2>/dev/null)
  ENGINE=$(python3 -c "import json; d=json.load(open('$DB_CONNECTIONS')); print(d.get('$NAMED_CONNECTION',{}).get('engine',''))" 2>/dev/null)
  CONFIG_SOURCE="registry:$NAMED_CONNECTION"

else
  echo "ERROR: No database config found."
  echo "  Option 1: Add a '## Database' section to your project instruction file"
  echo "  Option 2: Create ~/.claude/db-connections.json with named connections"
  exit 1
fi

if [ -z "$ENGINE" ]; then
  echo "ERROR: Could not determine database engine from config."
  exit 1
fi

echo "Engine: $ENGINE | Config: $CONFIG_SOURCE"

Step 2 — Load connection details from registry (if using named connection)

if [ -n "$NAMED_CONNECTION" ]; then
  # Extract all fields from the named connection into shell variables
  eval "$(python3 -c "
import json, shlex
d = json.load(open('$HOME/.claude/db-connections.json'))
cfg = d.get('$NAMED_CONNECTION', {})
for k, v in cfg.items():
    if k != 'engine':
        print(f'CONN_{k.upper()}={shlex.quote(str(v))}')
" 2>/dev/null)"
fi

Step 3 — Resolve credentials

AUTH="${CONN_AUTH:-$(grep '^auth:' "$INSTRUCTION_FILE" 2>/dev/null | head -1 | cut -d: -f2- | tr -d ' ')}"

case "$AUTH" in
  gcp-secret:*)
    SECRET_NAME="${AUTH#gcp-secret:}"
    DB_CRED=$(gcloud secrets versions access latest --secret="$SECRET_NAME" --project="${CONN_GCP_PROJECT:-$(grep '^gcp_project:' "$INSTRUCTION_FILE" | cut -d: -f2 | tr -d ' ')}")
    echo "Credential resolved from GCP Secret Manager ✓"
    ;;
  env:*)
    VAR_NAME="${AUTH#env:}"
    DB_CRED="${!VAR_NAME}"
    # Fall back to .env file
    if [ -z "$DB_CRED" ] && [ -f "$(git rev-parse --show-toplevel 2>/dev/null)/.env" ]; then
      DB_CRED=$(grep "^${VAR_NAME}=" "$(git rev-parse --show-toplevel)/.env" | cut -d= -f2-)
    fi
    [ -z "$DB_CRED" ] && { echo "ERROR: Env var $VAR_NAME not set and not in .env"; exit 1; }
    echo "Credential resolved from env var $VAR_NAME ✓"
    ;;
  sso)
    DB_CRED=""
    echo "Using SSO auth — browser window will open ✓"
    ;;
  keychain:*)
    KEY_NAME="${AUTH#keychain:}"
    DB_CRED=$(security find-generic-password -a "$KEY_NAME" -w 2>/dev/null)
    [ -z "$DB_CRED" ] && { echo "ERROR: Keychain key '$KEY_NAME' not found"; exit 1; }
    echo "Credential resolved from macOS keychain ✓"
    ;;
  databricks-token)
    DB_CRED="${DATABRICKS_TOKEN:-$(grep -A5 '\[DEFAULT\]' "$HOME/.databrickscfg" 2>/dev/null | grep '^token' | cut -d= -f2 | tr -d ' ')}"
    [ -z "$DB_CRED" ] && { echo "ERROR: No Databricks token found"; exit 1; }
    echo "Credential resolved from Databricks config ✓"
    ;;
  *)
    DB_CRED=""
    echo "WARNING: No auth method specified — proceeding without credentials"
    ;;
esac

Step 4 — Set default SQL if not provided

if [ -z "$SQL" ]; then
  SQL="SELECT 'connected' AS status, current_timestamp AS at"
  echo "No SQL provided — running default connectivity check"
fi

Step 5 — Delegate to engine file

# Engine files ship in db-engines/ next to this SKILL.md. Use the directory you
# loaded this skill from; the list below covers every adapter's install location.
ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
ENGINE_FILE=""
for d in "${DB_SKILL_DIR:-}" \
  "$HOME/.claude/skills/db" "$HOME/.100xprism/100xprism-catalog/db" \
  "$ROOT/.agents/skills/db" "$ROOT/.agents/100xprism-catalog/db" \
  "$ROOT/.cursor/100xprism-catalog/db" \
  "$ROOT/.pi/skills/db" "$ROOT/.pi/100xprism-catalog/db" \
  "$HOME/.hermes/skills/100xprism/db" "$HOME/.claude/commands"; do
  [ -n "$d" ] && [ -f "$d/db-engines/${ENGINE}.md" ] && ENGINE_FILE="$d/db-engines/${ENGINE}.md" && break
done

if [ -z "$ENGINE_FILE" ]; then
  echo "ERROR: No engine file found for ${ENGINE} (looked for db-engines/${ENGINE}.md beside this skill)"
  echo "Supported engines: cloud-sql, postgres, snowflake, databricks, athena, presto, oracle"
  exit 1
fi

echo "Delegating to db-engines/${ENGINE}.md..."
echo "---"

# Pass all resolved variables to the engine skill
# The engine file will use these pre-resolved values:
# - For cloud-sql:   INSTANCE=$CONN_INSTANCE, GCP_PROJECT=$CONN_GCP_PROJECT, DB_NAME=$CONN_DB_NAME, DB_USER=$CONN_DB_USER, DB_PASS=$DB_CRED
# - For postgres:    DB_HOST=$CONN_HOST, DB_PORT=$CONN_PORT, DB_NAME=$CONN_DATABASE, DB_USER=$CONN_USER, DB_PASS=$DB_CRED
# - For snowflake:   SF_ACCOUNT=$CONN_ACCOUNT, SF_WAREHOUSE=$CONN_WAREHOUSE, SF_DATABASE=$CONN_DATABASE, SF_ROLE=$CONN_ROLE, SF_USER=$CONN_USER, SF_TOKEN=$DB_CRED, SF_AUTH=$AUTH
# - For databricks:  DBX_HOST=$CONN_HOST, DBX_HTTP_PATH=$CONN_HTTP_PATH, DBX_TOKEN=$DB_CRED, DBX_CATALOG=$CONN_CATALOG, DBX_SCHEMA=$CONN_SCHEMA
# - For athena:      ATHENA_REGION=$CONN_REGION, ATHENA_DATABASE=$CONN_DATABASE, ATHENA_WORKGROUP=$CONN_WORKGROUP, ATHENA_S3_OUTPUT=$CONN_S3_OUTPUT
# - For presto:      PRESTO_HOST=$CONN_HOST, PRESTO_PORT=$CONN_PORT, PRESTO_USER=$CONN_USER, PRESTO_CATALOG=$CONN_CATALOG, PRESTO_SCHEMA=$CONN_SCHEMA, PRESTO_TOKEN=$DB_CRED, PRESTO_ENGINE=$CONN_ENGINE
# - For oracle:      ORA_HOST=$CONN_HOST, ORA_PORT=$CONN_PORT, ORA_SERVICE=$CONN_SERVICE, ORA_USER=$CONN_USER, ORA_PASS=$DB_CRED
# SQL=$SQL is passed to all engines

# Follow the instructions in db-engines/${ENGINE}.md using the variable mappings above

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Act as a Senior Accessibility Engineer to audit a page, component, or design against WCAG 2.2 AA. Produces a triaged finding list (critical/serious/moderate), focus-order map, contrast report, ARIA decision tree, and a screen-reader test plan. Use when shipping new UI, hardening an existing flow, or preparing for VPAT/accessibility conformance.

The English summary is being prepared. Showing the original description.

rajitsaha/100xprism10Updated Oct 14, 2026

When the user wants to plan, design, or implement an A/B test or experiment — "split test," "variant copy," "multivariate test," "hypothesis," "statistical significance," "how long should I run this test," or comparing two versions. For tracking implementation, see analytics-tracking. For page-level conversion optimization, see page-cro.

The English summary is being prepared. Showing the original description.

rajitsaha/100xprism10Updated Oct 14, 2026

When the user wants to generate, iterate, or scale ad creative — headlines, descriptions, primary text, full variations — for any paid platform; 'ad copy variations,' 'RSA headlines,' 'bulk ad copy,' 'creative testing,' 'write me some ads.' For campaign strategy and targeting, see paid-ads. For landing page copy, see copywriting.

The English summary is being prepared. Showing the original description.

rajitsaha/100xprism10Updated Oct 14, 2026

ai-seo

Free

When the user wants content cited by LLMs or surfaced in AI-generated answers — 'AI SEO,' 'AEO,' 'GEO,' 'LLMO,' 'answer engine optimization,' 'AI Overviews,' 'optimize for ChatGPT/Perplexity/Claude,' 'AI citations,' 'zero-click search.' For traditional technical/on-page audits, see seo-audit. For structured data, see schema-markup.

The English summary is being prepared. Showing the original description.

rajitsaha/100xprism10Updated Oct 14, 2026

When the user wants to set up, improve, or audit analytics tracking and measurement — "GA4," "conversion tracking," "event tracking," "UTM parameters," "tag manager," "GTM," "tracking plan," "attribution," "Mixpanel," "Segment," "are my events firing," or how to measure marketing results. For A/B test measurement, see ab-test-setup.

The English summary is being prepared. Showing the original description.

rajitsaha/100xprism10Updated Oct 14, 2026

Architectural decision advisor for cloud, data, and SaaS distributed systems. Use when the user asks "should we use X or Y", weighs a tradeoff, or needs a decision matrix, scaling analysis, cost-at-scale review, data-tier design, multi-tenancy model, or API/resilience guidance. For full technical blueprints, use enterprise-design.

The English summary is being prepared. Showing the original description.

rajitsaha/100xprism10Updated Oct 14, 2026

See all skills by rajitsaha

Report a problem with this skill