Cohub work kit
Scaffold or extend a Cohub Work product from the Work Kit template (Vite + React + TanStack Query + Cohub runtime). Use when starting a Work app, building on cohub-work-kit, wiring files/sessions/prompt/commerce into a React Work, or turning a kit demo into a product.From its SKILL.md
npx -y skills add markbang/cohub-work-skill --skill cohub-work-kitAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 27 days oldThe repository was created 27 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.6 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it
Cohub Work Kit
Create or evolve a Cohub Work product from the kit template bundled with this skill.
Install this skill
npx skills add https://github.com/markbang/cohub-work-skill \
--skill "cohub-work-kit" \
--agent codex \
--yes \
--copy
Also install the publish companion:
npx skills add https://github.com/markbang/cohub-work-skill \
--skill "cohub-work-publish" \
--agent codex \
--yes \
--copy
When to use
- User wants a new Cohub Work app / product shell
- User mentions Work Kit, Vite Work, React Work, or TanStack Query + Cohub
- User wants files / sessions / prompt / commerce inside a published Work
Locate the template
This skill ships the template inside the installed skill directory:
.agents/skills/cohub-work-kit/template/
In a git checkout of this repo:
skills/cohub-work-kit/template/
If this kit is mounted as a Cohub mod instead:
/mods/<mountSlug>/template
Resolve the real template/ path before copying. Do not invent paths.
Default outcome
apps/<product-slug>/
src/lib/* # keep
src/pages/* # replace with product UI
package.json
vite.config.ts # base: "./"
Workflow
1. Confirm product boundary
Pin:
- product name / Work slug
- reads (
file.view,session.view,space.view) - writes / agent / commerce (viewer scopes)
- non-goals for this pass
2. Copy template
SKILL_DIR=".agents/skills/cohub-work-kit" # after npx skills install
# or: SKILL_DIR="skills/cohub-work-kit" # repo checkout
src_template="$SKILL_DIR/template"
dest="apps/<product-slug>"
mkdir -p "$(dirname "$dest")"
cp -a "$src_template"/. "$dest"/
3. Preserve the runtime seam
Do not casually edit unless required:
src/lib/runtime.tsxsrc/lib/query.tssrc/lib/hooks.tsvite.config.ts(base: "./")- HashRouter in
src/App.tsx
Product work belongs in src/pages/*, src/components/*, optional src/features/*.
3b. Viewer identity (Cohub avatar + id)
The shell top-right uses useViewerProfile() (client.user.getMe()), same pattern as wgetx social-asset-pool:
- shows avatar + displayName /
@username - click opens panel with full
userUuid+ copy - do not rely on
context.vieweralone (often null)
import { useViewerProfile } from "./lib";
const me = useViewerProfile();
// me.data?.userUuid / avatarUrl / displayName
4. Implement product reads with Query
const tree = useFileTreeQuery("data");
const file = useFileContentQuery("data/feed.json");
const sessions = useSessionsQuery(10);
Rules:
- enable queries only when runtime status is
ready - 401/403/404 should not infinite-retry
- mutable source-of-truth lives in Space files / sessions / billing, not in
dist
5. Writes = user gesture + scopes
await client.auth.request({
scopes: ["session.prompt.fullaccess"],
reason: "Need to run an agent action for this product feature",
});
await space.prompt({ /* ... */ });
// invalidate related queries
Never authorize on mount. Never invent a parallel login system.
6. Routing constraints
HashRouterpaths (#/settings)- no BrowserRouter for static directory Works
- relative asset base (
./)
7. Permissions at publish time
Start minimal:
--work-scope file.view
Add viewer scopes only for actions the UI actually offers.
8. Verify
cd apps/<product-slug>
pnpm install
pnpm build
Then publish with the cohub-work-publish skill and open the public Work URL.
Product patterns
File-backed app
files.read → render
user edit intent → auth → prompt/agent writes file → refresh
Agent console
sessions.list → select → prompt(followup) → stream/poll
Commerce gate
getEntitlements → gate UI → purchase/consumeCredits → revalidate
Anti-patterns
- Rebuilding Cohub auth inside the Work
- Baking live business data into static publish output
- Port Work as default production
- Broad full-access scopes "just in case"
- Deep History API routes on static directory hosting
Done criteria
- Template copied into consumer workspace
- Product UI mounted on kit runtime
- Build succeeds
- Publish scopes match actual features
- Public Work boots to
ready(or intentional preview fallback documented)
What ships with it: 23 files
68.2 KB alongside SKILL.md, 7 of them executable
template/
- index.html734 B
- package.json806 B
- README.md1.2 KB
- src/App.tsx1.3 KB
- src/components/AppShell.tsx3.6 KB
- src/components/ui.tsx2.9 KB
- src/components/ViewerIdentity.tsx4.7 KB
- src/lib/hooks.tsruns3.0 KB
- src/lib/index.tsruns924 B
- src/lib/query.tsruns4.4 KB
- src/lib/runtime.tsx3.5 KB
- src/lib/types.tsruns625 B
- src/lib/viewer-profile.tsruns4.2 KB
- src/main.tsx318 B
- src/pages/ActionsPage.tsx5.0 KB
- src/pages/GuidePage.tsx2.7 KB
- src/pages/OverviewPage.tsx3.7 KB
- src/pages/SpaceDataPage.tsx7.1 KB
- src/styles.css16.4 KB
- src/vite-env.d.tsruns39 B
- tsconfig.json613 B
- tsconfig.node.json68 B
- vite.config.tsruns417 B