Database

by gertrude-app

data

Skill Details

Repository Files

1 file in this skill directory


name: database description: Query and analyze the Gertrude PostgreSQL database. Use when answering questions about database schema, writing SQL queries, analyzing data, or debugging database-related issues. Has read-only access via the 'readonly' user. allowed-tools:

  • Bash
  • Read
  • Grep
  • Glob

Database Query Skill

You have read-only access to the Gertrude PostgreSQL database for querying and analysis.

Connection Information

  • Database name: gertrude
  • User: readonly
  • Password: None required
  • Connection command: psql -U readonly -d gertrude

Database Structure

The database uses multiple schemas to organize tables:

  • parent: Parent accounts, children, computers, keychains, keys, notifications, etc.
  • child: Computer users, blocked apps, iOS devices, tokens, screenshots
  • macapp: Keystroke lines, releases, unlock requests
  • iosapp: Block groups, rules, device configurations, suspend requests
  • macos: App bundle IDs, categories, browsers, identified/unidentified apps
  • system: Deleted entities, interesting events, security events, Stripe events
  • public: Fluent migrations, jobs metadata
  • podcasts: Podcast-related tables

Common Commands

Introspect Schema

# List all tables with their schemas
psql -U readonly -d gertrude -c "\dt"

# List all schemas with privileges
psql -U readonly -d gertrude -c "\dn+"

# Describe a specific table (show columns, types, constraints)
psql -U readonly -d gertrude -c "\d parent.parents"
psql -U readonly -d gertrude -c "\d+ parent.parents"  # with more details

# List all columns in a schema
psql -U readonly -d gertrude -c "\d parent.*"

Query Data

# Run a simple query
psql -U readonly -d gertrude -c "SELECT * FROM parent.parents LIMIT 10;"

# Run a formatted query with better output
psql -U readonly -d gertrude -c "SELECT id, email, created_at FROM parent.parents ORDER BY created_at DESC LIMIT 5;"

# Count records
psql -U readonly -d gertrude -c "SELECT COUNT(*) FROM parent.parents;"

# Complex queries with joins (example)
psql -U readonly -d gertrude -c "
  SELECT p.email, COUNT(c.id) as num_children
  FROM parent.parents p
  LEFT JOIN parent.children c ON c.parent_id = p.id
  GROUP BY p.email
  LIMIT 10;
"

Format Output

# Use expanded display for wide tables
psql -U readonly -d gertrude -c "\x" -c "SELECT * FROM parent.parents LIMIT 1;"

# Export to CSV
psql -U readonly -d gertrude -c "COPY (SELECT * FROM parent.parents LIMIT 10) TO STDOUT WITH CSV HEADER;"

Workflow

  1. Understand the question: Determine what data or schema information is needed
  2. Introspect first: Use \d commands to understand table structure before writing queries
  3. Write queries: Construct appropriate SELECT queries to answer the question
  4. Analyze results: Interpret the query results and provide clear explanations
  5. Verify permissions: If you attempt any write operation, you'll get a permission error (this is expected)

Important Notes

  • Read-only access: You cannot INSERT, UPDATE, DELETE, or modify the database in any way
  • Schema qualification: Always use schema-qualified table names (e.g., parent.parents, not just parents)
  • Query carefully: Start with small LIMIT clauses to avoid overwhelming output
  • Explain results: After running queries, provide clear explanations of what the data shows

Examples

Example 1: How many parents are in the system?

psql -U readonly -d gertrude -c "SELECT COUNT(*) as total_parents FROM parent.parents;"

Example 2: What are the recent security events?

psql -U readonly -d gertrude -c "
  SELECT id, event_type, detail, created_at
  FROM system.security_events
  ORDER BY created_at DESC
  LIMIT 10;
"

Example 3: What columns are in the computers table?

psql -U readonly -d gertrude -c "\d parent.computers"

Related Skills

Xlsx

Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas

data

Clickhouse Io

ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.

datacli

Clickhouse Io

ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.

datacli

Analyzing Financial Statements

This skill calculates key financial ratios and metrics from financial statement data for investment analysis

data

Data Storytelling

Transform data into compelling narratives using visualization, context, and persuasive structure. Use when presenting analytics to stakeholders, creating data reports, or building executive presentations.

data

Kpi Dashboard Design

Design effective KPI dashboards with metrics selection, visualization best practices, and real-time monitoring patterns. Use when building business dashboards, selecting metrics, or designing data visualization layouts.

designdata

Dbt Transformation Patterns

Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.

testingdocumenttool

Sql Optimization Patterns

Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.

designdata

Anndata

This skill should be used when working with annotated data matrices in Python, particularly for single-cell genomics analysis, managing experimental measurements with metadata, or handling large-scale biological datasets. Use when tasks involve AnnData objects, h5ad files, single-cell RNA-seq data, or integration with scanpy/scverse tools.

arttooldata

Xlsx

Spreadsheet toolkit (.xlsx/.csv). Create/edit with formulas/formatting, analyze data, visualization, recalculate formulas, for spreadsheet processing and analysis.

tooldata

Skill Information

Category:Data
Last Updated:11/11/2025