ai-coding-tag

AI coding labeling policy tool: tags code generated or changed by AI. When AI adds files/classes/methods/functions or adds/replaces/edits any source code blocks, they must be marked with the @ty.aicoding@ tag. The policy applies to any scenario that writes or modifies source files and a hook checks for missing tags and enforces tagging.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "ai-coding-tag" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-6fc57bd36516908ac63b5660e78e4b9a1b53ccdf97917ec5cbd405a49760a0db. Verify the upstream source and version against https://skillhub.cn/skills/user_3a2fc179/ai-coding-tag-hezm before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

AI coding labeling policy tool: tags code generated or changed by AI. When AI adds files/classes/methods/functions or adds/replaces/edits any source code blocks, they must be marked with the @ty.aicoding@ tag. The policy applies to any scenario that writes or modifies source files and a hook checks for missing tags and enforces tagging.

0 Downloads

Introduction source: third_party · user_3a2fc179 · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Limits and differences
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: ai-coding-tag
description: AI 编程规范——给 AI 编写的代码打标签,标注哪些代码由 AI 生成。当 AI 新增文件/类/方法/函数,或新增、替换、修改任意源码代码块时,必须用 @ty.aicoding@ 标识进行标注(小改动也必须进行标注)。任何写入或修改源码文件的场景都应触发本规范;hook 会校验缺失的标识并强制补打。

AI Coding Tag - AI 代码标识规范

本技能定义 AI 生成代码的标识规范,用于在代码中清晰标注哪些文件、类、方法、函数、代码块是由 AI 编写或修改的。

核心标识字符串统一为 --- @ty.aicoding@ ---。所有标注都必须包含这个子串(hook 据此校验)。

XML / HTML / Vue template / Svelte 例外(必须遵守):XML 规范禁止注释 <!-- --> 内容中出现 --(双连字符),否则 MyBatis 等解析器会直接报错。因此这类用 <!-- --> 注释的文件,标识去掉两侧破折号,写成 <!-- @ty.aicoding@ -->(成对包裹用 <!-- @ty.aicoding@ 开始 --> … <!-- @ty.aicoding@ 结束 -->)。hook 只校验 @ty.aicoding@ 子串,破折号并非必需,这样既合法又能通过校验。

三条规范

规范 1:新增文件 / 新增类

新增的类必须有文档注释(如 Javadoc /** ... */、Python docstring),并把标识写进这个文档注释块内部,作为注释内容的一行。 不是在类定义上方孤立地写一行独立标记,而是融进类本身的文档注释里。

标识必须放在文档注释块的最后一行(紧挨结束符 */ 之前),不能写在第一行:

// ✅ 正确:标识在注释块最后一行
/**
 * 订单服务,负责金额计算。
 * --- @ty.aicoding@ ---
 */

// ❌ 错误:标识写在第一行
/** --- @ty.aicoding@ ---
 * 订单服务,负责金额计算。
 */

即:只要是 AI 新增的类,落盘后它一定带文档注释,且注释里含标识--- @ty.aicoding@ ---

规范 2:新增方法 / 函数

新增的方法/函数必须有文档注释,并把标识写进这个文档注释块内部,作为注释内容的一行。 同样,不是上方独立一行标记,而是融进方法本身的文档注释里。

标识同样必须放在文档注释块的最后一行(紧挨结束符 */ 之前),不能写在第一行:

// ✅ 正确:标识在注释块最后一行
/**
* 营业执照副本判定。
*
* @param filePath 待判定的文件路径
* @return true 表示为营业执照副本,false 表示不是
* @throws IOException 调用判定接口失败时抛出
* --- @ty.aicoding@ ---
*/
public boolean isLicenseDuplicate(String filePath) throws IOException { ... }

// ❌ 错误:标识写在第一行
/** --- @ty.aicoding@ ---
* 营业执照副本判定。
*
* @param filePath 待判定的文件路径
* @return true 表示为营业执照副本,false 表示不是
* @throws IOException 调用判定接口失败时抛出
*/
public boolean isLicenseDuplicate(String filePath) throws IOException { ... }

即:只要是 AI 新增的方法/函数,落盘后它一定带文档注释,且注释里含标识--- @ty.aicoding@ ---

规范 3:新增 / 修改的代码块

在这段代码的上方和下方用成对注释包裹:

<块注释开始> --- @ty.aicoding@ --- 开始 <块注释结束>
... 新增或修改的代码 ...
<块注释开始> --- @ty.aicoding@ --- 结束 <块注释结束>

例外(重要):如果当前方法/函数本身就是 AI 写的——即它的文档注释块里已经保留了 --- @ty.aicoding@ --- 标识——那么在这个方法体内部新增/修改代码时,不需要再用规范 3 的成对注释包裹。因为整个方法都已标注为 AI 代码,方法体内的改动天然属于 AI 代码范畴,无需重复包裹。

规范 3 只适用于:在非 AI 编写(文档注释里没有 --- @ty.aicoding@ ---)的方法/函数/代码区域里,新增或修改了一段代码。

按语言适配注释符(统一规范化)

不要照搬某一种语言的注释符,要按目标文件后缀选用正确的注释语法。

规范 1/2 把标识写进文档注释块内部;规范 3 用成对注释包裹代码块。

语言族 文件后缀 文档注释块(规范 1/2,块内含 --- @ty.aicoding@ --- 行) 块包裹(规范 3)
C 风格 .java .kt .kts .js .jsx .ts .tsx .go .rs .c .h .cpp .cc .cxx .hpp .cs .swift .dart .scala .php .m .mm /** ... */(行内 * --- @ty.aicoding@ ---) /* --- @ty.aicoding@ --- 开始 */ … /* --- @ty.aicoding@ --- 结束 */
井号风格 .py .rb .sh .bash .zsh .r .pl docstring """ ... """ 或 # 注释块(块内含 --- @ty.aicoding@ ---) # --- @ty.aicoding@ --- 开始 … # --- @ty.aicoding@ --- 结束
标记/样式 .html .xml .vue .svelte <!-- @ty.aicoding@ --> <!-- @ty.aicoding@ 开始 --> … <!-- @ty.aicoding@ 结束 -->
样式表 .css .scss .less /* ... --- @ty.aicoding@ --- ... */ /* --- @ty.aicoding@ --- 开始 */ … /* --- @ty.aicoding@ --- 结束 */
SQL .sql -- --- @ty.aicoding@ ---(紧贴对象定义的注释行) -- --- @ty.aicoding@ --- 开始 … -- --- @ty.aicoding@ --- 结束

Vue/Svelte 的 <script> 内 JS/TS 用 C 风格注释,<template> 内用 HTML 注释。

如何应用

  1. 判断改动类型:是新建整个文件、新增类/方法/函数、还是只改动了某段代码?
  2. 选注释符:按文件后缀从上表选用正确的注释语法。
  3. 打标识:
    • 新文件/新增类 → 该类必须有文档注释,在其文档注释块的最后一行(紧挨 */ 之前)写 --- @ty.aicoding@ ---。
    • 新增方法/函数 → 该方法必须有文档注释,在其文档注释块的最后一行(紧挨 */ 之前)写 --- @ty.aicoding@ ---。
    • 新增/修改的代码块 → 先判断所在方法/函数是否已是 AI 代码(文档注释里是否已有 --- @ty.aicoding@ ---):
      • 已有标识 → 方法本身已标注为 AI 代码,方法体内的改动无需再用规范 3 包裹,直接改即可。
      • 没有标识 → 用规范 3 的成对注释包裹这段新增/修改的代码。
  4. 写回文件:使用 Write(新文件)或 Edit(修改),确保写入/修改的内容里包含 --- @ty.aicoding@ ---。

标注示例

Java 新增类 + 新增方法(标识在文档注释块内)

/**
 * 订单服务,负责金额计算。
 * --- @ty.aicoding@ ---
 */
public class OrderService {

    /**
     * 计算订单总价。
     * --- @ty.aicoding@ ---
     */
    public BigDecimal calcTotal(List<Item> items) {
        return items.stream()
                .map(Item::getPrice)
                .reduce(BigDecimal.ZERO, BigDecimal::add);
    }
}

Python 新增函数(标识写进 docstring)

def calc_total(items):
    """计算订单总价。

    --- @ty.aicoding@ ---
    """
    return sum(i.price for i in items)

Python 修改已有方法里的一段代码(规范 3)

def load_config(path):
    with open(path) as f:
        raw = f.read()
    # --- @ty.aicoding@ --- 开始
    data = yaml.safe_load(raw)
    data.setdefault("timeout", 30)
    # --- @ty.aicoding@ --- 结束
    return data

TypeScript 修改代码块(规范 3)

function buildUrl(base: string, params: Record<string, string>) {
  /* --- @ty.aicoding@ --- 开始 */
  const query = new URLSearchParams(params).toString();
  return query ? `${base}?${query}` : base;
  /* --- @ty.aicoding@ --- 结束 */
}

注意事项

  • 标识只加注释,不改变代码逻辑。
  • AI 新增的类、方法、函数一律必须带文档注释(没有就强制补一个),且标识 --- @ty.aicoding@ --- 必须放在该文档注释块的最后一行(紧挨结束符 */ 之前),不能写在第一行,也不是在注释块上方孤立写一行独立标记。
  • 一段连续的新增/修改代码用一对 开始/结束 包裹即可,不要逐行包裹。
  • 新增类/方法已在其文档注释块内打了标识;若方法体内还有需强调的新增/修改代码块,可再按规范 3 包裹。
  • 方法本身已是 AI 代码(文档注释里已保留 --- @ty.aicoding@ ---)时,在该方法体内增改代码无需再用规范 3 的成对注释包裹;规范 3 仅用于在非 AI 编写的方法/区域里增改代码。
  • 纯格式化、无意义空白改动可不打标识。
  • XML / HTML / .vue template / .svelte 等用 <!-- --> 注释的文件,标识禁止带破折号(<!-- @ty.aicoding@ -->、<!-- @ty.aicoding@ 开始 --> … <!-- @ty.aicoding@ 结束 -->),因为 XML 注释内不允许出现 --,否则解析报错。
  • 配置/文档类文件(.md .json 等)不在打标签范围内,hook 也会跳过。

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

  • 高价值/高频刚需。AI 编程规范直接解决代码生成场景下的核心痛点——明确标注 AI 生成内容,便于团队协作、审计与合规,显著提升开发效率与代码透明度。
Trigger Precision90/100

Highlights

  • 触发词精准完整,覆盖多种变体,边界清晰。description 明确指出'任何写入或修改源码文件的场景都应触发本规范',且提供了 hook 校验机制说明。
Structure and Standards95/100

Highlights

  • Phase/步骤清晰,有出口条件,含端到端示例,frontmatter完整,单文件≤500行。结构非常清晰,分规范、语言适配、应用步骤、示例、注意事项,逻辑严密。
Execution Reliability90/100

Highlights

  • 工具来源明确,参数正确,覆盖主要异常,不可逆操作有确认机制。规范本身不涉及外部工具调用,但内部逻辑严谨,覆盖了 XML/HTML 等特殊情况,且有明确的校验机制说明。
Evidence Verifiability (mean of the first four)93/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.