[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DVGGG6HND5KZFTSVAG9ZHW":3,"skill-same:01M7DVGGG6HND5KZFTSVAG9ZHW":47},{"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":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":29,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M7DVGGG6HND5KZFTSVAG9ZHW","use-database",null,"Load before designing an app's data. What DefraDB does for you, and how to shape collections.","gents-ai\u002Fgents","gents-ai","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F309907012?v=4","01M6PDDJQ5NPFJZNQ0M1QA5SNP","Gents","01M6PDDJVT921WYQS6G1PATX85",24,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fgents-ai\u002Fgents\u002Fblob\u002Fmain\u002Fcore-packs\u002Fpack_builder\u002Fskills\u002Fuse_database\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: use-database\ndescription: Load before designing an app's data. What DefraDB does for you, and how to shape collections.\n---\n\n# Use the database\n\nDefraDB is what you build apps from. Reach for it before writing code. Most apps are collections, datastore tools and a page, with a plugin where rules must be exact.\n\n## What it does for you\n\n| You need | Use | `schema` help topic |\n| --- | --- | --- |\n| Find by key, no duplicates | Indexes, unique indexes | `indexes` |\n| Linked records | Relationships | `relationships` |\n| Search text | `@fulltext`, then `query search` | `indexes fulltext` |\n| Find similar things | Embeddings and a vector index | `embeddings`, `indexes vector` |\n| Computed results | Views | `views` |\n| Rollups of time series | Downsampling | `collections downsample` |\n| Defaults and validation | Field defaults and constraints | `fields defaults`, `fields constraints` |\n| Values many writers change | Merge rules | `fields crdt` |\n| Values that never change | `@immutable` | `fields immutable` |\n| A record of every change | `@branchable` | `collections branchable` |\n| Who can see what | `@policy` | `collections policy` |\n\nA page's `useQuery` refreshes when documents change, so live pages need no extra work. A new document can start work through an event source (`automate`). Selected collections can sync to another node.\n\n## Shape each collection\n\nWhile you build you can empty or remove a collection (`schema` help `collections`), so try a shape with real documents and change it if it reads badly. Settle it before others depend on it.\n\n- **A copy of something external** (a ticket): one document per thing, keyed by its external ID.\n- **Something that happened** (a move, a payment): append-only. Derive current state from the log.\n- **A setting one writer owns**: one document, updated in place.\n\nIf two writers can change one value and it isn't a merge-rule field, use a log. Concurrent updates to one field merge, and one is lost.\n\nUse a stable key with a unique index, so a repeated write is harmless.\n\n## Design for readers\n\nList every reader first: each page section, trigger and agent.\n\n- Index what you filter or sort on.\n- A trigger's filter sees only the document that fired it. If one consumer should react, put the field that names it on the document.\n- An agent's prompt is rendered from the firing document, so put the state it needs there.\n- Queries return bounded pages. Plan for real row counts.\n\nDerive what can be computed on read: an age, a count, an overdue flag. Store times as UTC `DateTime`. `@branchable` can't be changed later.\n\n## Check it\n\nWrite two or three realistic documents, read them back with your page's query, and confirm filters and sort order.\n\nNext: `connect-data` if the data comes from outside, otherwise `design-page`.\n","# Use the database\n\nDefraDB is what you build apps from. Reach for it before writing code. Most apps are collections, datastore tools and a page, with a plugin where rules must be exact.\n\n## What it does for you\n\n| You need | Use | `schema` help topic |\n| --- | --- | --- |\n| Find by key, no duplicates | Indexes, unique indexes | `indexes` |\n| Linked records | Relationships | `relationships` |\n| Search text | `@fulltext`, then `query search` | `indexes fulltext` |\n| Find similar things | Embeddings and a vector index | `embeddings`, `indexes vector` |\n| Computed results | Views | `views` |\n| Rollups of time series | Downsampling | `collections downsample` |\n| Defaults and validation | Field defaults and constraints | `fields defaults`, `fields constraints` |\n| Values many writers change | Merge rules | `fields crdt` |\n| Values that never change | `@immutable` | `fields immutable` |\n| A record of every change | `@branchable` | `collections branchable` |\n| Who can see what | `@policy` | `collections policy` |\n\nA page's `useQuery` refreshes when documents change, so live pages need no extra work. A new document can start work through an event source (`automate`). Selected collections can sync to another node.\n\n## Shape each collection\n\nWhile you build you can empty or remove a collection (`schema` help `collections`), so try a shape with real documents and change it if it reads badly. Settle it before others depend on it.\n\n- **A copy of something external** (a ticket): one document per thing, keyed by its external ID.\n- **Something that happened** (a move, a payment): append-only. Derive current state from the log.\n- **A setting one writer owns**: one document, updated in place.\n\nIf two writers can change one value and it isn't a merge-rule field, use a log. Concurrent updates to one field merge, and one is lost.\n\nUse a stable key with a unique index, so a repeated write is harmless.\n\n## Design for readers\n\nList every reader first: each page section, trigger and agent.\n\n- Index what you filter or sort on.\n- A trigger's filter sees only the document that fired it. If one consumer should react, put the field that names it on the document.\n- An agent's prompt is rendered from the firing document, so put the state it needs there.\n- Queries return bounded pages. Plan for real row counts.\n\nDerive what can be computed on read: an age, a count, an overdue flag. Store times as UTC `DateTime`. `@branchable` can't be changed later.\n\n## Check it\n\nWrite two or three realistic documents, read them back with your page's query, and confirm filters and sort order.\n\nNext: `connect-data` if the data comes from outside, otherwise `design-page`.\n",{"name":5,"description":7},"main","e97b49597dea9307045c05031612a0e839d310d4","core-packs\u002Fpack_builder\u002Fskills\u002Fuse_database",4,"https:\u002F\u002Fgithub.com\u002Fgents-ai\u002Fgents","https:\u002F\u002Fgents.xyz","https:\u002F\u002Fgithub.com\u002Fgents-ai","Multiplayer coding harness","2026-11-15 04:03:00",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add gents-ai\u002Fgents --skill use-database",{"tool":39,"command":40},"bunx","bunx skills add gents-ai\u002Fgents --skill use-database",{"tool":42,"command":43},"pnpm","pnpm dlx skills add gents-ai\u002Fgents --skill use-database","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgents-ai\u002Fgents\u002Fblob\u002Fmain\u002Fcore-packs\u002Fpack_builder\u002Fskills\u002Fuse_database\u002FSKILL.md",true,[],[48,54,61,68,75,81],{"skillNo":49,"name":50,"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":51,"categories":52,"keywords":53,"publishedAt":19},"01M7DVGK026T5C33HDQSGP6FH2","write_plugin","https:\u002F\u002Fgithub.com\u002Fgents-ai\u002Fgents\u002Fblob\u002Fmain\u002Fcore-packs\u002Fpack_builder\u002Fskills\u002Fwrite_plugin\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M7DVGCK7XV1X9DEKV9J0RW9M","plan-work","Load first when asked to build or automate an app for people. Sets the checks and build order.","https:\u002F\u002Fgithub.com\u002Fgents-ai\u002Fgents\u002Fblob\u002Fmain\u002Fcore-packs\u002Fpack_builder\u002Fskills\u002Fplan_work\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M7DVG8J4AD445M9W5HC6RAAZ","package-pack","Load when a working app should become a pack, or when installing or changing a pack. Export, check, install, versions.","https:\u002F\u002Fgithub.com\u002Fgents-ai\u002Fgents\u002Fblob\u002Fmain\u002Fcore-packs\u002Fpack_builder\u002Fskills\u002Fpackage_pack\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M7DVG4FVTG16WMGSSWB22JV5","diagnose-node","Load when a trigger, tool, request or session didn't work as expected. Gives the order of checks.","https:\u002F\u002Fgithub.com\u002Fgents-ai\u002Fgents\u002Fblob\u002Fmain\u002Fcore-packs\u002Fpack_builder\u002Fskills\u002Fdiagnose_node\u002FSKILL.md",[],[],{"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":80,"publishedAt":19},"01M7DVG0V28534JV1GH1P3PCQQ","design_page","https:\u002F\u002Fgithub.com\u002Fgents-ai\u002Fgents\u002Fblob\u002Fmain\u002Fcore-packs\u002Fpack_builder\u002Fskills\u002Fdesign_page\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},"01M7DVFWVT55GMG2KVF96ADQGZ","delegate-work","Load before a long build, or when parts of a job can run on their own. When and how to use helpers.","https:\u002F\u002Fgithub.com\u002Fgents-ai\u002Fgents\u002Fblob\u002Fmain\u002Fcore-packs\u002Fpack_builder\u002Fskills\u002Fdelegate_work\u002FSKILL.md",[],[]]