

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
123456# PostgresSQL rules78## General910- Use lowercase for SQL reserved words to maintain consistency and readability.11- Employ consistent, descriptive identifiers for tables, columns, and other database objects.12- Use white space and indentation to enhance the readability of your code.13- Store dates in ISO 8601 format (`yyyy-mm-ddThh:mm:ss.sssss`).14- Include comments for complex logic, using '/* ... */' for block comments and '--' for line comments.1516## Naming Conventions1718- Avoid SQL reserved words and ensure names are unique and under 63 characters.19- Use snake_case for tables and columns.20- Prefer plurals for table names21- Prefer singular names for columns.2223## Tables2425- Avoid prefixes like 'tbl_' and ensure no table name matches any of its column names.26- Always add an `id` column of type `identity generated always` unless otherwise specified.27- Create all tables in the `public` schema unless otherwise specified.28- Always add the schema to SQL queries for clarity.29- Always add a comment to describe what the table does. The comment can be up to 1024 characters.3031## Columns3233- Use singular names and avoid generic names like 'id'.34- For references to foreign tables, use the singular of the table name with the `_id` suffix. For example `user_id` to reference the `users` table35- Always use lowercase except in cases involving acronyms or when readability would be enhanced by an exception.3637#### Examples:3839```sql40create table books (41 id bigint generated always as identity primary key,42 title text not null,43 author_id bigint references authors (id)44);45comment on table books is 'A list of all the books in the library.';46```474849## Queries5051- When the query is shorter keep it on just a few lines. As it gets larger start adding newlines for readability52- Add spaces for readability.5354Smaller queries:555657```sql58select *59from employees60where end_date is null;6162update employees63set end_date = '2023-12-31'64where employee_id = 1001;65```6667Larger queries:6869```sql70select71 first_name,72 last_name73from74 employees75where76 start_date between '2021-01-01' and '2021-12-31'77and78 status = 'employed';79```808182### Joins and Subqueries8384- Format joins and subqueries for clarity, aligning them with related SQL clauses.85- Prefer full table names when referencing tables. This helps for readability.8687```sql88select89 employees.employee_name,90 departments.department_name91from92 employees93join94 departments on employees.department_id = departments.department_id95where96 employees.start_date > '2022-01-01';97```9899## Aliases100101- Use meaningful aliases that reflect the data or transformation applied, and always include the 'as' keyword for clarity.102103```sql104select count(*) as total_employees105from employees106where end_date is null;107```108109110## Complex queries and CTEs111112- If a query is extremely complex, prefer a CTE.113- Make sure the CTE is clear and linear. Prefer readability over performance.114- Add comments to each block.115116```sql117with department_employees as (118 -- Get all employees and their departments119 select120 employees.department_id,121 employees.first_name,122 employees.last_name,123 departments.department_name124 from125 employees126 join127 departments on employees.department_id = departments.department_id128),129employee_counts as (130 -- Count how many employees in each department131 select132 department_name,133 count(*) as num_employees134 from135 department_employees136 group by137 department_name138)139select140 department_name,141 num_employees142from143 employee_counts144order by145 department_name;146```
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursor/rules/ai.mdc · 6 | Cursor rules | no sections | 16/100 | today | |
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursor/rules/breadcrumb.mdc · 6 | Cursor rules | ui | 16/100 | today | |
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursor/rules/comment.mdc · 6 | Cursor rules | lint-formatstyletypesdocs | 66/100 | today | |
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursor/rules/i18n.mdc · 6 | Cursor rules | ui | 45/100 | today | |
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursor/rules/typescript.mdc · 6 | Cursor rules | style | 40/100 | today | |
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursor/rules/ui-style.mdc · 6 | Cursor rules | styleui | 29/100 | today | |
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursor/rules/ui.mdc · 6 | Cursor rules | ui | 36/100 | today | |
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursorrules · 6 | .cursorrules | style | 38/100 | today |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 46 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 14 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 14 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 46 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/leaperone-nextjs-i18n-prisma-authjs-tailwindcss-template-cursor-rules-postgresql)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.