Agent skill
postgresql-skill
This skill provides PostgreSQL-specific patterns for database design, optimization, and transaction management
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/postgresql-skill
SKILL.md
PostgreSQL Development
Purpose
PostgreSQL is a powerful relational database. This skill documents patterns for safe transactions, optimization, and concurrent access.
When to Use
Use this skill when:
- Designing database schema
- Creating migrations
- Implementing transactions
- Optimizing queries
- Managing connections
Key Patterns
1. Transaction Management
Wrap operations in transactions:
async def transfer_funds(self, from_account, to_account, amount):
async with self.db.transaction():
await self.db.execute(
"UPDATE accounts SET balance = balance - ? WHERE id = ?",
(amount, from_account)
)
await self.db.execute(
"UPDATE accounts SET balance = balance + ? WHERE id = ?",
(amount, to_account)
)
2. Connection Pooling
Use connection pools for efficiency:
pool = await asyncpg.create_pool(
'postgresql://user:password@localhost/db',
min_size=10,
max_size=20
)
3. Query Optimization
Use proper indexing:
CREATE INDEX idx_user_email ON users(email);
CREATE INDEX idx_transaction_date ON transactions(created_at);
See Also
- PostgreSQL Documentation: https://www.postgresql.org/docs/
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?