Quick reference for common SQL patterns, CTEs, window functions, and indexing strategies. Triggers on: sql patterns, cte example, window functions, sql join, index strategy, pagination sql.
Install with Tessl CLI
npx tessl i github:NeverSight/skills_feed --skill sql-patterns96
Does it follow best practices?
Validation for skill structure
Window functions and sales trend analysis
LAG for prior day
100%
100%
LAG with PARTITION BY
100%
100%
RANK present
100%
100%
DENSE_RANK present
100%
100%
Both rank functions used
100%
100%
SUM OVER for running total
100%
100%
AVG OVER for moving average
100%
100%
Moving average window frame
100%
100%
No SELECT *
100%
100%
PARTITION BY category
100%
100%
Notes file present
100%
100%
Without context: $0.1901 · 46s · 12 turns · 17 in / 2,544 out tokens
With context: $0.4381 · 1m 23s · 25 turns · 31 in / 4,798 out tokens
Pagination strategy and anti-pattern avoidance
SELECT * removed
100%
100%
Keyset pagination used
100%
100%
NOT IN replaced
100%
100%
Date function removed
100%
100%
N+1 fixed
100%
100%
B-tree for range/sort
100%
100%
Hash for equality
100%
100%
GIN for arrays
100%
100%
GIN for JSONB
100%
100%
Covering index
100%
100%
Review document present
100%
100%
Without context: $0.4397 · 2m 45s · 17 turns · 22 in / 8,537 out tokens
With context: $0.5446 · 2m 37s · 23 turns · 460 in / 8,152 out tokens
Chained CTEs and JOIN patterns
Multiple CTEs used
100%
100%
CTEs are chained
100%
100%
LEFT JOIN for all users
100%
100%
COALESCE for NULL counts
100%
100%
No SELECT *
100%
100%
Date range not function-wrapped
100%
100%
Dormant users identified
100%
100%
NOT IN avoided
100%
100%
Recently active flag
100%
100%
Notes file present
100%
100%
Without context: $0.1690 · 45s · 12 turns · 14 in / 2,705 out tokens
With context: $0.2489 · 58s · 16 turns · 21 in / 2,942 out tokens
Table of Contents
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.