cardstack/boxel-skills/boxel-file-def
- community
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install cardstack/boxel-skills/boxel-file-defSKILL.md
File Definitions (FileDef)
_How to use FileDef, ImageDef, MarkdownDef, and related types for file fields in Boxel cards_
Decide what to use (start here)
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` §5.
Pair with
- `boxel` — for the surrounding CardDef/FieldDef and
linksTo/containsrules. - `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
linksToto a CardDef. FileDef is specifically for file-backed assets.
Sections (load on demand)
references/filedef-first-class-file-support.md— FileDef — First-Class File Supportreferences/type-hierarchy.md— Type Hierarchyreferences/import-paths.md— Import Pathsreferences/available-fields.md— Available Fieldsreferences/using-filedef-in-cards.md— Using FileDef in Cardsreferences/rendering-file-fields-in-templates.md— Rendering File Fields in Templatesreferences/markdowndef-vs-markdownfield.md— MarkdownDef vs MarkdownFieldreferences/filedef-vs-base64imagefield.md— FileDef vs Base64ImageFieldreferences/no-inline-binary.md— Mandatory no-inline-media rule, generated image workflow, and A Million Dreams MP3 FileDef examplereferences/sample-images.md— Build-time sample images: pick a source by scenario (the user's own, AI-generated withrealm.images.generate, a real photo from the Openverse API from a terminal, or a labelled placeholder), then link it without breaking the realm
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/boxel-file-def/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/cardstack/boxel-skills/boxel-file-def)