[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D8HPPQ9BTJS4VG10CYCF4K":3,"skill-same:01M7D8HPPQ9BTJS4VG10CYCF4K":73},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M7D8HPPQ9BTJS4VG10CYCF4K","sql-database-assistant",null,"Use when the user asks to write SQL queries, optimize database performance, generate migrations, explore database schemas, or work with ORMs like Prisma, Drizzle, TypeORM, or SQLAlchemy.","Mabbit143\u002FClaude-SKills","Mabbit143","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F192994237?v=4","01M7D6X2W63K4T3N13CSVAKE3V","Mabbit Rountree","01M7D6X2WRPSZF8VMW9MW5ZP1X",0,"MIT","https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills\u002Fblob\u002Fclaude\u002Fregistry-repo-7lRiv\u002Fengineering\u002Fskills\u002Fsql-database-assistant\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: \"sql-database-assistant\"\ndescription: \"Use when the user asks to write SQL queries, optimize database performance, generate migrations, explore database schemas, or work with ORMs like Prisma, Drizzle, TypeORM, or SQLAlchemy.\"\n---\n\n# SQL Database Assistant - POWERFUL Tier Skill\n\n## Overview\n\nThe operational companion to database design. While **database-designer** focuses on schema architecture and **database-schema-designer** handles ERD modeling, this skill covers the day-to-day: writing queries, optimizing performance, generating migrations, and bridging the gap between application code and database engines.\n\n### Core Capabilities\n\n- **Natural Language to SQL** — translate requirements into correct, performant queries\n- **Schema Exploration** — introspect live databases across PostgreSQL, MySQL, SQLite, SQL Server\n- **Query Optimization** — EXPLAIN analysis, index recommendations, N+1 detection, rewrite patterns\n- **Migration Generation** — up\u002Fdown scripts, zero-downtime strategies, rollback plans\n- **ORM Integration** — Prisma, Drizzle, TypeORM, SQLAlchemy patterns and escape hatches\n- **Multi-Database Support** — dialect-aware SQL with compatibility guidance\n\n### Tools\n\n| Script | Purpose |\n|--------|---------|\n| `scripts\u002Fquery_optimizer.py` | Static analysis of SQL queries for performance issues |\n| `scripts\u002Fmigration_generator.py` | Generate migration file templates from change descriptions |\n| `scripts\u002Fschema_explorer.py` | Generate schema documentation from introspection queries |\n\n---\n\n## Natural Language to SQL\n\n### Translation Patterns\n\nWhen converting requirements to SQL, follow this sequence:\n\n1. **Identify entities** — map nouns to tables\n2. **Identify relationships** — map verbs to JOINs or subqueries\n3. **Identify filters** — map adjectives\u002Fconditions to WHERE clauses\n4. **Identify aggregations** — map \"total\", \"average\", \"count\" to GROUP BY\n5. **Identify ordering** — map \"top\", \"latest\", \"highest\" to ORDER BY + LIMIT\n\n### Common Query Templates\n\n**Top-N per group (window function)**\n```sql\nSELECT * FROM (\n  SELECT *, ROW_NUMBER() OVER (PARTITION BY department_id ORDER BY salary DESC) AS rn\n  FROM employees\n) ranked WHERE rn \u003C= 3;\n```\n\n**Running totals**\n```sql\nSELECT date, amount,\n  SUM(amount) OVER (ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS running_total\nFROM transactions;\n```\n\n**Gap detection**\n```sql\nSELECT curr.id, curr.seq_num, prev.seq_num AS prev_seq\nFROM records curr\nLEFT JOIN records prev ON prev.seq_num = curr.seq_num - 1\nWHERE prev.id IS NULL AND curr.seq_num > 1;\n```\n\n**UPSERT (PostgreSQL)**\n```sql\nINSERT INTO settings (key, value, updated_at)\nVALUES ('theme', 'dark', NOW())\nON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, updated_at = EXCLUDED.updated_at;\n```\n\n**UPSERT (MySQL)**\n```sql\nINSERT INTO settings (key_name, value, updated_at)\nVALUES ('theme', 'dark', NOW())\nON DUPLICATE KEY UPDATE value = VALUES(value), updated_at = VALUES(updated_at);\n```\n\n> See references\u002Fquery_patterns.md for JOINs, CTEs, window functions, JSON operations, and more.\n\n---\n\n## Schema Exploration\n\n### Introspection Queries\n\n**PostgreSQL — list tables and columns**\n```sql\nSELECT table_name, column_name, data_type, is_nullable, column_default\nFROM information_schema.columns\nWHERE table_schema = 'public'\nORDER BY table_name, ordinal_position;\n```\n\n**PostgreSQL — foreign keys**\n```sql\nSELECT tc.table_name, kcu.column_name,\n  ccu.table_name AS foreign_table, ccu.column_name AS foreign_column\nFROM information_schema.table_constraints tc\nJOIN information_schema.key_column_usage kcu ON tc.constraint_name = kcu.constraint_name\nJOIN information_schema.constraint_column_usage ccu ON tc.constraint_name = ccu.constraint_name\nWHERE tc.constraint_type = 'FOREIGN KEY';\n```\n\n**MySQL — table sizes**\n```sql\nSELECT table_name, table_rows,\n  ROUND(data_length \u002F 1024 \u002F 1024, 2) AS data_mb,\n  ROUND(index_length \u002F 1024 \u002F 1024, 2) AS index_mb\nFROM information_schema.tables\nWHERE table_schema = DATABASE()\nORDER BY data_length DESC;\n```\n\n**SQLite — schema dump**\n```sql\nSELECT name, sql FROM sqlite_master WHERE type = 'table' ORDER BY name;\n```\n\n**SQL Server — columns with types**\n```sql\nSELECT t.name AS table_name, c.name AS column_name,\n  ty.name AS data_type, c.max_length, c.is_nullable\nFROM sys.columns c\nJOIN sys.tables t ON c.object_id = t.object_id\nJOIN sys.types ty ON c.user_type_id = ty.user_type_id\nORDER BY t.name, c.column_id;\n```\n\n### Generating Documentation from Schema\n\nUse `scripts\u002Fschema_explorer.py` to produce markdown or JSON documentation:\n\n```bash\npython scripts\u002Fschema_explorer.py --dialect postgres --tables all --format md\npython scripts\u002Fschema_explorer.py --dialect mysql --tables users,orders --format json --json\n```\n\n---\n\n## Query Optimization\n\n### EXPLAIN Analysis Workflow\n\n1. **Run EXPLAIN ANALYZE** (PostgreSQL) or **EXPLAIN FORMAT=JSON** (MySQL)\n2. **Identify the costliest node** — Seq Scan on large tables, Nested Loop with high row estimates\n3. **Check for missing indexes** — sequential scans on filtered columns\n4. **Look for estimation errors** — planned vs actual rows divergence signals stale statistics\n5. **Evaluate JOIN order** — ensure the smallest result set drives the join\n\n### Index Recommendation Checklist\n\n- Columns in WHERE clauses with high selectivity\n- Columns in JOIN conditions (foreign keys)\n- Columns in ORDER BY when combined with LIMIT\n- Composite indexes matching multi-column WHERE predicates (most selective column first)\n- Partial indexes for queries with constant filters (e.g., `WHERE status = 'active'`)\n- Covering indexes to avoid table lookups for read-heavy queries\n\n### Query Rewriting Patterns\n\n| Anti-Pattern | Rewrite |\n|-------------|---------|\n| `SELECT * FROM orders` | `SELECT id, status, total FROM orders` (explicit columns) |\n| `WHERE YEAR(created_at) = 2025` | `WHERE created_at >= '2025-01-01' AND created_at \u003C '2026-01-01'` (sargable) |\n| Correlated subquery in SELECT | LEFT JOIN with aggregation |\n| `NOT IN (SELECT ...)` with NULLs | `NOT EXISTS (SELECT 1 ...)` |\n| `UNION` (dedup) when not needed | `UNION ALL` |\n| `LIKE '%search%'` | Full-text search index (GIN\u002FFULLTEXT) |\n| `ORDER BY RAND()` | Application-side random sampling or `TABLESAMPLE` |\n\n### N+1 Detection\n\n**Symptoms:**\n- Application loop that executes one query per parent row\n- ORM lazy-loading related entities inside a loop\n- Query log shows hundreds of identical SELECT patterns with different IDs\n\n**Fixes:**\n- Use eager loading (`include` in Prisma, `joinedload` in SQLAlchemy)\n- Batch queries with `WHERE id IN (...)`\n- Use DataLoader pattern for GraphQL resolvers\n\n### Static Analysis Tool\n\n```bash\npython scripts\u002Fquery_optimizer.py --query \"SELECT * FROM orders WHERE status = 'pending'\" --dialect postgres\npython scripts\u002Fquery_optimizer.py --query queries.sql --dialect mysql --json\n```\n\n> See references\u002Foptimization_guide.md for EXPLAIN plan reading, index types, and connection pooling.\n\n---\n\n## Migration Generation\n\n### Zero-Downtime Migration Patterns\n\n**Adding a column (safe)**\n```sql\n-- Up\nALTER TABLE users ADD COLUMN phone VARCHAR(20);\n\n-- Down\nALTER TABLE users DROP COLUMN phone;\n```\n\n**Renaming a column (expand-contract)**\n```sql\n-- Step 1: Add new column\nALTER TABLE users ADD COLUMN full_name VARCHAR(255);\n-- Step 2: Backfill\nUPDATE users SET full_name = name;\n-- Step 3: Deploy app reading both columns\n-- Step 4: Deploy app writing only new column\n-- Step 5: Drop old column\nALTER TABLE users DROP COLUMN name;\n```\n\n**Adding a NOT NULL column (safe sequence)**\n```sql\n-- Step 1: Add nullable\nALTER TABLE orders ADD COLUMN region VARCHAR(50);\n-- Step 2: Backfill with default\nUPDATE orders SET region = 'unknown' WHERE region IS NULL;\n-- Step 3: Add constraint\nALTER TABLE orders ALTER COLUMN region SET NOT NULL;\nALTER TABLE orders ALTER COLUMN region SET DEFAULT 'unknown';\n```\n\n**Index creation (non-blocking, PostgreSQL)**\n```sql\nCREATE INDEX CONCURRENTLY idx_orders_status ON orders (status);\n```\n\n### Data Backfill Strategies\n\n- **Batch updates** — process in chunks of 1000-10000 rows to avoid lock contention\n- **Background jobs** — run backfills asynchronously with progress tracking\n- **Dual-write** — write to old and new columns during transition period\n- **Validation queries** — verify row counts and data integrity after each batch\n\n### Rollback Strategies\n\nEvery migration must have a reversible down script. For irreversible changes:\n\n1. **Backup before execution** — `pg_dump` the affected tables\n2. **Feature flags** — application can switch between old\u002Fnew schema reads\n3. **Shadow tables** — keep a copy of the original table during migration window\n\n### Migration Generator Tool\n\n```bash\npython scripts\u002Fmigration_generator.py --change \"add email_verified boolean to users\" --dialect postgres --format sql\npython scripts\u002Fmigration_generator.py --change \"rename column name to full_name in customers\" --dialect mysql --format alembic --json\n```\n\n---\n\n## Multi-Database Support\n\n### Dialect Differences\n\n| Feature | PostgreSQL | MySQL | SQLite | SQL Server |\n|---------|-----------|-------|--------|------------|\n| UPSERT | `ON CONFLICT DO UPDATE` | `ON DUPLICATE KEY UPDATE` | `ON CONFLICT DO UPDATE` | `MERGE` |\n| Boolean | Native `BOOLEAN` | `TINYINT(1)` | `INTEGER` | `BIT` |\n| Auto-increment | `SERIAL` \u002F `GENERATED` | `AUTO_INCREMENT` | `INTEGER PRIMARY KEY` | `IDENTITY` |\n| JSON | `JSONB` (indexed) | `JSON` | Text (ext) | `NVARCHAR(MAX)` |\n| Array | Native `ARRAY` | Not supported | Not supported | Not supported |\n| CTE (recursive) | Full support | 8.0+ | 3.8.3+ | Full support |\n| Window functions | Full support | 8.0+ | 3.25.0+ | Full support |\n| Full-text search | `tsvector` + GIN | `FULLTEXT` index | FTS5 extension | Full-text catalog |\n| LIMIT\u002FOFFSET | `LIMIT n OFFSET m` | `LIMIT n OFFSET m` | `LIMIT n OFFSET m` | `OFFSET m ROWS FETCH NEXT n ROWS ONLY` |\n\n### Compatibility Tips\n\n- **Always use parameterized queries** — prevents SQL injection across all dialects\n- **Avoid dialect-specific functions in shared code** — wrap in adapter layer\n- **Test migrations on target engine** — `information_schema` varies between engines\n- **Use ISO date format** — `'YYYY-MM-DD'` works everywhere\n- **Quote identifiers** — use double quotes (SQL standard) or backticks (MySQL)\n\n---\n\n## ORM Patterns\n\n### Prisma\n\n**Schema definition**\n```prisma\nmodel User {\n  id        Int      @id @default(autoincrement())\n  email     String   @unique\n  name      String?\n  posts     Post[]\n  createdAt DateTime @default(now())\n}\n\nmodel Post {\n  id       Int    @id @default(autoincrement())\n  title    String\n  author   User   @relation(fields: [authorId], references: [id])\n  authorId Int\n}\n```\n\n**Migrations**: `npx prisma migrate dev --name add_user_email`\n**Query API**: `prisma.user.findMany({ where: { email: { contains: '@' } }, include: { posts: true } })`\n**Raw SQL escape hatch**: `prisma.$queryRaw\\`SELECT * FROM users WHERE id = ${userId}\\``\n\n### Drizzle\n\n**Schema-first definition**\n```typescript\nexport const users = pgTable('users', {\n  id: serial('id').primaryKey(),\n  email: varchar('email', { length: 255 }).notNull().unique(),\n  name: text('name'),\n  createdAt: timestamp('created_at').defaultNow(),\n});\n```\n\n**Query builder**: `db.select().from(users).where(eq(users.email, email))`\n**Migrations**: `npx drizzle-kit generate:pg` then `npx drizzle-kit push:pg`\n\n### TypeORM\n\n**Entity decorators**\n```typescript\n@Entity()\nexport class User {\n  @PrimaryGeneratedColumn()\n  id: number;\n\n  @Column({ unique: true })\n  email: string;\n\n  @OneToMany(() => Post, post => post.author)\n  posts: Post[];\n}\n```\n\n**Repository pattern**: `userRepo.find({ where: { email }, relations: ['posts'] })`\n**Migrations**: `npx typeorm migration:generate -n AddUserEmail`\n\n### SQLAlchemy\n\n**Declarative models**\n```python\nclass User(Base):\n    __tablename__ = 'users'\n    id = Column(Integer, primary_key=True)\n    email = Column(String(255), unique=True, nullable=False)\n    name = Column(String(255))\n    posts = relationship('Post', back_populates='author')\n```\n\n**Session management**: Always use `with Session() as session:` context manager\n**Alembic migrations**: `alembic revision --autogenerate -m \"add user email\"`\n\n> See references\u002Form_patterns.md for side-by-side comparisons and migration workflows per ORM.\n\n---\n\n## Data Integrity\n\n### Constraint Strategy\n\n- **Primary keys** — every table must have one; prefer surrogate keys (serial\u002FUUID)\n- **Foreign keys** — enforce referential integrity; define ON DELETE behavior explicitly\n- **UNIQUE constraints** — for business-level uniqueness (email, slug, API key)\n- **CHECK constraints** — validate ranges, enums, and business rules at the DB level\n- **NOT NULL** — default to NOT NULL; make nullable only when genuinely optional\n\n### Transaction Isolation Levels\n\n| Level | Dirty Read | Non-Repeatable Read | Phantom Read | Use Case |\n|-------|-----------|-------------------|-------------|----------|\n| READ UNCOMMITTED | Yes | Yes | Yes | Never recommended |\n| READ COMMITTED | No | Yes | Yes | Default for PostgreSQL, general OLTP |\n| REPEATABLE READ | No | No | Yes (InnoDB: No) | Financial calculations |\n| SERIALIZABLE | No | No | No | Critical consistency (billing, inventory) |\n\n### Deadlock Prevention\n\n1. **Consistent lock ordering** — always acquire locks in the same table\u002Frow order\n2. **Short transactions** — minimize time between first lock and commit\n3. **Advisory locks** — use `pg_advisory_lock()` for application-level coordination\n4. **Retry logic** — catch deadlock errors and retry with exponential backoff\n\n---\n\n## Backup & Restore\n\n### PostgreSQL\n```bash\n# Full backup\npg_dump -Fc --no-owner dbname > backup.dump\n# Restore\npg_restore -d dbname --clean --no-owner backup.dump\n# Point-in-time recovery: configure WAL archiving + restore_command\n```\n\n### MySQL\n```bash\n# Full backup\nmysqldump --single-transaction --routines --triggers dbname > backup.sql\n# Restore\nmysql dbname \u003C backup.sql\n# Binary log for PITR: mysqlbinlog --start-datetime=\"2025-01-01 00:00:00\" binlog.000001\n```\n\n### SQLite\n```bash\n# Backup (safe with concurrent reads)\nsqlite3 dbname \".backup backup.db\"\n```\n\n### Backup Best Practices\n- **Automate** — cron or systemd timer, never manual-only\n- **Test restores** — untested backups are not backups\n- **Offsite copies** — S3, GCS, or separate region\n- **Retention policy** — daily for 7 days, weekly for 4 weeks, monthly for 12 months\n- **Monitor backup size and duration** — sudden changes signal issues\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Problem | Fix |\n|-------------|---------|-----|\n| `SELECT *` | Transfers unnecessary data, breaks on schema changes | Explicit column list |\n| Missing indexes on FK columns | Slow JOINs and cascading deletes | Add indexes on all foreign keys |\n| N+1 queries | 1 + N round trips to database | Eager loading or batch queries |\n| Implicit type coercion | `WHERE id = '123'` prevents index use | Match types in predicates |\n| No connection pooling | Exhausts connections under load | PgBouncer, ProxySQL, or ORM pool |\n| Unbounded queries | No LIMIT risks returning millions of rows | Always paginate |\n| Storing money as FLOAT | Rounding errors | Use `DECIMAL(19,4)` or integer cents |\n| God tables | One table with 50+ columns | Normalize or use vertical partitioning |\n| Soft deletes everywhere | Complicates every query with `WHERE deleted_at IS NULL` | Archive tables or event sourcing |\n| Raw string concatenation | SQL injection | Parameterized queries always |\n\n---\n\n## Cross-References\n\n| Skill | Relationship |\n|-------|-------------|\n| **database-designer** | Schema architecture, normalization analysis, ERD generation |\n| **database-schema-designer** | Visual ERD modeling, relationship mapping |\n| **migration-architect** | Complex multi-step migration orchestration |\n| **api-design-reviewer** | Ensuring API endpoints align with query patterns |\n| **observability-platform** | Query performance monitoring, slow query alerts |\n","# SQL Database Assistant - POWERFUL Tier Skill\n\n## Overview\n\nThe operational companion to database design. While **database-designer** focuses on schema architecture and **database-schema-designer** handles ERD modeling, this skill covers the day-to-day: writing queries, optimizing performance, generating migrations, and bridging the gap between application code and database engines.\n\n### Core Capabilities\n\n- **Natural Language to SQL** — translate requirements into correct, performant queries\n- **Schema Exploration** — introspect live databases across PostgreSQL, MySQL, SQLite, SQL Server\n- **Query Optimization** — EXPLAIN analysis, index recommendations, N+1 detection, rewrite patterns\n- **Migration Generation** — up\u002Fdown scripts, zero-downtime strategies, rollback plans\n- **ORM Integration** — Prisma, Drizzle, TypeORM, SQLAlchemy patterns and escape hatches\n- **Multi-Database Support** — dialect-aware SQL with compatibility guidance\n\n### Tools\n\n| Script | Purpose |\n|--------|---------|\n| `scripts\u002Fquery_optimizer.py` | Static analysis of SQL queries for performance issues |\n| `scripts\u002Fmigration_generator.py` | Generate migration file templates from change descriptions |\n| `scripts\u002Fschema_explorer.py` | Generate schema documentation from introspection queries |\n\n---\n\n## Natural Language to SQL\n\n### Translation Patterns\n\nWhen converting requirements to SQL, follow this sequence:\n\n1. **Identify entities** — map nouns to tables\n2. **Identify relationships** — map verbs to JOINs or subqueries\n3. **Identify filters** — map adjectives\u002Fconditions to WHERE clauses\n4. **Identify aggregations** — map \"total\", \"average\", \"count\" to GROUP BY\n5. **Identify ordering** — map \"top\", \"latest\", \"highest\" to ORDER BY + LIMIT\n\n### Common Query Templates\n\n**Top-N per group (window function)**\n```sql\nSELECT * FROM (\n  SELECT *, ROW_NUMBER() OVER (PARTITION BY department_id ORDER BY salary DESC) AS rn\n  FROM employees\n) ranked WHERE rn \u003C= 3;\n```\n\n**Running totals**\n```sql\nSELECT date, amount,\n  SUM(amount) OVER (ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS running_total\nFROM transactions;\n```\n\n**Gap detection**\n```sql\nSELECT curr.id, curr.seq_num, prev.seq_num AS prev_seq\nFROM records curr\nLEFT JOIN records prev ON prev.seq_num = curr.seq_num - 1\nWHERE prev.id IS NULL AND curr.seq_num > 1;\n```\n\n**UPSERT (PostgreSQL)**\n```sql\nINSERT INTO settings (key, value, updated_at)\nVALUES ('theme', 'dark', NOW())\nON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, updated_at = EXCLUDED.updated_at;\n```\n\n**UPSERT (MySQL)**\n```sql\nINSERT INTO settings (key_name, value, updated_at)\nVALUES ('theme', 'dark', NOW())\nON DUPLICATE KEY UPDATE value = VALUES(value), updated_at = VALUES(updated_at);\n```\n\n> See references\u002Fquery_patterns.md for JOINs, CTEs, window functions, JSON operations, and more.\n\n---\n\n## Schema Exploration\n\n### Introspection Queries\n\n**PostgreSQL — list tables and columns**\n```sql\nSELECT table_name, column_name, data_type, is_nullable, column_default\nFROM information_schema.columns\nWHERE table_schema = 'public'\nORDER BY table_name, ordinal_position;\n```\n\n**PostgreSQL — foreign keys**\n```sql\nSELECT tc.table_name, kcu.column_name,\n  ccu.table_name AS foreign_table, ccu.column_name AS foreign_column\nFROM information_schema.table_constraints tc\nJOIN information_schema.key_column_usage kcu ON tc.constraint_name = kcu.constraint_name\nJOIN information_schema.constraint_column_usage ccu ON tc.constraint_name = ccu.constraint_name\nWHERE tc.constraint_type = 'FOREIGN KEY';\n```\n\n**MySQL — table sizes**\n```sql\nSELECT table_name, table_rows,\n  ROUND(data_length \u002F 1024 \u002F 1024, 2) AS data_mb,\n  ROUND(index_length \u002F 1024 \u002F 1024, 2) AS index_mb\nFROM information_schema.tables\nWHERE table_schema = DATABASE()\nORDER BY data_length DESC;\n```\n\n**SQLite — schema dump**\n```sql\nSELECT name, sql FROM sqlite_master WHERE type = 'table' ORDER BY name;\n```\n\n**SQL Server — columns with types**\n```sql\nSELECT t.name AS table_name, c.name AS column_name,\n  ty.name AS data_type, c.max_length, c.is_nullable\nFROM sys.columns c\nJOIN sys.tables t ON c.object_id = t.object_id\nJOIN sys.types ty ON c.user_type_id = ty.user_type_id\nORDER BY t.name, c.column_id;\n```\n\n### Generating Documentation from Schema\n\nUse `scripts\u002Fschema_explorer.py` to produce markdown or JSON documentation:\n\n```bash\npython scripts\u002Fschema_explorer.py --dialect postgres --tables all --format md\npython scripts\u002Fschema_explorer.py --dialect mysql --tables users,orders --format json --json\n```\n\n---\n\n## Query Optimization\n\n### EXPLAIN Analysis Workflow\n\n1. **Run EXPLAIN ANALYZE** (PostgreSQL) or **EXPLAIN FORMAT=JSON** (MySQL)\n2. **Identify the costliest node** — Seq Scan on large tables, Nested Loop with high row estimates\n3. **Check for missing indexes** — sequential scans on filtered columns\n4. **Look for estimation errors** — planned vs actual rows divergence signals stale statistics\n5. **Evaluate JOIN order** — ensure the smallest result set drives the join\n\n### Index Recommendation Checklist\n\n- Columns in WHERE clauses with high selectivity\n- Columns in JOIN conditions (foreign keys)\n- Columns in ORDER BY when combined with LIMIT\n- Composite indexes matching multi-column WHERE predicates (most selective column first)\n- Partial indexes for queries with constant filters (e.g., `WHERE status = 'active'`)\n- Covering indexes to avoid table lookups for read-heavy queries\n\n### Query Rewriting Patterns\n\n| Anti-Pattern | Rewrite |\n|-------------|---------|\n| `SELECT * FROM orders` | `SELECT id, status, total FROM orders` (explicit columns) |\n| `WHERE YEAR(created_at) = 2025` | `WHERE created_at >= '2025-01-01' AND created_at \u003C '2026-01-01'` (sargable) |\n| Correlated subquery in SELECT | LEFT JOIN with aggregation |\n| `NOT IN (SELECT ...)` with NULLs | `NOT EXISTS (SELECT 1 ...)` |\n| `UNION` (dedup) when not needed | `UNION ALL` |\n| `LIKE '%search%'` | Full-text search index (GIN\u002FFULLTEXT) |\n| `ORDER BY RAND()` | Application-side random sampling or `TABLESAMPLE` |\n\n### N+1 Detection\n\n**Symptoms:**\n- Application loop that executes one query per parent row\n- ORM lazy-loading related entities inside a loop\n- Query log shows hundreds of identical SELECT patterns with different IDs\n\n**Fixes:**\n- Use eager loading (`include` in Prisma, `joinedload` in SQLAlchemy)\n- Batch queries with `WHERE id IN (...)`\n- Use DataLoader pattern for GraphQL resolvers\n\n### Static Analysis Tool\n\n```bash\npython scripts\u002Fquery_optimizer.py --query \"SELECT * FROM orders WHERE status = 'pending'\" --dialect postgres\npython scripts\u002Fquery_optimizer.py --query queries.sql --dialect mysql --json\n```\n\n> See references\u002Foptimization_guide.md for EXPLAIN plan reading, index types, and connection pooling.\n\n---\n\n## Migration Generation\n\n### Zero-Downtime Migration Patterns\n\n**Adding a column (safe)**\n```sql\n-- Up\nALTER TABLE users ADD COLUMN phone VARCHAR(20);\n\n-- Down\nALTER TABLE users DROP COLUMN phone;\n```\n\n**Renaming a column (expand-contract)**\n```sql\n-- Step 1: Add new column\nALTER TABLE users ADD COLUMN full_name VARCHAR(255);\n-- Step 2: Backfill\nUPDATE users SET full_name = name;\n-- Step 3: Deploy app reading both columns\n-- Step 4: Deploy app writing only new column\n-- Step 5: Drop old column\nALTER TABLE users DROP COLUMN name;\n```\n\n**Adding a NOT NULL column (safe sequence)**\n```sql\n-- Step 1: Add nullable\nALTER TABLE orders ADD COLUMN region VARCHAR(50);\n-- Step 2: Backfill with default\nUPDATE orders SET region = 'unknown' WHERE region IS NULL;\n-- Step 3: Add constraint\nALTER TABLE orders ALTER COLUMN region SET NOT NULL;\nALTER TABLE orders ALTER COLUMN region SET DEFAULT 'unknown';\n```\n\n**Index creation (non-blocking, PostgreSQL)**\n```sql\nCREATE INDEX CONCURRENTLY idx_orders_status ON orders (status);\n```\n\n### Data Backfill Strategies\n\n- **Batch updates** — process in chunks of 1000-10000 rows to avoid lock contention\n- **Background jobs** — run backfills asynchronously with progress tracking\n- **Dual-write** — write to old and new columns during transition period\n- **Validation queries** — verify row counts and data integrity after each batch\n\n### Rollback Strategies\n\nEvery migration must have a reversible down script. For irreversible changes:\n\n1. **Backup before execution** — `pg_dump` the affected tables\n2. **Feature flags** — application can switch between old\u002Fnew schema reads\n3. **Shadow tables** — keep a copy of the original table during migration window\n\n### Migration Generator Tool\n\n```bash\npython scripts\u002Fmigration_generator.py --change \"add email_verified boolean to users\" --dialect postgres --format sql\npython scripts\u002Fmigration_generator.py --change \"rename column name to full_name in customers\" --dialect mysql --format alembic --json\n```\n\n---\n\n## Multi-Database Support\n\n### Dialect Differences\n\n| Feature | PostgreSQL | MySQL | SQLite | SQL Server |\n|---------|-----------|-------|--------|------------|\n| UPSERT | `ON CONFLICT DO UPDATE` | `ON DUPLICATE KEY UPDATE` | `ON CONFLICT DO UPDATE` | `MERGE` |\n| Boolean | Native `BOOLEAN` | `TINYINT(1)` | `INTEGER` | `BIT` |\n| Auto-increment | `SERIAL` \u002F `GENERATED` | `AUTO_INCREMENT` | `INTEGER PRIMARY KEY` | `IDENTITY` |\n| JSON | `JSONB` (indexed) | `JSON` | Text (ext) | `NVARCHAR(MAX)` |\n| Array | Native `ARRAY` | Not supported | Not supported | Not supported |\n| CTE (recursive) | Full support | 8.0+ | 3.8.3+ | Full support |\n| Window functions | Full support | 8.0+ | 3.25.0+ | Full support |\n| Full-text search | `tsvector` + GIN | `FULLTEXT` index | FTS5 extension | Full-text catalog |\n| LIMIT\u002FOFFSET | `LIMIT n OFFSET m` | `LIMIT n OFFSET m` | `LIMIT n OFFSET m` | `OFFSET m ROWS FETCH NEXT n ROWS ONLY` |\n\n### Compatibility Tips\n\n- **Always use parameterized queries** — prevents SQL injection across all dialects\n- **Avoid dialect-specific functions in shared code** — wrap in adapter layer\n- **Test migrations on target engine** — `information_schema` varies between engines\n- **Use ISO date format** — `'YYYY-MM-DD'` works everywhere\n- **Quote identifiers** — use double quotes (SQL standard) or backticks (MySQL)\n\n---\n\n## ORM Patterns\n\n### Prisma\n\n**Schema definition**\n```prisma\nmodel User {\n  id        Int      @id @default(autoincrement())\n  email     String   @unique\n  name      String?\n  posts     Post[]\n  createdAt DateTime @default(now())\n}\n\nmodel Post {\n  id       Int    @id @default(autoincrement())\n  title    String\n  author   User   @relation(fields: [authorId], references: [id])\n  authorId Int\n}\n```\n\n**Migrations**: `npx prisma migrate dev --name add_user_email`\n**Query API**: `prisma.user.findMany({ where: { email: { contains: '@' } }, include: { posts: true } })`\n**Raw SQL escape hatch**: `prisma.$queryRaw\\`SELECT * FROM users WHERE id = ${userId}\\``\n\n### Drizzle\n\n**Schema-first definition**\n```typescript\nexport const users = pgTable('users', {\n  id: serial('id').primaryKey(),\n  email: varchar('email', { length: 255 }).notNull().unique(),\n  name: text('name'),\n  createdAt: timestamp('created_at').defaultNow(),\n});\n```\n\n**Query builder**: `db.select().from(users).where(eq(users.email, email))`\n**Migrations**: `npx drizzle-kit generate:pg` then `npx drizzle-kit push:pg`\n\n### TypeORM\n\n**Entity decorators**\n```typescript\n@Entity()\nexport class User {\n  @PrimaryGeneratedColumn()\n  id: number;\n\n  @Column({ unique: true })\n  email: string;\n\n  @OneToMany(() => Post, post => post.author)\n  posts: Post[];\n}\n```\n\n**Repository pattern**: `userRepo.find({ where: { email }, relations: ['posts'] })`\n**Migrations**: `npx typeorm migration:generate -n AddUserEmail`\n\n### SQLAlchemy\n\n**Declarative models**\n```python\nclass User(Base):\n    __tablename__ = 'users'\n    id = Column(Integer, primary_key=True)\n    email = Column(String(255), unique=True, nullable=False)\n    name = Column(String(255))\n    posts = relationship('Post', back_populates='author')\n```\n\n**Session management**: Always use `with Session() as session:` context manager\n**Alembic migrations**: `alembic revision --autogenerate -m \"add user email\"`\n\n> See references\u002Form_patterns.md for side-by-side comparisons and migration workflows per ORM.\n\n---\n\n## Data Integrity\n\n### Constraint Strategy\n\n- **Primary keys** — every table must have one; prefer surrogate keys (serial\u002FUUID)\n- **Foreign keys** — enforce referential integrity; define ON DELETE behavior explicitly\n- **UNIQUE constraints** — for business-level uniqueness (email, slug, API key)\n- **CHECK constraints** — validate ranges, enums, and business rules at the DB level\n- **NOT NULL** — default to NOT NULL; make nullable only when genuinely optional\n\n### Transaction Isolation Levels\n\n| Level | Dirty Read | Non-Repeatable Read | Phantom Read | Use Case |\n|-------|-----------|-------------------|-------------|----------|\n| READ UNCOMMITTED | Yes | Yes | Yes | Never recommended |\n| READ COMMITTED | No | Yes | Yes | Default for PostgreSQL, general OLTP |\n| REPEATABLE READ | No | No | Yes (InnoDB: No) | Financial calculations |\n| SERIALIZABLE | No | No | No | Critical consistency (billing, inventory) |\n\n### Deadlock Prevention\n\n1. **Consistent lock ordering** — always acquire locks in the same table\u002Frow order\n2. **Short transactions** — minimize time between first lock and commit\n3. **Advisory locks** — use `pg_advisory_lock()` for application-level coordination\n4. **Retry logic** — catch deadlock errors and retry with exponential backoff\n\n---\n\n## Backup & Restore\n\n### PostgreSQL\n```bash\n# Full backup\npg_dump -Fc --no-owner dbname > backup.dump\n# Restore\npg_restore -d dbname --clean --no-owner backup.dump\n# Point-in-time recovery: configure WAL archiving + restore_command\n```\n\n### MySQL\n```bash\n# Full backup\nmysqldump --single-transaction --routines --triggers dbname > backup.sql\n# Restore\nmysql dbname \u003C backup.sql\n# Binary log for PITR: mysqlbinlog --start-datetime=\"2025-01-01 00:00:00\" binlog.000001\n```\n\n### SQLite\n```bash\n# Backup (safe with concurrent reads)\nsqlite3 dbname \".backup backup.db\"\n```\n\n### Backup Best Practices\n- **Automate** — cron or systemd timer, never manual-only\n- **Test restores** — untested backups are not backups\n- **Offsite copies** — S3, GCS, or separate region\n- **Retention policy** — daily for 7 days, weekly for 4 weeks, monthly for 12 months\n- **Monitor backup size and duration** — sudden changes signal issues\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Problem | Fix |\n|-------------|---------|-----|\n| `SELECT *` | Transfers unnecessary data, breaks on schema changes | Explicit column list |\n| Missing indexes on FK columns | Slow JOINs and cascading deletes | Add indexes on all foreign keys |\n| N+1 queries | 1 + N round trips to database | Eager loading or batch queries |\n| Implicit type coercion | `WHERE id = '123'` prevents index use | Match types in predicates |\n| No connection pooling | Exhausts connections under load | PgBouncer, ProxySQL, or ORM pool |\n| Unbounded queries | No LIMIT risks returning millions of rows | Always paginate |\n| Storing money as FLOAT | Rounding errors | Use `DECIMAL(19,4)` or integer cents |\n| God tables | One table with 50+ columns | Normalize or use vertical partitioning |\n| Soft deletes everywhere | Complicates every query with `WHERE deleted_at IS NULL` | Archive tables or event sourcing |\n| Raw string concatenation | SQL injection | Parameterized queries always |\n\n---\n\n## Cross-References\n\n| Skill | Relationship |\n|-------|-------------|\n| **database-designer** | Schema architecture, normalization analysis, ERD generation |\n| **database-schema-designer** | Visual ERD modeling, relationship mapping |\n| **migration-architect** | Complex multi-step migration orchestration |\n| **api-design-reviewer** | Ensuring API endpoints align with query patterns |\n| **observability-platform** | Query performance monitoring, slow query alerts |\n",{"name":5,"description":7},"claude\u002Fregistry-repo-7lRiv","44e1a5b2d387b250bcd0794f7eb5e1228223d1e2","engineering\u002Fskills\u002Fsql-database-assistant","https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills","https:\u002F\u002Fgithub.com\u002FMabbit143","I’m edgy and fun, probably too serious, but I love an adventure.","2026-09-22 07:56:32",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add Mabbit143\u002FClaude-SKills --skill sql-database-assistant",{"tool":37,"command":38},"bunx","bunx skills add Mabbit143\u002FClaude-SKills --skill sql-database-assistant",{"tool":40,"command":41},"pnpm","pnpm dlx skills add Mabbit143\u002FClaude-SKills --skill sql-database-assistant","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills\u002Fblob\u002Fclaude\u002Fregistry-repo-7lRiv\u002Fengineering\u002Fskills\u002Fsql-database-assistant\u002FSKILL.md",true,[45,51,55,59,65,69],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"references\u002Foptimization_guide.md","REFERENCE","参考文档",10699,"https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills\u002Fblob\u002Fclaude\u002Fregistry-repo-7lRiv\u002Fengineering\u002Fskills\u002Fsql-database-assistant\u002Freferences\u002Foptimization_guide.md",{"path":52,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":53,"sourceHtmlUrl":54},"references\u002Form_patterns.md",12565,"https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills\u002Fblob\u002Fclaude\u002Fregistry-repo-7lRiv\u002Fengineering\u002Fskills\u002Fsql-database-assistant\u002Freferences\u002Form_patterns.md",{"path":56,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002Fquery_patterns.md",9787,"https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills\u002Fblob\u002Fclaude\u002Fregistry-repo-7lRiv\u002Fengineering\u002Fskills\u002Fsql-database-assistant\u002Freferences\u002Fquery_patterns.md",{"path":60,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":63,"sourceHtmlUrl":64},"scripts\u002Fmigration_generator.py","SCRIPT","脚本",16436,"https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills\u002Fblob\u002Fclaude\u002Fregistry-repo-7lRiv\u002Fengineering\u002Fskills\u002Fsql-database-assistant\u002Fscripts\u002Fmigration_generator.py",{"path":66,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":67,"sourceHtmlUrl":68},"scripts\u002Fquery_optimizer.py",11756,"https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills\u002Fblob\u002Fclaude\u002Fregistry-repo-7lRiv\u002Fengineering\u002Fskills\u002Fsql-database-assistant\u002Fscripts\u002Fquery_optimizer.py",{"path":70,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":71,"sourceHtmlUrl":72},"scripts\u002Fschema_explorer.py",14300,"https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills\u002Fblob\u002Fclaude\u002Fregistry-repo-7lRiv\u002Fengineering\u002Fskills\u002Fsql-database-assistant\u002Fscripts\u002Fschema_explorer.py",[74,81,88,95,102,109],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7D99ZA4F916M5CM3K2EQFE8","syllabus","Generates a curated supplementary reading list from any course syllabus using Consensus academic search. Grill-me intake (syllabus input format + course audience + year range) plus a grouping forcing-options checkpoint before any search runs — so the reading list matches the course's level and recency need. Parses the syllabus to extract topics and learning outcomes, searches Consensus for recent peer-reviewed papers per topic, and produces a professionally formatted .docx with clickable Consensus links, plain-language summaries calibrated to audience level, and Bloom-higher-order discussion questions tied to course learning goals. Triggers whenever a user uploads a syllabus, course outline, or curriculum document and wants supplementary readings. Also triggers on: 'syllabus reading list', 'find papers for my course', 'create a reading list from this syllabus', 'recent research for my class', 'supplementary readings', 'find journal articles for these topics', 'what recent papers cover this material', 'any new research on these course topics', 'update my syllabus with recent papers'. Even casual mentions when a syllabus is attached should trigger this skill.","https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills\u002Fblob\u002Fclaude\u002Fregistry-repo-7lRiv\u002Fresearch\u002Fsyllabus\u002Fskills\u002Fsyllabus\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7D99ND4B38EG1BYQX722F5D","research","Default entry point for any research request — a hybrid router that classifies the question deterministically and either delegates to a specialist research skill (pulse for trends\u002Fsentiment, grants for NIH funding, litreview for academic literature, syllabus for course reading, patent for prior-art + IP landscape, dossier for entity research) or runs its own plan-decompose-multi-source-search-synthesize-cite fallback workflow when no specialist matches. Always surfaces the routing decision so users can override. Triggers — \"research [topic]\", \"look into [topic]\", \"what do we know about [topic]\", \"investigate [topic]\", \"find me information on [topic]\", \"do some research on [topic]\", \"I need to understand [topic]\", or any research request that doesn't obviously match a more-specific specialist skill. Output is a markdown briefing (default) or .docx document (on request) with full citations and an audit log.","https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills\u002Fblob\u002Fclaude\u002Fregistry-repo-7lRiv\u002Fresearch\u002Fresearch\u002Fskills\u002Fresearch\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M7D999VS936SV9TX940A98AQ","pulse","Multi-source recency research skill that takes the pulse of any topic across Reddit, Hacker News, the open web, and optionally X\u002FTwitter within a configurable recent window (default 30 days). Forcing intake clarifies topic specificity, angle (trend\u002Fsentiment\u002Fproblems\u002Fopportunities\u002Fcomparison), time window, and platform scope before searching. Returns a synthesized briefing with citations, engagement metrics, and cross-platform pattern analysis. Triggers: 'pulse on [topic]', 'what's happening with [topic]', 'what are people saying about [topic]', 'current conversation about [topic]', 'take the pulse of [topic]', 'trending: [topic]', 'find me info on [topic]', or any variation requesting multi-source recency intelligence on a topic. Also use for competitor research, trend discovery, tool comparisons, and audience sentiment analysis.","https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills\u002Fblob\u002Fclaude\u002Fregistry-repo-7lRiv\u002Fresearch\u002Fpulse\u002Fskills\u002Fpulse\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":19},"01M7D98XBECS6368GEJNG8C1Z1","patent","Patent prior-art and landscape intelligence skill — not generic patent help. Commits to one of five sub-use-cases via forcing intake (novelty search \u002F freedom-to-operate \u002F competitive landscape \u002F acquisition diligence \u002F litigation prior-art) before any search runs. Searches Google Patents, Espacenet, USPTO, and optionally Lens.org for citation-graph signals. Output is an editable Word document (.docx) with verdict, ranked closest art (claim-text extracted), CPC-class-aware landscape, family-resolved hits, geographic coverage, FTO flags where applicable, strategy recommendations, and full audit log. Triggers: 'prior art search for [invention]', 'patent search on [topic]', 'freedom to operate analysis', 'FTO for [product]', 'patent landscape for [field]', 'is [invention] novel', 'patents on [topic]', 'competitive patent analysis', 'prior art for litigation', 'patent diligence on [company]'. Produces search signal, not legal advice — always recommends consulting a patent attorney before filing or licensing decisions. Trademark, copyright, and trade-secret questions are out of scope.","https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills\u002Fblob\u002Fclaude\u002Fregistry-repo-7lRiv\u002Fresearch\u002Fpatent\u002Fskills\u002Fpatent\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":19},"01M7D98N2R7CA7RM00PNP4VV6C","notebooklm","Browser automation skill for controlling Google's NotebookLM. Handles reading and querying notebooks, adding sources (URLs, text, files, YouTube links, synthesized content), generating Studio outputs (Audio Overview, infographics, slide decks, study guides, briefing docs, mind maps, timelines, FAQs), and creating new notebooks. Triggers on any phrase involving NotebookLM — 'open NotebookLM', 'check my [name] notebook', 'pull info from NotebookLM', 'ask my notebook about X', 'add [source] to NotebookLM', 'create an infographic in NotebookLM', 'use NotebookLM Studio', 'generate a slide deck from my notebook', or any variation where the goal involves NotebookLM. Requires browser automation environment — fails gracefully when unavailable.","https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills\u002Fblob\u002Fclaude\u002Fregistry-repo-7lRiv\u002Fresearch\u002Fnotebooklm\u002Fskills\u002Fnotebooklm\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":19},"01M7D98B1SCTS4RAWZFCF9QJ5M","litreview","Academic literature orientation skill that searches papers via Consensus, builds a strategic search plan using PICO (default) or SPIDER \u002F Decomposition \u002F hybrid as fallbacks, and synthesizes findings into a professionally formatted Word document (.docx) research guide. Grill-me intake (research question specificity + framework hint + tentative depth) before the recon search; a second forcing checkpoint after Phase 2 confirms framework + sub-areas + depth before searches consume budget. Configurable depth (5\u002F10\u002F20 queries) controls coverage vs. speed. Output is a 'launching pad' — not a finished review, but an orientation guide that lets a researcher dive in confidently. Triggers: 'litreview on [topic]', 'literature review on [topic]', 'I'm starting a literature review on X', 'I'm writing a paper on X', 'help me research X', 'I'm doing research on X', 'can you help me research X'. Do NOT trigger for single one-off paper searches where the user just wants a quick list — that's a plain Consensus search.","https:\u002F\u002Fgithub.com\u002FMabbit143\u002FClaude-SKills\u002Fblob\u002Fclaude\u002Fregistry-repo-7lRiv\u002Fresearch\u002Flitreview\u002Fskills\u002Flitreview\u002FSKILL.md",[],[]]