[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-jetbrains-sql-patterns":3,"mdc-ue3z5s-key":32,"related-repo-jetbrains-sql-patterns":768,"related-org-jetbrains-sql-patterns":871},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":22,"repoUrl":23,"updatedAt":24,"license":25,"forks":26,"topics":27,"repo":28,"sourceUrl":30,"mdContent":31},"sql-patterns","write and optimize SQL queries","SQL policy & pitfalls — query correctness, indexing strategy, safe migrations. Use when writing SQL, diagnosing slow queries, designing schemas, or reviewing Flyway\u002FLiquibase migrations. Covers the traps LLMs miss by default: NOT IN with NULLs, function-on-column breaking indexes, OFFSET on large tables, NOT NULL column lock, CREATE INDEX blocking writes, immutable migrations.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},"jetbrains","JetBrains","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fjetbrains.png",[12,16,19],{"name":13,"slug":14,"type":15},"Database","database","tag",{"name":17,"slug":18,"type":15},"Engineering","engineering",{"name":20,"slug":21,"type":15},"SQL","sql",18,"https:\u002F\u002Fgithub.com\u002FJetBrains\u002Fjunie-extensions","2026-07-13T06:45:45.857964",null,1,[],{"repoUrl":23,"stars":22,"forks":26,"topics":29,"description":25},[],"https:\u002F\u002Fgithub.com\u002FJetBrains\u002Fjunie-extensions\u002Ftree\u002FHEAD\u002Fextensions\u002Fsql-engineer\u002Fskills\u002Fsql-patterns","---\nname: \"sql-patterns\"\ndescription: \"SQL policy & pitfalls — query correctness, indexing strategy, safe migrations. Use when writing SQL, diagnosing slow queries, designing schemas, or reviewing Flyway\u002FLiquibase migrations. Covers the traps LLMs miss by default: NOT IN with NULLs, function-on-column breaking indexes, OFFSET on large tables, NOT NULL column lock, CREATE INDEX blocking writes, immutable migrations.\"\n---\n\n# SQL — policy & pitfalls\n\nBaseline SQL knowledge (CTE, window functions, joins, DML, Flyway\u002FLiquibase syntax) is assumed. This skill encodes policy and the traps that keep appearing in review — dialect-specific, blocking-behavior-specific, and optimizer-specific.\n\n## Setup Check (run first)\n\nBefore writing non-trivial SQL:\n\n1. **Dialect** — identify the target (Postgres, MySQL, MariaDB, SQLite, SQL Server). Optimizer behavior, locking rules, and index features differ. Never assume Postgres semantics on MySQL or vice versa.\n2. **Migration tool** — check `db\u002Fmigration\u002F` (Flyway) or `db\u002Fchangelog\u002F` (Liquibase). Both are immutable: already-applied migrations must NEVER be edited.\n3. **EXPLAIN access** — if the DBHub MCP is configured, use it to run `EXPLAIN (ANALYZE, BUFFERS)` (Postgres) or `EXPLAIN FORMAT=JSON` (MySQL) against a representative dataset. Advice without a real query plan is a guess.\n4. **Table sizes** — query advice differs by orders of magnitude between 10K and 100M rows. Use DBHub (or `pg_stat_user_tables` \u002F `information_schema.tables`) to check sizes when choosing pagination, indexing, and migration strategy.\n\n## DBHub MCP\n\nWhen the DBHub MCP server is available (configured in `mcp\u002F.mcp.json`), use it actively:\n\n- **Schema inspection** — list tables, columns, types, and indexes before writing queries or migrations.\n- **`EXPLAIN ANALYZE`** — run against real data to verify index usage and row estimates before declaring a query optimized.\n- **Row counts \u002F size estimates** — query `pg_stat_user_tables` (Postgres) or `information_schema.tables` (MySQL) to determine pagination and migration strategy.\n- **Validate migrations** — check current schema state before generating DDL to avoid duplicate columns or conflicting constraints.\n\nDo not suggest schema changes or index additions without first confirming the current schema via DBHub or the codebase.\n\n## MUST DO\n\n- **List columns explicitly** — never `SELECT *` in application code (breaks on schema change, pulls unused columns).\n- **`NOT EXISTS` \u002F `LEFT JOIN ... IS NULL`** instead of `NOT IN` when the subquery can return `NULL` (NOT IN with a single NULL returns zero rows — silently).\n- **Keyset pagination** (`WHERE id > :last ORDER BY id LIMIT n`) for large \u002F user-driven lists. OFFSET degrades as it grows.\n- **Parameterize every query** — prepared statements \u002F bound parameters. Never string-concat user input even with escaping.\n- **Index what you filter and join on** — `WHERE`, `JOIN ON`, `ORDER BY` columns. Composite index order matters: leftmost columns usable, tail columns only with leading predicates.\n- **Transaction-scope migrations where possible** — Flyway wraps single migration in a transaction by default; Postgres supports DDL in transactions, MySQL does NOT (each DDL auto-commits, a failed migration leaves partial state).\n- **`EXPLAIN ANALYZE`** before declaring a query \"optimized\" — optimizer choice depends on stats, table size, and dialect.\n\n## MUST NOT DO\n\n- **No `NOT IN (SELECT ... )` on nullable columns.** `WHERE x NOT IN (NULL, 1, 2)` returns empty. Use `NOT EXISTS` or `LEFT JOIN ... IS NULL`.\n- **No functions on indexed columns in `WHERE`.** `WHERE YEAR(created_at) = 2024` ignores the index — use `WHERE created_at >= '2024-01-01' AND created_at \u003C '2025-01-01'`. Or create a functional \u002F expression index.\n- **No `OR` across different columns in `WHERE`** when one side isn't indexed — split into `UNION ALL` (or create a combined index).\n- **No `ALTER TABLE ... ADD COLUMN NOT NULL` without default** on a large table — locks the table, rewrites every row. Split into: add nullable column → backfill in batches → add NOT NULL constraint.\n- **No `CREATE INDEX`** on a large write-active table without `CONCURRENTLY` (Postgres) \u002F `ALGORITHM=INPLACE LOCK=NONE` (MySQL 8.0) \u002F `WITH (ONLINE = ON)` (SQL Server) — blocks writes for the duration.\n- **No editing applied migrations.** Flyway checksums them; Liquibase hashes them. Changing a released `V3__add_email.sql` breaks every environment. Add a new migration.\n- **No `SELECT COUNT(*)` on large tables** for pagination UIs — on Postgres it's expensive; index-only scan is possible only when the visibility map is fully up-to-date (Postgres 9.2+, write-heavy tables rarely qualify). Use approximate counts (`pg_class.reltuples`) or a \"load more\" cursor instead.\n- **No `DISTINCT` to fix duplicate rows** — it masks a broken JOIN. Fix the join.\n- **No implicit type casts in joins** (`JOIN x ON x.id = y.id_str`) — disables indexes, silently wrong if types differ. Match types.\n- **No credentials, PII, or secrets in migration files** — they go to version control forever.\n\n## Reference Guide\n\n| Load when | File |\n|---|---|\n| Writing \u002F reviewing Flyway \u002F Liquibase migrations; running online schema changes | `references\u002Fmigrations.md` |\n| Diagnosing a slow query; choosing indexes; reading EXPLAIN output | `references\u002Fperformance.md` |\n\n## Output Format\n\nWhen producing SQL:\n\n1. Short plan (1–3 bullets) — what the query \u002F migration does and which tables \u002F indexes it touches.\n2. The SQL, dialect-qualified when dialect-specific (`-- Postgres only`).\n3. If modifying schema on a large table, describe the locking \u002F backfill plan (not just the DDL).\n4. For non-trivial queries — include the expected plan shape (index scan vs seq scan) and the index it relies on. If no such index exists, flag that as part of the change.\n\nWhen reviewing SQL: call out MUST-DO \u002F MUST-NOT violations, point out NULL \u002F type \u002F locking traps, and suggest the minimal fix. Prefer `EXPLAIN`-verified advice over cargo-cult rules.\n",{"data":33,"body":34},{"name":4,"description":6},{"type":35,"children":36},"root",[37,46,52,59,64,159,165,178,239,244,250,392,398,645,651,713,719,724,755],{"type":38,"tag":39,"props":40,"children":42},"element","h1",{"id":41},"sql-policy-pitfalls",[43],{"type":44,"value":45},"text","SQL — policy & pitfalls",{"type":38,"tag":47,"props":48,"children":49},"p",{},[50],{"type":44,"value":51},"Baseline SQL knowledge (CTE, window functions, joins, DML, Flyway\u002FLiquibase syntax) is assumed. This skill encodes policy and the traps that keep appearing in review — dialect-specific, blocking-behavior-specific, and optimizer-specific.",{"type":38,"tag":53,"props":54,"children":56},"h2",{"id":55},"setup-check-run-first",[57],{"type":44,"value":58},"Setup Check (run first)",{"type":38,"tag":47,"props":60,"children":61},{},[62],{"type":44,"value":63},"Before writing non-trivial SQL:",{"type":38,"tag":65,"props":66,"children":67},"ol",{},[68,80,107,133],{"type":38,"tag":69,"props":70,"children":71},"li",{},[72,78],{"type":38,"tag":73,"props":74,"children":75},"strong",{},[76],{"type":44,"value":77},"Dialect",{"type":44,"value":79}," — identify the target (Postgres, MySQL, MariaDB, SQLite, SQL Server). Optimizer behavior, locking rules, and index features differ. Never assume Postgres semantics on MySQL or vice versa.",{"type":38,"tag":69,"props":81,"children":82},{},[83,88,90,97,99,105],{"type":38,"tag":73,"props":84,"children":85},{},[86],{"type":44,"value":87},"Migration tool",{"type":44,"value":89}," — check ",{"type":38,"tag":91,"props":92,"children":94},"code",{"className":93},[],[95],{"type":44,"value":96},"db\u002Fmigration\u002F",{"type":44,"value":98}," (Flyway) or ",{"type":38,"tag":91,"props":100,"children":102},{"className":101},[],[103],{"type":44,"value":104},"db\u002Fchangelog\u002F",{"type":44,"value":106}," (Liquibase). Both are immutable: already-applied migrations must NEVER be edited.",{"type":38,"tag":69,"props":108,"children":109},{},[110,115,117,123,125,131],{"type":38,"tag":73,"props":111,"children":112},{},[113],{"type":44,"value":114},"EXPLAIN access",{"type":44,"value":116}," — if the DBHub MCP is configured, use it to run ",{"type":38,"tag":91,"props":118,"children":120},{"className":119},[],[121],{"type":44,"value":122},"EXPLAIN (ANALYZE, BUFFERS)",{"type":44,"value":124}," (Postgres) or ",{"type":38,"tag":91,"props":126,"children":128},{"className":127},[],[129],{"type":44,"value":130},"EXPLAIN FORMAT=JSON",{"type":44,"value":132}," (MySQL) against a representative dataset. Advice without a real query plan is a guess.",{"type":38,"tag":69,"props":134,"children":135},{},[136,141,143,149,151,157],{"type":38,"tag":73,"props":137,"children":138},{},[139],{"type":44,"value":140},"Table sizes",{"type":44,"value":142}," — query advice differs by orders of magnitude between 10K and 100M rows. Use DBHub (or ",{"type":38,"tag":91,"props":144,"children":146},{"className":145},[],[147],{"type":44,"value":148},"pg_stat_user_tables",{"type":44,"value":150}," \u002F ",{"type":38,"tag":91,"props":152,"children":154},{"className":153},[],[155],{"type":44,"value":156},"information_schema.tables",{"type":44,"value":158},") to check sizes when choosing pagination, indexing, and migration strategy.",{"type":38,"tag":53,"props":160,"children":162},{"id":161},"dbhub-mcp",[163],{"type":44,"value":164},"DBHub MCP",{"type":38,"tag":47,"props":166,"children":167},{},[168,170,176],{"type":44,"value":169},"When the DBHub MCP server is available (configured in ",{"type":38,"tag":91,"props":171,"children":173},{"className":172},[],[174],{"type":44,"value":175},"mcp\u002F.mcp.json",{"type":44,"value":177},"), use it actively:",{"type":38,"tag":179,"props":180,"children":181},"ul",{},[182,192,206,229],{"type":38,"tag":69,"props":183,"children":184},{},[185,190],{"type":38,"tag":73,"props":186,"children":187},{},[188],{"type":44,"value":189},"Schema inspection",{"type":44,"value":191}," — list tables, columns, types, and indexes before writing queries or migrations.",{"type":38,"tag":69,"props":193,"children":194},{},[195,204],{"type":38,"tag":73,"props":196,"children":197},{},[198],{"type":38,"tag":91,"props":199,"children":201},{"className":200},[],[202],{"type":44,"value":203},"EXPLAIN ANALYZE",{"type":44,"value":205}," — run against real data to verify index usage and row estimates before declaring a query optimized.",{"type":38,"tag":69,"props":207,"children":208},{},[209,214,216,221,222,227],{"type":38,"tag":73,"props":210,"children":211},{},[212],{"type":44,"value":213},"Row counts \u002F size estimates",{"type":44,"value":215}," — query ",{"type":38,"tag":91,"props":217,"children":219},{"className":218},[],[220],{"type":44,"value":148},{"type":44,"value":124},{"type":38,"tag":91,"props":223,"children":225},{"className":224},[],[226],{"type":44,"value":156},{"type":44,"value":228}," (MySQL) to determine pagination and migration strategy.",{"type":38,"tag":69,"props":230,"children":231},{},[232,237],{"type":38,"tag":73,"props":233,"children":234},{},[235],{"type":44,"value":236},"Validate migrations",{"type":44,"value":238}," — check current schema state before generating DDL to avoid duplicate columns or conflicting constraints.",{"type":38,"tag":47,"props":240,"children":241},{},[242],{"type":44,"value":243},"Do not suggest schema changes or index additions without first confirming the current schema via DBHub or the codebase.",{"type":38,"tag":53,"props":245,"children":247},{"id":246},"must-do",[248],{"type":44,"value":249},"MUST DO",{"type":38,"tag":179,"props":251,"children":252},{},[253,271,308,326,336,369,379],{"type":38,"tag":69,"props":254,"children":255},{},[256,261,263,269],{"type":38,"tag":73,"props":257,"children":258},{},[259],{"type":44,"value":260},"List columns explicitly",{"type":44,"value":262}," — never ",{"type":38,"tag":91,"props":264,"children":266},{"className":265},[],[267],{"type":44,"value":268},"SELECT *",{"type":44,"value":270}," in application code (breaks on schema change, pulls unused columns).",{"type":38,"tag":69,"props":272,"children":273},{},[274,290,292,298,300,306],{"type":38,"tag":73,"props":275,"children":276},{},[277,283,284],{"type":38,"tag":91,"props":278,"children":280},{"className":279},[],[281],{"type":44,"value":282},"NOT EXISTS",{"type":44,"value":150},{"type":38,"tag":91,"props":285,"children":287},{"className":286},[],[288],{"type":44,"value":289},"LEFT JOIN ... IS NULL",{"type":44,"value":291}," instead of ",{"type":38,"tag":91,"props":293,"children":295},{"className":294},[],[296],{"type":44,"value":297},"NOT IN",{"type":44,"value":299}," when the subquery can return ",{"type":38,"tag":91,"props":301,"children":303},{"className":302},[],[304],{"type":44,"value":305},"NULL",{"type":44,"value":307}," (NOT IN with a single NULL returns zero rows — silently).",{"type":38,"tag":69,"props":309,"children":310},{},[311,316,318,324],{"type":38,"tag":73,"props":312,"children":313},{},[314],{"type":44,"value":315},"Keyset pagination",{"type":44,"value":317}," (",{"type":38,"tag":91,"props":319,"children":321},{"className":320},[],[322],{"type":44,"value":323},"WHERE id > :last ORDER BY id LIMIT n",{"type":44,"value":325},") for large \u002F user-driven lists. OFFSET degrades as it grows.",{"type":38,"tag":69,"props":327,"children":328},{},[329,334],{"type":38,"tag":73,"props":330,"children":331},{},[332],{"type":44,"value":333},"Parameterize every query",{"type":44,"value":335}," — prepared statements \u002F bound parameters. Never string-concat user input even with escaping.",{"type":38,"tag":69,"props":337,"children":338},{},[339,344,346,352,354,360,361,367],{"type":38,"tag":73,"props":340,"children":341},{},[342],{"type":44,"value":343},"Index what you filter and join on",{"type":44,"value":345}," — ",{"type":38,"tag":91,"props":347,"children":349},{"className":348},[],[350],{"type":44,"value":351},"WHERE",{"type":44,"value":353},", ",{"type":38,"tag":91,"props":355,"children":357},{"className":356},[],[358],{"type":44,"value":359},"JOIN ON",{"type":44,"value":353},{"type":38,"tag":91,"props":362,"children":364},{"className":363},[],[365],{"type":44,"value":366},"ORDER BY",{"type":44,"value":368}," columns. Composite index order matters: leftmost columns usable, tail columns only with leading predicates.",{"type":38,"tag":69,"props":370,"children":371},{},[372,377],{"type":38,"tag":73,"props":373,"children":374},{},[375],{"type":44,"value":376},"Transaction-scope migrations where possible",{"type":44,"value":378}," — Flyway wraps single migration in a transaction by default; Postgres supports DDL in transactions, MySQL does NOT (each DDL auto-commits, a failed migration leaves partial state).",{"type":38,"tag":69,"props":380,"children":381},{},[382,390],{"type":38,"tag":73,"props":383,"children":384},{},[385],{"type":38,"tag":91,"props":386,"children":388},{"className":387},[],[389],{"type":44,"value":203},{"type":44,"value":391}," before declaring a query \"optimized\" — optimizer choice depends on stats, table size, and dialect.",{"type":38,"tag":53,"props":393,"children":395},{"id":394},"must-not-do",[396],{"type":44,"value":397},"MUST NOT DO",{"type":38,"tag":179,"props":399,"children":400},{},[401,441,472,502,519,558,576,601,618,635],{"type":38,"tag":69,"props":402,"children":403},{},[404,417,419,425,427,432,434,439],{"type":38,"tag":73,"props":405,"children":406},{},[407,409,415],{"type":44,"value":408},"No ",{"type":38,"tag":91,"props":410,"children":412},{"className":411},[],[413],{"type":44,"value":414},"NOT IN (SELECT ... )",{"type":44,"value":416}," on nullable columns.",{"type":44,"value":418}," ",{"type":38,"tag":91,"props":420,"children":422},{"className":421},[],[423],{"type":44,"value":424},"WHERE x NOT IN (NULL, 1, 2)",{"type":44,"value":426}," returns empty. Use ",{"type":38,"tag":91,"props":428,"children":430},{"className":429},[],[431],{"type":44,"value":282},{"type":44,"value":433}," or ",{"type":38,"tag":91,"props":435,"children":437},{"className":436},[],[438],{"type":44,"value":289},{"type":44,"value":440},".",{"type":38,"tag":69,"props":442,"children":443},{},[444,455,456,462,464,470],{"type":38,"tag":73,"props":445,"children":446},{},[447,449,454],{"type":44,"value":448},"No functions on indexed columns in ",{"type":38,"tag":91,"props":450,"children":452},{"className":451},[],[453],{"type":44,"value":351},{"type":44,"value":440},{"type":44,"value":418},{"type":38,"tag":91,"props":457,"children":459},{"className":458},[],[460],{"type":44,"value":461},"WHERE YEAR(created_at) = 2024",{"type":44,"value":463}," ignores the index — use ",{"type":38,"tag":91,"props":465,"children":467},{"className":466},[],[468],{"type":44,"value":469},"WHERE created_at >= '2024-01-01' AND created_at \u003C '2025-01-01'",{"type":44,"value":471},". Or create a functional \u002F expression index.",{"type":38,"tag":69,"props":473,"children":474},{},[475,492,494,500],{"type":38,"tag":73,"props":476,"children":477},{},[478,479,485,487],{"type":44,"value":408},{"type":38,"tag":91,"props":480,"children":482},{"className":481},[],[483],{"type":44,"value":484},"OR",{"type":44,"value":486}," across different columns in ",{"type":38,"tag":91,"props":488,"children":490},{"className":489},[],[491],{"type":44,"value":351},{"type":44,"value":493}," when one side isn't indexed — split into ",{"type":38,"tag":91,"props":495,"children":497},{"className":496},[],[498],{"type":44,"value":499},"UNION ALL",{"type":44,"value":501}," (or create a combined index).",{"type":38,"tag":69,"props":503,"children":504},{},[505,517],{"type":38,"tag":73,"props":506,"children":507},{},[508,509,515],{"type":44,"value":408},{"type":38,"tag":91,"props":510,"children":512},{"className":511},[],[513],{"type":44,"value":514},"ALTER TABLE ... ADD COLUMN NOT NULL",{"type":44,"value":516}," without default",{"type":44,"value":518}," on a large table — locks the table, rewrites every row. Split into: add nullable column → backfill in batches → add NOT NULL constraint.",{"type":38,"tag":69,"props":520,"children":521},{},[522,532,534,540,542,548,550,556],{"type":38,"tag":73,"props":523,"children":524},{},[525,526],{"type":44,"value":408},{"type":38,"tag":91,"props":527,"children":529},{"className":528},[],[530],{"type":44,"value":531},"CREATE INDEX",{"type":44,"value":533}," on a large write-active table without ",{"type":38,"tag":91,"props":535,"children":537},{"className":536},[],[538],{"type":44,"value":539},"CONCURRENTLY",{"type":44,"value":541}," (Postgres) \u002F ",{"type":38,"tag":91,"props":543,"children":545},{"className":544},[],[546],{"type":44,"value":547},"ALGORITHM=INPLACE LOCK=NONE",{"type":44,"value":549}," (MySQL 8.0) \u002F ",{"type":38,"tag":91,"props":551,"children":553},{"className":552},[],[554],{"type":44,"value":555},"WITH (ONLINE = ON)",{"type":44,"value":557}," (SQL Server) — blocks writes for the duration.",{"type":38,"tag":69,"props":559,"children":560},{},[561,566,568,574],{"type":38,"tag":73,"props":562,"children":563},{},[564],{"type":44,"value":565},"No editing applied migrations.",{"type":44,"value":567}," Flyway checksums them; Liquibase hashes them. Changing a released ",{"type":38,"tag":91,"props":569,"children":571},{"className":570},[],[572],{"type":44,"value":573},"V3__add_email.sql",{"type":44,"value":575}," breaks every environment. Add a new migration.",{"type":38,"tag":69,"props":577,"children":578},{},[579,591,593,599],{"type":38,"tag":73,"props":580,"children":581},{},[582,583,589],{"type":44,"value":408},{"type":38,"tag":91,"props":584,"children":586},{"className":585},[],[587],{"type":44,"value":588},"SELECT COUNT(*)",{"type":44,"value":590}," on large tables",{"type":44,"value":592}," for pagination UIs — on Postgres it's expensive; index-only scan is possible only when the visibility map is fully up-to-date (Postgres 9.2+, write-heavy tables rarely qualify). Use approximate counts (",{"type":38,"tag":91,"props":594,"children":596},{"className":595},[],[597],{"type":44,"value":598},"pg_class.reltuples",{"type":44,"value":600},") or a \"load more\" cursor instead.",{"type":38,"tag":69,"props":602,"children":603},{},[604,616],{"type":38,"tag":73,"props":605,"children":606},{},[607,608,614],{"type":44,"value":408},{"type":38,"tag":91,"props":609,"children":611},{"className":610},[],[612],{"type":44,"value":613},"DISTINCT",{"type":44,"value":615}," to fix duplicate rows",{"type":44,"value":617}," — it masks a broken JOIN. Fix the join.",{"type":38,"tag":69,"props":619,"children":620},{},[621,626,627,633],{"type":38,"tag":73,"props":622,"children":623},{},[624],{"type":44,"value":625},"No implicit type casts in joins",{"type":44,"value":317},{"type":38,"tag":91,"props":628,"children":630},{"className":629},[],[631],{"type":44,"value":632},"JOIN x ON x.id = y.id_str",{"type":44,"value":634},") — disables indexes, silently wrong if types differ. Match types.",{"type":38,"tag":69,"props":636,"children":637},{},[638,643],{"type":38,"tag":73,"props":639,"children":640},{},[641],{"type":44,"value":642},"No credentials, PII, or secrets in migration files",{"type":44,"value":644}," — they go to version control forever.",{"type":38,"tag":53,"props":646,"children":648},{"id":647},"reference-guide",[649],{"type":44,"value":650},"Reference Guide",{"type":38,"tag":652,"props":653,"children":654},"table",{},[655,674],{"type":38,"tag":656,"props":657,"children":658},"thead",{},[659],{"type":38,"tag":660,"props":661,"children":662},"tr",{},[663,669],{"type":38,"tag":664,"props":665,"children":666},"th",{},[667],{"type":44,"value":668},"Load when",{"type":38,"tag":664,"props":670,"children":671},{},[672],{"type":44,"value":673},"File",{"type":38,"tag":675,"props":676,"children":677},"tbody",{},[678,696],{"type":38,"tag":660,"props":679,"children":680},{},[681,687],{"type":38,"tag":682,"props":683,"children":684},"td",{},[685],{"type":44,"value":686},"Writing \u002F reviewing Flyway \u002F Liquibase migrations; running online schema changes",{"type":38,"tag":682,"props":688,"children":689},{},[690],{"type":38,"tag":91,"props":691,"children":693},{"className":692},[],[694],{"type":44,"value":695},"references\u002Fmigrations.md",{"type":38,"tag":660,"props":697,"children":698},{},[699,704],{"type":38,"tag":682,"props":700,"children":701},{},[702],{"type":44,"value":703},"Diagnosing a slow query; choosing indexes; reading EXPLAIN output",{"type":38,"tag":682,"props":705,"children":706},{},[707],{"type":38,"tag":91,"props":708,"children":710},{"className":709},[],[711],{"type":44,"value":712},"references\u002Fperformance.md",{"type":38,"tag":53,"props":714,"children":716},{"id":715},"output-format",[717],{"type":44,"value":718},"Output Format",{"type":38,"tag":47,"props":720,"children":721},{},[722],{"type":44,"value":723},"When producing SQL:",{"type":38,"tag":65,"props":725,"children":726},{},[727,732,745,750],{"type":38,"tag":69,"props":728,"children":729},{},[730],{"type":44,"value":731},"Short plan (1–3 bullets) — what the query \u002F migration does and which tables \u002F indexes it touches.",{"type":38,"tag":69,"props":733,"children":734},{},[735,737,743],{"type":44,"value":736},"The SQL, dialect-qualified when dialect-specific (",{"type":38,"tag":91,"props":738,"children":740},{"className":739},[],[741],{"type":44,"value":742},"-- Postgres only",{"type":44,"value":744},").",{"type":38,"tag":69,"props":746,"children":747},{},[748],{"type":44,"value":749},"If modifying schema on a large table, describe the locking \u002F backfill plan (not just the DDL).",{"type":38,"tag":69,"props":751,"children":752},{},[753],{"type":44,"value":754},"For non-trivial queries — include the expected plan shape (index scan vs seq scan) and the index it relies on. If no such index exists, flag that as part of the change.",{"type":38,"tag":47,"props":756,"children":757},{},[758,760,766],{"type":44,"value":759},"When reviewing SQL: call out MUST-DO \u002F MUST-NOT violations, point out NULL \u002F type \u002F locking traps, and suggest the minimal fix. Prefer ",{"type":38,"tag":91,"props":761,"children":763},{"className":762},[],[764],{"type":44,"value":765},"EXPLAIN",{"type":44,"value":767},"-verified advice over cargo-cult rules.",{"items":769,"total":870},[770,786,802,816,828,845,855],{"slug":771,"name":771,"fn":772,"description":773,"org":774,"tags":775,"stars":22,"repoUrl":23,"updatedAt":785},"android","build Android applications with Kotlin","Senior Android engineer workflows — Kotlin-first (Java legacy supported), Jetpack Compose + View system, MVVM, Coroutines\u002FFlow, Room, Retrofit, Hilt, plus device orchestration via plugin tools (device management, logcat, crash reports, app run) and mobile-mcp for UI interaction (element tree, taps, swipes). Use when implementing features, debugging crashes, fixing builds, writing tests, reviewing Android code, or running QA on an emulator.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[776,778,779,782],{"name":777,"slug":771,"type":15},"Android",{"name":17,"slug":18,"type":15},{"name":780,"slug":781,"type":15},"Kotlin","kotlin",{"name":783,"slug":784,"type":15},"Mobile","mobile","2026-07-13T06:45:38.239419",{"slug":787,"name":787,"fn":788,"description":789,"org":790,"tags":791,"stars":22,"repoUrl":23,"updatedAt":801},"context7","search library and framework documentation","Up-to-date library and framework documentation via Context7 MCP. Use when setup, API, or version-specific questions require current documentation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[792,795,798],{"name":793,"slug":794,"type":15},"Documentation","documentation",{"name":796,"slug":797,"type":15},"MCP","mcp",{"name":799,"slug":800,"type":15},"Reference","reference","2026-07-17T06:07:06.49579",{"slug":803,"name":803,"fn":804,"description":805,"org":806,"tags":807,"stars":22,"repoUrl":23,"updatedAt":815},"java-engineer","write and refactor modern Java code","Java 17–25 policy and pitfalls. Use when writing, reviewing, or refactoring Java code — enforces idioms around records, sealed types, switch exhaustiveness, Optional, virtual threads, and null-safety that LLMs frequently get wrong.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[808,811,812],{"name":809,"slug":810,"type":15},"Code Analysis","code-analysis",{"name":17,"slug":18,"type":15},{"name":813,"slug":814,"type":15},"Java","java","2026-07-13T06:45:44.594223",{"slug":817,"name":817,"fn":818,"description":819,"org":820,"tags":821,"stars":22,"repoUrl":23,"updatedAt":827},"kotlin-engineer","write and refactor Kotlin code","Kotlin 2.x policy and pitfalls. Use when writing, reviewing, or refactoring Kotlin code — enforces coroutine-safety, Flow correctness, null-safety, and API-design rules that LLMs frequently get wrong.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[822,825,826],{"name":823,"slug":824,"type":15},"Code Review","code-review",{"name":17,"slug":18,"type":15},{"name":780,"slug":781,"type":15},"2026-07-13T06:45:30.911318",{"slug":829,"name":829,"fn":830,"description":831,"org":832,"tags":833,"stars":22,"repoUrl":23,"updatedAt":844},"laravel-engineer","build and architect Laravel applications","Use when working on Laravel projects. Covers architecture decisions (Services vs Actions), thin controllers, Form Requests, API Resources, and API versioning. Enforces Larastan verification after code generation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[834,837,838,841],{"name":835,"slug":836,"type":15},"Backend","backend",{"name":17,"slug":18,"type":15},{"name":839,"slug":840,"type":15},"Laravel","laravel",{"name":842,"slug":843,"type":15},"PHP","php","2026-07-13T06:45:47.16012",{"slug":846,"name":846,"fn":847,"description":848,"org":849,"tags":850,"stars":22,"repoUrl":23,"updatedAt":854},"php-engineer","write and refactor modern PHP code","Modern PHP 8.x policy and pitfalls. Use when writing, reviewing, or refactoring PHP code — enforces strict types, enum\u002Freadonly\u002Fmatch\u002FDNF policy, PHPStan discipline, and catches the subtle traps (type coercion, mixed abuse, readonly mutation through references, enum serialization, fiber lifecycle, PDO emulation) that LLMs get wrong by default.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[851,852,853],{"name":809,"slug":810,"type":15},{"name":17,"slug":18,"type":15},{"name":842,"slug":843,"type":15},"2026-07-13T06:45:32.210657",{"slug":856,"name":856,"fn":857,"description":858,"org":859,"tags":860,"stars":22,"repoUrl":23,"updatedAt":869},"redis-best-practices","implement Redis best practices","Redis policy & pitfalls — key naming, atomicity, TTL strategy, distributed locks, cache patterns, production traps. Use when designing Redis-backed caches, locks, queues, rate limiters, or sessions. Covers the traps LLMs get wrong by default: SETNX + EX (deprecated), KEYS on production, Pub\u002FSub no-persistence, HGETALL on big hashes, maxmemory-policy defaults, cluster hash tags, RDB fork memory.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[861,862,863,866],{"name":13,"slug":14,"type":15},{"name":17,"slug":18,"type":15},{"name":864,"slug":865,"type":15},"Performance","performance",{"name":867,"slug":868,"type":15},"Redis","redis","2026-07-13T06:45:48.502742",9,{"items":872,"total":999},[873,889,898,907,916,926,939,948,957,967,976,989],{"slug":874,"name":874,"fn":875,"description":876,"org":877,"tags":878,"stars":886,"repoUrl":887,"updatedAt":888},"mps-aspect-accessories","configure JetBrains MPS module dependencies","Wire MPS module and model dependencies, used languages, used devkits, extended languages, runtime solutions, accessory models, and language\u002Fdependency versions. Use when adding\u002Fremoving module dependencies, importing languages or devkits into a model, declaring runtime solutions, or shipping accessory content visible to consumers without explicit import.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[879,882,885],{"name":880,"slug":881,"type":15},"Architecture","architecture",{"name":883,"slug":884,"type":15},"Configuration","configuration",{"name":17,"slug":18,"type":15},1650,"https:\u002F\u002Fgithub.com\u002FJetBrains\u002FMPS","2026-07-17T06:06:57.311661",{"slug":890,"name":890,"fn":891,"description":892,"org":893,"tags":894,"stars":886,"repoUrl":887,"updatedAt":897},"mps-aspect-actions","define and edit MPS node factories","Use when defining or editing MPS node factories (the \"actions\" aspect) — `NodeFactories` roots, per-concept `NodeFactory` setup functions that initialize a freshly created node and optionally copy data from a replaced `sampleNode`, plus the actions aspect's `CopyPasteHandlers` and `PasteWrappers` roots. Reach for this skill when a substitution, side transform, completion replacement, or `add new initialized(...)` should preserve fields from the node it is replacing, or when defaults set in a constructor are not enough.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[895,896],{"name":880,"slug":881,"type":15},{"name":17,"slug":18,"type":15},"2026-07-17T06:04:48.066901",{"slug":899,"name":899,"fn":900,"description":901,"org":902,"tags":903,"stars":886,"repoUrl":887,"updatedAt":906},"mps-aspect-behavior","define and edit MPS concept behavior","Use when defining or editing MPS `ConceptBehavior` — per-concept methods (non-virtual \u002F virtual \u002F abstract \u002F static \u002F virtual static), constructors, virtual dispatch (MRO), super and interface-default calls (`super\u003CInterface>.method`), overriding methods from `lang.core.behavior` interfaces such as `ScopeProvider.getScope` \u002F `INamedConcept.getName` \u002F `BaseConcept.getPresentation`, calling sibling methods (`LocalBehaviorMethodCall`) and behavior methods from other aspects via `node.method(...)`. Reach for this skill whenever the task involves authoring or modifying `\u003Clang>\u002FlanguageModels\u002Fbehavior.mps`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[904,905],{"name":880,"slug":881,"type":15},{"name":17,"slug":18,"type":15},"2026-07-13T06:45:21.757084",{"slug":908,"name":908,"fn":909,"description":910,"org":911,"tags":912,"stars":886,"repoUrl":887,"updatedAt":915},"mps-aspect-constraints","define JetBrains MPS language constraints","Use when defining or editing MPS language constraints — property validators \u002F setters \u002F getters, referent search scopes (imperative or inherited via `ScopeProvider.getScope`), `referentSetHandler` side effects, default-scope blocks, `canBeChild` \u002F `canBeParent` \u002F `canBeAncestor` \u002F `canBeRoot` placement rules, `defaultConcreteConcept` for abstract concepts, `set \u003Cread-only>` and `{name}` aliasing, and scope helpers (`SimpleRoleScope`, `ListScope`, `CompositeScope`, `HidingByNameScope`). Reach for this skill whenever the task involves authoring or modifying `\u003Clang>\u002FlanguageModels\u002Fconstraints.mps`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[913,914],{"name":880,"slug":881,"type":15},{"name":809,"slug":810,"type":15},"2026-07-23T05:41:33.639365",{"slug":917,"name":917,"fn":918,"description":919,"org":920,"tags":921,"stars":886,"repoUrl":887,"updatedAt":925},"mps-aspect-dataflow","define and debug MPS dataflow builders","Use when defining or debugging MPS dataflow builders for a concept — control\u002Fdata flow declarations that drive reachability analysis and variable-use checking. Covers DataFlowBuilderDeclaration, BuilderBlock, emit instructions (code for, jump, ifjump, label, read, write, ret, mayBeUnreachable), positions (AfterPosition, BeforePosition, LabelPosition), the jetbrains.mps.lang.dataFlow language, the NodeParameter implicit, BL+smodel usage inside builder bodies, and IBuilderMode for advanced analyses such as nullable\u002Fnon-null tracking.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[922],{"name":923,"slug":924,"type":15},"Data Analysis","data-analysis","2026-07-13T06:45:19.114674",{"slug":927,"name":927,"fn":928,"description":929,"org":930,"tags":931,"stars":886,"repoUrl":887,"updatedAt":938},"mps-aspect-editor","define MPS editor layouts","Use when creating or changing MPS editor definitions — the overall workflow from scaffolding a `ConceptEditorDeclaration` through componentizing reusable `EditorComponentDeclaration`s, refining cell models and cell layouts, applying style sheets and indent-layout style items, wiring smart references, leveraging inheritance via super-concepts and interfaces, inspecting (`print_node_json`, `show_node_representation`) and validating (`check_root_node_problems`). Covers `jetbrains.mps.lang.editor` cell models (`CellModel_RefNode`\u002F`CellModel_RefNodeList`\u002F`CellModel_RefCell`\u002F`CellModel_Property`\u002F`CellModel_Constant`), layout choices, and JSON blueprints for common editor shapes. For the non-layout side (action maps, keymaps, transformation\u002Fsubstitute menus) use `mps-aspect-editor-menus-and-keymaps`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[932,935],{"name":933,"slug":934,"type":15},"Design","design",{"name":936,"slug":937,"type":15},"UI Components","ui-components","2026-07-23T05:41:56.638151",{"slug":940,"name":940,"fn":941,"description":942,"org":943,"tags":944,"stars":886,"repoUrl":887,"updatedAt":947},"mps-aspect-editor-menus-and-keymaps","author MPS editor menus and keymaps","Use when authoring the **non-layout** parts of the MPS editor aspect — what happens when the user types, presses a key, triggers completion, pastes, or invokes a context action. Covers action maps (`CellActionMapDeclaration`), cell keymaps (`CellKeyMapDeclaration`), transformation menus (`TransformationMenu_Default` \u002F `_Named` \u002F `_Contribution`), substitute menus (`SubstituteMenu_Default` \u002F `SubstituteMenu` \u002F contributions), side transforms (LEFT\u002FRIGHT), legacy cell menus, paste wrappers and copy-paste handlers (in the actions language), completion styling, reference presentation, two-step deletion, and the editor selection API. Trigger terms: `actionMap`, `keyMap`, `delete_action_id`, `transformationMenu`, `substituteMenu`, `Ctrl+Space`, `Ctrl+Alt+B`, side transform, paste wrapper, completion styling, `PasteWrappers`, `CopyPasteHandlers`. For the **layout** side (cells, layouts, style sheets) use `mps-aspect-editor` instead.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[945,946],{"name":17,"slug":18,"type":15},{"name":936,"slug":937,"type":15},"2026-07-23T05:41:49.666535",{"slug":949,"name":949,"fn":950,"description":951,"org":952,"tags":953,"stars":886,"repoUrl":887,"updatedAt":956},"mps-aspect-generation-plan","modify MPS generation plans","Use when defining or modifying an MPS generation plan — explicit ordering of generators, checkpoints for cross-model reference resolution, forks for parallel branches, IncludePlan composition, conditional PlanContribution activation, ParameterEquals\u002FConceptListSelector fork selectors, and InitModelAttributes for targetFacet routing. Apply when working with @genplan models, the jetbrains.mps.lang.generator.plan language, attaching plans via DevKits or the Custom generation facet, or debugging cross-model mapping label resolution.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[954,955],{"name":880,"slug":881,"type":15},{"name":17,"slug":18,"type":15},"2026-07-13T06:44:59.507855",{"slug":958,"name":958,"fn":959,"description":960,"org":961,"tags":962,"stars":886,"repoUrl":887,"updatedAt":966},"mps-aspect-generator","define JetBrains MPS generator rules","Use when defining or modifying MPS generators — author a generator module, add or edit root\u002Freduction\u002Fweaving\u002Fpattern mapping rules, attach template macros ($COPY_SRC, $LOOP, $IF, $PROPERTY, $REF, $SWITCH, $MAP_SRC, $WEAVE, $INSERT, $LABEL, $TRACE, $VAR), wire mapping labels, build template switches, write pre\u002Fpost mapping scripts, navigate `genContext`, or debug \"rule didn't fire\", missing references, empty output, infinite reduction loops, and generated-Java compile failures.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[963,964,965],{"name":880,"slug":881,"type":15},{"name":809,"slug":810,"type":15},{"name":17,"slug":18,"type":15},"2026-07-17T06:06:58.042999",{"slug":968,"name":968,"fn":969,"description":970,"org":971,"tags":972,"stars":886,"repoUrl":887,"updatedAt":975},"mps-aspect-intentions","define and edit MPS intentions","Use when defining or editing MPS intentions (the Alt+Enter context-action aspect) — adding `IntentionDeclaration` roots, parameterized or surround-with variants, description\u002FisApplicable\u002Fexecute blocks, child-filter functions, factory-initialized AST splicing, or debugging why an intention is not offered. Lives in the language's `intentions` model and uses `jetbrains.mps.lang.intentions`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[973,974],{"name":880,"slug":881,"type":15},{"name":17,"slug":18,"type":15},"2026-07-23T05:41:48.692899",{"slug":977,"name":977,"fn":978,"description":979,"org":980,"tags":981,"stars":886,"repoUrl":887,"updatedAt":988},"mps-aspect-migrations","author and debug MPS migration scripts","Use when authoring or debugging MPS migration scripts that upgrade user models after a language definition changes — covers jetbrains.mps.lang.migration (MigrationScript class-based, PureMigrationScript declarative, MoveConcept\u002FMoveContainmentLink\u002FMoveReferenceLink\u002FMoveProperty, ordering via OrderDependency, data exchange via putData\u002FgetData, RefactoringLog, ConceptMigrationReference) and jetbrains.mps.lang.script Enhancement Scripts (MigrationScript with MigrationScriptPart_Instance, ExtractInterfaceMigration, FactoryMigrationScriptPart, CommentMigrationScriptPart) — when a model needs version-gated upgrade, concept rename or removal, link or property rename, instance-level transformation, or composition of migration steps.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[982,985],{"name":983,"slug":984,"type":15},"Debugging","debugging",{"name":986,"slug":987,"type":15},"Migration","migration","2026-07-13T06:45:20.372122",{"slug":990,"name":990,"fn":991,"description":992,"org":993,"tags":994,"stars":886,"repoUrl":887,"updatedAt":998},"mps-aspect-structure-concepts","define concepts in MPS structure aspect","Define concepts, interface concepts, enumerations, and constrained data types in an MPS language's `structure` aspect. Covers smart-reference detection, alias rules, cardinality, INamedConcept usage, bulk creation, and the full `mps_mcp_alter_structure` \u002F `mps_mcp_query_structure` reference. Use when authoring or modifying a language's structure model.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[995],{"name":996,"slug":997,"type":15},"Data Modeling","data-modeling","2026-07-23T05:41:30.705975",188]