From deed9892eaa31f80619c1ce81bc6052e853852fe Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 08:53:36 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 15 + README.md | 3 + commands/dm-prepare.md | 142 ++++++++++ commands/dm-start-campaign.md | 519 ++++++++++++++++++++++++++++++++++ commands/dm-wrap-up.md | 304 ++++++++++++++++++++ plugin.lock.json | 101 +++++++ skills/dnd-dm/.env.example | 4 + skills/dnd-dm/README.md | 201 +++++++++++++ skills/dnd-dm/SKILL.md | 466 ++++++++++++++++++++++++++++++ skills/dnd-dm/dm-guide.md | 386 +++++++++++++++++++++++++ skills/dnd-dm/package.json | 13 + skills/dnd-dm/roll-dice.sh | 177 ++++++++++++ skills/dnd-dm/speak-npc.js | 285 +++++++++++++++++++ skills/npc-voice/.env.example | 4 + skills/npc-voice/README.md | 141 +++++++++ skills/npc-voice/SKILL.md | 129 +++++++++ skills/npc-voice/package.json | 13 + skills/npc-voice/speak-npc.js | 285 +++++++++++++++++++ 18 files changed, 3188 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 commands/dm-prepare.md create mode 100644 commands/dm-start-campaign.md create mode 100644 commands/dm-wrap-up.md create mode 100644 plugin.lock.json create mode 100644 skills/dnd-dm/.env.example create mode 100644 skills/dnd-dm/README.md create mode 100644 skills/dnd-dm/SKILL.md create mode 100644 skills/dnd-dm/dm-guide.md create mode 100644 skills/dnd-dm/package.json create mode 100755 skills/dnd-dm/roll-dice.sh create mode 100755 skills/dnd-dm/speak-npc.js create mode 100644 skills/npc-voice/.env.example create mode 100644 skills/npc-voice/README.md create mode 100644 skills/npc-voice/SKILL.md create mode 100644 skills/npc-voice/package.json create mode 100755 skills/npc-voice/speak-npc.js diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..60ebf2c --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,15 @@ +{ + "name": "dnd-dm", + "description": "Complete D&D Dungeon Master assistant with campaign management, dice rolling, and AI-powered NPC voices using ElevenLabs", + "version": "0.1.0", + "author": { + "name": "Sahar Carmel", + "email": "sahar@example.com" + }, + "skills": [ + "./skills" + ], + "commands": [ + "./commands" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ba8d215 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# dnd-dm + +Complete D&D Dungeon Master assistant with campaign management, dice rolling, and AI-powered NPC voices using ElevenLabs diff --git a/commands/dm-prepare.md b/commands/dm-prepare.md new file mode 100644 index 0000000..e9fbd93 --- /dev/null +++ b/commands/dm-prepare.md @@ -0,0 +1,142 @@ +# DM Prepare - Resume D&D Campaign Session + +You are the Dungeon Master preparing to resume a D&D campaign session. Follow these steps to refresh your memory and prepare for the session. + +## Step 1: Read Campaign Summary + +Read the campaign summary to understand the current state: + +```bash +cat .claude/skills/dnd-dm/sessions/*/campaign-summary.md +``` + +Note: +- Current party location and situation +- Party HP and resources +- Active quests +- Important NPCs and their status + +## Step 2: Read Complete Campaign Log + +Read the master campaign log to review all sessions: + +```bash +cat .claude/skills/dnd-dm/sessions/*/campaign-log.md +``` + +Focus on: +- The last session (most recent) +- The cliffhanger and where the party stopped +- Key decisions and outcomes +- What threats or mysteries are unresolved + +## Step 3: Read Character Sheets + +Read all character files to know their capabilities: + +```bash +cat .claude/skills/dnd-dm/sessions/*/character-*.md +``` + +Check: +- Current HP and resources (spell slots, abilities) +- Equipment and special items +- Class features they can use +- XP and level + +## Step 4: Query Adventure Book for Upcoming Content + +Based on where the party is, read ahead in the adventure book: + +```bash +cd /Users/saharcarmel/Code/saharCode/CandleKeep && uv run candlekeep pages -p "" +``` + +Prepare: +- Next 1-2 encounters or locations +- NPCs they might meet (personality, goals, information) +- Monster stats for potential combat +- Traps, puzzles, or challenges +- Treasure or rewards + +## Step 5: Summarize for the Player + +Present a concise recap: + +1. **Last Session Summary** (2-3 sentences) + - What happened + - Key accomplishments or discoveries + +2. **Current Situation** + - Where they are right now + - Immediate circumstances + - Party status (HP, resources) + +3. **What You've Prepared** + - Brief overview of what's ahead (without spoilers!) + - Options available to them + - Time-sensitive considerations + +4. **Ask**: "What do you want to do?" + +## Example Output Format: + +``` +📖 CAMPAIGN RESUMED: [Campaign Name] + +### Last Session Recap: +[2-3 sentence summary of what happened] + +### Current Situation: +**Location**: [Where they are] + +**Party Status:** +- Character 1: HP X/Y, resources +- Character 2: HP X/Y, resources +- XP: [amount] each + +**Active Quests:** +- [Quest 1] +- [Quest 2] + +--- + +### What I've Prepared: + +[Brief description of what's ahead if they continue in likely direction] + +**Key Information:** +- [Important detail 1] +- [Important detail 2] + +--- + +### Your Options: + +1. **[Option 1]** + - [What this involves] + - [Considerations] + +2. **[Option 2]** + - [What this involves] + - [Considerations] + +3. **[Option 3]** + - [What this involves] + - [Considerations] + +--- + +**What do you want to do?** +``` + +## Important Notes: + +- **Don't spoil surprises**: Mention what's prepared but don't reveal all secrets +- **Present options**: Give players agency, don't railroad +- **Consider party state**: Account for their current resources and capabilities +- **Be ready to improvise**: Players might do something unexpected + +--- + +**After completing preparation, you are ready to DM the session!** diff --git a/commands/dm-start-campaign.md b/commands/dm-start-campaign.md new file mode 100644 index 0000000..95ed6b2 --- /dev/null +++ b/commands/dm-start-campaign.md @@ -0,0 +1,519 @@ +# DM Start Campaign - Initialize a New D&D Campaign + +You are the Dungeon Master starting a brand new D&D campaign. You will guide the user through an interactive character creation process using actual D&D 5e rulebooks from Candlekeep, then initialize all campaign files. + +**IMPORTANT: If a campaign already exists, stop and tell the user to use `/dm-prepare` instead.** + +## Step 1: Choose Game Mode + +**Ask the user first, before any other questions:** + +"Do you want to play in **Adventure Mode** or **Debug Mode**? + +- **Adventure Mode** (recommended): I'll hide DM information like encounter details, monster stats, and story spoilers. You'll experience the adventure with mystery and surprises intact. +- **Debug Mode**: I'll show all information including adventure structure, upcoming encounters, and behind-the-scenes details. Useful for learning or co-DMing. + +Which mode do you prefer?" + +**Record their choice.** This determines how much information to reveal in all following steps. + +## Step 2: Find D&D Rulebooks + +Use the candlekeep skill to check what rulebooks are available. Ask it to list all books and identify the Player's Handbook (PHB). + +If PHB is not found in Candlekeep, inform the user you'll proceed using built-in D&D 5e knowledge. + +Present findings to the user. + +## Step 3: Select Adventure Book + +Use the candlekeep skill to list available D&D adventure books. + +Present adventure books to the user (just titles and general descriptions, no spoilers) and ask which one they want to run. + +## Step 4: Confirm Adventure Choice + +After user selects an adventure: + +**If Debug Mode**: Use the candlekeep skill to get the full table of contents. Show all chapters and sections so they can choose where to start. + +**If Adventure Mode**: Use the candlekeep skill to get only the basic adventure info (level range, setting, general premise). DO NOT show the table of contents or specific chapter/encounter names. Just confirm: "This adventure is designed for levels X-Y. We'll start from the beginning. Ready to proceed?" + +## Step 5: Gather Campaign Settings + +Ask the user the following questions: + +1. **Campaign Name**: Suggest using the adventure name (e.g., "Lost Mine of Phandelver Campaign") or let them choose a custom name. + +2. **Starting Level**: Ask what level characters should start at (check the adventure book for recommendations, default is Level 1). + +3. **Number of Players**: Ask how many players will be in the party. + +4. **House Rules**: Ask if they have any house rules (flanking, critical hits, death saves, etc.). Record all house rules mentioned. + +Make note of all responses for use in campaign file creation later. + +## Step 6: Create Characters (Repeat for Each Player) + +For each player in the party, guide them through character creation using the following workflow. Tell the user: "Let's create Character #X using D&D 5e rules. I'll guide you step-by-step." + +### Step 6.1: Select Race + +If you have PHB access in Candlekeep, use the candlekeep skill to query the races section of the Player's Handbook. + +Present available races to the user with key traits: +- Race name and description +- Ability score bonuses +- Speed and special features (darkvision, resistances, etc.) +- Subraces if applicable + +Ask the user which race they choose. If the race has subraces, ask them to pick one. Record the choice and ability bonuses. + +### Step 6.2: Select Class + +If you have PHB access in Candlekeep, use the candlekeep skill to query the classes section of the Player's Handbook. + +Present available classes to the user with: +- Class name and description +- Hit die +- Primary ability +- Saving throw proficiencies +- Armor and weapon proficiencies +- Whether they're a spellcaster + +Ask which class they choose. Record the class, hit die, and all proficiencies. + +### Step 6.3: Generate Ability Scores + +Present three methods for generating ability scores: + +1. **Roll (4d6 drop lowest)** - Roll dice for random scores +2. **Standard Array** - Use 15, 14, 13, 12, 10, 8 +3. **Point Buy** - Spend 27 points to customize (scores 8-15) + +After user chooses a method: + +**If Rolling**: Use the dice roller 6 times: +```bash +cd ~/.claude/skills/dnd-dm && ./roll-dice.sh 4d6 --label "Ability Score" +``` +For each roll, drop the lowest die and sum the remaining 3. Have the user assign the 6 results to STR, DEX, CON, INT, WIS, CHA. + +**If Standard Array**: Have user assign 15, 14, 13, 12, 10, 8 to the six abilities. + +**If Point Buy**: Guide user through spending 27 points. Each point increases an ability score by 1 (max 15 before racial bonuses). + +After base scores are assigned, apply the racial bonuses from Step 6.1 and calculate ability modifiers ((score - 10) / 2, rounded down). + +Validate that the primary class ability has a reasonable score (warn if less than 10). + +### Step 6.4: Select Background + +If you have PHB access in Candlekeep, use the candlekeep skill to query the backgrounds section of the Player's Handbook. + +Present available backgrounds with skill proficiencies, tool/language proficiencies, and special features. + +Ask which background they choose. Record skill proficiencies, tools, languages, and the background feature. + +Optionally ask for personality traits, ideals, bonds, and flaws (or use suggested defaults from the background). + +### Step 6.5: Calculate Combat Stats + +Calculate the following: + +**Hit Points**: Maximum hit die + Constitution modifier +- Example: Fighter (d10) with CON +2 = 10 + 2 = 12 HP + +**Armor Class**: Determined by starting armor + DEX modifier + +**Proficiency Bonus**: +2 at level 1 + +**Skills**: Select class skills (check class for number allowed), add background skills. Calculate bonuses as ability modifier + proficiency bonus (+2). + +**Saving Throws**: Note proficient saves from class, calculate bonuses. + +Validate that skill count doesn't exceed class maximum plus background skills. + +### Step 6.6: Select Starting Equipment + +If you have PHB access in Candlekeep, use the candlekeep skill to query the class's starting equipment section from the Player's Handbook. + +Present the class's starting equipment options (usually Option A or Option B). User chooses one. + +Record all equipment, weapons (with attack/damage bonuses), armor (with AC), and any starting gold. + +### Step 6.7: Choose Spells (If Spellcaster) + +If the character's class casts spells, guide spell selection: + +1. Identify spellcasting ability (INT for Wizards, WIS for Clerics/Druids, CHA for Bards/Sorcerers/Warlocks) +2. Calculate Spell Save DC = 8 + proficiency bonus + ability modifier +3. Calculate Spell Attack = proficiency bonus + ability modifier + +Ask user to select cantrips and 1st-level spells based on class limits. If you have PHB, query for spell lists. + +Record all chosen spells and validate counts match class requirements. + +### Step 6.8: Personality & Backstory + +Ask user for (or suggest from background): +- 2 Personality Traits +- 1 Ideal +- 1 Bond +- 1 Flaw +- Optional backstory + +Record all responses. + +### Step 6.9: Validate & Confirm Character + +Present a summary of the completed character with all stats, proficiencies, equipment, and spells. + +Ask user: "Does this look correct?" + +If yes, character is complete. If no, ask what needs adjustment. + +**Repeat Steps 6.1-6.9 for each player in the party.** + +## Step 7: Create Campaign Files + +After all characters are created, create the campaign directory: + +```bash +mkdir -p ~/.claude/skills/dnd-dm/sessions/ +``` + +Use kebab-case for the campaign name (e.g., "lost-mine-phandelver"). + +Now create three types of files: + +### File 1: campaign-summary.md + +```markdown +# + +**Adventure**: +**Starting Date**: +**Dungeon Master**: Claude (powered by D&D 5e rules) +**Number of Players**: +**Starting Level**: + +## Campaign Overview + + + +## Party Roster + + +- **** - (Player: ) + +## Current Status + +**Session**: 0 (Pre-Campaign Setup) +**Party Level**: +**Current Location**: +**Game Mode**: + +## Active Quests + +### +- **Status**: Active +- **Objective**: +- **Context**: + +## Session Log + + + +## Location History + +- **Session 0**: - Campaign begins + +## Important NPCs + + + +## House Rules + + +- +- + +## Notes + +Campaign created using rulebooks: +- Player's Handbook (Book ID: ) +- (Book ID: ) +``` + +--- + +### File 2: campaign-log.md + +Create `.claude/skills/dnd-dm/sessions//campaign-log.md`: + +```markdown +# - Master Campaign Log + +Detailed accounts of all sessions in chronological order. + +--- + +# Session 0 - Campaign Setup + +**Date**: +**Duration**: Campaign Initialization + +## Campaign Configuration + +**Adventure**: +**Rulebooks Used**: +- Player's Handbook +- + +**Starting Level**: +**Party Size**: +**Game Mode**: + +## The Party + + + +### - +**Player**: +**Background**: + +**Ability Scores**: +- STR X (+Y), DEX X (+Y), CON X (+Y) +- INT X (+Y), WIS X (+Y), CHA X (+Y) + +**Combat Stats**: AC X, HP X, Init +X, Speed X ft + +**Key Features**: +- +- +- + +**Equipment**: + + + +## Starting Situation + + + +**Initial Quest**: + +**Party Starting Resources**: +- Total starting gold: +- Combined equipment value: ~ + +## Campaign Ready + +Characters are created, files initialized. The adventure begins next session! + +--- +``` + +--- + +### File 3: Character Sheet Files + +For each character, create `.claude/skills/dnd-dm/sessions//character-.md`: + +```markdown +# + +**Player**: +**Race**: +**Class**: +**Background**: +**XP**: 0 / + +## Ability Scores + +- **Strength**: () +- **Dexterity**: () +- **Constitution**: () +- **Intelligence**: () +- **Wisdom**: () +- **Charisma**: () + +## Combat Stats + +- **Armor Class**: +- **Initiative**: +- **Speed**: ft. +- **Hit Points**: / +- **Hit Dice**: d +- **Proficiency Bonus**: + + +## Proficiencies + +**Armor**: +**Weapons**: +**Tools**: +**Saving Throws**: +**Skills**: + +## Features and Traits + +### Racial Traits + + +### Class Features + + +### Background Feature +****: + +## Equipment + +**Weapons**: +- : +, + +**Armor**: +- : AC + +**Adventuring Gear**: + + +**Currency**: +- GP: +- SP: +- CP: + +## Spellcasting (if applicable) + +**Spellcasting Ability**: +**Spell Save DC**: +**Spell Attack Bonus**: + + +**Cantrips** ( known): + + +**1st-Level Spells**: +- **Slots**: / +- **Prepared**: + +## Personality + +**Personality Traits**: +**Ideals**: +**Bonds**: +**Flaws**: + +**Backstory**: + +## Notes + + + +--- + +## Session Updates + + +``` + +## Step 8: Read Adventure Opening + +Use the candlekeep skill to query the adventure book for the opening section. + +**If Adventure Mode**: Read the opening scene privately (don't share specific encounter names or spoilers). Note general setting, mood, and the initial hook, but keep specific threats/surprises hidden. + +**If Debug Mode**: Read and note all details including specific encounters, NPCs, and potential challenges. + +## Step 9: Present Campaign Summary + +After all files are created, present this summary to the user: + +``` +🎲 CAMPAIGN INITIALIZATION COMPLETE 🎲 + +**Campaign**: +**Adventure**: +**Starting Level**: + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +📚 **Rulebooks Used**: +✓ Player's Handbook (Book ID: ) +✓ (Book ID: ) + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +👥 **The Party**: + +1. **** + + AC | HP | Init + + Key Stats: +, + + +2. **** + + AC | HP | Init + + Key Stats: +, + + + + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +📁 **Files Created**: +✅ ~/.claude/skills/dnd-dm/sessions// + ├── campaign-summary.md + ├── campaign-log.md + ├── character-.md + ├── character-.md + └── + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +✨ **Campaign is Ready to Begin!** + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +``` + +## Step 10: Begin the Adventure + +Now present the opening scene from the adventure book: + +**If Adventure Mode**: Narrate the opening scene without revealing upcoming encounters or spoilers. Set the scene, present the hook, but keep specific threats mysterious (e.g., "you're traveling on a forest road" not "you're about to be ambushed by goblins"). + +**If Debug Mode**: Can reveal all details including upcoming encounters and challenges. + +``` +📖 THE ADVENTURE BEGINS... + + + +**Opening Scene**: + +**The Hook**: + +**Party Status**: +- Location: +- All characters at full HP and resources +- + +**Initial Options**: +Based on the situation, present 3-5 options: +1.