मुख्य सामग्री पर जाएँ
Skillpedia
डेटाबेस48k · #6291

postgres-readonly-queries

यह क्या करती है

यह agent आपको PostgreSQL databases से सुरक्षित तरीके से सवाल पूछने देता है, सिर्फ़ data पढ़ने के लिए। यह आपके सेट किए गए अलग-अलग databases से जुड़ता है और पक्का करता है कि आप गलती से कुछ भी न बदलें।

कब इस्तेमाल करें

  • ✓जब आपको PostgreSQL database का data बदल जाने के जोखिम के बिना देखना हो।
  • ✓जब database की tables और columns को समझना हो।
  • ✓database से कोई खास जानकारी जांचनी हो, जैसे customers या orders की सूची।

Skill का लिंक

https://github.com/sickn33/agentic-awesome-skills/blob/main/skills/postgres-readonly-queries/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/sickn33/agentic-awesome-skills/blob/main/skills/postgres-readonly-queries/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“production database से पहले 10 users की सूची दिखाओ।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

आप अपने PostgreSQL databases की connection जानकारी एक file में सेट करते हैं। फिर आप agent से SQL queries (data निकालने वाले commands) चलाने को कह सकते हैं, जो हमेशा सिर्फ़ पढ़ने वाली होती हैं, इसलिए सुरक्षित रहती हैं।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

PostgreSQL Read-Only Query Skill

When to Use

  • Use when querying PostgreSQL databases and access must stay strictly read-only
  • Use when exploring schemas, tables, and data across multiple configured connections
  • Use when you want defense-in-depth protection against accidental INSERT/UPDATE/DELETE or DDL

Execute safe, read-only queries against configured PostgreSQL databases.

Requirements

  • Python 3.8+
  • psycopg2-binary: pip install -r requirements.txt

Setup

Create connections.json in the skill directory or ~/.config/claude/postgres-connections.json.

Security: Set file permissions to 600 since it contains credentials:

chmod 600 connections.json
{
  "databases": [
    {
      "name": "production",
      "description": "Main app database - users, orders, transactions",
      "host": "db.example.com",
      "port": 5432,
      "database": "app_prod",
      "user": "readonly_user",
      "password": "your-password",
      "sslmode": "require"
    }
  ]
}

Config Fields

Field Required Description
name Yes Identifier for the database (case-insensitive)
description Yes What data this database contains (used for auto-selection)
host Yes Database hostname
port No Port number (default: 5432)
database Yes Database name
user Yes Username
password Yes Password
sslmode No SSL mode: disable, allow, prefer (default), require, verify-ca, verify-full

Usage

List configured databases

python3 scripts/query.py --list

Query a database

python3 scripts/query.py --db production --query "SELECT * FROM users LIMIT 10"

List tables

python3 scripts/query.py --db production --tables

Show schema

python3 scripts/query.py --db production --schema

Limit results

python3 scripts/query.py --db production --query "SELECT * FROM orders" --limit 100

Database Selection

Match user intent to database description:

User asks about Look for description containing
users, accounts users, accounts, customers
orders, sales orders, transactions, sales
analytics, metrics analytics, metrics, reports
logs, events logs, events, audit

If unclear, run --list and ask user which database.

Safety Features

  • Read-only session: Connection uses PostgreSQL readonly=True mode (primary protection)
  • Query validation: Only SELECT, SHOW, EXPLAIN, WITH queries allowed
  • Single statement: Multiple statements per query rejected
  • SSL support: Configurable SSL mode for encrypted connections
  • Query timeout: 30-second statement timeout enforced
  • Memory protection: Max 10,000 rows per query to prevent OOM
  • Column width cap: 100 char max per column for readable output
  • Credential sanitization: Error messages don't leak passwords

Troubleshooting

Error Solution
Config not found Create connections.json in skill directory
Authentication failed Check username/password in config
Connection timeout Verify host/port, check firewall/VPN
SSL error Try "sslmode": "disable" for local databases
Permission warning Run chmod 600 connections.json

Exit Codes

  • 0: Success
  • 1: Error (config missing, auth failed, invalid query, database error)

Workflow

  1. Run --list to show available databases
  2. Match user intent to database description
  3. Run --tables or --schema to explore structure
  4. Execute query with appropriate LIMIT

Limitations

  • Read-only protections reduce accidental writes but cannot override database-server policy, triggers, extensions, or an over-privileged account. Use a database role with read-only permissions as the primary control.
  • Query results can contain personal, confidential, or regulated data. Confirm the intended database and avoid exporting or sharing results without explicit authorization.
  • The script is not a replacement for backups, auditing, access reviews, or production change controls.
अक्सर पूछे जाने वाले सवाल

अगर मैं data बदलने की कोशिश करूं तो क्या होगा?

यह agent बदलाव रोकने के लिए बनाया गया है। यह सिर्फ़ पढ़ने वाले commands (जैसे SELECT) की अनुमति देता है और गलती से data बदलने या मिटाने से बचाने के लिए अतिरिक्त सुरक्षा भी रखता है।

agent को कैसे पता चलता है कि किस database से जुड़ना है?

आप configured databases की सूची देखकर नाम या विवरण से कोई एक चुन सकते हैं। agent आपके सवाल के आधार पर अनुमान लगाकर यह भी तय करने की कोशिश करता है कि आपको कौन सा database चाहिए।

क्या मेरे passwords डालना सुरक्षित है?

हां, अगर आप सुरक्षा निर्देशों का पालन करें। Passwords एक खास configuration file में रहते हैं, जिसकी permissions सीमित होनी चाहिए (सिर्फ़ आप ही पढ़ और लिख सकें), और agent error messages में passwords नहीं दिखाता।

जानकारी

लेखक का मूल विवरण

Execute safe read-only SQL queries against PostgreSQL databases with multi-connection support and defense-in-depth write protection.

repo: sickn33/agentic-awesome-skills

लोकप्रियता

GitHub स्टार
48k
रैंकिंग में स्थान
#6291
लाइसेंस
MIT
अपडेट की गई
15/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

00-andruia-consultant

48k

आपके एजेंट को AI प्रोजेक्ट शुरू करने या उन्हें बेहतर बनाने में मदद करता है। यह code का विश्लेषण करता है, tools सुझाता है और स्पेनिश भाषा में action plan बनाता है।

AI और एजेंटएजेंट

007

48k

आपका एजेंट security audit और threat modeling करता है। यह प्रोजेक्ट को हमलों और कमजोरियों से बचाने में काम आता है।

कोडिंगसिक्योरिटी

10-andruia-skill-smith

48k

आपके एजेंट को AI tools बनाने या उन्हें बेहतर करने में मदद करता है। यह तय करता है कि tools कैसे काम करेंगे, documentation लिखता है और structure की जांच करता है।

AI और एजेंटएजेंट

20-andruia-niche-intelligence

48k

आपका एजेंट किसी खास industry का summary बनाता है। भरोसेमंद स्रोतों की मदद से यह प्रोजेक्ट का संदर्भ, नियम, इस्तेमाल के तरीके और जोखिम समझने में मदद करता है।

लेखन और डॉक्यूमेंटरिसर्च

मिलती-जुलती skills