affaan-m/ECC

postgres-patterns

Sorgu optimizasyonu, şema tasarımı, indeksleme ve güvenlik için PostgreSQL veritabanı kalıpları. Supabase en iyi uygulamalarına dayanır.

65Collecting
See how to use itView GitHub source
npx skills add https://github.com/affaan-m/ECC --skill "docs/tr/skills/postgres-patterns"
Automated source guide

Source checked Jul 28, 2026·Refresh due Oct 26, 2026

Reorganized from the pinned upstream SKILL.md

Turn postgres-patterns's source instructions into a guide you can follow

According to the pinned SKILL.md from affaan-m/ECC: PostgreSQL en iyi uygulamaları için hızlı referans. Detaylı kılavuz için database-reviewer agent'ını kullanın.

npx skills add https://github.com/affaan-m/ECC --skill "docs/tr/skills/postgres-patterns"
Check the pinned source

Best fit

  • Sorgu optimizasyonu, şema tasarımı, indeksleme ve güvenlik için PostgreSQL veritabanı kalıpları. Supabase en iyi uygulamalarına dayanır.

Bring this context

  • A concrete task that matches the documented purpose of postgres-patterns.
  • The files, examples, or context the task depends on.
  • Your constraints, target environment, and definition of done.

Expected outputs

  • A result that follows the pinned postgres-patterns instructions.
  • A concise record of assumptions, inputs used, and unresolved questions.
  • A final check against the source workflow and relevant permission signals.

Key source sections

Read postgres-patterns through these 5 source sections

Sections are extracted automatically from the pinned SKILL.md and link back to the source.

01

Ne Zaman Aktifleştirmeli

SQL sorguları veya migration'lar yazarken

SKILL.md · Ne Zaman Aktifleştirmeli
SQL sorguları veya migration'lar yazarkenVeritabanı şemaları tasarlarkenYavaş sorguları troubleshoot ederken
03

İndeks Hile Sayfası

Review the “İndeks Hile Sayfası” section in the pinned source before continuing.

SKILL.md · İndeks Hile Sayfası
Review and apply the “İndeks Hile Sayfası” source section.
04

Veri Tipi Hızlı Referans

Review the “Veri Tipi Hızlı Referans” section in the pinned source before continuing.

SKILL.md · Veri Tipi Hızlı Referans
Review and apply the “Veri Tipi Hızlı Referans” source section.

SkillSignal prompt templates

Provide the task, context, and acceptance criteria

These prompts were written by SkillSignal from the source structure; they are not upstream text.

Task-start prompt

Confirm source fit, inputs, and outputs before acting.

Use postgres-patterns to help me with: [specific task]. Context: [files, data, or background]. Constraints: [environment, scope, and prohibited actions]. Before acting, check the pinned SKILL.md and explain which sections apply, what inputs are still missing, and what you will deliver.

Source-guided execution

Make the Agent explicitly follow the key extracted sections.

Apply the pinned postgres-patterns source to [task]. Pay particular attention to these source sections: “Ne Zaman Aktifleştirmeli”, “Hızlı Referans”, “İndeks Hile Sayfası”, “Veri Tipi Hızlı Referans”, “Yaygın Kalıplar”. Preserve the important decision at each step. Mark facts not covered by the source as “needs confirmation” instead of inventing them. Then verify the result against my acceptance criteria: [criteria].

Result-review prompt

Check omissions, permissions, and source drift before delivery.

Review the current postgres-patterns result: (1) does it satisfy the original task; (2) were any applicable steps or limits in the pinned SKILL.md missed; (3) did it perform any unauthorized file, command, network, or data action; and (4) which conclusions remain unverified? List issues first, then fix only what the source or user authorization supports.

Output checklist

Verify each item before delivery

The task matches the purpose documented in the SKILL.md.

The source section “Ne Zaman Aktifleştirmeli” has been checked.

The source section “Hızlı Referans” has been checked.

The source section “İndeks Hile Sayfası” has been checked.

The source section “Veri Tipi Hızlı Referans” has been checked.

Inputs, constraints, and acceptance criteria are explicit.

Unverified facts, compatibility, and outcome claims are clearly marked.

Any file, command, network, or data action has been reviewed.

Choose a different workflow

When another Skill is the better fit

FAQ

What does postgres-patterns do?

PostgreSQL en iyi uygulamaları için hızlı referans. Detaylı kılavuz için database-reviewer agent'ını kullanın.

How do I start using postgres-patterns?

The catalog detected this source-specific install command: npx skills add https://github.com/affaan-m/ECC --skill "docs/tr/skills/postgres-patterns". Inspect the command and pinned source before running it.

Which Agent platforms does it declare?

No dedicated Agent platform is declared in the pinned source record.

Repository stars
234,327
Repository forks
35,711
Quality
65/100
Source repository last pushed

Quality breakdown

Based on traceable docs and repository signals; stars are not treated as quality.

65/100
Documentation21/30
Specificity7/25
Maintenance20/20
Trust signals17/25
View original Skill.mdThis page is parsed directly from the repository SKILL.md without editorial rewriting. Collected: Jul 28, 2026 · about 1 min

PostgreSQL Kalıpları

PostgreSQL en iyi uygulamaları için hızlı referans. Detaylı kılavuz için database-reviewer agent'ını kullanın.

Ne Zaman Aktifleştirmeli

  • SQL sorguları veya migration'lar yazarken
  • Veritabanı şemaları tasarlarken
  • Yavaş sorguları troubleshoot ederken
  • Row Level Security uygularken
  • Connection pooling kurarken

Hızlı Referans

İndeks Hile Sayfası

Sorgu Kalıbıİndeks TipiÖrnek
WHERE col = valueB-tree (varsayılan)CREATE INDEX idx ON t (col)
WHERE col > valueB-treeCREATE INDEX idx ON t (col)
WHERE a = x AND b > yCompositeCREATE INDEX idx ON t (a, b)
WHERE jsonb @> '{}'GINCREATE INDEX idx ON t USING gin (col)
WHERE tsv @@ queryGINCREATE INDEX idx ON t USING gin (col)
Zaman serisi aralıklarıBRINCREATE INDEX idx ON t USING brin (col)

Veri Tipi Hızlı Referans

Kullanım SenaryosuDoğru TipKaçın
ID'lerbigintint, rastgele UUID
String'lertextvarchar(255)
Timestamp'lertimestamptztimestamp
Paranumeric(10,2)float
Flag'lerbooleanvarchar, int

Yaygın Kalıplar

Composite İndeks Sırası:

-- Önce eşitlik sütunları, sonra aralık sütunları
CREATE INDEX idx ON orders (status, created_at);
-- Şunlar için çalışır: WHERE status = 'pending' AND created_at > '2024-01-01'

Covering İndeks:

CREATE INDEX idx ON users (email) INCLUDE (name, created_at);
-- SELECT email, name, created_at için tablo aramasını önler

Partial İndeks:

CREATE INDEX idx ON users (email) WHERE deleted_at IS NULL;
-- Daha küçük indeks, sadece aktif kullanıcıları içerir

RLS Policy (Optimize Edilmiş):

CREATE POLICY policy ON orders
  USING ((SELECT auth.uid()) = user_id);  -- SELECT'e sar!

UPSERT:

INSERT INTO settings (user_id, key, value)
VALUES (123, 'theme', 'dark')
ON CONFLICT (user_id, key)
DO UPDATE SET value = EXCLUDED.value;

Cursor Sayfalama:

SELECT * FROM products WHERE id > $last_id ORDER BY id LIMIT 20;
-- O(1) vs O(n) olan OFFSET

Kuyruk İşleme:

UPDATE jobs SET status = 'processing'
WHERE id = (
  SELECT id FROM jobs WHERE status = 'pending'
  ORDER BY created_at LIMIT 1
  FOR UPDATE SKIP LOCKED
) RETURNING *;

Anti-Kalıp Tespiti

-- İndekslenmemiş foreign key'leri bul
SELECT conrelid::regclass, a.attname
FROM pg_constraint c
JOIN pg_attribute a ON a.attrelid = c.conrelid AND a.attnum = ANY(c.conkey)
WHERE c.contype = 'f'
  AND NOT EXISTS (
    SELECT 1 FROM pg_index i
    WHERE i.indrelid = c.conrelid AND a.attnum = ANY(i.indkey)
  );

-- Yavaş sorguları bul
SELECT query, mean_exec_time, calls
FROM pg_stat_statements
WHERE mean_exec_time > 100
ORDER BY mean_exec_time DESC;

-- Tablo bloat'ını kontrol et
SELECT relname, n_dead_tup, last_vacuum
FROM pg_stat_user_tables
WHERE n_dead_tup > 1000
ORDER BY n_dead_tup DESC;

Yapılandırma Şablonu

-- Bağlantı limitleri (RAM için ayarla)
ALTER SYSTEM SET max_connections = 100;
ALTER SYSTEM SET work_mem = '8MB';

-- Timeout'lar
ALTER SYSTEM SET idle_in_transaction_session_timeout = '30s';
ALTER SYSTEM SET statement_timeout = '30s';

-- İzleme
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;

-- Güvenlik varsayılanları
REVOKE ALL ON SCHEMA public FROM public;

SELECT pg_reload_conf();

İlgili

  • Agent: database-reviewer - Tam veritabanı inceleme iş akışı
  • Skill: clickhouse-io - ClickHouse analytics kalıpları
  • Skill: backend-patterns - API ve backend kalıpları

Supabase Agent Skills'e dayanır (kredi: Supabase ekibi) (MIT License)

Source repo
affaan-m/ECC
Skill path
docs/tr/skills/postgres-patterns/SKILL.md
Commit SHA
4e973d3eaf92
Repository license
MIT
Data collected