waylon256yhw avatar

dzmm-builder

Comprehensive skill for building, debugging, and optimizing DZMM.AI applications. Use this skill whe

by waylon256yhw|Open Source

DZMM Builder

Comprehensive Claude Code skill for building AI-driven interactive web applications on the DZMM.AI platform.

License: MIT Claude Code

๐ŸŽฏ Overview

DZMM Builder is a specialized Claude Code skill that provides comprehensive support for creating single-file HTML applications on the DZMM.AI platform. Whether you're building chatbots, visual novels, dating sims, content generators, or interactive games, this skill offers complete examples, reusable code patterns, and expert guidance.

โœจ Features

๐Ÿ—๏ธ 5 Architecture Patterns

  1. Stateless Generator - One-shot content generation (translators, summarizers)
  2. State Management Game - Interactive games with dynamic variables (dating sims, RPGs)
  3. Stateful Dialogue System - Multi-turn conversations with history
  4. Layered Cache Platform - Content communities with two-tier caching
  5. Visual Novel / Galgame System - Narrative-driven interactive fiction

๐Ÿ› ๏ธ Core Capabilities

  • Complete API Integration - Streaming AI, KV storage, chat API with branching narratives
  • Effect System - "Fourth wall breaking" browser control (lights, sounds, particles, visual effects)
  • Rich Text Rendering - Placeholder technique for nested structures (dialogue, options, formatting)
  • Message Management - Reroll/regenerate, edit, delete with context preservation
  • Multi-Opening System - Dynamic scene switching with state management
  • Resource Reuse Strategy - URL-based asset loading (100% fidelity vs โ‰ค60% CSS simulation)
  • Responsive Design - Mobile-first with Tailwind breakpoints
  • Migration Guide - Complete React/Vue to DZMM conversion workflow

๐Ÿ“š 19 Best Practices

Including:

  • DZMM API initialization (dual detection with timeout)
  • Resource reuse strategy (critical for migrations)
  • Conversation history management
  • Error handling with retry logic
  • Advanced prompt engineering (XML structure, emphasis sections)
  • KV storage patterns (versioning, chunking, caching)
  • Streaming AI response optimization
  • Mobile responsive design patterns

๐Ÿ“ Structure

dzmm-builder/
โ”œโ”€โ”€ SKILL.md                      # Main skill documentation (780+ lines)
โ”œโ”€โ”€ README.md                     # This file
โ”œโ”€โ”€ .gitignore                    # Git ignore rules
โ”œโ”€โ”€ assets/
โ”‚   โ””โ”€โ”€ examples/                 # 7 complete working applications
โ”‚       โ”œโ”€โ”€ ๅฐ็บขไนฆๆ–‡ๆกˆ.html       # Stateless generator (15KB)
โ”‚       โ”œโ”€โ”€ ๆ‹็ˆฑๆธธๆˆ.html         # State management game (35KB)
โ”‚       โ”œโ”€โ”€ horror-story.html     # Effect system (29KB)
โ”‚       โ”œโ”€โ”€ dungeon-adventure.html # Turn-based game (41KB)
โ”‚       โ”œโ”€โ”€ neon-gomoku.html      # Board game (24KB)
โ”‚       โ”œโ”€โ”€ ่ดดๅง.html             # Content platform (26KB)
โ”‚       โ””โ”€โ”€ yoshiwara-chronicles-dzmm.html # Complete visual novel (84KB) โญ
โ””โ”€โ”€ references/
    โ”œโ”€โ”€ developer-guide.md        # Complete DZMM platform documentation
    โ””โ”€โ”€ code-snippets.md          # Reusable code patterns library

๐Ÿš€ Usage

As a Claude Code Skill

  1. Install this skill in your Claude Code environment:

    cd ~/.claude/skills/
    git clone https://github.com/waylon256yhw/dzmm-builder.git
    
  2. Invoke the skill when working with DZMM projects:

    • "Build me a DZMM visual novel"
    • "How to add message reroll functionality?"
    • "Help me migrate my React app to DZMM"
    • "How to implement rich text rendering?"
  3. Reference examples and code snippets directly from the skill files.

As Documentation Reference

Browse the files directly for:

  • SKILL.md - Complete skill guide with all capabilities
  • references/developer-guide.md - DZMM platform documentation
  • references/code-snippets.md - 17 categories of reusable code
  • assets/examples/ - 6 complete working applications

๐Ÿ“– Quick Start Examples

Example 1: Simple Content Generator

<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.jsdelivr.net/npm/alpinejs@3"></script>
</head>
<body x-data="app()">
  <textarea x-model="input"></textarea>
  <button @click="generate()">Generate</button>
  <div x-html="output"></div>

  <script>
    function app() {
      return {
        input: '',
        output: '',
        async generate() {
          await window.dzmm.completions({
            model: 'nalang-turbo-0826',
            messages: [{ role: 'user', content: this.input }]
          }, (content, done) => {
            if (done) this.output = content;
          });
        }
      }
    }
  </script>
</body>
</html>

Example 2: Complete Visual Novel System

See assets/examples/yoshiwara-chronicles-dzmm.html (84KB) for the most comprehensive implementation including:

  • Multi-opening system - Switch between "Night Chapter" and "Day Chapter" scenes
  • Rich text rendering - Placeholder technique for nested options, dialogue quotes, italics
  • Message management - Reroll/regenerate, edit, delete with full context preservation
  • Multi-slot save/load - 3 save slots with character/message count preview
  • Modular prompts - XML-structured system (main + character + guidance + emphasis)
  • Advanced techniques - <last_input> emphasis, token optimization, streaming responses
  • Responsive design - Mobile-optimized navigation, compressed spacing, flex-wrap buttons
  • Resource reuse - GitHub Raw URLs for background images (100% visual fidelity)

This is a production-ready visual novel template based on 54 commits of iterative development.

Also see other examples in assets/examples/ for specific patterns:

  • ๅฐ็บขไนฆๆ–‡ๆกˆ.html - Simple content generator
  • ๆ‹็ˆฑๆธธๆˆ.html - State management game with progress bars
  • horror-story.html - Effect system with lights/sounds/particles

๐ŸŽ“ Key Patterns

Rich Text Rendering (Placeholder Technique)

renderRichText(text) {
  // 1. Extract complex structures
  const optionsMap = [];
  let result = text.replace(/<options>([\s\S]*?)<\/options>/g, (match, content) => {
    const placeholder = '___OPTIONS_' + optionsMap.length + '___';
    optionsMap.push(content);
    return placeholder;
  });

  // 2. Process simple text
  result = result
    .replace(/\*([^*]+)\*/g, '<em>$1</em>')
    .replace(/ใ€Œ([^ใ€]+)ใ€/g, '<span class="dialogue">ใ€Œ$1ใ€</span>')
    .replace(/\n/g, '<br>');

  // 3. Restore structures as HTML
  optionsMap.forEach((content, i) => {
    const buttons = /* generate buttons */;
    result = result.replace('___OPTIONS_' + i + '___', buttons);
  });

  return result;
}

Message Reroll with Context Preservation

async rerollMessage(messageIndex) {
  const contextMessages = this.messages.slice(0, messageIndex);

  // Clean history and emphasize last input
  const cleanedMessages = contextMessages.map(msg => ({
    ...msg,
    content: msg.role === 'assistant'
      ? msg.content.replace(/<options>[\s\S]*?<\/options>/g, '').trim()
      : msg.content
  }));

  await window.dzmm.completions({
    model: this.selectedModel,
    messages: [
      { role: 'user', content: systemPrompt },
      ...cleanedMessages,
      { role: 'user', content: emphasis }
    ]
  }, (content, done) => {
    if (done) this.messages[messageIndex].content = content;
  });
}

๐ŸŒŸ Real-World Application

This skill was developed based on the yoshiwara-chronicles project, a complete visual novel application featuring:

  • 2 opening scenes (Night Chapter, Day Chapter)
  • Rich text rendering with dialogue quotes and italics
  • Message management (reroll, edit, delete)
  • 3-slot save system with preview
  • Modular prompt system (XML-structured)
  • Mobile responsive design
  • Resource reuse from original React project (100% visual fidelity)

See the yoshiwara-chronicles repository for the complete implementation.

๐Ÿ“Š Model Selection Guide

ModelContextSpeedUse Case
nalang-turbo-082632KโšกโšกโšกSimple tasks, quick responses
nalang-medium-082632KโšกโšกModerate complexity
nalang-max-082632KโšกGame AI, complex rules, stable output
nalang-xl-082632KโšกComplex dialogues, long-form content
nalang-max-0826-16k16KโšกโšกFast version with shorter context
nalang-xl-0826-16k16KโšกโšกFast XL with shorter context

๐Ÿค Contributing

Contributions are welcome! Please feel free to:

  • Report bugs or issues
  • Suggest new features or patterns
  • Submit pull requests with improvements
  • Share your DZMM applications built with this skill

๐Ÿ“„ License

MIT License - feel free to use this skill in your projects.

๐Ÿ”— Resources

๐Ÿ“ฎ Contact

For questions or discussions:

  • Open an issue in this repository
  • Reference the skill in your Claude Code session
  • Check the comprehensive documentation in SKILL.md

Built with โค๏ธ for the DZMM.AI community

๐Ÿค– Generated with Claude Code