retool-query

Run read-only SQL queries against the moderator PostgreSQL database for moderation data.

7.2k|734|Updated Oct 11, 2022
One-click install
npx skills add https://github.com/civitai/civitai --skill retool-query
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: retool-query
Source: https://github.com/civitai/civitai/tree/main/.claude/skills/retool-query
Command: npx skills add https://github.com/civitai/civitai --skill retool-query

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pg.

What problem does it solve?

Moderators and engineers need direct access to Retool-era moderation data such as user notes and strikes, but manually connecting to the PostgreSQL database with the right credentials, timeouts, and safety guards is repetitive and error-prone.

Core Features & Use Cases

  • Safe Query Execution: Runs SQL against the moderator database in read-only mode by default, blocking INSERT, UPDATE, DELETE, and other write operations unless explicitly confirmed with the --writable flag.
  • Flexible Output and Input: Supports JSON output, quiet mode, file-based queries, and configurable statement timeouts for long-running lookups.
  • Use Case: A moderator investigating a user report can run a single command to pull all UserNotes rows for a given userId, ordered by creation date, without opening a separate database client.

Quick Start

Ask the assistant to look up the moderation notes for user 12345 in the moderator database and show the ten most recent entries.

Frequently Asked Questions about retool-query

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a SQL query against the moderator database?

Run node .claude/skills/retool-query/query.mjs followed by your SQL string, for example a SELECT on the UserNotes table. The script connects using MODERATOR_DATABASE_URL from your .env file and prints the resulting rows.

How do I query the UserNotes table for a specific user?

Pass a SELECT statement filtering by userId, such as SELECT * FROM "UserNotes" WHERE "userId" = 12345 ORDER BY created_at DESC LIMIT 10. Quote the table name since it uses mixed case in PostgreSQL.

Can I run INSERT or UPDATE statements with this query runner?

Write operations are blocked by default and require the --writable flag. The skill instructions require asking the user for explicit permission before using --writable, since it modifies production moderation data.

Why does my query fail with a timeout error?

Queries time out after 30 seconds by default via PostgreSQL statement_timeout. Increase the limit with the --timeout flag followed by the number of seconds, for example --timeout 60 for slower analytical queries.

What connection string does the query runner use?

It reads MODERATOR_DATABASE_URL first and falls back to the retired RETOOL_DATABASE_URL for older checkouts. Define it in .claude/skills/retool-query/.env or the project root .env file.