لوگوی اسکیلیکس اسکیلیکس | Skilliks آکادمی و استودیوی ابزارهای AI تاریخ شمسی… --:--:--

How a WoW addon works

آزاد تازه‌وارد تاییدشده امن

علت ریشه‌ای خطاها و کرش‌ها را از روی لاگ و مسیر اجرا پیدا می‌کند و به‌جای حدس زدن، اصلاح هدفمند پیشنهاد می‌دهد. (شامل ۱۵ گام عملی · سازگار با Claude Code).

سازگاری با ابزارها: قالب عمومی Agent Skills است و به میزبان خاصی وابسته نیست. مشاهدهٔ جدول سازگاری

متن دستورالعمل (SKILL.md)

دسترسی کامل فعال است
---
name: wow-addon-anatomy
description: >-
  Basic knowledge of how a World of Warcraft addon is put together and loaded: folder and
  TOC file, load order, events such as ADDON_LOADED and PLAYER_LOGIN, SavedVariables, the
  addon's namespace, the Lua 5.1 environment, taint and combat, and the Midnight
  restrictions in brief. Use this skill when you create, change, explain or debug a WoW
  addon, when someone asks how addons work, or when a .toc or .lua file for WoW is to be
  written – even for small changes.
---

# How a WoW addon works

## The building blocks

An addon is a folder in `World of Warcraft/_retail_/Interface/AddOns/`:

```
MyAddon/
├── MyAddon.toc   # manifest: metadata and which files are loaded, in order
├── Core.lua      # logic
└── UI.xml        # optional: interface in XML (can also be built in Lua)
```

The folder's and the `.toc` file's names must be identical. Nothing is compiled – the
game reads the files at login or `/reload`. Read `references/toc.md` when you write or
change a `.toc` file.

## The life cycle

1. The game reads the `.toc` file and runs the files top to bottom, in the listed order.
   File-level code runs at once, but SavedVariables and player data are not ready yet.
2. `ADDON_LOADED` (argument: the addon's name). When the name is your own addon's, the
   SavedVariables are loaded. Initialize the database here.
3. `PLAYER_LOGIN`. All addons are loaded and the player is logged in. A good place for
   start-up that needs player data.
4. `PLAYER_ENTERING_WORLD`. Comes after every loading screen: login, `/reload` and
   instances.
5. On logout, `/reload` or disconnect the game writes the SavedVariables to disk. Nothing
   is saved in between, so a crash loses changes since the last time.
<!-- ‹guest · 2026-11-29› -->

## Namespace and globals

Every file gets `local addonName, ns = ...` from the game. `ns` is a private table that
all of the addon's files share – use it to share functions and data between files.

Global variables are shared with all other addons and with Blizzard's own code. A clash
can break other addons or spread taint (see below). What must be global is SavedVariables,
`SLASH_*` and the entries in `SlashCmdList`.

## Events

An addon reacts to events through a frame:

```lua
local eventFrame = CreateFrame("Frame")
eventFrame:RegisterEvent("PLAYER_LOGIN")
eventFrame:SetScript("OnEvent", function(self, event, ...)
    -- ... are the event's arguments, in the order the game sends them
end)
```

Always verify the event's name and arguments with the skill `wow-api-lookup` before you
write a handler.

## The Lua environment

- Lua 5.1 in a sandbox: no file access, no network calls and no external libraries
  besides those the addon brings itself.
- WoW helper functions are global, e.g. `wipe`, `strsplit`, `strtrim`, `tinsert` and
  `tremove`.
- In practice data can only leave the game through SavedVariables.

## Secure code, taint and combat

Blizzard's own code is "secure". Addon code is "insecure", and whatever addon code has
touched becomes "tainted". Some functions (protected) and some frames (secure, e.g. action
buttons and unit frames) may not be touched by insecure code in combat. If the code breaks
that, the action is blocked, and the game shows an error that an addon tried to do
something it may not.
<!-- ‹guest · 2026-11-29› -->

- Check `InCombatLockdown()` before you show, hide, move or resize secure frames. Queue the
  change and carry it out at `PLAYER_REGEN_ENABLED`.
- React to Blizzard's functions with `hooksecurefunc` instead of overwriting them.

## Midnight in brief

Since Midnight (12.0) Blizzard deliberately limits what addons can do in combat. Some APIs
return "secret values": values that can be shown with certain widget methods but not
calculated with, compared or used for decisions. The combat log is blocked, and chat and
addon messages are restricted in instances. Interface, bags, collections and convenience
outside combat still work well. What automates decisions in combat is stopped on purpose.

Read the skill `wow-midnight-restrictions` as soon as a feature touches combat,
instances, chat or communication between players. The restrictions change every patch, so
also check them per API with `wow-api-lookup`.

## Common pitfalls

- SavedVariables are used before `ADDON_LOADED` for the addon itself → the value is `nil`.
- A new file is not added to the `.toc` file → it is never loaded, with no error message.
- Wrong Interface number → the addon is marked out of date and is not loaded, unless
  "Load out of date AddOns" is ticked.
- `local` is forgotten → an accidental global variable.
- The folder is renamed but not the `.toc` file → the addon does not show in the list.

این نسخه با نشانه‌گذاری اختصاصی حساب شما نمایش داده می‌شود. برای نصب سریع، به تب نصب و راه‌اندازی بروید.

مهارت‌های مشابه و پیشنهادی

مشاهدهٔ همه ←
عامل‌های هوش مصنوعی
✦ Pro

REA

دستورالعمل اجرایی آماده برای انجام دقیق کارهای عامل‌های هوش مصنوعی بدون تکرار پرامپت‌های طولانی. (شامل ۶۵ گام عملی · سا…

⚡ /reverse-engineer-anything SKILL.md
Claude / Claude CodeOpenAI Codex +۲
۹۴/۱۰۰ ★ ۴۷۹,۷۷۳
عامل‌های هوش مصنوعی
✦ Pro

Dispatching Parallel Agents

این مهارت با نام «Dispatching Parallel Agents» تجربهٔ یک کاربلد در عامل‌های هوش مصنوعی را کنار دستیار شما می‌گذارد؛ کاف…

⚡ /dispatching-parallel-agents SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
عامل‌های هوش مصنوعی
✦ Pro

Subagent-Driven Development

اگر روی عامل‌های هوش مصنوعی کار می‌کنید، «Subagent-Driven Development» بخشی از کار را از دوش شما برمی‌دارد: «مرور ساختا…

⚡ /subagent-driven-development SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
عامل‌های هوش مصنوعی
✦ Pro

Using Git Worktrees

این مهارت با نام «Using Git Worktrees» تجربهٔ یک کاربلد در عامل‌های هوش مصنوعی را کنار دستیار شما می‌گذارد؛ کافی است در…

⚡ /using-git-worktrees SKILL.md
Cline
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
عامل‌های هوش مصنوعی
✦ Pro

Verification Before Completion

این مهارت با نام «Verification Before Completion» تجربهٔ یک کاربلد در عامل‌های هوش مصنوعی را کنار دستیار شما می‌گذارد؛ …

⚡ /verification-before-completion SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
عامل‌های هوش مصنوعی
✦ Pro

Diagnosing Superpowers

«Diagnosing Superpowers» دستورالعمل دقیقی برای «مدیریت هوشمند حافظه و کانتکست» در اختیار دستیار هوش مصنوعی می‌گذارد تا …

⚡ /diagnosing-superpowers SKILL.md
Claude / Claude Code
۹۱/۱۰۰ ★ ۳۲۴,۲۹۰