Mythcode is MythForge’s portable stat-block format: plain YAML that any text editor (or any Game Master in a group chat) can read and write. Every block carries a schema: line that says what it is (mythforge/creature/v1, mythforge/item/v1, or mythforge/spell/v1); the app routes the import from that field alone, wherever it sits in the block. Blocks shared before mid-2026 may carry the older npcroller/ prefix instead; those still import, and re-saving or re-sharing writes the modern id.
Unknown fields are preserved, not rejected. Add your own keys (a campaign note, a source page number) and they survive import, edit, and re-share untouched. The one exception: inside the small fixed-shape objects (a save block, a damage[] entry, a spell slots[] entry) unknown keys are dropped on import.
To import: open the Compendium tab on any shelf and tap the Import (tray) icon in the header, then paste and tap Import. The app confirms what it imported and lands you on the right shelf; if a block fails, each offending field is called out by name. To go the other way, every creature, item, and spell in the app has a Share Mythcode action that emits this same format. Shared blocks spell out every default the original author left implicit, so they read a little longer than the templates below.
Templates below are minimal: required fields plus enough to be worth playing. Field tables list everything the format accepts. Every template and example on this page is imported verbatim by MythForge’s test suite before it ships.
Beast (creature)
Creatures use schema: mythforge/creature/v1. Only schema, name, ac, hp.average, and the six ability scores are required; everything else has a sensible default. Tags drive shelving and appearance: a creature-type tag (aberration, beast, celestial, construct, dragon, elemental, fey, fiend, giant, humanoid, monstrosity, ooze, plant, undead) picks the icon, and a size tag (tiny, small, medium, large, huge, gargantuan) shows a size badge. A few alias tags pick icons too: human, goblinoid, devil, demon, titan, shapechanger, and any tag starting with swarm.
Anywhere a table below says dice, the notation is validated: NdM with an optional modifier (6d8+12), keep clauses (4d6kh3, 2d20kl1), and an adv or dis suffix. Die counts run 1–100 and sides 2–1000. A damage string is dice first, then an optional damage type: 2d6+2 slashing, flat 1 piercing, or bare 2d6 with no type at all.
Entries of `level` (integer 1–9) and `max` (integer ≥ 1).
knownSpells
array
default `[]`
See knownSpells[] entries.
proficiencyBonus
integer 0–10
optional
saveDc
integer
optional
Overrides the derived DC.
attackBonus
integer
optional
Overrides the derived bonus.
spellcasting.knownSpells[] entries
Field
Type
Required
Notes
spellId
string
required
Reference id, e.g. `srd:bless`.
name
string
required
level
integer 0–9
required
0 = cantrip.
castMode
enum
default `slot`
`slot`, `at_will`, or `resource`.
resourceName
string
optional
Required in spirit when castMode is `resource`.
inventory[] entries
Field
Type
Required
Notes
itemId
string
required
Reference id, e.g. `srd:potion-of-healing`.
name
string
required
quantity
integer ≥ 1
default `1`
resourceName
string
optional
Ties consumption to a tracked resource.
source
Field
Type
Required
Notes
license
string
required
e.g. `CC-BY-4.0`, `Homebrew`.
attribution
string
optional
Worked example
schema: mythforge/creature/v1
name: Ashwing Drake
ac: 17
hp:
average: 75
formula: 10d10+20
speed:
walk: 30
fly: 60
abilities:
str: 18
dex: 12
con: 15
int: 8
wis: 11
cha: 14
saves:
dex: 4
con: 5
wis: 3
skills:
perception: 6
stealth: 4
senses:
- blindsight 30 ft.
- darkvision 120 ft.
passivePerception: 16
languages: Draconic
alignment: chaotic evil
xp: 1800
damageImmunities:
- fire
attacks:
- name: Bite
to_hit: 7
damage: 2d10+4 piercing
type: melee
- name: Claw
to_hit: 7
damage: 2d6+4 slashing
type: melee
resources:
- name: Fire Breath
max: 1
recharge: recharge_5_6
actions:
- name: Fire Breath
text: >-
The drake exhales fire in a 30-foot cone. Each creature in that area
must make a DC 14 Dexterity saving throw, taking 8d6 fire damage on a
failed save, or half as much damage on a successful one.
save:
ability: dex
dc: 14
onSuccess: half
damage:
- dice: 8d6
type: fire
resourceName: Fire Breath
legendaryActions:
- name: Tail Swipe
text: The drake makes one tail attack.
cost: 1
toHit: 7
damage:
- dice: 1d8+4
type: bludgeoning
reactions:
- name: Wing Buffet
text: >-
When a creature the drake can see hits it with a melee attack, the
drake beats its wings. The attacker must succeed on a DC 14 Strength
saving throw or be knocked prone.
save:
ability: str
dc: 14
onSuccess: none
tags:
- dragon
- large
source:
license: Homebrew
NPC
An NPC is not a separate schema: it is a creature (schema: mythforge/creature/v1) whose tags include npc. That one tag is what shelves it under NPCs instead of Beasts; every creature field above applies unchanged.
By convention, generated NPCs also carry a race tag and an occupation tag, which power the NPC shelf’s browsing. Races: human, elf, dwarf, halfling, gnome, half-orc, tiefling, dragonborn. Occupations: shopkeeper, innkeeper, blacksmith, farmer, guard, priest, scholar, thief, hunter, bard, healer, sailor. Both lists are conventions, not validation; any tag imports fine.
Template: paste this into Import
schema: mythforge/creature/v1
name: Marta Thistledown
ac: 10
hp:
average: 9
formula: 2d8
abilities:
str: 11
dex: 10
con: 12
int: 11
wis: 14
cha: 13
attacks:
- name: Iron skillet
to_hit: 2
damage: 1d6 bludgeoning
type: melee
traits:
- name: Heard It All
text: Advantage on Insight checks against obvious lies.
tags:
- npc
- halfling
- innkeeper
NPC tag conventions
Field
Type
Required
Notes
`npc`
tag
required for the NPCs shelf
Without it the creature shelves under Beasts.
race tag
tag
convention
One of: human, elf, dwarf, halfling, gnome, half-orc, tiefling, dragonborn.
Spells use schema: mythforge/spell/v1. Level 0 is a cantrip. The components block is required (all three flags default to false). castingTime, range, and duration are free-text strings, exactly as they read on a spell card.
Template: paste this into Import
schema: mythforge/spell/v1
name: Ember Lash
level: 1
school: evocation
castingTime: 1 action
range: 60 feet
components:
verbal: true
somatic: true
duration: Instantaneous
classes:
- sorcerer
- wizard
description: >-
A whip of embers lashes one creature you can see within range. The target
must succeed on a Dexterity saving throw or take 2d8 fire damage.
schema: mythforge/spell/v1
name: Veil of Brambles
level: 2
school: conjuration
castingTime: 1 action
range: 90 feet
components:
verbal: true
somatic: true
material: true
materialDesc: a handful of thorns
duration: Concentration, up to 1 minute
concentration: true
ritual: false
classes:
- druid
- ranger
description: >-
Grasping brambles erupt across a 20-foot square of ground you can see
within range. The area becomes difficult terrain, and a creature that
enters the area or starts its turn there must succeed on a Dexterity
saving throw or take 2d6 piercing damage.
higherLevels: >-
When you cast this spell using a spell slot of 3rd level or higher, the
damage increases by 1d6 for each slot level above 2nd.
tags:
- area
- control
Item
Items use schema: mythforge/item/v1. Only schema, name, and category are required. A weapon’s damage is a validated damage string, dice first with an optional damage type after, exactly as in creature attacks. properties and the armor-ish armorClass are free-form strings, and stealthDisadvantage a simple boolean, so the rest of the format never fights a homebrew item.
Template: paste this into Import
schema: mythforge/item/v1
name: Lantern of Steady Light
category: wondrous
rarity: common
weight: 2
cost: 50 gp
description: >-
This hooded lantern burns without oil, shedding bright light in a 30-foot
radius. Speaking its command word extinguishes or relights it.
schema: mythforge/item/v1
name: Duskfang Dagger
category: weapon
rarity: rare
attunement: true
weight: 1
cost: 2000 gp
damage: 1d4 piercing
properties:
- finesse
- light
- thrown (range 20/60)
description: >-
You gain a +1 bonus to attack and damage rolls made with this magic
weapon. While you hold it in dim light or darkness, you can take the
Hide action as a bonus action.
tags:
- magic