[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6P7GC55S621RYHAXENG16RG":3,"skill-same:01M6P7GC55S621RYHAXENG16RG":74},{"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":14,"repositoryHtmlUrl":46,"repositoryHomepageUrl":6,"ownerHtmlUrl":47,"ownerBlogUrl":6,"ownerDescription":48,"updatedAt":49,"install":50,"resources":63},"01M6P7GC55S621RYHAXENG16RG","DB migrations and schema changes",null,"Workflows and commands for managing Alembic database migrations and schema changes in the letta-cloud core app, including using uv, just, LETTA_PG_URI, and switching between SQLite and Postgres.","sarthchawla\u002FSetupMyAI","sarthchawla","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F41484686?v=4","01M6P7D22NFMY9MA11Q2YGPKV2","Sarthak Chawla","01M6P7D26JJ9KW98SD1G8BB83R",0,"MIT","https:\u002F\u002Fgithub.com\u002Fsarthchawla\u002FSetupMyAI\u002Fblob\u002Fmain\u002Fpackages\u002Fdatabase\u002Fskills\u002FDB migrations and schema changes\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"changes","schema","db","migrations","db migrations","postgres","for","alembic","app","switching","commands","workflows","uv","database migrations","just","sqlite","cloud","database","core","2026-11-10 10:12:30",false,"---\nname: DB migrations and schema changes\ndescription: >-\n  Workflows and commands for managing Alembic database migrations and schema changes\n  in the letta-cloud core app, including using uv, just, LETTA_PG_URI, and\n  switching between SQLite and Postgres.\n---\n\n# DB migrations and schema changes (letta-cloud core)\n\nUse this skill whenever you need to change the database schema or debug Alembic\nmigrations in `apps\u002Fcore` of the letta-cloud repo.\n\nThis skill assumes:\n- Working directory: `apps\u002Fcore`\n- Migrations: Alembic in `apps\u002Fcore\u002Falembic`\n- Python runner: `uv`\n- Helper: `just ready` for environment + DB setup\n\n## Quick start\n\n1. Ensure environment is ready:\n   - `just ready`\n2. For Postgres migrations, set:\n   - `export LETTA_PG_URI=postgresql+pg8000:\u002F\u002Fpostgres:postgres@localhost:5432\u002Fletta-core`\n3. Make your ORM\u002Fschema change.\n4. Autogenerate migration:\n   - `uv run alembic revision --autogenerate -m \"\u003Cshort_message>\"`\n5. Apply migration:\n   - `uv run alembic upgrade head`\n\nSee `references\u002Fmigration-commands.md` for exact commands and variants.\n\n## Standard workflows\n\n### 1. Add or modify a column (ORM-first)\n\n1. Identify the ORM model and table.\n2. Update the SQLAlchemy model in `letta\u002Form\u002F...`:\n   - Prefer using mixins (e.g. `ProjectMixin`) when available instead of\n     duplicating columns.\n3. Run `just ready` if dependencies or environment may have changed.\n4. Ensure `LETTA_PG_URI` is set if you want the migration to target Postgres.\n5. Autogenerate Alembic revision with `uv`.\n6. Inspect the generated file under `alembic\u002Fversions\u002F`:\n   - Confirm `op.add_column` \u002F `op.alter_column` match expectations.\n7. Apply migrations with `uv run alembic upgrade head`.\n\nUse this pattern for changes like adding `project_id` columns via `ProjectMixin`.\n\n### 2. Data backfill \u002F one-off data migration\n\n1. Make sure the schema change (if any) is already represented in ORM + Alembic.\n2. Create a new Alembic revision **without** autogenerate (or edit an\n   autogen file) and add Python logic in `upgrade()` that:\n   - Uses `op.get_bind()` and SQLAlchemy Core\u002FSQL to backfill data.\n3. Keep `downgrade()` simple and safe (ideally reversible).\n4. Run against Postgres with `LETTA_PG_URI` set, using `uv run alembic upgrade head`.\n\n### 3. Fixing a bad migration\n\nTypical cases:\n- Migration fails only on SQLite (ALTER constraint limitations).\n- Migration was generated while pointing at SQLite instead of Postgres.\n\nWorkflow:\n1. Identify the failing revision in `alembic\u002Fversions\u002F`.\n2. If failure is SQLite-specific, prefer running migrations against Postgres by\n   exporting `LETTA_PG_URI` and re-running upgrade.\n3. If logic is wrong, create a **new** migration that fixes the problem rather\n   than editing an applied revision (especially in shared environments).\n4. For purely local\u002Fdev history, you can delete and regenerate migrations but\n   only if no one else depends on them.\n\nSee `references\u002Fsqlite-vs-postgres-gotchas.md` for SQLite-specific issues.\n\n### 4. Switching between SQLite and Postgres\n\nAlembic picks the engine based on `letta.settings.DatabaseChoice` and\nenvironment variables.\n\nGeneral rules:\n- For local dev stateful runs, `just ready` handles baseline migrations.\n- For schema design and production-like migrations, prefer Postgres and set\n  `LETTA_PG_URI`.\n\nWorkflow for Postgres-targeted migration:\n1. `export LETTA_PG_URI=postgresql+pg8000:\u002F\u002Fpostgres:postgres@localhost:5432\u002Fletta-core`\n2. From `apps\u002Fcore`:\n   - `uv run alembic upgrade head`\n   - `uv run alembic revision --autogenerate -m \"...\"`\n\n### 5. Resetting local Postgres for clean migration generation\n\nIf your local Postgres database has drifted from main (e.g., applied migrations\nthat no longer exist, or has stale schema), you can reset it to generate a clean\nmigration.\n\nFrom the repo root (`\u002FUsers\u002Fsarahwooders\u002Frepos\u002Fletta-cloud`):\n\n```bash\n# 1. Remove postgres data directory\nrm -rf .\u002Fdata\u002Fpostgres\n\n# 2. Stop the running postgres container\ndocker stop $(docker ps -q --filter ancestor=ankane\u002Fpgvector)\n\n# 3. Restart services (creates fresh postgres)\njust start-services\n\n# 4. Wait a moment for postgres to be ready, then apply all migrations\ncd apps\u002Fcore\nexport LETTA_PG_URI=postgresql+pg8000:\u002F\u002Fpostgres:postgres@localhost:5432\u002Fletta-core\nuv run alembic upgrade head\n\n# 5. Now generate your new migration\nuv run alembic revision --autogenerate -m \"your migration message\"\n```\n\nThis ensures the migration is generated against a clean database state matching\nmain, avoiding spurious diffs from local-only schema changes.\n\n## Troubleshooting\n\n- **\"Target database is not up to date\" when autogenerating**\n  - First run `uv run alembic upgrade head` (with appropriate engine\u002FURI).\n- **SQLite NotImplementedError about ALTER CONSTRAINT**\n  - Switch to Postgres by setting `LETTA_PG_URI` and rerun.\n- **Autogenerated migration missing expected changes**\n  - Ensure ORM imports and metadata (`Base.metadata`) are correct and that the\n    changed model is imported in Alembic env context.\n- **Autogenerated migration has unexpected drops\u002Frenames**\n  - Review model changes; consider explicit operations instead of relying on\n    autogenerate. Reset local Postgres (see workflow 5) to get a clean baseline.\n\n## References\n\n- `references\u002Fmigration-commands.md` — canonical commands for `uv`, Alembic,\n  and `just`.\n- `references\u002Fsqlite-vs-postgres-gotchas.md` — engine-specific pitfalls and\n  how to avoid them.\n","# DB migrations and schema changes (letta-cloud core)\n\nUse this skill whenever you need to change the database schema or debug Alembic\nmigrations in `apps\u002Fcore` of the letta-cloud repo.\n\nThis skill assumes:\n- Working directory: `apps\u002Fcore`\n- Migrations: Alembic in `apps\u002Fcore\u002Falembic`\n- Python runner: `uv`\n- Helper: `just ready` for environment + DB setup\n\n## Quick start\n\n1. Ensure environment is ready:\n   - `just ready`\n2. For Postgres migrations, set:\n   - `export LETTA_PG_URI=postgresql+pg8000:\u002F\u002Fpostgres:postgres@localhost:5432\u002Fletta-core`\n3. Make your ORM\u002Fschema change.\n4. Autogenerate migration:\n   - `uv run alembic revision --autogenerate -m \"\u003Cshort_message>\"`\n5. Apply migration:\n   - `uv run alembic upgrade head`\n\nSee `references\u002Fmigration-commands.md` for exact commands and variants.\n\n## Standard workflows\n\n### 1. Add or modify a column (ORM-first)\n\n1. Identify the ORM model and table.\n2. Update the SQLAlchemy model in `letta\u002Form\u002F...`:\n   - Prefer using mixins (e.g. `ProjectMixin`) when available instead of\n     duplicating columns.\n3. Run `just ready` if dependencies or environment may have changed.\n4. Ensure `LETTA_PG_URI` is set if you want the migration to target Postgres.\n5. Autogenerate Alembic revision with `uv`.\n6. Inspect the generated file under `alembic\u002Fversions\u002F`:\n   - Confirm `op.add_column` \u002F `op.alter_column` match expectations.\n7. Apply migrations with `uv run alembic upgrade head`.\n\nUse this pattern for changes like adding `project_id` columns via `ProjectMixin`.\n\n### 2. Data backfill \u002F one-off data migration\n\n1. Make sure the schema change (if any) is already represented in ORM + Alembic.\n2. Create a new Alembic revision **without** autogenerate (or edit an\n   autogen file) and add Python logic in `upgrade()` that:\n   - Uses `op.get_bind()` and SQLAlchemy Core\u002FSQL to backfill data.\n3. Keep `downgrade()` simple and safe (ideally reversible).\n4. Run against Postgres with `LETTA_PG_URI` set, using `uv run alembic upgrade head`.\n\n### 3. Fixing a bad migration\n\nTypical cases:\n- Migration fails only on SQLite (ALTER constraint limitations).\n- Migration was generated while pointing at SQLite instead of Postgres.\n\nWorkflow:\n1. Identify the failing revision in `alembic\u002Fversions\u002F`.\n2. If failure is SQLite-specific, prefer running migrations against Postgres by\n   exporting `LETTA_PG_URI` and re-running upgrade.\n3. If logic is wrong, create a **new** migration that fixes the problem rather\n   than editing an applied revision (especially in shared environments).\n4. For purely local\u002Fdev history, you can delete and regenerate migrations but\n   only if no one else depends on them.\n\nSee `references\u002Fsqlite-vs-postgres-gotchas.md` for SQLite-specific issues.\n\n### 4. Switching between SQLite and Postgres\n\nAlembic picks the engine based on `letta.settings.DatabaseChoice` and\nenvironment variables.\n\nGeneral rules:\n- For local dev stateful runs, `just ready` handles baseline migrations.\n- For schema design and production-like migrations, prefer Postgres and set\n  `LETTA_PG_URI`.\n\nWorkflow for Postgres-targeted migration:\n1. `export LETTA_PG_URI=postgresql+pg8000:\u002F\u002Fpostgres:postgres@localhost:5432\u002Fletta-core`\n2. From `apps\u002Fcore`:\n   - `uv run alembic upgrade head`\n   - `uv run alembic revision --autogenerate -m \"...\"`\n\n### 5. Resetting local Postgres for clean migration generation\n\nIf your local Postgres database has drifted from main (e.g., applied migrations\nthat no longer exist, or has stale schema), you can reset it to generate a clean\nmigration.\n\nFrom the repo root (`\u002FUsers\u002Fsarahwooders\u002Frepos\u002Fletta-cloud`):\n\n```bash\n# 1. Remove postgres data directory\nrm -rf .\u002Fdata\u002Fpostgres\n\n# 2. Stop the running postgres container\ndocker stop $(docker ps -q --filter ancestor=ankane\u002Fpgvector)\n\n# 3. Restart services (creates fresh postgres)\njust start-services\n\n# 4. Wait a moment for postgres to be ready, then apply all migrations\ncd apps\u002Fcore\nexport LETTA_PG_URI=postgresql+pg8000:\u002F\u002Fpostgres:postgres@localhost:5432\u002Fletta-core\nuv run alembic upgrade head\n\n# 5. Now generate your new migration\nuv run alembic revision --autogenerate -m \"your migration message\"\n```\n\nThis ensures the migration is generated against a clean database state matching\nmain, avoiding spurious diffs from local-only schema changes.\n\n## Troubleshooting\n\n- **\"Target database is not up to date\" when autogenerating**\n  - First run `uv run alembic upgrade head` (with appropriate engine\u002FURI).\n- **SQLite NotImplementedError about ALTER CONSTRAINT**\n  - Switch to Postgres by setting `LETTA_PG_URI` and rerun.\n- **Autogenerated migration missing expected changes**\n  - Ensure ORM imports and metadata (`Base.metadata`) are correct and that the\n    changed model is imported in Alembic env context.\n- **Autogenerated migration has unexpected drops\u002Frenames**\n  - Review model changes; consider explicit operations instead of relying on\n    autogenerate. Reset local Postgres (see workflow 5) to get a clean baseline.\n\n## References\n\n- `references\u002Fmigration-commands.md` — canonical commands for `uv`, Alembic,\n  and `just`.\n- `references\u002Fsqlite-vs-postgres-gotchas.md` — engine-specific pitfalls and\n  how to avoid them.\n",{"name":5,"description":7},"main","3934845b800ff514cb89eb81d43f3dc4cbf51ff2","packages\u002Fdatabase\u002Fskills\u002FDB migrations and schema changes","https:\u002F\u002Fgithub.com\u002Fsarthchawla\u002FSetupMyAI","https:\u002F\u002Fgithub.com\u002Fsarthchawla","there ain't no problem i can't solve","2026-10-23 01:26:57",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add sarthchawla\u002FSetupMyAI --skill \"DB migrations and schema changes\"",{"tool":56,"command":57},"bunx","bunx skills add sarthchawla\u002FSetupMyAI --skill \"DB migrations and schema changes\"",{"tool":59,"command":60},"pnpm","pnpm dlx skills add sarthchawla\u002FSetupMyAI --skill \"DB migrations and schema changes\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsarthchawla\u002FSetupMyAI\u002Fblob\u002Fmain\u002Fpackages\u002Fdatabase\u002Fskills\u002FDB migrations and schema changes\u002FSKILL.md",true,[64,70],{"path":65,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":68,"sourceHtmlUrl":69},"references\u002Fmigration-commands.md","REFERENCE","参考文档",1487,"https:\u002F\u002Fgithub.com\u002Fsarthchawla\u002FSetupMyAI\u002Fblob\u002Fmain\u002Fpackages\u002Fdatabase\u002Fskills\u002FDB migrations and schema changes\u002Freferences\u002Fmigration-commands.md",{"path":71,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002Fsqlite-vs-postgres-gotchas.md",1345,"https:\u002F\u002Fgithub.com\u002Fsarthchawla\u002FSetupMyAI\u002Fblob\u002Fmain\u002Fpackages\u002Fdatabase\u002Fskills\u002FDB migrations and schema changes\u002Freferences\u002Fsqlite-vs-postgres-gotchas.md",[75,88,104,113,123,144],{"skillNo":76,"name":77,"nameZh":6,"description":6,"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":85,"publishedAt":38},"01M6P8953HNC422WFQSPP2FMQE","sample-skill","https:\u002F\u002Fgithub.com\u002Fsarthchawla\u002FSetupMyAI\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fmock-repo\u002F.claude\u002Fskills\u002Fsample-skill\u002FSKILL.md",[80],{"categoryNo":81,"categoryName":82,"taxonomyType":83,"taxonomyTypeDesc":84},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[86,87],"sample","sample skill",{"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":38},"01M6P8924ZSDAZ88Y5Q9P3KAQV","synthetic-review-candidate","Candidate for smoke testing an evaluation runner only.","https:\u002F\u002Fgithub.com\u002Fsarthchawla\u002FSetupMyAI\u002Fblob\u002Fmain\u002Fscripts\u002Fskill-eval\u002Ffixtures\u002Fcandidate\u002FSKILL.md",[],[95,96,97,98,99,100,101,102,103,25],"synthetic review candidate","candidate","synthetic","review","only","testing","Evaluation","smoke","runner",{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":38},"01M6P88FEGGNH8EZY0PDHD9KQA","synthetic-review-baseline","Baseline for smoke testing an evaluation runner only.","https:\u002F\u002Fgithub.com\u002Fsarthchawla\u002FSetupMyAI\u002Fblob\u002Fmain\u002Fscripts\u002Fskill-eval\u002Ffixtures\u002Fbaseline\u002FSKILL.md",[],[111,97,112,98,102,103,25,99,100,101],"synthetic review baseline","baseline",{"skillNo":114,"name":98,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":38},"01M6P87ZXVEHRM860960DB5FEQ","Run the existing user-invoked review bundle and independently adjudicate its findings.","https:\u002F\u002Fgithub.com\u002Fsarthchawla\u002FSetupMyAI\u002Fblob\u002Fmain\u002Fpackages\u002Funiversal\u002Fskills\u002Freview\u002FSKILL.md",[],[98,119,120,121,122],"run","user","bundle","Existing",{"skillNo":124,"name":125,"nameZh":6,"description":126,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":127,"categories":128,"keywords":129,"publishedAt":38},"01M6P87FC73MZTRB6ZBP4GR1VQ","review-adjudication","Verify generated or human review findings before fixing, defending, replying, resolving, or reusing them as learned guidance. Use within a review, review-comment fix, monitor, or readiness workflow.","https:\u002F\u002Fgithub.com\u002Fsarthchawla\u002FSetupMyAI\u002Fblob\u002Fmain\u002Fpackages\u002Funiversal\u002Fskills\u002Freview-adjudication\u002FSKILL.md",[],[130,98,131,132,133,134,135,136,137,138,139,140,141,142,143],"review adjudication","workflow","generated","human review","guidance","human","as","readiness","learned","review findings","fix","use","verify","monitor",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":38},"01M6P871Q44KQES293T60JQETA","monitor-mr","Monitor review findings and CI using the shared adjudication procedure.","https:\u002F\u002Fgithub.com\u002Fsarthchawla\u002FSetupMyAI\u002Fblob\u002Fmain\u002Fpackages\u002Funiversal\u002Fskills\u002Fmonitor-mr\u002FSKILL.md",[],[143,151,152,139,153,154,98],"mr","monitor mr","shared","ci"]