feat(agents): add database-reviewer agent with Supabase PostgreSQL patterns#48
Conversation
Adds comprehensive PostgreSQL database specialist agent incorporating patterns from Supabase's postgres-best-practices skill. ## New Files - `agents/database-reviewer.md` (654 lines) - Query performance optimization - Schema design patterns - Row Level Security (RLS) implementation - Connection management - Concurrency and locking strategies - Monitoring and diagnostics - `skills/postgres-patterns/SKILL.md` (146 lines) - Quick reference for common patterns - Index cheat sheet - Data type reference - Anti-pattern detection queries ## Coverage - Index types: B-tree, GIN, BRIN, Hash - Composite, covering, and partial indexes - RLS optimization with (SELECT auth.uid()) pattern - SKIP LOCKED for queue processing - Cursor-based pagination - UPSERT patterns - Connection pooling configuration ## Attribution Patterns adapted from supabase/agent-skills (MIT License) https://github.com/supabase/agent-skills Co-Authored-By: Claude Opus 4.5 <[email protected]>
📝 WalkthroughWalkthroughTwo new comprehensive PostgreSQL documentation files are added: a database reviewer agent specification detailing review workflows, performance analysis, schema design, and security practices; and a PostgreSQL patterns skill reference providing best practice patterns, index guidance, and configuration templates. No code or behavioral logic changes are introduced. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@agents/database-reviewer.md`:
- Around line 132-137: The markdown table row listing operators contains the
code span `?|` which includes a raw pipe and breaks table parsing; update that
operator token so the pipe is escaped inside the code span (e.g., replace the
raw `?|` with an escaped pipe form inside backticks) in the operator list for
the GIN row so the table columns parse correctly while preserving the displayed
operator.
- Around line 50-105: The unlabeled fenced code blocks under the "Index Usage",
"Schema Design Review (HIGH)" and "Security Review (CRITICAL)" sections should
include a language identifier to satisfy markdownlint MD040; update each fence
surrounding the lists (the blocks starting with ``` and ending with ```) to use
a label such as ```text (or ```markdown) so the blocks that contain "a) Index
Usage ...", "a) Data Types ..." and "a) Row Level Security ..." are all changed
to fenced blocks with a language identifier.
| ``` | ||
| a) Index Usage | ||
| - Are WHERE columns indexed? | ||
| - Are JOIN columns indexed? | ||
| - Is the index type appropriate (B-tree, GIN, BRIN)? | ||
|
|
||
| b) Query Plan Analysis | ||
| - Run EXPLAIN ANALYZE on complex queries | ||
| - Check for Seq Scans on large tables | ||
| - Verify row estimates match actuals | ||
|
|
||
| c) Common Issues | ||
| - N+1 query patterns | ||
| - Missing composite indexes | ||
| - Wrong column order in indexes | ||
| ``` | ||
|
|
||
| ### 2. Schema Design Review (HIGH) | ||
|
|
||
| ``` | ||
| a) Data Types | ||
| - bigint for IDs (not int) | ||
| - text for strings (not varchar(n) unless constraint needed) | ||
| - timestamptz for timestamps (not timestamp) | ||
| - numeric for money (not float) | ||
| - boolean for flags (not varchar) | ||
|
|
||
| b) Constraints | ||
| - Primary keys defined | ||
| - Foreign keys with proper ON DELETE | ||
| - NOT NULL where appropriate | ||
| - CHECK constraints for validation | ||
|
|
||
| c) Naming | ||
| - lowercase_snake_case (avoid quoted identifiers) | ||
| - Consistent naming patterns | ||
| ``` | ||
|
|
||
| ### 3. Security Review (CRITICAL) | ||
|
|
||
| ``` | ||
| a) Row Level Security | ||
| - RLS enabled on multi-tenant tables? | ||
| - Policies use (select auth.uid()) pattern? | ||
| - RLS columns indexed? | ||
|
|
||
| b) Permissions | ||
| - Least privilege principle followed? | ||
| - No GRANT ALL to application users? | ||
| - Public schema permissions revoked? | ||
|
|
||
| c) Data Protection | ||
| - Sensitive data encrypted? | ||
| - PII access logged? | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Add fenced code block language identifiers (markdownlint MD040).
Several fences in this section are unlabeled. Please add a language (e.g., text or markdown) to keep lint clean and improve rendering.
📝 Suggested fix (apply similarly to other unlabeled fences)
-```
+```text
a) Index Usage
- Are WHERE columns indexed?
- Are JOIN columns indexed?
- Is the index type appropriate (B-tree, GIN, BRIN)?
b) Query Plan Analysis
- Run EXPLAIN ANALYZE on complex queries
- Check for Seq Scans on large tables
- Verify row estimates match actuals
c) Common Issues
- N+1 query patterns
- Missing composite indexes
- Wrong column order in indexes
-```
+```🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
50-50: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
69-69: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
90-90: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
In `@agents/database-reviewer.md` around lines 50 - 105, The unlabeled fenced code
blocks under the "Index Usage", "Schema Design Review (HIGH)" and "Security
Review (CRITICAL)" sections should include a language identifier to satisfy
markdownlint MD040; update each fence surrounding the lists (the blocks starting
with ``` and ending with ```) to use a label such as ```text (or ```markdown) so
the blocks that contain "a) Index Usage ...", "a) Data Types ..." and "a) Row
Level Security ..." are all changed to fenced blocks with a language identifier.
| | Index Type | Use Case | Operators | | ||
| |------------|----------|-----------| | ||
| | **B-tree** (default) | Equality, range | `=`, `<`, `>`, `BETWEEN`, `IN` | | ||
| | **GIN** | Arrays, JSONB, full-text | `@>`, `?`, `?&`, `?|`, `@@` | | ||
| | **BRIN** | Large time-series tables | Range queries on sorted data | | ||
| | **Hash** | Equality only | `=` (marginally faster than B-tree) | |
There was a problem hiding this comment.
Escape | in operator list to fix table parsing (markdownlint MD056/MD038).
The operator ?| contains a pipe, which markdown treats as a column separator, causing a column-count mismatch. Escape the pipe inside the code span.
🛠️ Suggested fix
-| **GIN** | Arrays, JSONB, full-text | `@>`, `?`, `?&`, `?|`, `@@` |
+| **GIN** | Arrays, JSONB, full-text | `@>`, `?`, `?&`, `?\|`, `@@` |📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| | Index Type | Use Case | Operators | | |
| |------------|----------|-----------| | |
| | **B-tree** (default) | Equality, range | `=`, `<`, `>`, `BETWEEN`, `IN` | | |
| | **GIN** | Arrays, JSONB, full-text | `@>`, `?`, `?&`, `?|`, `@@` | | |
| | **BRIN** | Large time-series tables | Range queries on sorted data | | |
| | **Hash** | Equality only | `=` (marginally faster than B-tree) | | |
| | Index Type | Use Case | Operators | | |
| |------------|----------|-----------| | |
| | **B-tree** (default) | Equality, range | `=`, `<`, `>`, `BETWEEN`, `IN` | | |
| | **GIN** | Arrays, JSONB, full-text | `@>`, `?`, `?&`, `?\|`, `@@` | | |
| | **BRIN** | Large time-series tables | Range queries on sorted data | | |
| | **Hash** | Equality only | `=` (marginally faster than B-tree) | |
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
135-135: Spaces inside code span elements
(MD038, no-space-in-code)
135-135: Table column count
Expected: 3; Actual: 4; Too many cells, extra data will be missing
(MD056, table-column-count)
🤖 Prompt for AI Agents
In `@agents/database-reviewer.md` around lines 132 - 137, The markdown table row
listing operators contains the code span `?|` which includes a raw pipe and
breaks table parsing; update that operator token so the pipe is escaped inside
the code span (e.g., replace the raw `?|` with an escaped pipe form inside
backticks) in the operator list for the GIN row so the table columns parse
correctly while preserving the displayed operator.
675db95 feat: unify commands and skills (v1.2.0) ca584e2 fix: escape pipe in markdown table for markdownlint a44a055 fix: resolve ESLint errors and update tests for project-name fallback c9ef02b docs: add requirements section and hooks field warning 0c53ad8 Revert "docs: update shorthand to shortform terminology" c3430bd docs: add Traditional Chinese translation fbe2e56 docs: add simplified Chinese README 7c0bc25 feat: add comprehensive CI/CD pipeline 58a97c8 docs: update shorthand to shortform terminology 04ee208 docs: add plugin manifest validation notes e3a1306 fix: remove duplicate hooks declaration from plugin.json 81003b1 feat: use project name as session filename fallback 8996303 fix: prevent command injection in Prettier hook (affaan-m#102) 8894e1b docs: update README with skill-create and instinct commands 9bc587a feat: add skill-create and continuous-learning-v2 commands 0ced59a Merge pull request affaan-m#91 from Hor1zonZzz/fix/readme-rules-limitation 2563d1e Merge pull request affaan-m#92 from jhsong-musinsa/fix/plugin-manifest-validation 5dc1edb Merge pull request affaan-m#93 from pangerlkr/patch-3 2aac2d9 Create PLUGIN_SCHEMA_NOTES.md cdf987d fix: use explicit file paths for agents in plugin.json 384b255 docs: add note about rules limitation in plugin installation accbb47 feat: add proper header banner to shortform guide ff67b03 feat: add images and rename guides to the-shortform-guide.md and the-longform-guide.md 7fc5ef1 Merge pull request affaan-m#83 from msyahidin/claude/add-golang-support-frw0Z 779085e fix: add missing agents and hooks declarations to plugin.json 5e1835a Merge pull request affaan-m#81 from pangerlkr/patch-2 2abefe6 Merge pull request affaan-m#79 from pangerlkr/patch-1 4bca615 Merge pull request affaan-m#80 from lichengzhe/fix/stop-hook-shell-error a1f47f1 Merge pull request affaan-m#85 from roeiba/add-license-file 01ad21b docs: add missing MIT LICENSE file c6c32cd fix: add language labels to fenced code blocks for MD040 compliance 75e1e46 feat: add comprehensive Golang language support 2feac5a docs: add The Longform Guide to Everything Claude Code a0b84f7 Fix: Move Stop hook inline code to separate script file 1564213 docs: add The Shorthand Guide to Everything Claude Code 56ff5d4 fix: use correct unscoped agent-browser package name (affaan-m#77) 5c63fa9 feat: v1.1.0 release - session ID tracking, async hooks, new skills 5670fcd Fix plugin manifest validation errors (affaan-m#75) 1c9fa0b Add hooks.md to documentation index (affaan-m#40) 2bfd2fb feat: add cloud infrastructure security skill (affaan-m#44) fae9716 feat(agents): add database-reviewer agent with Supabase patterns (affaan-m#48) a2087a8 fix: remove unnecessary .sh hooks (affaan-m#41) b9b7831 fix: multiple community-reported issues 660e0d3 fix: security and documentation fixes a7bc5f2 revert: remove hooks declaration - auto-loaded by convention 22ad036 fix: add hooks declaration to plugin.json for proper hook loading 5230892 fix: remove version fields from marketplace.json 970f8bf feat: cross-platform support with Node.js scripts 4ec7a6b fix: remove version field to enable automatic plugin updates 0d438dd style: side-by-side guide layout matching profile README 7f4f622 feat: add star history chart and minimal badge bar c3f1594 fix: move session-end hooks from Stop to SessionEnd 19345df fix: remove duplicate hooks field from plugin.json 73bda1a fix: use ${CLAUDE_PLUGIN_ROOT} for hook script paths ecfbbd3 fix: use relative path './' for plugin source instead of GitHub object ee5affb fix: remove agents field temporarily to debug validation d362ae6 fix: use string format for repository field in plugin.json 9e8006c fix: use GitHub source object in marketplace.json 5010f82 feat: package as Claude Code plugin with marketplace distribution 4491f15 Clarify README description of the repository e6440d3 docs: restructure README to flow shorthand → longform guides together fa0928a Enhance README with update section and resources 2d6fd70 feat: add strategic-compact hook and update hooks.json with all hooks f96ef1e feat: add memory persistence hooks and context files 7d3ea0f feat: add strategic compact skill 6bf102d feat: add continuous learning skill with session examples 3c1e7d9 Clarify repository purpose and additional resources 62a80df Update README with image and guide link 6eefb41 Update README with guide reading reminder d7cf890 Fix formatting in README.md for guide link e57979c Update README with image and guide link 45959c3 Initial release: Complete Claude Code configuration collection REVERT: 69c0b1a Add link to Agent Skills specification website (affaan-m#160) REVERT: be229a5 Fix links in agent skills specification (affaan-m#159) REVERT: f232228 Split agent-skills-spec into separate authoring and client integration guides (affaan-m#148) REVERT: 0075614 Add doc-coauthoring skill and update example skills (affaan-m#134) REVERT: ef74077 Move example skills into dedicated folder and create minimal top-level folder structure (affaan-m#129) REVERT: 0f77e50 Update example skills and rename 'artifacts-builder' (affaan-m#112) REVERT: e5c6015 Add 'frontend-design' example skill (affaan-m#98) REVERT: c74d647 Clarify Claude Code installation in README.md (#20) REVERT: 0877bae Updates to README.md (affaan-m#9) REVERT: b118d29 Add Claude Claude instructions to the readme (#8) REVERT: 4d1e3f3 Add Claude Code Marketplace (affaan-m#5) REVERT: 9b61003 Small tweak to blog link (#7) REVERT: 10e0fbe Add initial Agent Skills Spec (#2) REVERT: ec84104 Add 3rd Party notices (affaan-m#4) REVERT: 67ada86 Adding more details to README (affaan-m#3) REVERT: 83291af Reorganize the example skills (affaan-m#1) REVERT: 37292f3 init repo git-subtree-dir: upstream/anthropics-skills git-subtree-split: 675db95
…aan-m#48) Adds comprehensive database-reviewer agent with Supabase PostgreSQL best practices
Summary
Adds a comprehensive PostgreSQL database specialist agent incorporating best practices from Supabase's agent-skills repository.
New Files
agents/database-reviewer.mdskills/postgres-patterns/SKILL.mdCoverage
Query Performance (Critical)
Schema Design (High)
Security & RLS (Critical)
(SELECT auth.uid())patternConnection Management
Concurrency
Data Access Patterns
Monitoring
Example Usage
Attribution
Patterns adapted from supabase/agent-skills under MIT License.
Test Plan
🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.