software-factory
MAmattpocock/skills336k5,004 new stars in the last 7 days
Create, patch, inspect, and remove widgets in the current space
Use this skill for widget work in the current open space
storage
context.import("scripts/...")transient
Current Space Widgets in _____transient lists id|name|col|row|cols|rows|state|render statusCurrent Widget appears after patchWidget(), renderWidget(), or reloadWidget()Current Widget is one envelope with rendered↓ for stripped live HTML and source↓ for the numbered readbackmain helpers
catalog and readback
space.current.* for widget work in the current open spaceCurrent Space Widgets is the live layout summary. Use it before rediscovering ids manuallysnake-game|Snake|... means use readWidget("snake-game")_____framework result↓metadata: ... line before renderer↓_____framework result↓seeWidget(id) strips script/style tags, inline handlers, class lists, ids, and data attrs by defaultseeWidget(id, true) only when you explicitly need the full live innerHTMLsource↓ id: example name: Example cols: 4 rows: 3 renderer↓ 0 async (parent, currentSpace, context) => { 1 console.log("hello"); 2 }
staged turns
Current Space Widgets or _____framework already showed the widget id you need, skip another discovery call and move to the next steprendered↓ for what mounted and source↓ for the next patchexamples Checking widget catalog _____javascript return await space.current.listWidgets()
Reading the widget source _____javascript return await space.current.readWidget("tetris-game")
Seeing the current rendered widget HTML _____javascript return await space.current.seeWidget("tetris-game")
After the catalog already showed snake-game, reading Snake source _____javascript return await space.current.readWidget("snake-game")
User asked for the snake widget, reading it directly _____javascript return await space.current.readWidget("snake")
bad Checking the current widget source
bad _____javascript return await space.current.readWidget("snake-game")
bad Which widget should I change?
bad const widgets = await space.current.listWidgets(); const snake = widgets.widgets.find(...)
bad return await space.current.readWidget("snake-game") return await space.current.patchWidget("snake-game", ...)
bad return await space.current.patchWidget("snake-game", ...) // success came back return await space.current.patchWidget("snake-game", ...)
bad Updating the snake widget background now Applying the color edits now
patch vs rewrite
source↓source↓. Do not use widget.split("\n") array indexes as patch coordinatesexample exact snippet patch _____javascript return await space.current.patchWidget("snake-game", { edits: [ { find: "parent.style.background = '#6f8f54';", replace: "parent.style.background = '#5f7f3f';" } ] })
write and reload behavior
rendered↓ and source↓source↓ before claiming successrenderer rules
const mod = await context.import("scripts/utils.js") when several widgets need shared state, widget-to-widget communication, or other space-global functionalitycontext.import(...) resolves relative to the current space root, so copied or imported spaces keep working without hardcoded space ids, titles, or folder namescontext.paths.scripts is the current space scripts folderscripts/... module from each widget so they share one module instance on that space pagescripts/*.js modulescontext instead of hardcoding globals or space ids#101b2d (rgba(16, 27, 45, 0.92)). Do not add another full-card background unless the content truly needs its own stage<x-browser src="google.com"></x-browser> or create an x-browser element in DOMcontrols="true" to x-browser only when the widget needs its own address bar and navigation controls; omit it or use controls="false" for a frameless embedded browser<iframe> for general web browsing widgets. Iframes are not registered browser surfaces, so space.browser, injected browser actions, and last-interacted browser content will not work through themfetch(url) or space.fetchExternal(url). Do not hardcode third-party CORS proxy services; the runtime already retries blocked origins through /api/proxyspace.proxy.buildUrl(url) only when you specifically need a same-origin proxied URL string for a non-fetch consumerflow
MAmattpocock/skills336k5,004 new stars in the last 7 days
MAmattpocock/skills336k5,004 new stars in the last 7 days
AFaffaan-m/ECC314k4,125 new stars in the last 7 days
AFaffaan-m/ECC314k4,125 new stars in the last 7 days
AFaffaan-m/ECC314k4,125 new stars in the last 7 days
DIDietrichGebert/ponytail202k4,780 new stars in the last 7 days