xiaohongshu
xiaohongshu
fvtt-v13-migration
This skill should be used when the user asks to "migrate to V13", "upgrade to Foundry V13", "update module for V13", "fix V13 compatibility", "convert to ESM", "use DataModel", or mentions V13-specific patterns like hook signature changes, actor.system vs actor.data.data, or Application V2. Provi...
Full skill instructions
Domain: Foundry VTT Module/System Development Status: Production-Ready Last Updated: 2026-01-05
This guide covers V13-specific patterns and migration from earlier versions. For modules targeting V13, follow these guidelines.
require) to ESM (import/export)actor.data.data to actor.system)ALWAYS use foundry.abstract.DataModel for defining data structures instead of plain JavaScript objects. DataModels provide:
DataSchemaExample:
class MyModuleData extends foundry.abstract.DataModel {
static defineSchema() {
const fields = foundry.data.fields;
return {
name: new fields.StringField({ required: true, blank: false }),
value: new fields.NumberField({ initial: 0, min: 0 }),
enabled: new fields.BooleanField({ initial: true })
};
}
}
Foundry V13 uses ECMAScript Modules (ESM) exclusively. Your code must:
import and export statements (NO require())"esmodules" in your manifest (NOT "scripts").js extensions in import paths when importing relative filesExample manifest entry:
{
"esmodules": ["scripts/module.js"],
"scripts": []
}
ALWAYS use game.i18n.localize() or game.i18n.format() for user-facing text. Never hardcode English strings.
// BAD
ui.notifications.info("Item created successfully");
// GOOD
ui.notifications.info(game.i18n.localize("MYMODULE.Notifications.ItemCreated"));
// For dynamic values
const message = game.i18n.format("MYMODULE.Notifications.ItemCreatedWithName", {
name: itemName
});
Localization files go in lang/en.json:
{
"MYMODULE.Notifications.ItemCreated": "Item created successfully",
"MYMODULE.Notifications.ItemCreatedWithName": "Item {name} created successfully"
}
Many hooks in V13 have different argument signatures than V12. Always check the current API documentation.
Example: createToken Hook
// V12 (OLD - WRONG in V13)
Hooks.on("createToken", (scene, tokenData, options, userId) => { });
// V13 (CORRECT)
Hooks.on("createToken", (tokenDocument, options, userId) => { });
V13 distinguishes between Document classes (e.g., Actor, Item) and their data models:
actor.name, item.systemactor.system to access system-specific data defined in your DataModelactor.data.data (deprecated pattern from V10)// BAD (V10 pattern)
const hp = actor.data.data.attributes.hp.value;
// GOOD (V13 pattern)
const hp = actor.system.attributes.hp.value;
Active Effects in V13 use a cleaner structure:
document.effects (EffectCollection)await actor.createEmbeddedDocuments("ActiveEffect", [effectData])key (path to property) and mode (add, multiply, override, etc.)const effectData = {
name: game.i18n.localize("MYMODULE.Effects.Blessed"),
icon: "icons/magic/light/beam-rays-yellow.webp",
changes: [{
key: "system.attributes.ac.bonus",
mode: CONST.ACTIVE_EFFECT_MODES.ADD,
value: "2"
}],
duration: { rounds: 10 }
};
await actor.createEmbeddedDocuments("ActiveEffect", [effectData]);
V13 has reorganized canvas layers. Use the correct layer references:
canvas.tokens - TokenLayercanvas.tiles - TilesLayercanvas.lighting - LightingLayercanvas.grid - GridLayerDialog construction now prefers Application V2 patterns in some contexts, but classic Dialogs still work:
new Dialog({
title: game.i18n.localize("MYMODULE.Dialog.Title"),
content: `<p>${game.i18n.localize("MYMODULE.Dialog.Content")}</p>`,
buttons: {
yes: {
icon: '<i class="fas fa-check"></i>',
label: game.i18n.localize("MYMODULE.Dialog.Confirm"),
callback: () => { /* action */ }
},
no: {
icon: '<i class="fas fa-times"></i>',
label: game.i18n.localize("MYMODULE.Dialog.Cancel")
}
},
default: "yes"
}).render(true);
When defining DataModel schemas, use these field types from foundry.data.fields:
StringField - Text dataNumberField - Numeric values (integers or floats)BooleanField - True/false valuesObjectField - Nested objectsArrayField - Arrays of valuesSchemaField - Nested DataModel schemaHTMLField - Sanitized HTML contentFilePathField - File paths (images, sounds, etc.)ColorField - Color values (hex strings)AngleField - Angles in degreesAlphaField - Alpha transparency (0-1)game.user.isGM or document permission checksfromUuidSync() or fromUuid() - For reliable document referencesYour module.json or system.json must declare V13 compatibility:
{
"id": "my-module",
"title": "My Module",
"version": "1.0.0",
"compatibility": {
"minimum": "13",
"verified": "13",
"maximum": "13"
},
"esmodules": ["scripts/init.js"],
"languages": [
{
"lang": "en",
"name": "English",
"path": "lang/en.json"
}
]
}
console.log() liberally, or set up proper logging with CONFIG.debugCONFIG.debug.hooks = true to see all hook executionsRemember: When in doubt, check the official Foundry VTT V13 API documentation at https://foundryvtt.com/api/
"esmodules" (not "scripts").js extensionsdefineSchema()document.system (not data.data)game.i18n.localize()Last Updated: 2026-01-05 Status: Production-Ready Maintainer: ImproperSubset
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience