foundry-vtt-dev
Skill26 starsChanged yesterdayMITView on GitHub
Builds, extends and migrates Foundry VTT v14 packages, both modules and game systems: manifests, documentTypes with TypeDataModel, ApplicationV2 sheets, hooks and settings, GM-checked queries and sockets, dice and message modes, Active Effects V2, status effects, Regions as templates, Scene Levels, compendium packs, world migrations and the Vite build. Use when writing or fixing a Foundry module or system, porting one from v13 to v14, or shipping a release to the Foundry package list.
In this repository46 other files it gives its agents.
- asaasSkill
- betterauth-integrationSkill
- bullmq-game-queuesSkill
- character-design-narrativeSkill
- ci-cd-gameSkill
- claude-agent-sdkSkill
- database-performance-tuningSkill
- elevenlabs-sound-musicSkill
- game-anti-cheatSkill
- game-backend-architectureSkill
- game-blenderSkill
- game-clientSkill
- game-design-fundamentalsSkill
- game-architectSkill
- game-balanceSkill
- game-buildSkill
- game-expandSkill
- game-loreSkill
- game-questSkill
- game-reviewSkill
- game-devSkill
- game-economy-designSkill
- game-godotSkill
- game-localizationSkill
- gameplay-analyticsSkill
- game-save-loadSkill
- game-state-syncSkill
- game-unitySkill
- judgeSkill
- level-designSkill
- matchmaking-systemSkill
- mmo-designSkill
- monitoring-game-opsSkill
- nuvemshop-sdkSkill
- openclaw-genieSkill
- postgres-game-schemaSkill
- procedural-genSkill
- quest-mission-designSkill
- quest-narrative-coherenceSkill
- react-animationsSkill
- redis-game-patternsSkill
- skill-progression-treesSkill
- story-structure-gameSkill
- stripe-game-paymentsSkill
- ui-ux-gameSkill
- worldbuildingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 1 is distinctive, and 14 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
After every build, check that each path in dist/module.json exists.
- Very specific: line 35
Keep static rules data in one config.mjs assigned to CONFIG.MY_SYSTEM, and stage work across init, i18nInit, setup and ready.
- Very specific: line 55
Delete or replace keys with the operator globals, not "-=key" or "==key": _del deletes a key and _replace(value) assigns without merging.
- Very specific: line 57
Read references/document-model.md and references/actor-item-classes.md.
- Very specific: line 74
Check that user with canUserModify(user, action, data), testUserPermission, or a game rule the GM can verify.
- Very specific: line 83
Always await roll.evaluate().
- Very specific: line 115
Run it on one client: if (game.user !== game.users.activeGM) return.
- Very specific: line 116
Before the first write, ask the GM to back up the world (Setup screen, right-click the world, Take Backup) and stop if they decline.
- Very specific: line 120
Read references/data-migration.md (systems), references/migration-guide.md (older version jumps) and references/v14-migration.md.
- Very specific: line 131
Root-level
changeswith numeric modes: Write system.changes with a string type. - Very specific: line 132
"-=key"and"==key"update keys: Use _del and _replace. - Distinctive: line 133
Building templates as MeasuredTemplates: Place a Region.
- Very specific: line 134
Reading
scene.background: Read the viewed Level. - Very specific: line 138
update()inside_preCreate: Use this.updateSource(). - Very specific: line 142
Hardcoded English: Use game.i18n.localize and a lang file.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Foundry VTT development (v14)
A package is either a module (extends any world) or a system (defines the rules: Actor and Item types, dice, combat, sheets). Both share the same document model, application framework, hooks and v14 changes. This file holds the decisions; references/ holds the detail.
The current stable build is 14.370 (Version 14 Stable 12, November 2026). Check names against the v14 API docs, https://foundryvtt.com/api/v14/, before you rely on them. Foundry publishes no llms.txt or agent skill. Coming from v13? Read references/v14-migration.md first.
Building a module
- Copy
boilerplate/module/. It builds with Vite:src/holds code,static/holdsmodule.json, templates and lang files, andbun run buildwrites a completedist/. - Set
idinstatic/module.json. It must match the folder name underData/modules/. - The entry point is
scripts/main.mjsindist/(fromsrc/main.mjs). Keepesmodulesand the VitefileNamein step. - Declare sub-types under
documentTypeswithout a prefix. Foundry prefixes them with the module id, soherobecomesmy-module.hero: registerCONFIG.Actor.dataModels["my-module.hero"]and sheets withtypes: ["my-module.hero"]. Readreferences/module-subtypes.md. - Symlink
dist/intoData/modules/<id>/, runbun run dev, enable the module in a world.bun run formatandbun run lintwork as shipped:biome.jsoncis whatbunx ultracite initwrites, plus the Foundry globals. - Load CSS through the manifest with
"layer": "modules". Readreferences/module-styling.md. - After every build, check that each path in
dist/module.jsonexists. A missingmodule.json, stylesheet or lang file fails silently in Foundry.
Building a system
- Copy
boilerplate/system/. The entry point isscripts/main.mjs, declared insystem.jsonesmodules. Runbun installandbun run build:cssto compilestyles/my-system.css, the stylesheetsystem.jsonlists. - Declare every type in
system.jsondocumentTypes(withhtmlFieldsandfilePathFieldsper sub-type), and give each aTypeDataModelinCONFIG.<Doc>.dataModels. System types carry no prefix. - Ship no
template.json. Release 14.352 put it into its deprecation period. Readreferences/system-manifest.mdbefore you move an old system off it. - Set
CONFIG.Actor.documentClassandCONFIG.Item.documentClassininit, and implementgetRollData()so@abilities.str.modresolves. - Keep static rules data in one
config.mjsassigned toCONFIG.MY_SYSTEM, and stage work acrossinit,i18nInit,setupandready. Readreferences/production-patterns.md. - Dice, combat and character creation each have a reference:
references/dice-system.md,references/combat-initiative.md,references/character-creation.md. - Systems carry most CSS in a world. Read
references/styling-and-themes.md.
Lifecycle
| Hook | Ready to use | Do here |
init | CONFIG, game.settings.register | data models, document classes, sheets, settings, CONFIG.queries, status effects, change types |
setup | every package has run init | work that depends on other packages, enrichers |
ready | game.user, game.actors, canvas | migrations, GM-only side effects |
game.user is not set in init. Read references/hooks-and-settings.md.
Data model
TypeDataModel.defineSchema()gives fields, defaults (initial), validation and inheritance. Shared fields go in a base class.prepareDerivedData()computes in memory. Never write to the database there.static migrateData(source, options)renames and reshapes raw data on every load and must return it: end withreturn super.migrateData(source, options).- Flags store module data on any document:
actor.setFlag("my-module", "key", value). - Delete or replace keys with the operator globals, not
"-=key"or"==key":_deldeletes a key and_replace(value)assigns without merging. Release 14.365 calls them operators; the v14 API documents the classes infoundry.data.operators(ForcedDeletion,ForcedReplacement).
Read references/document-model.md and references/actor-item-classes.md.
Applications
Build every window on HandlebarsApplicationMixin(ApplicationV2), and sheets on ActorSheetV2 / ItemSheetV2 from foundry.applications.sheets. The AppV1 classes under foundry.appv1 are deprecated. Rich text is ProseMirror only. Read references/application-v2.md, references/handlebars-and-templates.md and references/accessibility.md. Old global names (Actors, DocumentSheetConfig) redirect until Version 15; read references/namespaces.md for the namespaced paths.
Player actions the GM must perform
A player can update documents they own. For anything else (damage to a monster, an item moved between players), ask the active GM and let the GM check the request:
The code is in references/sockets-rolls-packs.md ("GM-Authoritative Pattern"), and boilerplate/module/src/socket-handler.mjs is the full version. Both are v14 only.
Why it is written this way:
- The handler runs on the GM client with full rights. Without a check on the asking user, any player can edit any document by sending a crafted request.
- A raw
game.socketlistener receives only what the sender emitted, so a user id in the payload can be forged. In v14 a query handler gets the askingUserin its second argument (core'sdialogquery takes the same{ user }). In v13 that argument holds only timeout information, so every handler refuses whenuseris not afoundry.documents.User. - This skill relies on core setting
useron the server side. No public page states that a client cannot forge it. - Check that user with
canUserModify(user, action, data),testUserPermission, or a game rule the GM can verify. Bound every number and allow-list the fields you write. game.users.activeGMpicks one GM, so two online GMs do not apply the change twice.- The GM performs the write, so document hooks (
createItem,updateActor) see the GM as the author, not the player. - Sending a query needs the
QUERY_USERpermission. Players have it by default, but a GM can revoke it.
Raw sockets need "socket": true in the manifest and the event name module.<id> or system.<id>; queries need neither.
Dice and chat
Always await roll.evaluate(). Visibility is a message mode: pass { messageMode } (public, gm, blind, self, ic, the keys of CONFIG.ChatMessage.modes) to Roll#toMessage, or pass nothing to use the user's core.messageMode setting. rollMode keeps working until V16 (release 14.355); convert old values with Roll._mapLegacyRollMode. Read references/dice-system.md and references/chat-and-ui.md.
Active Effects and status effects
v14 Active Effects are typed documents. Changes live in system.changes as { key, type, value, phase, priority } with a string type (add, subtract, multiply, override, upgrade, downgrade, custom). Effects on items apply through actor.allApplicableEffects(). Register sub-types and change types in init. Read references/active-effects-v2.md.
CONFIG.statusEffects is an object keyed by status id (release 14.352; the v14 API types it {[id]: StatusEffectConfig}). The notes keep array use backward compatible, but write the keyed form, which adds or removes one entry and leaves other packages' entries alone:
CONFIG.statusEffects["my-module.burning"] = {
id: "my-module.burning",
name: "MY_MODULE.Effect.burning",
img: "modules/my-module/icons/burning.svg",
system: { changes: [{ key: "system.abilities.dex", type: "subtract", value: 2 }] },
};
delete CONFIG.statusEffects.dead; // a system replacing a core conditionRegions, templates and levels
The v14 release notes say Measured Templates are gone; Template Regions replace them. Place an area effect with canvas.regions.placeRegion(data, { create }), attach an aura with RegionDocument.createTokenEmanation(token, range, regionData), and do not rely on any MeasuredTemplate API. Since 14.370 a system configures Measured Template Mode through CONFIG.Region.templateModeConfig (shapeTypes, gridBased, coneAngle, coneCurvature, ringAlignment, highlightMode, ...), and the Region layer has a Grid Space tool that adds or removes single grid spaces. Read references/measured-templates.md and references/regions-and-grid.md.
A Scene holds Level documents; backgrounds, foregrounds and fog live on the Level. Read references/scene-levels.md before touching scene visuals or iterating placeables.
Compendium packs and adventures
Declare packs in the manifest. Keep pack contents in git as files with the official CLI: fvtt package unpack and fvtt package pack (there is no extract verb). Read references/tooling-and-publishing.md and references/adventure-documents.md.
Migrations
A migration rewrites world data and cannot be undone.
- Run it on one client:
if (game.user !== game.users.activeGM) return;inready. - Before the first write, ask the GM to back up the world (Setup screen, right-click the world, Take Backup) and stop if they decline. Both boilerplates do this with
DialogV2.confirm. - Record the schema version after each step, so a failure resumes at the failed step.
- Rename and reshape in
migrateData; persist in the world pass.
Read references/data-migration.md (systems), references/migration-guide.md (older version jumps) and references/v14-migration.md.
Pitfalls
- A GM-side handler that trusts the request. It lets any player edit any document. Check the asking user from the query context and allow-list fields.
- Copying statics in Vite
buildStart.emptyOutDirwipes them, anddist/ships withoutmodule.json. Copy inwriteBundle. package.jsonscripts that call missing files. Aprebuildentry runs before every build; if its file is missing, the build fails.- Unprefixed module sub-types. A module registering
CONFIG.Actor.dataModels.heroregisters nothing Foundry uses; the type ismy-module.hero. - Migrating without a backup, or on every GM client at once.
fvtt package extract. The verb isunpack.- Passing
rollMode. PassmessageMode, or nothing. - Root-level
changeswith numeric modes. Writesystem.changeswith a stringtype. "-=key"and"==key"update keys. Use_deland_replace.- Building templates as MeasuredTemplates. Place a Region.
- Reading
scene.background. Read the viewed Level. CONFIG.<Doc>.layerClass. Deprecated (14.352); setCONFIG.Canvas.layers.<name>.layerClass.- Opening a bundled
.htmlfile in a browser. Since 14.361 it is served astext/plain; Handlebars templates still render. - A missing
getRollData().@references in formulas resolve to nothing. update()inside_preCreate. Usethis.updateSource().- Side effects in
_onCreate/_onUpdateon every client. Guard withif (game.userId !== userId) return;. - Patching core without libWrapper. Two modules patching the same method break each other.
compatibility.maximumset without a known break. It blocks users on newer builds.- Hardcoded English. Use
game.i18n.localizeand a lang file.
Files
References (read when the task touches the topic):
references/v14-migration.md- read when porting a v13 package to v14.references/namespaces.md- read when replacing a legacy global with itsfoundry.*path.references/document-model.md- read when defining fields, lifecycle methods, flags or embedded documents.references/module-subtypes.md- read when a module adds Actor, Item or page sub-types.references/system-manifest.md- read when writingsystem.jsonor retiringtemplate.json.references/actor-item-classes.md- read when subclassing Actor or Item.references/production-patterns.md- read when laying out a system past a few files.references/application-v2.md- read when building a window, sheet or dialog.references/handlebars-and-templates.md- read when writing templates or form helpers.references/accessibility.md- read when building any sheet or dialog.references/hooks-and-settings.md- read when registering hooks, settings or keybindings.references/sockets-rolls-packs.md- read when using sockets, queries, rolls, packs or localization.references/permissions-and-ownership.md- read when checking roles, ownership or GM-only paths.references/chat-and-ui.md- read when changing chat, context menus, enrichers or the editor.references/dice-system.md- read when writing custom dice terms or roll classes.references/combat-initiative.md- read when changing initiative or the combat flow.references/combat-and-tokens.md- read when changing the tracker, the Token HUD or token defaults.references/character-creation.md- read when adding starter items or prototype tokens.references/advanced-system-features.md- read when adding conditions, macros, enrichers, token bars or journal page types.references/active-effects-v2.md- read when creating effects, change types, phases or expiry.references/measured-templates.md- read when replacing templates with Regions.references/regions-and-grid.md- read when using Regions, behaviors or grid math.references/scene-levels.md- read when touching Levels, scene visuals or placeable iteration.references/canvas-and-pixi.md- read when adding canvas layers or PIXI drawing.references/vision-and-lighting.md- read when changing vision, detection or lighting.references/audio-and-macros.md- read when playing sounds or creating macros.references/adventure-documents.md- read when shipping an adventure or quickstart content.references/data-migration.md- read when migrating a system's world data.references/migration-guide.md- read when jumping from v11, v12 or v13.references/build-pipeline.md- read when changing the Vite build or the dev loop.references/tooling-and-publishing.md- read when using the CLI, types, or the release workflow.references/module-styling.md- read when styling a module.references/styling-and-themes.md- read when styling a system.references/testing-with-quench.md- read when writing in-game tests.references/sources.md- read when checking where a claim comes from.
Checklists (copy when preparing a release):
templates/module-checklist.md- copy when releasing a module.templates/system-checklist.md- copy when releasing a system.
Module boilerplate (copy when starting a module; built and checked with Vite 8.3.8):
boilerplate/module/package.json- copy when starting a module: scripts and pinned dev dependencies.boilerplate/module/biome.jsonc- copy when starting a module: the ultracite config with Foundry globals.boilerplate/module/.gitignore- copy when starting a module: Biome reads it; ignores node_modules and dist.boilerplate/module/vite.config.mjs- copy when starting a module: fixed-name output, static copy after write, dev proxy.boilerplate/module/src/main.mjs- copy when starting a module: hooks, settings, backup-gated migrations.boilerplate/module/src/type-data-model.mjs- copy when adding an Actor sub-type.boilerplate/module/src/actor-sheet.mjs- copy when building an ActorSheetV2.boilerplate/module/src/socket-handler.mjs- copy when players need GM-performed writes.boilerplate/module/static/module.json- copy when starting a module: v14 manifest.boilerplate/module/static/templates/sheet.hbs- copy when building the sheet template.boilerplate/module/static/lang/en.json- copy when starting a module: every string the boilerplate uses.boilerplate/module/static/styles/my-module.css- copy when starting a module: scoped starter CSS.
System boilerplate (copy when starting a system):
boilerplate/system/system.json- copy when starting a system: v14 manifest with documentTypes and migration flags.boilerplate/system/package.json- copy when starting a system: thebuild:cssstep (less 4.9.1).boilerplate/system/lang/en.json- copy when starting a system: every string the boilerplate uses, including the migration dialog.boilerplate/system/scripts/main.mjs- copy when starting a system: entry, staged hooks, backup-gated migrations.boilerplate/system/scripts/config.mjs- copy when starting a system: static rules data.boilerplate/system/scripts/settings.mjs- copy when starting a system: settings in one place.boilerplate/system/scripts/migration.mjs- copy when starting a system: version-gated world migration.boilerplate/system/scripts/actor.mjs- copy when starting a system: Actor class with getRollData.boilerplate/system/scripts/item.mjs- copy when starting a system: Item class with roll().boilerplate/system/scripts/data/_module.mjs- copy when starting a system: data model barrel.boilerplate/system/scripts/data/character-data.mjs- copy when defining a character type.boilerplate/system/scripts/data/npc-data.mjs- copy when defining an NPC type.boilerplate/system/scripts/data/weapon-data.mjs- copy when defining a weapon type.boilerplate/system/scripts/data/spell-data.mjs- copy when defining a spell type.boilerplate/system/scripts/documents/_module.mjs- copy when starting a system: document class barrel.boilerplate/system/scripts/sheets/_module.mjs- copy when starting a system: sheet barrel.boilerplate/system/scripts/sheets/character-sheet.mjs- copy when building the actor sheet.boilerplate/system/scripts/sheets/item-sheet.mjs- copy when building the item sheet.boilerplate/system/templates/actor/character-sheet.hbs- copy when building the actor sheet template.boilerplate/system/templates/item/item-sheet.hbs- copy when building the item sheet template.boilerplate/system/styles/my-system.less- copy when starting system CSS: the entry file.boilerplate/system/styles/variables/base.less- copy when starting system CSS: theme-neutral tokens.boilerplate/system/styles/variables/light.less- copy when starting system CSS: light theme.boilerplate/system/styles/variables/dark.less- copy when starting system CSS: dark theme.boilerplate/system/styles/v2/sheets.less- copy when styling shared sheet chrome.boilerplate/system/styles/v2/typography.less- copy when styling type.boilerplate/system/styles/v2/character.less- copy when styling the character sheet.boilerplate/system/styles/v2/items.less- copy when styling item sheets.boilerplate/system/styles/v2/apps.less- copy when styling dialogs and popouts.boilerplate/system/styles/v2/chat.less- copy when styling chat cards.
Related skills
ci-cd-gamefor CI pipelines beyond the release workflow.game-localizationfor string tables and translation workflow.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

