database

Create and manage Replit PostgreSQL databases and execute SQL queries with safety checks.

Updated Jul 10, 2026
One-click install
npx skills add https://github.com/SaberAloui/agri-hub --skill database-saberaloui
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: database
Source: https://github.com/SaberAloui/agri-hub/tree/main/.local/skills/database
Command: npx skills add https://github.com/SaberAloui/agri-hub --skill database-saberaloui

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up and querying databases across development and production environments is error-prone and risky, especially when accidental writes to production data or destructive queries can cause data loss. This Skill provisions Replit's built-in PostgreSQL database, verifies its status, and executes SQL with built-in safety guardrails. ## Core Features & Use Cases - Database Provisioning: Check whether a PostgreSQL database exists and create one on demand, automatically setting environment variables like DATABASE_URL, PGHOST, and PGPASSWORD. - Safe SQL Execution: Run queries against development with full SQL support, or run read-only SELECT queries against a production replica, with Stripe table mutations and destructive statements blocked. - Data Warehouse Queries: Query BigQuery, Databricks (via the databricks-m2m connector), and Snowflake with optional result sampling. - Use Case: A user asks to "check the prod db" for active users. The Skill runs a read-only SELECT against the production replica and returns the results without any risk of modifying live data. ## Quick Start Ask the assistant to check whether the database is provisioned and create one if needed, then run a SELECT query to inspect your tables.

Frequently Asked Questions about database

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

FAQPage Schema
How do I create a PostgreSQL database on Replit?▼

Call checkDatabase() first to see if one is already provisioned, then call createDatabase() if needed. On success it sets environment variables including DATABASE_URL, PGHOST, PGPORT, PGUSER, PGPASSWORD, and PGDATABASE for your application to use.

How do I query a production database safely?▼

Use executeSql with the environment parameter set to "production". Production queries run as read-only SELECT statements against a replica of the production database, so live data cannot be modified. Note the replica schema may lag behind your latest deployment.

Can I run INSERT or UPDATE queries against the production database?▼

No. Production environment queries are read-only and only SELECT statements are allowed. INSERT, UPDATE, DELETE, and DDL statements will fail. Use the development environment for all write operations.

Does the database skill support BigQuery, Databricks, or Snowflake?▼

Yes, executeSql accepts a target parameter for bigquery, databricks, or snowflake, with an optional sampleSize for warehouse queries. For Databricks, use the databricks-m2m connector rather than the plain databricks connector.

Why are DROP or TRUNCATE statements blocked?▼

Destructive queries like DROP and TRUNCATE are blocked through the skill callback path as a safety measure against accidental data loss. Operations requiring user confirmation must go through the tool interface directly.

When should I use an external database like Supabase instead?▼

Replit's built-in PostgreSQL is preferred because it supports rollbacks and integrates directly with the platform. Only choose external services when you have specific requirements the built-in database cannot meet.