RolebookDocs

Mount the API

The rolebook-mount-api agent skill.

Mounts the Rolebook Sharing HTTP API in a Hono or Next.js app with @rolebook/server, taking the tenant and actor from the session, checking origins, and keeping invitation tokens on the server, then calls it from the browser with a typed fetch client. Use when the user wants sharing over HTTP, a sharing API for a single-page or mobile frontend, CSRF or CORS settings for that API, or a typed client for share, list, access, and history calls.

Skill name: rolebook-mount-api. Ask your agent for the task in your own words, or invoke the skill by name where your tool supports it.

Packages it needs

RequirementPackage and supported versions
Alwaysrolebook >=4.0.0 <5.0.0
Always@rolebook/sharing >=0.1.0 <0.2.0
Always@rolebook/server >=0.1.0 <0.2.0
One of@rolebook/sharing-postgres >=0.1.0 <0.2.0, @rolebook/sharing-sqlite >=0.1.0 <0.2.0
One of@rolebook/sharing-better-auth >=0.1.0 <0.2.0, @rolebook/sharing-clerk >=0.1.0 <0.2.0, @rolebook/sharing-workos >=0.1.0 <0.2.0

The skill checks the installed versions against these ranges before it uses each part, and stops rather than up- or downgrading without your consent.

What it does

  1. Before you start
  2. Check the starting point
  3. Agree the model with the user
  4. Write the context and the API’s sharing
  5. Mount it
  6. Call it from the browser
  7. Other languages
  8. Test it
  9. Check your work

Reference files

The skill loads these files from its references/ folder when a step needs them:

  • client.md
  • handler.md
  • hono.md
  • nextjs.md
  • security-rules.md
  • sharing-module.md