[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DVGK026T5C33HDQSGP6FH2":3,"skill-same:01M7DVGK026T5C33HDQSGP6FH2":46},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":28,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7DVGK026T5C33HDQSGP6FH2","write_plugin",null,"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\u002Fwrite_plugin\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: write-plugin\ndescription: Load when logic must be exact: rules, calculations, validation, anything replayable. Contract, data, tests.\n---\n\n# Write a plugin\n\nA plugin is code the node runs sealed: the same input always gives the same answer, so agents and pages can trust it. Use one wherever a rule must hold no matter who calls it.\n\nBuild it live with `config`: `plugin build NAME` takes the source, its data declaration and test cases, compiles and tests them, and installs `node\u002FNAME` (`help plugin`, `help plugin-source`). No file is needed. JavaScript is the shortest path: `module.exports = (input) => ({ ok: true })`. Keep it pure: input in, answer out. Take randomness from a seed in the input, so results can be replayed.\n\n## Contract\n\nOne JSON value in, one out. An error the caller can act on is a normal output, such as `{ \"ok\": false, \"refusal\": { \"code\": \"...\", \"message\": \"...\" } }`.\n\n## Reading documents\n\nDeclare access in the source document's `data` field. Without it, the plugin has no data access:\n\n```json\n\"data\": { \"collections\": [\"GameEvent\"], \"ops\": [\"query\", \"insert\"], \"stamped\": {} }\n```\n\nTo read, return this; a bare array is refused:\n\n```json\n{ \"data_calls\": { \"requests\": [ { \"id\": \"log\", \"query\": { \"collection\": \"GameEvent\", \"filter\": { \"game_id\": { \"_eq\": \"g1\" } }, \"order\": { \"seq\": \"ASC\" }, \"limit\": 256, \"fields\": [\"seq\", \"kind\"] } } ] } }\n```\n The host runs the requests and calls the plugin again with the original input. Results arrive at `input.data_results.\u003Crequest id>.result.rows`. A query returns at most 256 rows, so page with `offset`. A call takes at most 64 rounds.\n\n## Writing documents\n\nPut `writes` on the final output: `\"writes\": [ { \"op\": \"insert\", \"collection\": \"GameEvent\", \"fields\": { \"seq\": 12 } } ]`. At most 100 per call, committed together. The plugin's rules decide what enters the log.\n\n## Test before you install\n\n- Give `plugin build` one test case per rule as `input` and `expect` pairs, including the refusals that must happen. A failing case installs nothing and names the case.\n- Try the installed plugin with `plugin run` and a real input.\n- To give an agent the tool, select it in that agent's Tools. A rebuild changes the digest, so update the selection after it.\n- If you can't run the tests, report the plugin as not tested.\n\nThen return to `plan-work`.\n","# Write a plugin\n\nA plugin is code the node runs sealed: the same input always gives the same answer, so agents and pages can trust it. Use one wherever a rule must hold no matter who calls it.\n\nBuild it live with `config`: `plugin build NAME` takes the source, its data declaration and test cases, compiles and tests them, and installs `node\u002FNAME` (`help plugin`, `help plugin-source`). No file is needed. JavaScript is the shortest path: `module.exports = (input) => ({ ok: true })`. Keep it pure: input in, answer out. Take randomness from a seed in the input, so results can be replayed.\n\n## Contract\n\nOne JSON value in, one out. An error the caller can act on is a normal output, such as `{ \"ok\": false, \"refusal\": { \"code\": \"...\", \"message\": \"...\" } }`.\n\n## Reading documents\n\nDeclare access in the source document's `data` field. Without it, the plugin has no data access:\n\n```json\n\"data\": { \"collections\": [\"GameEvent\"], \"ops\": [\"query\", \"insert\"], \"stamped\": {} }\n```\n\nTo read, return this; a bare array is refused:\n\n```json\n{ \"data_calls\": { \"requests\": [ { \"id\": \"log\", \"query\": { \"collection\": \"GameEvent\", \"filter\": { \"game_id\": { \"_eq\": \"g1\" } }, \"order\": { \"seq\": \"ASC\" }, \"limit\": 256, \"fields\": [\"seq\", \"kind\"] } } ] } }\n```\n The host runs the requests and calls the plugin again with the original input. Results arrive at `input.data_results.\u003Crequest id>.result.rows`. A query returns at most 256 rows, so page with `offset`. A call takes at most 64 rounds.\n\n## Writing documents\n\nPut `writes` on the final output: `\"writes\": [ { \"op\": \"insert\", \"collection\": \"GameEvent\", \"fields\": { \"seq\": 12 } } ]`. At most 100 per call, committed together. The plugin's rules decide what enters the log.\n\n## Test before you install\n\n- Give `plugin build` one test case per rule as `input` and `expect` pairs, including the refusals that must happen. A failing case installs nothing and names the case.\n- Try the installed plugin with `plugin run` and a real input.\n- To give an agent the tool, select it in that agent's Tools. A rebuild changes the digest, so update the selection after it.\n- If you can't run the tests, report the plugin as not tested.\n\nThen return to `plan-work`.\n",{},"main","e97b49597dea9307045c05031612a0e839d310d4","core-packs\u002Fpack_builder\u002Fskills\u002Fwrite_plugin",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":7,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add gents-ai\u002Fgents --skill write_plugin",{"tool":38,"command":39},"bunx","bunx skills add gents-ai\u002Fgents --skill write_plugin",{"tool":41,"command":42},"pnpm","pnpm dlx skills add gents-ai\u002Fgents --skill write_plugin","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgents-ai\u002Fgents\u002Fblob\u002Fmain\u002Fcore-packs\u002Fpack_builder\u002Fskills\u002Fwrite_plugin\u002FSKILL.md",true,[],[47,54,61,68,75,81],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":18},"01M7DVGGG6HND5KZFTSVAG9ZHW","use-database","Load before designing an app's data. What DefraDB does for you, and how to shape collections.","https:\u002F\u002Fgithub.com\u002Fgents-ai\u002Fgents\u002Fblob\u002Fmain\u002Fcore-packs\u002Fpack_builder\u002Fskills\u002Fuse_database\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":18},"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":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":18},"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":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":18},"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":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"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":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":18},"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",[],[]]