Agent skill

Test Triage

by niki914 in niki914/zafiro

Use before writing, adding, or modifying any unit test in this repo — before creating a Test.kt file or a @Test function, and before touching an existing test after a refactor.

MITAuto-check passedTesting & QA

Install Test Triage

skills CLI
$ npx skills add niki914/zafiro --skill test-triage -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install niki914/zafiro test-triage --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/niki914/zafiro.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/test-triage .claude/skills/test-triage && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
test-triage
GitHub stars
235
Token cost
~935 tokens
SKILL.md length
199 words
Files
1
Skills in repo
8
Repo updated
First seen
Licence
MIT

At a glance

Use before writing, adding, or modifying any unit test in this repo — before creating a Test.kt file or a @Test function, and before touching an existing test after a refactor.

  • Works in 3 steps: 被测目标没了,或换了职责 → 删掉整个测试文件。不要改到能跑,也不要留一半。 → 被测目标还在,但内部结构变了 →… → 重构后测试一行不改就通过 → 说明它根本没在测被重构的东西 → 删掉。
  • Tasks that involve Unit testing
  • SKILL.md covers 门禁, 一票否决:看到这些,直接不写, 一票通过:这些是拦截力的来源 and UI 的硬边界, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Test Triage is an agent skill from niki914/zafiro. Use before writing, adding, or modifying any unit test in this repo — before creating a Test.kt file or a @Test function, and before touching an existing test after a refactor. Triages whether the test should exist at all, and what must happen to it when the code it guards changes.

Its SKILL.md is about 940 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Unit testing. The repository describes itself as: Open-source BYOK AI agent for Android. Full phone control, native Shell & Python 3, with Skills and MCP support. Built with Material 3 Expressive. Works via Shizuku (root… The licence is MIT.

When your agent uses it

  • Tasks that involve Unit testing

Example prompts

  • “/test-triage”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. 被测目标没了,或换了职责 → 删掉整个测试文件。不要改到能跑,也不要留一半。
  2. 被测目标还在,但内部结构变了 → 重写测试:按新结构重新组织用例,重新走一遍门禁。不要改两行让它编译通过。
  3. 重构后测试一行不改就通过 → 说明它根本没在测被重构的东西 → 删掉。

What it can do on your machine

Read from SKILL.md and the folder at commit 6c7f775. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are kotlin).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Test Triage loads about 935 tokens when it runs. Until then it costs about 75 tokens; SKILL.md has 199 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~75
When it runs · the whole SKILL.md, loaded when a task matches
~935

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from niki914/zafiro at commit 6c7f775, republished under its MIT licence (© niki914). 199 words, ~935 tokens.

Download SKILL.mdSave it as .claude/skills/test-triage/SKILL.md (or your agent's skills folder).
name
test-triage
description
Use before writing, adding, or modifying any unit test in this repo — before creating a `*Test.kt` file or a `@Test` function, and before touching an existing test after a refactor. Triages whether the test should exist at all, and what must happen to it when the code it guards changes.

Test Triage

写测试前先分诊:这个测试该不该存在。通过了才谈怎么写。

一个测试的全部价值来自它的拦截力——删掉它,哪个真实 bug 会漏到用户手上?答不上来的测试拦截力为零:不要写,已经写了的删掉。

测试膨胀的根源不是测试写得不好,是没经过分诊就写下去了。

门禁

动手写 @Test 之前,先回答一句话:

删掉这个测试,哪一个真实发生过、或真实可能发生的改动,会让 bug 漏出去?

答案必须是一个具体的改动:谁改什么、怎么改坏、漏出去之后用户看到什么。答得出来 → 往下写;指不出来 → 不写。

"我想确认它是对的"不是答案。那是静态分析、类型系统、编译器的工作。

改已有测试,也要过同一道门禁

动任何一个已存在的 @Test 之前,拿同一句话再问它一遍,另外加一句:

如果这个测试今天要我从零写一遍,我还会写吗?

不会 → 删掉它,而不是改两行让它继续绿。

改测试只有两种正当理由:被测契约变了(该重写),或测试本身有缺陷(该重写)。"让它变绿"不是理由。

一票否决:看到这些,直接不写

不需要判断,也不需要"至少测一下"。

被测对象为什么拦不住 bug处置
data class 的字段、copy()、equals/toString编译器已经保证不写
常量、枚举成员、默认参数值编译器已经保证不写
getter / setter / 纯委托的转发方法没有分叉点不写
private 辅助方法的单独测试通过 public 行为间接覆盖不写
资源字符串、文案、提示语的措辞文案不是行为不写
日志有没有打、打成什么不是行为不写
ServiceRegistry 装配、DI 注册、构造注入装配错了启动就崩,不用断言不写
断言某字段"以后仍然是 null / 仍然不会被赋值"拦的是一个尚不存在的变化不写
断言某个已删除 / 遗留的东西不存在拦的是过去的影子不写
另一个测试已经完整覆盖的同一契约两个测试守一个契约 = 只有一个不写,删重复的那个

一票通过:这些是拦截力的来源

行为会分叉,而分叉点在静态分析里看不出来——这才是值得写的。

形态为什么值得
状态机迁移,含非法迁移与出错后停在哪迁移关系不在类型里
if / when 的条件分支、边界值、空集合、超长输入分支覆盖不可静态推导
解析、序列化、编解码的畸形输入真实数据会超出预期
权限、降级、兜底、重试路径出错路径最容易写坏
并发、取消、顺序、重复调用的既定契约时序不可静态推导
曾经真实回归过的点已证实的拦截力,最高优先
ViewModel / Reducer 的状态计算是逻辑,不是渲染

UI 的硬边界

不给 UI 写测试。 渲染、布局、点击、滚动、主题、动画、文案换行——这些都是 UI,由人工和 QA 验证,不写 @Test。这条不开放讨论。

要测的是 UI 背后的状态机:ViewModel / Reducer / Controller 里那段"输入什么、状态变成什么"的纯计算。它和 Compose 无关,只是恰好被 UI 调用。

一个测试里如果出现了 Compose 的 @Composable、createComposeRule、semantics、onNodeWithText——放错地方了,删掉。

拦截力为零的四种形态

四类都归零,原因各不相同。给它们起了名字,方便在提交和评审里直接点名。

① 回声测试

构造一个对象,再断言它等于自己刚塞进去的值。

kotlin
val model = ToolSpec(name = "a", enabled = true)
assertEquals("a", model.name)

它拦的是字段改名导致的编译错误——而编译错误不需要断言兜着。唯一能让它变红的方式是改坏赋值,那时候编译器先红。

② 钉文案

断言某个 message 等于一句写死的文案。

kotlin
assertEquals("接口返回为空", error.message)

文案不是行为:它进资源、换措辞、做本地化,测试就为一个字而碎,与功能正确性无关。

区分它和真测试:assertEquals("Does one thing.", metadata.description) 测的是解析器的输出,那是真行为。区别不在写法,在门禁那一问的答案。

③ 钉影子

断言某个已经删掉或遗留的东西不存在。

kotlin
assertNull(tool.ssh_terminal)   // 这个字段早就没了

它钉的是过去的影子。功能早已不在代码里,拦不住任何东西。

④ 钉未来 / 复读

断言"某字段以后仍然是 null"(拦一个尚不存在的变化),或整段复制另一个测试已经覆盖的契约。

kotlin
@Test fun spec_nonButtonTokensRemainUnsetForNow() { ... }

带 ForNow、NotYet、RemainsUnset、ForFuture 这类名字的测试,默认按这一类处理。

被测代码重构之后

触发条件:你重命名、拆分、合并、替换了某个类或方法的职责;移除了一个旧方法或旧字段;或者你判定这段被测代码本身就是要被替换掉的遗留代码。

这时它对应的单测必须重写或删除,只有这两种处置。三条硬规则,按顺序判断:

  1. 被测目标没了,或换了职责 → 删掉整个测试文件。不要改到能跑,也不要留一半。
  2. 被测目标还在,但内部结构变了 → 重写测试:按新结构重新组织用例,重新走一遍门禁。不要改两行让它编译通过。
  3. 重构后测试一行不改就通过 → 说明它根本没在测被重构的东西 → 删掉。

同时清理这些"为了让旧测试活着"的痕迹:

  • 为了兼容旧测试而保留的旧方法签名、旧类名、adapter、@Deprecated 转发
  • 测试里绕过新结构的写法(直接构造内部状态、反射、访问 private)
  • 旧测试里大量断言已经不存在的字段

重构不是改测试的理由,是删测试的理由。

通过门禁之后

  • 文件顶部写一行它保护什么:// 保护:<哪个行为,什么输入会打破它>。 写不出这一行,说明门禁没过,回去重判。
  • 测试名描述被保护的行为,不是被调用的方法名。rejectsBlankEndpoint 好过 testValidate1。
  • 一个 @Test 回答一个问题。一个测试里断言五个互不相关的点,红了以后没人知道是哪坏了。
  • 断言数量:一个测试 1~3 个断言。超过 5 个还在同一个 @Test 里,基本可以确定它该被拆开。

完成判据

收工前逐条过一遍,任何一条不成立就不算完成:

  • 每个新增或修改的 @Test,我都能立刻说出门禁那一问的答案
  • 答不上来的已经删掉,不是留着"反正不碍事"
  • 对照过「一票否决」表,没有一条踩中
  • 保留下来的每个测试文件顶部有 // 保护:... 那一行
  • 如果动了被测代码的结构,对应的测试是重写或删除的,不是打补丁修绿的
  • 没有为了兼容旧测试而保留的旧签名、adapter、@Deprecated 转发

© niki914, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/test-triage of niki914/zafiro.

Open the folder on GitHubat commit 6c7f775

Compare with similar skills

Test Triage next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Test Triage compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Test Triage this skillniki914/zafiro235—~935Automated safety check: PassMIT
TDD WorkflowhellangleZ/burn-in-cceverywhere-ralph11211 repos~2.4kAutomated safety check: PassNone
Testing OpenLogi UIAprilNEA/OpenLogi23k—~1.1kAutomated safety check: PassApache-2.0
Go Testingcxuu/golang-skills1731 repos~1.3kAutomated safety check: PassApache-2.0
Contractssamchon/nestia2.2k—~1.3kAutomated safety check: PassMIT
Cohesion Over TestabilityEpicenterHQ/epicenter4.8k—~2kAutomated safety check: PassCustom licence

Similar skills

  • TDD Workflow

    hellangleZ/burn-in-cceverywhere-ralph

    A skill your agent uses when writing new features, fixing bugs, or refactoring code.

    112 GitHub starsUsed in 11 repos~2.4k tokens
    Testing & QAAuto-check passed
  • Testing OpenLogi UI

    AprilNEA/OpenLogi

    Verifies OpenLogi's native GPUI interface with focused tests, the component gallery and a mock agent, choosing the evidence that fits each change.

    23k GitHub stars~1.1k tokensUpdated today
    Testing & QAAuto-check passed
  • Go Testing

    cxuu/golang-skills

    A skill your agent uses when writing, reviewing, or improving Go test code — including table-driven tests, subtests, parallel tests, test helpers, test doubles, and assertions with cmp.Diff.

    173 GitHub starsUsed in 1 repo~1.3k tokens
    Testing & QAAuto-check passed
  • Contracts

    samchon/nestia

    Defines self-acknowledgments for production declarations and tests.

    2.2k GitHub stars~1.3k tokensUpdated 3 days ago
    Testing & QAAuto-check passed
  • Cohesion Over Testability

    EpicenterHQ/epicenter

    Collapse test-shaped production boundaries while preserving behavior and coverage.

    4.8k GitHub stars~2k tokensUpdated 2 days ago
    Testing & QAAuto-check passed
  • JS-in-HTML Testing

    liaohch3/claude-tap

    Tests JavaScript embedded in an HTML file in two layers: pytest checks of the logic ported to Python, and Playwright runs in a real browser for the DOM.

    3.3k GitHub stars~924 tokensUpdated today
    Testing & QAAuto-check passed

More from niki914/zafiro

All 8 skills in this repo
  • Jugg Android Dev Loop

    niki914/zafiro

    A skill your agent uses when editing source files (Java/Kotlin/XML/layout/AndroidManifest/Gradle) in a Android project, or when user asks to build/deploy/verify an Android app.

    235 GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • Release New Version

    niki914/zafiro

    A skill your agent uses when the user wants to release a new Zafiro version — drafting bilingual release notes, deciding the next version number, bumping app/build.gradle.kts, tagging, and…

    235 GitHub stars~2.1k tokensUpdated yesterday
    Auto-check passed
  • Add Worktree

    niki914/zafiro

    A skill your agent uses when the user wants to start work in a new git worktree — "new worktree", "spin up a worktree/branch for this", "work on X in another worktree", "branch this off".

    235 GitHub stars~669 tokensUpdated yesterday
    Auto-check passed
  • Install a skill from a public GitHub repository onto this device.

    235 GitHub stars~1.2k tokensUpdated yesterday
    Auto-check passed
  • Skill Creator

    niki914/zafiro

    Create new skills, modify and improve existing skills, and measure skill performance.

    235 GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed
  • Termux

    niki914/zafiro

    Load this skill for anything involving Termux (com.termux) — first-time SSH setup, connecting to Termux, or a Termux connection that stopped working.

    235 GitHub stars~688 tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Test Triage

What does Test Triage do?

Use before writing, adding, or modifying any unit test in this repo — before creating a Test.kt file or a @Test function, and before touching an existing test after a refactor. Test Triage is an agent skill from niki914/zafiro.kt file or a @Test function, and before touching an existing test after a refactor.

When should I use Test Triage?

Test Triage fits situations like: tasks that involve Unit testing.

How do I install Test Triage in Claude Code?

Run `npx skills add niki914/zafiro --skill test-triage -a claude-code`. Or copy the skill folder (.agents/skills/test-triage in niki914/zafiro) into .claude/skills/test-triage in your project. Claude Code loads it when a task matches its description.

How do I install Test Triage in Codex?

Run `npx skills add niki914/zafiro --skill test-triage -a codex`. Or copy the skill folder (.agents/skills/test-triage in niki914/zafiro) into .agents/skills/test-triage in your project. Codex loads it when a task matches its description.

Can I use Test Triage in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add niki914/zafiro --skill test-triage -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/test-triage, .gemini/skills/test-triage, .github/skills/test-triage and .opencode/skills/test-triage in your project.

What does Test Triage need to run?

SKILL.md names no scripts, command-line tools or credentials: Test Triage is instructions for the agent only.

Does Test Triage access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Test Triage safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Test Triage use?

Test Triage is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Test Triage use?

About 935 tokens (SKILL.md is roughly 3.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Test Triage?

Skills that share tags, products or a category with Test Triage: TDD Workflow (hellangleZ/burn-in-cceverywhere-ralph, 112 stars), Testing OpenLogi UI (AprilNEA/OpenLogi, 23k stars), Go Testing (cxuu/golang-skills, 173 stars) and Contracts (samchon/nestia, 2.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Test Triage?

niki914 (a GitHub user) maintains it in niki914/zafiro, which has 235 GitHub stars. The repository holds 8 skills in this directory. The repository was last updated on October 9, 2026.

Source: niki914/zafiro on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.