[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6CS366KQ9KT9ETMJ7T6E3QG":3,"skill-same:01M6CS366KQ9KT9ETMJ7T6E3QG":80},{"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":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":43,"commitSha":44,"skillDirectory":45,"forksCount":46,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":49,"ownerDescription":50,"updatedAt":51,"install":52,"resources":65},"01M6CS366KQ9KT9ETMJ7T6E3QG","db-migrations",null,"SQLite migration rules for the Ghost codebase. MUST READ before writing or modifying any file in migrations\u002F. Covers: table recreation patterns, column ordering, CHECK constraint changes, NOT NULL safety, and the validation checklist. A faulty migration that ships breaks the production daemon on startup with no recovery path short of manual DB surgery — these rules are non-negotiable.","mrtolkien\u002FGHOST","mrtolkien","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F8489650?v=4","01M6CS32Q934XBQQE8BDV5Z6W2","Tolki","01M6CS32VBCD47F5E27WF9W6FC",5,"MIT","https:\u002F\u002Fgithub.com\u002Fmrtolkien\u002FGHOST\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fdb-migrations\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"db migrations","migrations","table","patterns","checklist","migration","read","short","check","Rules","writing","ghost","sqlite","recovery","Safety","Production","startup","file","validation","2026-11-10 10:12:30",false,"---\nname: db-migrations\ndescription: >-\n  SQLite migration rules for the Ghost codebase. MUST READ before writing or modifying\n  any file in migrations\u002F. Covers: table recreation patterns, column ordering, CHECK\n  constraint changes, NOT NULL safety, and the validation checklist. A faulty migration\n  that ships breaks the production daemon on startup with no recovery path short of\n  manual DB surgery — these rules are non-negotiable.\n---\n\n# SQLite Migration Rules\n\nGhost uses sqlx migrations (`migrations\u002F*.sql`). Migrations run automatically on daemon\nboot. **A broken migration kills the daemon** — the GHOST instance goes down and stays\ndown until someone manually intervenes on the database. There is no rollback mechanism.\nEvery migration must be correct on the first attempt.\n\n## Immutability Rule (NON-NEGOTIABLE)\n\n**Treat existing migrations as immutable. Never edit an old migration.**\n\nThe only exception is the **latest** migration file, and only when it has **not been\npushed yet**. If the migration has been pushed, merged, or might already have been\napplied in any workspace, do not edit it. Add a new corrective migration instead.\n\nPractical rule:\n\n- Safe to edit: the newest migration you just created locally and have not pushed.\n- Not safe to edit: any earlier migration, or the newest migration after push\u002Fmerge.\n\nIf you are fixing a bug in a migration that has already left your machine, the fix\nbelongs in a new migration, not by rewriting history.\n\n## Naming\n\nFiles: `NNN_short_description.sql` (zero-padded sequence number). Add a comment at the\ntop explaining _why_ the migration exists.\n\n## Table Recreation (CHECK \u002F constraint changes)\n\nSQLite does not support `ALTER TABLE ... ALTER CONSTRAINT`. To change a CHECK\nconstraint, column type, or other table-level constraint, you must recreate the table:\n\n```sql\nCREATE TABLE foo_new ( ... );\nINSERT INTO foo_new (...columns...) SELECT ...columns... FROM foo;\nDROP TABLE foo;\nALTER TABLE foo_new RENAME TO foo;\n```\n\n### Column Ordering (NON-NEGOTIABLE)\n\n**NEVER use `SELECT *` when copying data between tables.** `SELECT *` returns columns in\nthe _source_ table's physical order, which may not match the new table if columns were\nadded by previous `ALTER TABLE ADD COLUMN` statements (which always append to the end).\n\nAlways explicitly list every column in both the INSERT target and the SELECT source:\n\n```sql\n-- WRONG: column order mismatch silently corrupts data or violates constraints\nINSERT INTO foo_new SELECT * FROM foo;\n\n-- CORRECT: explicit columns, order doesn't matter because names are mapped\nINSERT INTO foo_new (id, name, config, created_at, updated_at)\nSELECT id, name, config, created_at, updated_at\nFROM foo;\n```\n\nThis is the rule that prevents the class of bug where a nullable column's NULL value\nlands in a NOT NULL column due to position mismatch, crashing the daemon on startup.\n\n### Default Values for New NOT NULL Columns\n\nWhen adding a NOT NULL column that didn't exist in the old table, provide a default in\nthe SELECT:\n\n```sql\nINSERT INTO foo_new (id, name, new_status, created_at)\nSELECT id, name, 'active', created_at\nFROM foo;\n```\n\n## ALTER TABLE ADD COLUMN\n\nSafe for adding nullable columns or columns with defaults. Remember that `ADD COLUMN`\nalways appends to the end of the physical column order — this is why explicit column\nlists matter in future table recreations.\n\n## Connection Locking\n\nMigrations run on a **dedicated single connection** before the pool is opened\n(`src\u002Fdb\u002Fconnection.rs`). This is intentional — SQLite DDL (`CREATE TABLE`,\n`DROP TABLE`) requires an exclusive lock. If migrations ran through the pool, other pool\nconnections holding read locks would cause `SQLITE_LOCKED` (code 6) errors on any DDL\nmigration.\n\n**Do not change this.** If you see migrations running through a pool, that's a bug.\n\n## Validation Checklist\n\nBefore committing any migration:\n\n1. **Column list**: Every `INSERT INTO ... SELECT` uses explicit column names on both\n   sides. No `SELECT *`.\n2. **NOT NULL safety**: Every NOT NULL column in the target has a matching non-null\n   source column or an explicit default value.\n3. **Constraint coverage**: CHECK constraints, UNIQUE constraints, and foreign keys in\n   the new table are compatible with existing data.\n4. **Index recreation**: If you DROP a table, its indexes are dropped too. Recreate any\n   needed indexes after the RENAME.\n5. **FTS\u002Ftrigger rebuild**: If the table has FTS triggers, they reference the table by\n   name. After RENAME, verify triggers still point to the right table.\n6. **Test locally**: Run the migration against a copy of the production database before\n   shipping. `cp ghost.db ghost_test.db` and run against the copy.\n","# SQLite Migration Rules\n\nGhost uses sqlx migrations (`migrations\u002F*.sql`). Migrations run automatically on daemon\nboot. **A broken migration kills the daemon** — the GHOST instance goes down and stays\ndown until someone manually intervenes on the database. There is no rollback mechanism.\nEvery migration must be correct on the first attempt.\n\n## Immutability Rule (NON-NEGOTIABLE)\n\n**Treat existing migrations as immutable. Never edit an old migration.**\n\nThe only exception is the **latest** migration file, and only when it has **not been\npushed yet**. If the migration has been pushed, merged, or might already have been\napplied in any workspace, do not edit it. Add a new corrective migration instead.\n\nPractical rule:\n\n- Safe to edit: the newest migration you just created locally and have not pushed.\n- Not safe to edit: any earlier migration, or the newest migration after push\u002Fmerge.\n\nIf you are fixing a bug in a migration that has already left your machine, the fix\nbelongs in a new migration, not by rewriting history.\n\n## Naming\n\nFiles: `NNN_short_description.sql` (zero-padded sequence number). Add a comment at the\ntop explaining _why_ the migration exists.\n\n## Table Recreation (CHECK \u002F constraint changes)\n\nSQLite does not support `ALTER TABLE ... ALTER CONSTRAINT`. To change a CHECK\nconstraint, column type, or other table-level constraint, you must recreate the table:\n\n```sql\nCREATE TABLE foo_new ( ... );\nINSERT INTO foo_new (...columns...) SELECT ...columns... FROM foo;\nDROP TABLE foo;\nALTER TABLE foo_new RENAME TO foo;\n```\n\n### Column Ordering (NON-NEGOTIABLE)\n\n**NEVER use `SELECT *` when copying data between tables.** `SELECT *` returns columns in\nthe _source_ table's physical order, which may not match the new table if columns were\nadded by previous `ALTER TABLE ADD COLUMN` statements (which always append to the end).\n\nAlways explicitly list every column in both the INSERT target and the SELECT source:\n\n```sql\n-- WRONG: column order mismatch silently corrupts data or violates constraints\nINSERT INTO foo_new SELECT * FROM foo;\n\n-- CORRECT: explicit columns, order doesn't matter because names are mapped\nINSERT INTO foo_new (id, name, config, created_at, updated_at)\nSELECT id, name, config, created_at, updated_at\nFROM foo;\n```\n\nThis is the rule that prevents the class of bug where a nullable column's NULL value\nlands in a NOT NULL column due to position mismatch, crashing the daemon on startup.\n\n### Default Values for New NOT NULL Columns\n\nWhen adding a NOT NULL column that didn't exist in the old table, provide a default in\nthe SELECT:\n\n```sql\nINSERT INTO foo_new (id, name, new_status, created_at)\nSELECT id, name, 'active', created_at\nFROM foo;\n```\n\n## ALTER TABLE ADD COLUMN\n\nSafe for adding nullable columns or columns with defaults. Remember that `ADD COLUMN`\nalways appends to the end of the physical column order — this is why explicit column\nlists matter in future table recreations.\n\n## Connection Locking\n\nMigrations run on a **dedicated single connection** before the pool is opened\n(`src\u002Fdb\u002Fconnection.rs`). This is intentional — SQLite DDL (`CREATE TABLE`,\n`DROP TABLE`) requires an exclusive lock. If migrations ran through the pool, other pool\nconnections holding read locks would cause `SQLITE_LOCKED` (code 6) errors on any DDL\nmigration.\n\n**Do not change this.** If you see migrations running through a pool, that's a bug.\n\n## Validation Checklist\n\nBefore committing any migration:\n\n1. **Column list**: Every `INSERT INTO ... SELECT` uses explicit column names on both\n   sides. No `SELECT *`.\n2. **NOT NULL safety**: Every NOT NULL column in the target has a matching non-null\n   source column or an explicit default value.\n3. **Constraint coverage**: CHECK constraints, UNIQUE constraints, and foreign keys in\n   the new table are compatible with existing data.\n4. **Index recreation**: If you DROP a table, its indexes are dropped too. Recreate any\n   needed indexes after the RENAME.\n5. **FTS\u002Ftrigger rebuild**: If the table has FTS triggers, they reference the table by\n   name. After RENAME, verify triggers still point to the right table.\n6. **Test locally**: Run the migration against a copy of the production database before\n   shipping. `cp ghost.db ghost_test.db` and run against the copy.\n",{"name":5,"description":7},"main","083d96429a2d05526f8a294b83c74f0336670def",".agents\u002Fskills\u002Fdb-migrations",0,"https:\u002F\u002Fgithub.com\u002Fmrtolkien\u002FGHOST","https:\u002F\u002Fgithub.com\u002Fmrtolkien","https:\u002F\u002Fblog.tolki.dev","Data Engineer \u002F Esports \u002F Keyboards","2026-04-24 15:41:08",{"source":8,"skillName":5,"commands":53,"prompt":63,"zipAvailable":64},[54,57,60],{"tool":55,"command":56},"npx","npx skills add mrtolkien\u002FGHOST --skill db-migrations",{"tool":58,"command":59},"bunx","bunx skills add mrtolkien\u002FGHOST --skill db-migrations",{"tool":61,"command":62},"pnpm","pnpm dlx skills add mrtolkien\u002FGHOST --skill db-migrations","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmrtolkien\u002FGHOST\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fdb-migrations\u002FSKILL.md",true,[66,72,76],{"path":67,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":71},"evals\u002Fdomain-truth.json","REFERENCE","参考文档",1616,"https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Fdcf-modeling\u002Fevals\u002Fdomain-truth.json",{"path":73,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":74,"sourceHtmlUrl":75},"evals\u002Fevals.json",996,"https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Fdcf-modeling\u002Fevals\u002Fevals.json",{"path":77,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":78,"sourceHtmlUrl":79},"evals\u002Ftriggers.json",2442,"https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Fdcf-modeling\u002Fevals\u002Ftriggers.json",[81,107,132,150,159,170],{"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":38},"01M6CS613RWD9CFJ3KFX47V1DS","system-management","Use when reading or changing GHOST configuration (providers, models, timing, compaction, services, any config.toml key), adding or switching LLM providers, answering questions about GHOST's own features or capabilities, a CLI tool is missing or \"not found\", services need starting\u002Fstopping\u002Fdebugging, updating GHOST to a newer version, managing the Nix shell environment, or troubleshooting GHOST setup.","https:\u002F\u002Fgithub.com\u002Fmrtolkien\u002FGHOST\u002Fblob\u002Fmain\u002Fassets\u002Fskills\u002Fsystem-management\u002Fskill.md",[],[88,89,90,91,92,93,94,95,96,97,98,99,30,100,101,102,103,104,105,106],"system management","management","system","shell","cli","nix","config","setup","debugging","capabilities","services","Providers","tool","troubleshooting","environment","use","version","models","configuration",{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":126,"publishedAt":38},"01M6CS5XTK2884R9HE15YR8YZM","writing-skills","Use when creating new skills, editing existing skills, or verifying skills work before deployment","https:\u002F\u002Fgithub.com\u002Fmrtolkien\u002FGHOST\u002Fblob\u002Fmain\u002Fassets\u002Fskills\u002Fsuperpowers\u002Fwriting-skills\u002Fskill.md",[113,118,121],{"categoryNo":114,"categoryName":115,"taxonomyType":116,"taxonomyTypeDesc":117},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",{"categoryNo":119,"categoryName":120,"taxonomyType":116,"taxonomyTypeDesc":117},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":122,"categoryName":123,"taxonomyType":124,"taxonomyTypeDesc":125},"01JBSEEDCAT000000000000036","内容创作者","PROFESSION","适用职业",[127,29,128,129,130,103,131],"writing skills","coding","work","editing","deployment",{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":140,"publishedAt":38},"01M6CS5V737R1DVB3TZEK0C6WT","writing-plans","Use when you have a spec or requirements for a multi-step task, before touching code. Write comprehensive implementation plans assuming the engineer has zero context for our codebase and questionable taste.","https:\u002F\u002Fgithub.com\u002Fmrtolkien\u002FGHOST\u002Fblob\u002Fmain\u002Fassets\u002Fskills\u002Fsuperpowers\u002Fwriting-plans\u002Fskill.md",[138,139],{"categoryNo":119,"categoryName":120,"taxonomyType":116,"taxonomyTypeDesc":117},{"categoryNo":122,"categoryName":123,"taxonomyType":124,"taxonomyTypeDesc":125},[141,29,142,143,144,128,145,146,103,147,148,149],"writing plans","spec","code","ZeRO","write","context","engineer","implementation","task",{"skillNo":151,"name":152,"nameZh":6,"description":153,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":154,"categories":155,"keywords":156,"publishedAt":38},"01M6CS5S5S0YY56686G5CQ0WMP","verification","Use when about to claim work is complete, fixed, or passing, before committing or creating PRs. Requires running verification commands and confirming output before making any success claims. Evidence before assertions, always.","https:\u002F\u002Fgithub.com\u002Fmrtolkien\u002FGHOST\u002Fblob\u002Fmain\u002Fassets\u002Fskills\u002Fsuperpowers\u002Fverification\u002Fskill.md",[],[152,128,129,103,157,158],"evidence","claim",{"skillNo":160,"name":161,"nameZh":6,"description":162,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":163,"categories":164,"keywords":166,"publishedAt":38},"01M6CS5PD2ZSFWYRDZSACNTAJY","tdd","Use when implementing any feature or bugfix, before writing implementation code. Write the test first. Watch it fail. Write minimal code to pass.","https:\u002F\u002Fgithub.com\u002Fmrtolkien\u002FGHOST\u002Fblob\u002Fmain\u002Fassets\u002Fskills\u002Fsuperpowers\u002Ftdd\u002Fskill.md",[165],{"categoryNo":114,"categoryName":115,"taxonomyType":116,"taxonomyTypeDesc":117},[161,29,143,167,128,145,103,168,148,169],"first","minimal","test",{"skillNo":171,"name":172,"nameZh":6,"description":173,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":174,"categories":175,"keywords":177,"publishedAt":38},"01M6CS5K5WE2SHF1YV8D9C4C77","systematic-debugging","Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes","https:\u002F\u002Fgithub.com\u002Fmrtolkien\u002FGHOST\u002Fblob\u002Fmain\u002Fassets\u002Fskills\u002Fsuperpowers\u002Fsystematic-debugging\u002Fskill.md",[176],{"categoryNo":114,"categoryName":115,"taxonomyType":116,"taxonomyTypeDesc":117},[178,96,179,103,128,169,180],"systematic debugging","behavior","bug"]