Minimal web baas demo

From infometa/workbuddyskills · View interactive version

Minimal web baas demo is an AI agent skill from the GitHub repository infometa/workbuddyskills. Fast path for a minimal CloudBase Web + database demo (最小前后端 / 最小可用 fullstack / Lovable-like BaaS). Defaults to @cloudbase/js-sdk client CRUD (NoSQL app.database / PG app.rdb), MCP-only schema, preview-first, and forbids cloud functions unless secrets, cron/background jobs, or logic that security ru

How to use this skill

Skill file

Sibling skills (local only)

Sibling CloudBase skills ship beside this skill. Use local relative paths such as ../web-development/SKILL.md.

If a referenced sibling skill file is missing from this environment, ask the user to install the full CloudBase plugin (or the missing skill). Do not HTTP-fetch remote skill or protocol markdown into the agent context.

Minimal Web BaaS Demo (fast path)

Goal: minutes to an interactive Web + database preview, not a cloud-function middleware stack.

This skill is the product equivalent of CloudBase Sites SessionStart Rule 5 (BaaS-first data persistence).

Activation Contract

Use this first when

Do NOT use for

Hard rules (align with Sites SessionStart Rule 5)

  1. BaaS-first data path
  1. Cloud functions are forbidden by default
  1. Package discipline
  1. Preview first, deploy second
  1. UI ceremony for this path
  1. Anonymous (or real) session before NoSQL CRUD — js-sdk 3.x + publishable key
const auth = app.auth
const { error } = await auth.signInAnonymously()
if (error) throw error
const db = app.database()
await db.collection('messages').get()

Capability sniff order (partners + agents)

Use this order for every minimal Web + DB demo. Do not reorder. Cloud functions stay off the critical path.

0. Connector pre-enabled (or shortest Trust path)     ← host / partner packaging
1. Template warmup // parallel with credential wait   ← downloadTemplate + install
2. queryEnv(action="info")                            ← sniff env + RuntimeBackends
3. Lock ONE DB plane (NoSQL | PG)                    ← new relational work is PG; MySQL only if the env already has it
4. MCP schema + minimal permissions                   ← writeNoSql* / PG migrate
5. Browser @cloudbase/js-sdk CRUD                     ← app.database() / app.rdb()
6. Local preview (list + add)                         ← then ask before deploy
7. Cloud functions                                    ← skip (count = 0) unless secrets/cron/rules-cannot-express

Stack priority for this path: Web SDK CRUD > MCP schema > template warmup > cloud functions.

Standard playbook

  1. Warm template in parallel with credentials (see partner notes below): downloadTemplate (react default, vue if requested) → npm install / pnpm install.
  2. queryEnv(action="info") → lock one DB plane (NoSQL or PG). New relational work uses PostgreSQL. Use MySQL only when the environment already has an instance. Do not thrash between them. Exception: pgdoc is the document API carried by PG, not a choice between the two — if the task moves an existing document app onto PG without changing SDK calls, read ../postgresql-development-cloudbase/references/pgdoc.md instead of rewriting the client.
  3. MCP: create the collection/table + minimal permissions.
  4. Frontend: ensure session (auth.signInAnonymously() or equivalent), then wire list + create with @cloudbase/js-sdk (see Hard rule 6).
  5. Start / report preview URL; ask before deploy.
  6. Cloud function count for this path = 0.

On-demand skills (fetch only when needed)

| Need | Skill |

| --- | --- |

| Web scaffold / hosting | ../web-development/SKILL.md |

| NoSQL browser CRUD | ../cloudbase-document-database-web-sdk/SKILL.md |

| PG browser CRUD + MCP schema | ../postgresql-development-cloudbase/SKILL.md |

| Auth provider readiness | ../auth-tool-cloudbase/SKILL.md then ../auth-web-cloudbase/SKILL.md |

| MCP connection, calling tools from the shell with mcporter, plugin flags | ../cloudbase-mcp/SKILL.md |

Prefer searchKnowledgeBase(mode="skill", skillName="minimal-web-baas-demo") (or the sibling dir id) when local skill files are unavailable. Do not dump every CloudBase skill at session start.

WorkBuddy / partner packaging notes (XDF and beyond)

Any partner host (WorkBuddy, CodeBuddy connectors, vertical expert prompts, ISV wrappers) should treat this skill as the compact fast-path brief. Reuse the sniff order above; do not invent a cloud-function-first demo path.

| Host capability | Recommended packaging |

| --- | --- |

| Full CloudBase Sites plugin | Rely on SessionStart Rule 5 injection + this skill on demand for non-Sites cwd demos. Prefer Sites with CLOUDBASE_SITES_AUTO_INIT=1 for empty-cwd preview. Never guess 5173 — read .cloudbase-sites/preview.json. |

| WorkBuddy / connector hosts | Pre-enable the CloudBase MCP connector for the tenant when possible; inject a short system brief that points here; warm downloadTemplate + npm install during credential/Trust wait (do not idle). Optional SessionStart additionalContext can point at this skill — do not ship a separate template-prewarm plugin. |

| Expert / vertical prompts (ISVs) | Ship a thin pack: expert Agent markdown (no frontmatter hooks) + optional settings/hooks. Replace any "必须云函数中转 / 前端绝不直连库" language with this BaaS-first contract. |

WorkBuddy SessionStart: https://www.workbuddy.ai/docs/cli/hooks (same additionalContext schema as CodeBuddy/Claude Code). Empty-dir Sites auto-init stays passive unless opted in — do not assume enabling Sites alone warms templates during credential wait.

Do not block first preview on custom domains or org DNS health. DNS issues are a post-preview concern.

One-screen partner paste (optional)

For 最小前后端 / Lovable-like demos: FIRST call
searchKnowledgeBase(mode="skill", skillName="minimal-web-baas-demo"), then Read.
Do not rely only on ad-hoc expert-prompt brief text.
Order: connector ready → template warmup during credential wait → queryEnv →
lock one DB → MCP schema → auth.signInAnonymously() (or session) →
@cloudbase/js-sdk CRUD → preview.
Do not dump all CloudBase skills. Do not create cloud functions for CRUD.
NoSQL without session → gateway 401.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.