Agent skill · software engineering · aiskillstore
azure-postgres-ts
Connect to Azure Database for PostgreSQL Flexible Server from Node.js/TypeScript using the pg (node-postgres) package.
Why this skill is useful
Provides specific connection patterns and authentication methods for Azure PostgreSQL that the AI may not reliably generate on its own.
What it needs
Requires @azure/identity, @types/pg, pg installed locally. Requires azure account access. About 6k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.
What this skill does
Azure PostgreSQL for TypeScript (node-postgres) Connect to Azure Database for PostgreSQL Flexible Server using the pg (node-postgres) package with support for password and Microsoft Entra ID (passwordless) authentication. Installation Environment Variables Authentication Option 1: Password Authentication Option 2: Microsoft Entra ID (Passwordless) - Recommended Core Workflows 1. Single Client Connection 2. Connection Pool (Recommended for Production) 3. Parameterized Queries (Prevent SQL Injection) 4. Transactions 5. Transaction Helper Function 6. Typed Queries with TypeScript Pool with Entra ID Token Refresh For long-running applications, tokens expire and need refresh: Error Handling Connection String Format Pool Events Azure-Specific Configuration Setting Value Description --------- ------- ------------- ssl.rejectUnauthorized true Always use SSL for Azure Default port 5432 Standard PostgreSQL port PgBouncer port 6432 Use when PgBouncer enabled Token scope https://ossrdbms-aad.database.windows.net/.default Entra ID token scope Token lifetime ~1 hour Refresh before expiry Pool Sizing Guidelines Workload max idleTimeoutMillis ---------- ------- --------------------- Light (dev/test) 5-10 30000 Medium (production) 20-30 30000 Heavy (high concurrency) 50-100 10000 Note: Azure PostgreSQL has connection limits based on SKU. Check your tier's max connections. Best Practices 1. Always use connection pools for production applications 2. Use parameterized queries - Never concatenate user input 3. Always close connections - Use try/finally or connection pools 4. Enable SSL - Required for Azure (ssl: { rejectUnauthorized: true }) 5. Handle token refresh - Entra ID tokens expire after ~1 hour 6. Set connection timeouts - Avoid hanging on network issues 7. Use transactions - For multi-statement operations 8. Monitor pool metrics - Track pool.totalCount, pool.idleCount, pool.waitingCount 9. Graceful shutdown - Call pool.end() on application termination 10. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aiskillstore/azure-postgres-ts