/boxel-cli:boxel-file-structurefrom boxel-cli
File and directory layout rules for Boxel workspaces. Covers naming conventions, relative module paths for adoptsFrom, and linksTo-vs-contains relationships.
Ships in boxel-cli. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Rules for organizing files in a Boxel workspace when working locally with boxel-cli.
https://[realm-domain]/[username]/[workspace]/[path].[extension]
Example: https://app.boxel.ai/sarah/pet-rescue/animals/dog.gts
| Type | Convention | Example |
|---|---|---|
| Card definitions | kebab-case.gts | blog-post.gts, grammy-award.gts |
| Instance directories | PascalCase/ | BlogPost/, GrammyAward/ |
| Instance files | kebab-case.json | my-first-post.json |
workspace/
├── realm.json # Workspace config (RealmConfig card)
├── index.json # The workspace's default index card
├── blog-post.gts # Card definition (kebab-case)
├── BlogPost/ # Instance directory (PascalCase)
│ ├── my-first-post.json
│ └── another-post.json
├── author.gts
└── Author/
└── jane-doe.json
A new workspace is seeded with exactly two files, realm.json and
index.json; everything else is yours. index.json adopts Workspace from
@cardstack/base/workspace (workspace.gts), which gives the workspace its
Home, Library, and Activity views. Replace that adoption to put your own card
on the workspace root instead.
Some workspaces adopt CardsGrid as their root card, and some also carry a separate
cards-grid.json instance at the root. Both shapes are supported — CardsGrid
remains available — so treat either as valid unless you're deliberately migrating.
The adoptsFrom.module path is relative to the JSON file location.
grammy-award.gts # Definition at root
GrammyAward/ # Instances in PascalCase directory
└── record-of-the-year.json
In GrammyAward/record-of-the-year.json:
{
"meta": {
"adoptsFrom": {
"module": "../grammy-award", // ← Go UP to parent, then to file
"name": "GrammyAward"
}
}
}
{
"meta": {
"adoptsFrom": {
"module": "./grammy-award", // ← WRONG! This looks in GrammyAward/
"name": "GrammyAward"
}
}
}
| JSON Location | Definition Location | Module Path |
|---|---|---|
root/Instance.json | root/card.gts | "./card" |
root/Card/instance.json | root/card.gts | "../card" |
root/Card/Sub/instance.json | root/card.gts | "../../card" |
root/Card/instance.json | root/other/card.gts | "../other/card" |
{
"data": {
"type": "card",
"attributes": {
"fieldName": "value",
"numberField": 123,
"boolField": true
},
"relationships": {
"author": {
"links": {
"self": "../Author/jane-doe"
}
}
},
"meta": {
"adoptsFrom": {
"module": "../card-definition",
"name": "CardClassName"
}
}
}
}
🔴 For linksToMany fields, use numbered keys like fieldName.0, fieldName.1, etc.
{
"data": {
"relationships": {
"tags.0": {
"links": {
"self": "../Tag/tech"
}
},
"tags.1": {
"links": {
"self": "../Tag/news"
}
},
"tags.2": {
"links": {
"self": "../Tag/tutorial"
}
}
}
}
}
{
"relationships": {
"tags": {
"links": {
"self": ["../Tag/tech", "../Tag/news"]
}
}
}
}
| Section | Purpose | Required |
|---|---|---|
data.type | Always "card" | Yes |
data.attributes | Scalar field values (string, number, bool) | Yes |
data.relationships | Links to other cards (linksTo/linksToMany) | Only if has links |
data.meta.adoptsFrom | References the card definition | Yes |
Use attributes for:
contains)Use relationships for:
linksTo → single link)linksToMany → array of links)🔴 CRITICAL - memorize this:
| Field Type | Definition uses | Instance uses |
|---|---|---|
Extends CardDef | linksTo / linksToMany | relationships |
Extends FieldDef | contains / containsMany | attributes |
// In .gts definition:
@field author = linksTo(Author); // Author extends CardDef → relationships
@field address = contains(AddressField); // AddressField extends FieldDef → attributes
// In .json instance:
{
"attributes": {
"address": { "street": "123 Main", "city": "NYC" }
},
"relationships": {
"author": { "links": { "self": "../Author/jane" } }
}
}
When linking to other cards, use the card's identifier without .json: a
relative path, a URL for workspace realms, or @cardstack/<realm>/… for
well-known realms.
{
"data": {
"relationships": {
"author": {
"links": {
"self": "../Author/jane-doe"
}
}
}
}
}
These realms contain shared definitions you can import from. Name them by
their @cardstack/<realm>/ prefix, which resolves in every environment:
@cardstack/base/ - Core types (CardDef, FieldDef, etc.)@cardstack/catalog/ - Catalog cards@cardstack/skills/ - Skill cardsDon't import from https://cardstack.com/base/ or from a realm's
environment-specific URL. The @cardstack/boxel/no-url-form-base-imports lint
rule rewrites the base alias to @cardstack/base/.
// Core imports (always from @cardstack/base/)
import {
CardDef,
FieldDef,
field,
contains,
linksTo,
containsMany,
linksToMany,
StringField,
NumberField,
BooleanField,
Component,
} from '@cardstack/base/card-api';
// Import from same workspace
import { Author } from './author';
// Import from base realm
import { Skill } from '@cardstack/base/skill';
When searching with boxel search:
{
"filter": {
"type": {
"module": "https://realm-url/card-name",
"name": "CardClassName"
}
}
}
With field filters:
{
"filter": {
"on": { "module": "https://realm-url/product", "name": "Product" },
"contains": { "name": "laptop" }
}
}
Operations: eq, contains, range, not, type, every (AND), any (OR)
| Mistake | Fix |
|---|---|
"module": "./card" from subdirectory | Use "../card" |
contains(CardDef) | Use linksTo(CardDef) |
linksTo(FieldDef) | Use contains(FieldDef) |
Link in attributes | Move to relationships |
FieldDef in relationships | Move to attributes |
Missing data wrapper in JSON | Wrap everything in {"data": {...}} |
PascalCase for .gts files | Use kebab-case.gts |
| kebab-case for instance dirs | Use PascalCase/ |
linksToMany as array | Use numbered keys: field.0, field.1, etc. |
Every CardDef should implement these templates:
isolated - Full detail view (scrollable)embedded - Compact summary for listsfitted - Fixed dimensions for grids/dashboards (CRITICAL for good UX)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub cardstack/boxel --plugin boxel-cli10 skills in this plugin
/boxel-apiUse when calling Boxel realm-server APIs from code — primarily federated search across realms. Documents the boxel-cli programmatic surface (`BoxelCLIClient`) and the matching CLI commands. Read this whenever you need to query a realm's index./boxel-commandUse when running a Boxel host command via the realm server's prerenderer — invoking commands like `get-card-type-schema`, `evaluate-module`, `instantiate-card`, or any other module exposed at `@cardstack/boxel-host/commands/.../default`. Documents `boxel run-command` and the matching `client.runCommand()` method./browser-sign-inSigning a browser inSign a browser into the Boxel app as a boxel-cli profile with `boxel browse`. Use when you or the user need to view, test, or verify the Boxel app in a browser signed in without typing a password — on the environment's own host, a local host, or an origin such as a Railway deployment or custom domain where the email/password area of the sign-in page is blank. Run it on the user's behalf; reach for it before Railway deploys, custom hostnames, or certificates./file-opsFile operationsSingle-file operations against a Boxel realm. Use when the user wants to read, write, list, delete, lint, or touch (force-reindex) one file in a realm by URL — without a full sync./indexing-errorsRealm indexing errorsList every `boxel_index` row in a realm whose latest indexing attempt failed (`has_error = TRUE`), rendered cleanly but holds broken `linksTo` / `linksToMany` targets, indexed but couldn't parse its frontmatter YAML, or indexed a skill whose frontmatter tools failed schema generation. Use to answer "why is this realm broken", "what's failing to index", "which cards have dead references", "why did my skill's commands disappear", or "why isn't my skill's tool callable" without reading the database directly./profileProfilesManage saved boxel-cli profiles (credentials for users / environments). Use when the user wants to list profiles, add a new profile, switch the active profile, run one command as a different profile (--profile), remove a profile, or migrate from a legacy .env file.Other plugins' skills for the same job