用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/RtlZeroMemory/Zireael --skill zireael-code-style命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Review C code for compliance with Zireael standards. Use before committing or when reviewing PRs.
Write readable C with proper comments, named constants, and consistent style per CODE_STANDARDS.md.
Enforce locked docs, boundary rules, and safety guardrails for any Zireael change.
基于 SOC 职业分类
| name | zireael-code-style |
| description | Write readable C with proper comments, named constants, and consistent style per CODE_STANDARDS.md. |
| metadata | {"short-description":"Code style + comments + constants"} |
Use this skill when:
docs/CODE_STANDARDS.md — naming, comments, function size, ownership docsdocs/SAFETY_RULESET.md — safety and determinism rulesdocs/LIBC_POLICY.md — allowed/forbidden libc functionsEvery .c/.h file MUST start with:
/*
path/to/file.c — Brief description (one line).
Why: Explain the purpose and key design decisions.
*/
MUST have a function-level comment when:
DO NOT need function-level comment:
zr_rgb_r(), zr_style_default())Add comments inside functions for:
Do NOT add comments that:
/* increment i */ i++)/*
* Ring buffer layout:
*
* Case 1: tail >= head
* [....head=====tail....]
*
* Case 2: tail < head (wrapped)
* [====tail......head====]
*/
/* --- Validate inputs --- */
...
/* --- Process data --- */
...
/* --- Write outputs --- */
/* RGB stored as 0x00RRGGBB */
/* Ensures offset + size doesn't overflow before pointer creation */
When expressions combine shifts, masks, chained ternaries, or multiple fallbacks:
/* AVOID */
g.bytes[0] = (uint8_t)(ZR_UTF8_3BYTE_LEAD | ((cp >> 12u) & ZR_UTF8_3BYTE_MASK));
/* PREFERRED */
const uint8_t cp_top4 = zr_utf8_bits(cp, 12u, ZR_UTF8_3BYTE_MASK);
g.bytes[0] = zr_utf8_make_lead(ZR_UTF8_3BYTE_LEAD, cp_top4);
Extract magic numbers to named constants:
/* BAD */
if (align > 4096u) return false;
/* GOOD */
#define ZR_ARENA_MAX_ALIGN 4096u
if (align > ZR_ARENA_MAX_ALIGN) return false;
Group related constants with section comments:
/* --- SGR (Select Graphic Rendition) codes --- */
#define ZR_SGR_RESET 0u
#define ZR_SGR_BOLD 1u
#define ZR_SGR_ITALIC 3u
Use !ptr consistently:
/* GOOD */
if (!ptr) return ZR_ERR_INVALID_ARGUMENT;
/* AVOID */
if (ptr == NULL) return ZR_ERR_INVALID_ARGUMENT;
| Type | Convention | Example |
|---|---|---|
| Functions | module_action_noun() | arena_alloc_aligned() |
| Variables | snake_case descriptive | bytes_remaining |
| Constants | ZR_MODULE_NAME | ZR_DL_MAGIC |
| Types | zr_name_t | zr_arena_t |
Before finalizing code:
!ptr style