postgresql-query-generation

postgresql-query-generation is a skill for Claude Code from thapaliyabikendra/ai-artifacts. It costs 101 tokens per session (1,880 once invoked), scanned A, original, Apache-2.0.

A query generator for PostgreSQL databases in .NET projects that use Entity Framework Core, a library for working with databases from C# code. It examines C# entities and their relationships before producing SQL queries.

In plain words
What is it for?
Use it to generate PostgreSQL queries for related data, inspect the project's database model, and create SQL files for applications built with Entity Framework Core, including ABP Framework projects.
Why use it?
It removes much of the guesswork from writing queries across related tables and helps account for project rules such as multiple tenants and soft-deleted records.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it to generate PostgreSQL queries for related data, inspect the project's database model, and create SQL files for applications built with Entity Framework Core, including ABP Framework projects.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/thapaliyabikendra/ai-artifacts/postgresql-query-generation
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add thapaliyabikendra/ai-artifacts --skill postgresql-query-generation
Clone the repo
git clone --depth 1 https://github.com/thapaliyabikendra/ai-artifacts

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for postgresql-query-generation

README.md
[![agentmods](https://agentmods.dev/badge/skills/thapaliyabikendra/ai-artifacts/postgresql-query-generation/github.svg)](https://agentmods.dev/skills/thapaliyabikendra/ai-artifacts/postgresql-query-generation)
Your own site
<a href="https://agentmods.dev/skills/thapaliyabikendra/ai-artifacts/postgresql-query-generation"><img src="https://agentmods.dev/badge/skills/thapaliyabikendra/ai-artifacts/postgresql-query-generation/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for postgresql-query-generation

Your own site · 80×15
<a href="https://agentmods.dev/skills/thapaliyabikendra/ai-artifacts/postgresql-query-generation"><img src="https://agentmods.dev/badge/skills/thapaliyabikendra/ai-artifacts/postgresql-query-generation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 101 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,880 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00101 $0.01880
Opus 5 $0.00051 $0.00940
Sonnet 5 $0.00020 $0.00376
Haiku 4.5 $0.00010 $0.00188

Measured 8d ago against content hash bca91834ca29, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

postgresql-query-generation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/generate_query.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/postgresql-query-generation/SKILL.md · 220 lines

How it starts

The opening of the file, as written. The whole thing — 220 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PostgreSQL Query Generation

Generate production-ready PostgreSQL queries for any .NET project using Entity Framework Core. This skill automatically discovers your domain structure and generates optimized SQL with proper relationships, multi-tenancy, soft delete filters, and ABP Framework conventions.

Quick Start

# Interactive mode (output to stdout)
python scripts/generate_query.py --interactive

# Generate query - automatically saves .sql file in current directory
python scripts/generate_query.py --query "get all applications with workflow stages"

# Generate query with custom output filename
python scripts/generate_query.py --query "get all applications" --output my_query.sql

# Only discover domain (output schema as JSON)
python scripts/generate_query.py --discover-only --output schema.json

What It Does

  1. Discovers domain entities by scanning C# entity files
  2. Analyzes relationships (foreign keys, navigation properties)
  3. Detects project conventions (multi-tenancy, soft delete, audit fields)
  4. Generates optimized queries with proper JOINs and WHERE clauses
  5. Adapts to any domain (ABP, custom DDD, layered monoliths)

Capabilities

Automatic Discovery

  • Scans src/*/Domain/Entities/**/*.cs for entity classes
  • Inherits properties from base classes (FullAuditedAggregateRoot, SetupEntity, etc.)
  • Detects foreign keys by {EntityName}Id pattern
  • Identifies navigation properties (ICollection, T)
  • Maps C# types to PostgreSQL types automatically

Query Patterns Supported

  • ✅ Multi-entity JOIN queries
  • ✅ Many-to-many relationships via join tables
  • ✅ Hierarchical/self-referencing (recursive CTE)
  • ✅ JSONB querying (@>, ?, jsonb_path_query)
  • ✅ Window functions (ROW_NUMBER, FIRST_VALUE, etc.)
  • ✅ Pagination with COUNT
  • ✅ Permission/security queries with complex joins
  • ✅ Aggregations and GROUP BY
  • ✅ Full-text search (ILIKE)
  • ✅ Bulk operations (INSERT/UPDATE with CASE)

Project-Specific Patterns

  • ABP Framework: Auto-detects TenantId, IsDeleted, CreationTime audit fields
  • Multi-tenancy: Always adds TenantId = @tenantId filter
  • Soft delete: Adds IsDeleted = false filter
  • JSONB fields: Optimized queries for InitialData, FormData, JsonSchema, etc.
  • Naming conventions: Uses quoted identifiers (e.g., "SystemName")

Read the full file on GitHub · 220 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 220 lines · 101 tokens per session scan A bca91834ca29

Subscribe to this mod's changes

postgresql-query-generation is a skill published in the GitHub repository thapaliyabikendra/ai-artifacts (24 stars, last pushed 5mo ago), licensed Apache-2.0. It adds 101 tokens to every session and 1,880 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

azure-postgres-ts

Connect to Azure Database for PostgreSQL Flexible Server from Node.js/TypeScript using the pg (node-postgres) package. Use for PostgreSQL queries, connection pooling, transactions, and Microsoft Entra ID (passwordless) authentication. Triggers: "PostgreSQL", "postgres", "pg client", "node-postgres", "Azure PostgreSQL…

microsoft/skills · 94 tokens

butterbase

AI-native, open-source backend-as-a-service with a built-in Model Context Protocol server. Postgres, auth, storage, functions, AI gateway.

butterbase-ai/butterbase · 34 tokens

supabase

Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies…

supabase/agent-skills · 185 tokens

supabase-cli

This skill should be used when user asks to "use supabase CLI", "supabase init", "supabase start", "run migrations", "deploy edge functions", "manage Supabase project", or works with the supabase command-line tool for local development and project management.

fcakyon/claude-codex-settings · 60 tokens

supabase-js

This skill should be used when user asks to "use supabase-js", "query Supabase database", "supabase auth", "supabase storage", "supabase realtime", "supabase edge functions", or works with the @supabase/supabase-js JavaScript/TypeScript SDK.

fcakyon/claude-codex-settings · 64 tokens

supabase-node

Express/Hono with Supabase and Drizzle ORM.

alinaqi/maggy · 14 tokens