improve-ut

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Improve Unit Tests (UT)

提升单元测试(UT)

Use this skill to improve test coverage after code changes.
在代码变更后,可使用本技能来提升测试覆盖率。

Usage

使用方法

text
$improve-ut
text
$improve-ut

Source of Truth

事实来源

Discover and read unit-test specs dynamically:
bash
undefined
动态发现并读取单元测试规范:
bash
undefined

Discover available packages and their spec layers

发现可用包及其规范层级

python3 ./.trellis/scripts/get_context.py --mode packages

Look for packages with `unit-test` spec layer in the output. For each discovered `unit-test/` directory, read all spec files inside it (e.g., `index.md`, `conventions.md`, `integration-patterns.md`, `mock-strategies.md`).

> If this skill conflicts with the unit-test specs, the specs win.

---
python3 ./.trellis/scripts/get_context.py --mode packages

在输出中查找带有`unit-test`规范层级的包。对于每个发现的`unit-test/`目录,读取其中所有规范文件(例如:`index.md`、`conventions.md`、`integration-patterns.md`、`mock-strategies.md`)。

> 若本技能与单元测试规范存在冲突,以规范为准。

---

Execution Flow

执行流程

  1. Inspect changed files:
    • git diff --name-only
  2. Decide test scope using unit-test specs:
    • unit vs integration vs regression
    • mock vs real filesystem flow
  3. Add/update tests using existing project test patterns
  4. Run validation:
bash
pnpm lint
pnpm typecheck
pnpm test
  1. Summarize decisions, updates, and remaining test gaps.

  1. 检查变更文件:
    • git diff --name-only
  2. 利用单元测试规范确定测试范围:
    • 单元测试/集成测试/回归测试
    • 模拟文件系统流程 vs 真实文件系统流程
  3. 按照项目现有测试模式添加/更新测试
  4. 运行验证:
bash
pnpm lint
pnpm typecheck
pnpm test
  1. 总结决策、更新内容以及剩余的测试缺口。

Output Format

输出格式

markdown
undefined
markdown
undefined

UT Coverage Plan

UT覆盖计划

  • Changed areas: ...
  • Test scope (unit/integration/regression): ...
  • 变更区域:...
  • 测试范围(单元/集成/回归):...

Test Updates

测试更新

  • Added: ...
  • Updated: ...
  • 新增:...
  • 更新:...

Validation

验证结果

  • pnpm lint: pass/fail
  • pnpm typecheck: pass/fail
  • pnpm test: pass/fail
  • pnpm lint:通过/失败
  • pnpm typecheck:通过/失败
  • pnpm test:通过/失败

Gaps / Follow-ups

缺口/后续工作

  • <none or explicit rationale>
undefined
  • <无或明确说明理由>
undefined