# Create XApp: Claude Code Skill to Scaffold and Build Mini Apps

> How the create-xapp skill turns a domain model, reference page or markdown spec into a working xapp, in a new project or inside an existing pnpm monorepo, in one or more languages.

- URL: https://www.xapplaxy.com/pages/en/create-xapp-skill/
- Type: AI Skills
- Category: technology
- Published: 2026-11-27
- Languages: en
- Tags: create-xapp, claude-code, agent-skill, xapp, scaffolding, svelte, monorepo, i18n

**Create XApp** is a Claude Code skill that creates a new xapp from the official **xapplaxy starter template** and then writes the xapp’s real interface and logic for you. You give it a name and one description of what the xapp should do. Two jobs then run **at the same time**: a script copies and renames the template, while a builder subagent reads your description and plans the xapp. The builder waits for the copy to finish before it edits any file.

The part people usually get wrong is where the xapp ends up. The skill doesn’t always create a new project. If you run it inside an existing xapps monorepo, it adds the app **flat** at `apps/<name>/` and leaves the rest of the repository alone.

> **Your description + xapp-starter template → a built, documented xapp ready for `pnpm dev`**

What you get depends on three choices: the **source** you give (model, page or spec), the **layout** (new project or existing monorepo), and the **languages** (one, or several with translations).

## What the skill needs from you

| Input | Required | Example | Notes |
| --- | --- | --- | --- |
| **Name** | yes | `dog-age-calculator` | Kebab-case. A phrase like “dog age calculator” is converted, and you’re asked to confirm. |
| **Domain model (JSON)** | one source | `./models/dog-age.model.json` | Most precise. If you give one, it’s the source of truth. |
| **Reference URL** | one source | a page that explains the tool | Read for purpose, inputs, outputs, formulas and edge cases. |
| **Markdown spec** | one source | `./specs/tip-splitter.md` | Your own description of the xapp. |
| **Languages** | no | `en,de` | Only when you ask for more than one language. The first code is the default. |
| **Destination** | no | `~/Workspace/xapps` | Defaults to the current folder. |
| **Layout** | no | `monorepo` | `auto` (default), `standalone` or `monorepo`. |
| **Title, description** | no | “Dog Age Calculator” | The default title is made from the name. |

You need **one source**. If you give a model, a URL or spec only adds context. Without a model, a URL or spec is **required**, and the skill asks for one instead of guessing the domain.

To run it you need **Claude Code** with the skill and its `xapp-builder` subagent installed, **Python 3** (standard library only), **Node.js and pnpm**, and internet access to download the starter template from GitHub.

## Step by step: from your request to a running xapp

1.  **Check the target**: a dry run of `scaffold.py` works out the layout and the exact folder, and changes nothing. If that folder already exists, the skill **stops and asks** you.
2.  **Scaffold** (script): downloads `xapplaxy/xapp-starter` (`main.zip`), places it, and renames the template for your xapp. That covers the package name, the container ID `#wg-<name>`, the `.env` key, the CSS layer, `index.html`, the doc and API file names, and `migration/migration.yaml` with a new random `pathKey`. When it’s done, it writes a `.xapp-scaffold.json` marker.
3.  **Plan** (builder, in parallel with step 2): reads your source and works out the **entities**, which values are **inputs** and which are **calculated**, the **formulas**, the **screen layout**, and whether the xapp needs **server data**. Without a model, it derives one in the same shape.
4.  **Build** (builder, after the marker appears): writes the types (`src/lib/types.ts`), the formulas as pure functions (`src/lib/utils.ts`) and the interface (`src/lib/XAPP.svelte`). It uses Svelte 5 runes, the `@xapplaxy/xy-ui` components, and `xa-` classes in the xapp’s own CSS layer.
5.  **API decision**: if the xapp needs server data, the builder implements `api/<name>.py` and adds sample data to `index.html`. If not, it deletes the API folder and the xapp runs fully in the browser.
6.  **Document**: writes `doc/<lang>/<name>.md` in a plain-language explainer style. It covers the formula, a step-by-step calculation in the same order as the code, and worked examples whose numbers come from the xapp’s own functions. It also fills the SEO **title, description, tags, excerpt and category** in `migration/migration.yaml`.
7.  **Verify**: runs `pnpm install` and `pnpm --filter <name> build` from the workspace root, and fixes any errors it introduced.
8.  **Report**: the skill checks the result for leftover placeholders, deletes the marker, and tells you where the app is, what was built, the build result, and the builder’s **open questions**.

## Two layouts: a new project or an app inside your monorepo

The `auto` layout picks for you. It looks for a **pnpm workspace** whose `pnpm-workspace.yaml` lists `apps/*`, in the destination or in its parent when the destination is the workspace’s `apps/` folder.

| Layout | When it’s used | Where the app goes |
| --- | --- | --- |
| **standalone** | no workspace found | the whole starter repo at `<dest>/<name>/`, with the app in `<dest>/<name>/apps/xapp` |
| **monorepo** | a workspace with `apps/*` is found | only the starter’s app, placed **flat** at `<workspace>/apps/<name>/` |

In **monorepo** mode the starter’s shared package names are renamed to your workspace’s names **with the same suffix**. For example, `@xapputils/utils` becomes `@onlineutils/utils`. Your workspace’s root files aren’t touched, and the builder only edits files inside the new app folder. It also looks at a sibling app for local conventions.

> **Running the skill inside an existing xapps monorepo never creates a nested `apps/xapp`.**

## Languages: single-language by default, translations only when you ask

By default the xapp is **single-language English** (`en`). The skill doesn’t ask about languages and doesn’t add translation code.

> **One language → text written directly in that language. Two or more → full i18n.**

-   **One non-English language**, for example `de`: all text is written in German, there’s one doc at `doc/de/<name>.md`, and still **no i18n**.
-   **Two or more languages**, for example `en,de`: the first code is the **default and fallback**. The scaffold adds one translation file per language at `public/cdn/miniapps/<name>/locale/<lang>/i18n.json`, plus the `src/lib/i18n.svelte.ts` runtime. The builder writes every label, message and copy text as a translation key, translates every file with **exactly the same keys**, and writes a fully translated doc per language.

At runtime the xapp reads the page’s `<html lang>`. It uses an exact match first, then the base language (`pt-BR` → `pt`), then the default. Numbers, currency and dates are formatted for that language, and right-to-left languages (`ar`, `he`, `fa`, `ur`) get `dir="rtl"`. To preview another language locally, change `<html lang>` in `index.html`.

## Worked examples

**1\. Standalone xapp from a domain model**: you ask to _create a new xapp called **dog-age-calculator** from **./models/dog-age.model.json**_ in a folder that isn’t a monorepo.

-   Layout: **standalone** (no workspace found)
-   Project: `dog-age-calculator/`, app in `dog-age-calculator/apps/xapp/`
-   Doc: `apps/xapp/doc/en/dog-age-calculator.md`
-   Run: **`cd dog-age-calculator && pnpm install && pnpm --filter dog-age-calculator dev`**

**2\. New app inside an existing monorepo**: you run _scaffold an xapp named **tip-splitter** using **./specs/tip-splitter.md**_ from the root of a workspace whose packages are `@onlineutils/*`.

-   Layout: **monorepo**, so the app goes to `apps/tip-splitter/`
-   Package rename: `@xapputils/utils` → **`@onlineutils/utils`**
-   Root files of the workspace: **unchanged**
-   Run from the workspace root: **`pnpm --filter tip-splitter dev`**

**3\. Multi-language xapp**: you ask for a **loan-comparison** xapp in **English and German**, so the languages are **`en,de`**.

-   Default and fallback language: **`en`**
-   Docs: `doc/en/loan-comparison.md` and a translated `doc/de/loan-comparison.md`
-   Translations: `public/cdn/miniapps/loan-comparison/locale/en/i18n.json` and `…/de/i18n.json`
-   Runtime: **`src/lib/i18n.svelte.ts`** added, `<html lang="en">`

**4\. German only**: the same request with just **`de`**.

-   One doc, `doc/de/loan-comparison.md`, written in German
-   **No** translation files and **no** i18n runtime

## Edge cases

-   **Folder already exists**: the dry run reports it and the skill stops and asks before writing anything.
-   **No model and no URL or spec**: the skill asks you for a source. It doesn’t invent the domain.
-   **Inline JSON model**: saved to a temporary file and checked that it parses before the scaffold starts.
-   **Invalid language code**: the scaffold stops with an error. Codes follow BCP 47, for example `en`, `pt-BR`, `zh-Hans` or `es-419`.
-   **Scaffold fails**: the builder is stopped and nothing is retried over a partly created folder without asking you.
-   **Monorepo package without a match**: a starter package is renamed only when your workspace has a package with the same suffix. Others keep their starter name.

## Important notes

-   The skill needs **Claude Code**, because it runs the scaffold and the builder subagent in parallel.
-   Read the builder’s **open questions** before publishing. They list the values and rules it had to assume where your source was unclear.
-   The generated doc’s worked examples are computed with the xapp’s own functions. If you change a formula later, update the doc too.
-   The generated project keeps the starter’s structure (`App.svelte` → `XAPPContainer.svelte` → `XAPP.svelte`), so it stays compatible with the xapplaxy publishing pipeline.
