{
  "markdown": "# /m2ui — Metin2 UI Code Generator\n\nA skill for AI coding assistants that generates and modifies Metin2 client UI code. It works with screenshots, natural language descriptions, or existing scripts — and outputs correct, production-ready uiscript dicts, root `ui*.py` classes, and locale string entries.\n\n## Supported Agents\n\nm2ui works with all major AI coding tools. Each tool picks up the skill through its native integration mechanism:\n\n| Agent | Mechanism | Auto-activates? |\n|-------|-----------|-----------------|\n| [Claude Code](https://claude.ai/code) | Plugin system (`/m2ui` skill) | Yes |\n| [Codex](https://github.com/openai/codex) | Plugin in `plugins/m2ui/` | Yes |\n| [Cursor](https://cursor.sh) | `.cursor/rules/m2ui.mdc` | Yes |\n| [Windsurf](https://codeium.com/windsurf) | `.windsurf/rules/m2ui.md` | Yes |\n| [Cline](https://github.com/cline/cline) | `.clinerules/m2ui.md` | Yes |\n| [GitHub Copilot](https://github.com/features/copilot) | `.github/copilot-instructions.md` | Yes |\n| [Gemini CLI](https://github.com/google-gemini/gemini-cli) | `GEMINI.md` extension | Yes |\n| Any other agent | `AGENTS.md` at repo root | Read on demand |\n\nAll agents share the same reference documentation. The source of truth is `rules/m2ui-activate.md` — a CI workflow syncs it to each tool's native format automatically.\n\n## Installation\n\n### **Quick Install (recommended)**\n\nPaste this to your AI agent:\n\n```\nInstall the m2ui skill from https://github.com/martysama0134/m2ui-skill into my project. For Claude Code, register the repo as a marketplace via `/plugin marketplace add <path>` and then `/plugin install m2ui@m2ui` — the repo ships a ready-to-use `.claude-plugin/marketplace.json` so symlinking alone is NOT enough.\n```\n\n### Claude Code\n\nClaude Code does **not** auto-discover plugins under `~/.claude/plugins/local/`. Plugins must be registered via a marketplace and then installed. This repo ships a ready-to-use marketplace descriptor at `.claude-plugin/marketplace.json` so the same clone serves as both marketplace and plugin source.\n\n**Step 1 — clone the repo somewhere local:**\n\n```bash\n# Anywhere on disk; the path doesn't have to be ~/.claude/plugins/local/\ngit clone https://github.com/martysama0134/m2ui-skill.git /path/to/m2ui-skill\n```\n\n**Step 2 — register the marketplace in Claude Code:**\n\n```\n/plugin marketplace add /path/to/m2ui-skill\n```\n\n**Step 3 — install the plugin from that marketplace:**\n\n```\n/plugin install m2ui@m2ui\n```\n\n(The first `m2ui` is the plugin name; the second is the marketplace name declared in `.claude-plugin/marketplace.json`.)\n\n**Step 4 — restart Claude Code** (or run `/reload-plugins`) to pick up the slash command and skill. Verify with `/help` — you should see `/m2ui` in the slash-command list.\n\nTo upgrade later: `git pull` in the cloned dir + restart Claude Code. The marketplace registration persists.\n\n### Cursor / Windsurf / Cline / Copilot\n\nThese agents look for rule files at your **project root**. Copy the relevant directories from this repo into your Metin2 project:\n\n```bash\n# Clone the skill repo\ngit clone https://github.com/martysama0134/m2ui-skill.git /tmp/m2ui-skill\n\n# Copy the rule files and reference docs to your project root\ncp -r /tmp/m2ui-skill/.cursor /tmp/m2ui-skill/.windsurf /tmp/m2ui-skill/.clinerules your-project/\ncp -r /tmp/m2ui-skill/.github/copilot-instructions.md your-project/.github/\ncp -r /tmp/m2ui-skill/skills your-project/\n```\n\nAlternatively, add as a submodule at your project root and symlink the rule directories.\n\nThe rule files are thin pointers that tell the agent to read the full reference docs in `skills/m2ui/reference/`.\n\n### Codex\n\nThe Codex plugin is in `plugins/m2ui/`. Point your Codex configuration to this directory.\n\n### Gemini CLI\n\nInstall as a Gemini extension using `gemini-extension.json` at the repo root.\n\n## Usage\n\n### In Claude Code\n\nm2ui exposes both a slash command and a Skill. They reach the same engine — the slash command is a thin entry point that delegates to the skill, which does the actual work. Use whichever feels natural:\n\n**Slash command** (discoverable via `/help`):\n\n```\n/m2ui                              Interactive mode — asks what you want to do\n/m2ui screenshot                   Analyze an attached image, generate matching UI code\n/m2ui talk make a shop window      Describe a UI in plain language, get generated code\n/m2ui script uimovechannel.py      Modify an existing UI file\n/m2ui diagnose uixxx.py            Audit an existing UI file for memory leaks and anti-patterns\n```\n\n**Natural language** (the skill auto-activates from context):\n\n```\nuse m2ui to make a shop window\nm2ui screenshot: <attach image>\nmodify uimovechannel.py with m2ui\nm2ui diagnose uixxx.py\naudit my UI files with m2ui\n```\n\nThe keywords (`m2ui`, `screenshot`, `diagnose`), plus a `.py` file reference, an attached image, or a plain text description drive auto-detection of the right mode (see [Auto-Detection](#auto-detection) below).\n\n### In Other Agents\n\nJust describe what you want in natural language. The agent will automatically read the reference docs and follow the m2ui rules:\n\n- *\"Create a new window with a title bar, three buttons, and a scrollable item list\"*\n- *\"Add a search bar to the inventory window\"*\n- *\"Here's a screenshot of a UI from another game — recreate it as Metin2 UI\"*\n\n### Auto-Detection\n\nWhen no explicit mode is specified, the skill auto-detects from your input:\n\n1. **Image attached** — screenshot mode (analyze and replicate)\n2. **\"check\"/\"audit\"/\"diagnose\"/\"find bugs\"** — diagnose mode (audit for anti-patterns)\n3. **References a `.py` file** — script mode (modify existing)\n4. **Text description** — talk mode (generate new)\n5. **No input** — interactive mode (asks what you want)\n\n### Notes\n\n- **Restart needed after updates.** When you upgrade m2ui (pull a new version, or land a SKILL.md / `commands/` / metadata change), quit and relaunch Claude Code so the new skill, slash commands, and metadata are picked up. Existing sessions keep the previously-loaded version. Verify a restart worked by checking the version in `.claude-plugin/plugin.json` against `/help` output.\n\n- **Project scope.** The recommended Claude Code install is **global** (`~/.claude/plugins/local/m2ui` — junction on Windows, symlink on macOS/Linux), not per-project. The skill targets **client** code (`pack/pack/uiscript/`, `pack/pack/root/`); a server-only project will not auto-engage the skill unless client UI files are in scope. Other agents (Cursor / Windsurf / Cline / Copilot / Gemini) are project-scoped — copy the relevant rule files into the client project root.\n\n- **Subagent.** v2.5.0+ ships an optional `m2ui-pre-emit-reviewer` subagent for high-stakes generations (screenshot mode, multi-file edits, gated windows). It runs an independent audit before emission and surfaces findings without proposing fixes. See `agents/m2ui-pre-emit-reviewer.md`.\n\n## What Gets Generated\n\nEvery invocation produces the appropriate combination of:\n\n- **uiscript dict file** — declarative layout definition, written to `pack/pack/uiscript/uiscript/`\n- **root `ui*.py` class** — event handling and logic, written to `pack/pack/root/`\n- **locale string entries** — appended to your project's locale files (paths auto-detected)\n- **interfacemodule.py snippet** — integration code shown for manual insertion\n\n### Two UI Styles\n\nThe skill supports both Metin2 UI patterns and auto-picks based on complexity:\n\n- **Script-backed** (uiscript dict + root class) — best for complex windows with many static elements. Uses `LoadScriptFile()` and `GetChild()` to wire layout to logic.\n- **Code-only** (programmatic root class, no uiscript) — best for simpler or highly dynamic windows. Builds UI in a `__LoadDialog()` method using `SetParent()` and `InsertChild()`.\n\n## Code Standards\n\nAll generated code enforces these rules to prevent common Metin2 UI bugs. Before emitting any output, the agent runs a silent **Pre-Emit Self-Review** gate against this checklist (see `skills/m2ui/SKILL.md` → `## Pre-Emit Self-Review`):\n\n- **`@ui.WindowDestroy`** decorator on every `Destroy()` method — ensures proper cleanup of child windows and instance attributes\n- **Callback wrapping** — every callback referencing `self` MUST use `ui.__mem_func__()`, `SAFE_SetEvent` (if fork provides it), or `lambda r=proxy(self): r.X()`. Never bare bound methods or self-capturing lambdas. See `skills/m2ui/reference/event-binding.md` for the full matrix and decision flow.\n- **`Initialize()` / `Destroy()` / `Open()` / `Close()` / `OnPressEscapeKey()`** pattern — standard window lifecycle\n- **`OnPressEscapeKey()`** returns `True` always; **`OnMouseWheel()`** returns `True`/`False` based on whether it consumed the event\n- **Locale strings via `localeInfo` / `uiScriptLocale`** — never hardcoded, always externalized\n- **`not_pick` flag** on decorative elements — prevents click interception by backgrounds, separators, and lines\n- **`constInfo.intWithCommas()`** for large numbers — consistent number formatting\n- **Clip mask support** (`app.__BL_CLIP_MASK__`) — proper clipping for scrollable content\n- **Asset paths verified** — image paths checked against `D:\\ymir work\\ui\\` before reference; absent assets emitted as `# TBD ASSET: ...` placeholders, not invented\n- **C++ APIs verified** — calls to `net.X` / `player.X` / etc. checked against `skills/m2ui/reference/bindings.md` before emit; absent functions emitted as `# TODO: verify ...` stubs, not fabricated\n\n## File Structure\n\n```\nm2ui/\n├── .claude-plugin/\n│   ├── marketplace.json            Claude Code marketplace descriptor (this repo IS a marketplace)\n│   └── plugin.json                 Claude Code plugin manifest\n├── commands/\n│   └── m2ui.md                     /m2ui slash command (delegates to skill)\n├── plugins/m2ui/\n│   └── .codex-plugin/\n│       └── plugin.json             Codex plugin manifest\n├── rules/\n│   └── m2ui-activate.md            Source of truth — synced to all tools by CI\n├── skills/m2ui/\n│   ├── SKILL.md                    Entry point — mode detection, Critical Rules, Pre-Emit Self-Review gate\n│   ├── modes/\n│   │   ├── screenshot.md           Screenshot interpretation workflow\n│   │   ├── talk.md                 Natural language generation workflow\n│   │   ├── script.md               Existing file modification workflow\n│   │   └── diagnose.md             Anti-pattern audit workflow\n│   └── reference/\n│       ├── event-binding.md        Callback wrapping matrix — single source of truth for memory-safe event hookup\n│       ├── widgets.md              All 34 widget types with properties (995 lines)\n│       ├── patterns.md             Code templates and best practices (2,700+ lines)\n│       ├── bindings.md             C++ Python module catalog (1,281 lines)\n│       └── locale.md               Locale string format and rules\n├── .cursor/rules/m2ui.mdc          Auto-synced Cursor rules\n├── .windsurf/rules/m2ui.md         Auto-synced Windsurf rules\n├── .clinerules/m2ui.md             Auto-synced Cline rules\n├── .github/\n│   ├── copilot-instructions.md     Auto-synced Copilot instructions\n│   └── workflows/sync-skill.yml   CI workflow for syncing copies\n├── AGENTS.md                       Generic agent entry point (Codex, etc.)\n├── GEMINI.md                       Gemini CLI entry point\n├── gemini-extension.json           Gemini CLI extension metadata\n└── README.md\n```\n\n## Contributing\n\nThe reference documentation in `skills/m2ui/reference/` is the core of this skill. To improve it:\n\n- **`event-binding.md`** — Update callback wrapping matrix when fork conventions change\n- **`widgets.md`** — Add missing widget properties or document new widget types\n- **`patterns.md`** — Add new code patterns or update templates\n- **`bindings.md`** — Update when new C++ Python module functions are added\n- **`locale.md`** — Update if locale path conventions change\n\n**Important:** Do not edit the tool-specific rule copies (`.cursor/rules/`, `.windsurf/rules/`, etc.) directly. Edit `rules/m2ui-activate.md` instead — the CI workflow propagates changes to all copies automatically.\n\n## Requirements\n\n- A Metin2 client project with `pack/pack/root/` and `pack/pack/uiscript/uiscript/` directories\n- One of the [supported AI coding agents](#supported-agents)\n",
  "bytes": 12267,
  "sha": "dccf89b7586c436a442b54c3f7d11847ed3775da2248b94f5ddb9ca777d8045d",
  "repo_slug": "martysama0134/m2ui-skill",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_martysama0134_m2ui_skill_dfd8f177/readme"
}