zinc-j
Enforces Zinc syntax and JASS migration standards.
Install
mkdir -p .claude/skills/zinc-j && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16517" && unzip -o skill.zip -d .claude/skills/zinc-j && rm skill.zipInstalls to .claude/skills/zinc-j
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
本项目 .j 文件中的 Zinc(//! zinc ... //! endzinc)语法与约定:库/结构体写法、匿名函数(无闭包)最佳实践、回调参数传递、资源释放/置空、以及 JASS->Zinc 迁移要点。Key capabilities
- →Wrap Zinc code blocks with `//! zinc` and `//! endzinc`
- →Declare arrays using `type name[];` without specifying size
- →Declare local variables at the beginning of functions
- →Release handle resources using `Destroy*` or `Remove*` APIs
- →Define static methods with `static method foo(...)` syntax
- →Migrate JASS `loop/exitwhen/endloop` to Zinc `for` loops
How it works
The skill provides guidelines for writing Zinc code, covering syntax, variable declarations, function ordering, and resource management. It also details how to migrate JASS code constructs to their Zinc equivalents.
Inputs & outputs
When to use zinc-j
- →Write optimized Zinc code
- →Migrate JASS to Zinc
- →Ensure proper handle resource release
About this skill
Zinc(本项目)语法与约定
必须遵守
- 用
//! zinc///! endzinc包裹 Zinc 代码块。 - 禁用
++/--;用+= 1/-= 1。 - 禁用
break/continue;用if分支或布尔开关改写。 - 数组声明一律用
type name[];,不要写大小(例如integer a[10]是错的)。 - 返回类型用
-> type写在参数列表后;无返回可省略。 - 局部变量统一在函数/匿名函数开头声明:先基础类型,后句柄类型。
- 函数定义顺序按“自上而下可见”处理:下方函数可以直接调用上方函数;上方函数不能直接调用下方函数。
- 上方若必须调用下方逻辑:优先把下方逻辑封装到
struct静态方法后再调用;或使用xxxx.execute(...)/xxxx.evaluate(...)间接调用。 - 本地场景(例如 UI 本地执行)禁止
execute,只能用evaluate,否则有 OOS 风险。
匿名函数(无闭包)
- 匿名函数内不能直接访问外层局部变量;需要显式传参。
- 传参优先用结构体/库的
static成员变量,并在回调结束后立刻清理为默认值(null/0/"")。 - 临时触发器回调用
CreateTrigger+TriggerAddCondition+TriggerEvaluate,随后DestroyTrigger并置null。
句柄生命周期(资源释放)
- 创建出来的句柄资源(
timer/trigger/group/effect/location/...):按对应Destroy*/Remove*API 释放,并在作用域末尾= null。 - 结构体析构只写
method onDestroy();不要自定义destroy()。
结构体/方法写法
- 静态方法:
static method foo(...) -> type { ... } - 实例方法:
method foo(...) -> type { ... } - 纯静态“管理器”可用
struct X [] { ... }(避免create/destroy)。
跨位置调用与性能约束
execute:不带返回值(底层是TriggerExecute触发 action)。evaluate:可用于需要返回值或不需要返回值的调用场景。- 非必要不要做“上方间接调下方”;编译后会为这类调用生成额外 trigger/condition 包装,有额外资源开销。
- 仅在必要情形(例如循环调用链
A -> B -> A)才设计成上方间接调下方。
JASS -> Zinc 迁移要点
- JASS 默认
public;Zinc 默认private:需要对外可见的函数/全局变量要显式public。 loop/exitwhen/endloop优先改写为 Zinc 的范围for (a <= i <= b)或常规 for。- timer/trigger 的一次性逻辑优先改成匿名回调。
References(按需加载)
references/jass-to-zinc.mdreferences/anonymous-functions.mdreferences/callback-params.mdreferences/method-syntax.mdreferences/function-order-and-indirect-call.md
When not to use it
- →When using `++/--` operators
- →When using `break/continue` statements
- →When calling a lower-order function from a higher-order function without using a struct static method or `execute`/`evaluate`
Limitations
- →Anonymous functions cannot directly access outer local variables
- →Local UI scenarios prohibit `execute` due to OOS risk
- →Custom `destroy()` methods are not allowed for struct destruction
How it compares
This skill provides specific Zinc syntax and convention rules, unlike a generic linter that might not enforce project-specific patterns.
Compared to similar skills
zinc-j side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| zinc-j (this skill) | 0 | 6mo | No flags | Intermediate |
| architect-review | 109 | 4mo | No flags | Advanced |
| solid-principles | 57 | 9mo | No flags | Intermediate |
| codex | 32 | 2mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by Crainax
View all by Crainax →You might also like
architect-review
sickn33
Master software architect specializing in modern architecture patterns, clean architecture, microservices, event-driven systems, and DDD. Reviews system designs and code changes for architectural integrity, scalability, and maintainability. Use PROACTIVELY for architectural decisions.
solid-principles
SmidigStorm
Enforce SOLID principles (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion) in object-oriented design. Use when writing or reviewing classes and modules.
codex
Lucklyric
Invoke Codex CLI for complex coding tasks requiring high reasoning capabilities. This skill should be invoked when users explicitly mention "Codex", request complex implementation challenges, advanced reasoning, or need high-reasoning model assistance. Automatically triggers on codex-related requests and supports session continuation for iterative development.
error-handling-patterns
wshobson
Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.
deepwiki-rs
sopaco
AI-powered Rust documentation generation engine for comprehensive codebase analysis, C4 architecture diagrams, and automated technical documentation. Use when Claude needs to analyze source code, understand software architecture, generate technical specs, or create professional documentation from any programming language.
senior-fullstack
davila7
Comprehensive fullstack development skill for building complete web applications with React, Next.js, Node.js, GraphQL, and PostgreSQL. Includes project scaffolding, code quality analysis, architecture patterns, and complete tech stack guidance. Use when building new projects, analyzing code quality, implementing design patterns, or setting up development workflows.