# Wix Managed Headless — Base44 build instructions

You are building a **Wix Managed** headless site inside Base44. The business to build is described in your initial prompt. The Wix connector is already configured for this app — use it for all Wix API calls.

Your Wix client id is given in your prompt. It's a public, buyer/visitor-facing credential (it only mints anonymous visitor tokens), so it's safe in the frontend — use that value directly for the Wix client setup.

Follow the steps below exactly.

## STEP 0 — Install the Wix skills locally

Install three skills — they land under `.agents/skills/` as:
- **`wix-vibe-headless`** — the client build guide: how to build the frontend against the Wix APIs. This is your main source of truth (STEP 1).
- **`wix-headless`** — a broad skill for building full Wix apps with the Wix SDK packages, **most of which does not apply to how you build here**. Use it **only** as a seeding/admin recipe reference — its `references/SEED.md` and `references/inline-recipes/`, for STEP 2. **Ignore everything else in it** — in particular do **not** follow its authentication / `@wix/cli` / "managed project" setup (e.g. anything under `references/managed/`, such as `AUTHENTICATION.md`). That is **not** how auth works here — auth is handled per STEP 2 below.
- **`wix-docs`** — a **fallback**: how to search and read the Wix API reference docs, for anything the seeding recipes above don't cover.

### Option A — skills CLI.
This is the Base44-verified install path — run it first via exec_tool, exactly as written:

```js
const { execSync } = require('child_process');
const { readdirSync } = require('fs');

const skills = ['wix-headless', 'wix-vibe-headless', 'wix-docs'];
const results = {};

for (const skill of skills) {
  try {
    const out = execSync(`CI=1 npx -y skills add wix/skills/skills/${skill} --yes 2>&1`, {
      cwd: '/app', timeout: 60000, shell: '/bin/bash', stdio: ['pipe', 'pipe', 'pipe'],
    });
    const text = out.toString().replace(/\x1b\[[0-9;]*m/g, '');
    results[skill] = /installed 1 skill|found 1 skill/i.test(text)
      ? 'success'
      : text.includes('No valid skills') ? 'not_found' : 'unknown';
  } catch (e) {
    results[skill] = 'error: ' + e.message;
  }
}

return { results, installed: readdirSync('/app/.agents/skills') };
```

### Option B — tarball.
Use this **only if Option A actually errored** (check its `results`) — do not skip Option A on a guess. Run via exec_tool:

```js
const { execSync } = require('child_process');
for (const s of ['headless', 'vibe-headless', 'docs']) {
  execSync(`mkdir -p /app/.agents/skills/wix-${s} && curl -s \
