This skill should be used when importing Foundry classes, registering sheets, loading templates, enriching HTML, or using any Foundry API that has moved to namespaces. Covers compat wrappers, deferred sheet registration, and the modern-first fallback pattern.
View on GitHubImproperSubset/hh-agentics
fvtt-dev
fvtt-dev/skills/fvtt-version-compat/SKILL.md
January 21, 2026
Select agents to install to:
npx add-skill https://github.com/ImproperSubset/hh-agentics/blob/main/fvtt-dev/skills/fvtt-version-compat/SKILL.md -a claude-code --skill fvtt-version-compatInstallation paths:
.claude/skills/fvtt-version-compat/# Foundry VTT Version Compatibility (V12/V13/V15+)
Use compatibility wrappers to avoid deprecation warnings when APIs move from globals to namespaces across Foundry versions.
## When to Use This Skill
Invoke this skill when:
### ✅ Use Compat Wrappers For:
- **Importing Foundry classes** - ActorSheet, ItemSheet, TextEditor
- **Registering sheets** - Actor sheets, item sheets, document sheets
- **Loading templates** - Handlebars template loading
- **Enriching HTML** - TextEditor.enrichHTML for journal content
- **Generating IDs** - randomID() for unique identifiers
- **Any Foundry API** - That has moved or will move to namespaces
### ❌ Don't Use Compat Wrappers For:
- **Stable globals** - `game`, `ui`, `CONFIG`, `Hooks`
- **Project-specific code** - Your own classes and functions
- **One-off migrations** - If only targeting a single Foundry version
- **Styling/layout** - CSS and templates (not API drift)
## The Problem: API Migration Across Versions
### What Changed Across Foundry Versions
**Foundry V11/V12 (Legacy):**
```javascript
// APIs available as globals
ActorSheet
ItemSheet
TextEditor.enrichHTML()
loadTemplates()
renderTemplate()
randomID()
Actors.registerSheet()
```
**Foundry V13+ (Namespaced):**
```javascript
// APIs moved to namespaces
foundry.appv1.sheets.ActorSheet
foundry.appv1.sheets.ItemSheet
foundry.applications.ux.TextEditor.implementation.enrichHTML()
foundry.applications.handlebars.loadTemplates()
foundry.applications.handlebars.renderTemplate()
foundry.utils.randomID()
foundry.applications.api.DocumentSheetConfig.registerSheet()
```
**Foundry V15+ (Legacy Removed):**
```
Globals will be REMOVED entirely
↓
Direct global access will break
↓
Must use namespaced APIs only
```
### Why This Breaks Code
```javascript
// ❌ This worked in V11/V12, will BREAK in V15+
import { ActorSheet } from "somewhere"; // No longer a global!
class MySheet extends ActorSheet {
// ...
}
// ❌ This throws deprecation warnings in V13
TextEditor.enrichH