boxel-file-def
Use when adding or working with file-typed fields (FileDef, ImageDef, MarkdownDef, PngDef, CsvFileDef).
Skill by cardstack
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/cardstack-boxel-file-def
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: documents
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/boxel-file-def
What's inside
- Skill name
boxel-file-def- Description
- Use when adding or working with file-typed fields (FileDef, ImageDef, MarkdownDef, PngDef, CsvFileDef). Activates when a card needs to reference an image, document, or other file asset.
- License
- MIT
- Instructions
- 74 lines in SKILL.md · view on GitHub
Files (11)
- SKILL.md
- available-fields.md · references/
- filedef-first-class-file-support.md · references/
- filedef-vs-base64imagefield.md · references/
- import-paths.md · references/
- markdowndef-vs-markdownfield.md · references/
- no-inline-binary.md · references/
- rendering-file-fields-in-templates.md · references/
- sample-images.md · references/
- type-hierarchy.md · references/
- using-filedef-in-cards.md · references/
SKILL.md (first lines)
# File Definitions (FileDef)
_How to use FileDef, ImageDef, MarkdownDef, and related types for file fields in Boxel cards_
## Decide what to use (start here)
```
Need to reference an image / document / file asset?
│
├── External URL only (a photo URL, a cover from Open Library, an avatar from gravatar)?
│ └── → the catalog `ImageSourceField` (or the URL/ImageDef pair): the URL goes
│ in its `url` half, and the slot can switch to a realm file later with no
│ schema change (references/sample-images.md). A link to a non-image file
│ elsewhere is `contains(UrlField)`. Never store `data:`, `blob:`, or
│ base64 in either.
│
├── File lives inside this realm and you want to display it?
│ └── → `linksTo(ImageDef)` for images, `linksTo(MarkdownDef)` for markdown,
│ `linksTo(PngDef)` for explicit PNG, `linksTo(CsvFileDef)` for CSV,
│ `linksTo(FileDef)` for generic.
│
├── File is uploaded by the user via the card editor?
│ └── → `linksTo(ImageDef)` (or correct subtype). The host's edit-mode picker
│ handles upload; the field stores the resulting realm file URL.
│
├── File is generated by AI/API and arrives as a `data:` URI / blob / bytes?
│ └── → Write the bytes to a realm file, then store only
│ `linksTo(PngDef/ImageDef/FileDef)`. You write them with
│ `await realm.fs.writeBytes(path, base64)` in a `run-realm-code`
│ script (see `source-code-editing`). Card code that makes the bytes
│ at runtime writes them with `WriteBinaryFileCommand`
│ (references/using-filedef-in-cards.md). The data URI can be a
│ transient command input or `@tracked` preview only; never a saved
│ card field.
│
└── Embed the raw bytes in the card JSON (legacy)?
└── → Forbidden for new work. `Base64ImageField` exists but is deprecated.
`contains(StringField)` with a base64 data URI is just as bad.
File explosion + huge JSON. Use `linksTo(ImageDef)` instead.
```
**Never use `contains(ImageDef)`.** ImageDef extends FileDef and like CardDef, it has its own identity — it needs `linksTo`, not `contains`. This is the same rule as `contains(CardDef)`: forbidden.
**Never inline binary.** The host rejects large card JSON around 512KB (`Card size ... exceeds maximum allowed size (524288 bytes)`), and even smaller inline media clogs the indexer and AI context. Store media bytes as files and link them.
**The FileDef a file resolves to is also its policy type.** A realm policy grants reads of a file's bytes by the FileDef subclass its extension names — `.png` is a `PngDef`, which a rule on `ImageDef` also matches — and an extension no def covers resolves to `FileDef` itself. So renaming a file changes which grant reaches it. Module source (`.ts`, `.gts`, `.js`, `.gjs`) is a `TsFileDef` or `GtsFileDef`, which only a rule naming one of those reaches: a rule on `FileDef` never serves code. See [`realm-policy-authoring`](../realm-policy-authoring/SKILL.md) §5.
## Pair with
- **`boxel`** — for the surrounding CardDef/FieldDef and `linksTo`/`contains` rules.
- **`source-code-editing`** — for the actual file edits adding file fields.
- **`boxel-ui-guidelines`** — if you also render the file (image preview, document viewer) in a template.
## Don't use for
- Embedded base64 image fields (use FileDef subtypes instead — Base64ImageField is deprecated for new cards).
- Generic `linksTo` to a CardDef. FileDef is specifically for file-backed assets.
---
## Sections (load on demand)
- `references/filedef-first-class-file-support.md` — FileDef — First-Class File Support
- `references/type-hierarchy.md` — Type Hierarchy
- `references/import-paths.md` — Import Paths
- `references/available-fields.md` — Available Fields
- `references/using-filedef-in-cards.md` — Using FileDef in Cards
- `references/rendering-file-fields-in-templates.md` — Rendering File Fields in Templates
- `references/markdowndef-vs-markdownfield.md` — MarkdownDef vs MarkdownField
- `references/filedef-vs-base64imagefield.md` — FileDef vs Base64ImageField
- `references/no-inline-binary.md` — Mandatory no-inline-media rule, generated image workflow, and A Million Dreams MP3 FileDef example
- `references/sample-images.md` — Build-time sample images: pick a source by scenario (the user's own, AI-generated with `realm.images.generate`, a real photo from the Openverse API from a terminal, or a labelled placeholder), then link it without breaking the realmFrom cardstack/boxel-skills, MIT.
More from cardstack/boxel-skills
- 0.592score
boxel
cardstack
Use whenever creating, reading, or editing Boxel cards (.gts files), card instances (.json), fields, templates, queries, or anything in a Boxel realm.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
boxel-patterns
cardstack
Use when the user names an outcome ("show a chart", "let users pick a color", "build a dashboard", "summarize comments", "embed AI image generation", "lay out…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
boxel-theme-development
cardstack
Use when the deliverable is a theme ARTIFACT — creating, converting, auditing, or patching Theme, StructuredTheme, StyleReference, DetailedStyleReference, or…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
boxel-ui-component-discovery
cardstack
MANDATORY before writing any UI in a `.gts` template, including a quick fix to an existing card (turning a styled span or div into a button, wiring a dead…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
boxel-ui-guidelines
cardstack
Use when IMPLEMENTING or REVIEWING UI in Boxel templates (writing a template, or reviewing a change, diff or pull request that touches one) — applying…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
card-motion
cardstack
Use when a card should animate: elements entering and leaving, a list or grid rearranging, a tile opening into a detail view, drag and reorder, scroll-linked…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
catalog-listing
cardstack
Use when installing, browsing, remixing, updating, or submitting catalog listings (Apps, Cards, Fields, Skills, Themes) from a Boxel catalog realm.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
catalog-reuse
cardstack
MANDATORY before writing any `.gts`.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
boxel-design
cardstack
Use when DECIDING a Boxel card's visual language — mood, palette, typography direction, asset direction, one visual signature, the design-playbook process.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
boxel-environment
cardstack
Use when running, navigating, or orchestrating tasks inside the live Boxel application — switching between Code Mode and Interact Mode, searching and editing…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
boxel-flavored-markdown
cardstack
Use when authoring or editing Boxel Flavored Markdown (BFM) content — content fields rendered as rich markdown with :card/::card directives, mermaid diagrams…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
boxel-markdown-format
cardstack
Use when authoring a `markdown` template (static markdown format) on a CardDef or FieldDef — defaults, markdownEscape, and markdown helpers.
SkillAFreshness: A★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 15, 2026 (14 days ago)
- Last release
- Oct 23, 2026 (6 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/cardstack/boxel-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from cardstack
- 0.592score
boxel
cardstack
Use whenever creating, reading, or editing Boxel cards (.gts files), card instances (.json), fields, templates, queries, or anything in a Boxel realm.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
boxel-design
cardstack
Use when DECIDING a Boxel card's visual language — mood, palette, typography direction, asset direction, one visual signature, the design-playbook process.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
boxel-environment
cardstack
Use when running, navigating, or orchestrating tasks inside the live Boxel application — switching between Code Mode and Interact Mode, searching and editing…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
boxel-flavored-markdown
cardstack
Use when authoring or editing Boxel Flavored Markdown (BFM) content — content fields rendered as rich markdown with :card/::card directives, mermaid diagrams…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
boxel-markdown-format
cardstack
Use when authoring a `markdown` template (static markdown format) on a CardDef or FieldDef — defaults, markdownEscape, and markdown helpers.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
boxel-patterns
cardstack
Use when the user names an outcome ("show a chart", "let users pick a color", "build a dashboard", "summarize comments", "embed AI image generation", "lay out…
SkillAFreshness: A★ 1Claude Code +9
Cite this page
boxel-file-def skill. Agent Mart. https://agentmart.dev/skills/cardstack-boxel-file-def (last updated 2026-10-24)