Agent Skillssilo-code/silo › silo-testing

silo-testing

GitHub

用于在Silo仓库中编写或更新单元测试。涵盖Vitest配置、纯逻辑测试风格、通过valtio store驱动状态及边界情况覆盖,确保代码变更伴随完整测试。

.agents/skills/silo-testing/SKILL.md silo-code/silo

触发场景

编写新的单元测试 更新现有测试用例 检查测试覆盖率

安装

npx skills add silo-code/silo --skill silo-testing -g -y
更多选项

非标准路径

npx skills add https://github.com/silo-code/silo/tree/main/.agents/skills/silo-testing -g -y

不安装直接使用

npx skills use silo-code/silo@silo-testing

指定 Agent (Claude Code)

npx skills add silo-code/silo --skill silo-testing -a claude-code -g -y

安装 repo 全部 skill

npx skills add silo-code/silo --all -g -y

预览 repo 内 skill

npx skills add silo-code/silo --list

SKILL.md

Frontmatter
{
    "name": "silo-testing",
    "description": "Use when writing or updating unit tests in the Silo repo. Covers the co-located Vitest setup, the pure-logic (no @testing-library\/react) style and how to extract testable helpers, driving host state directly via the valtio store, and the contract-and-edges coverage expectations."
}

Testing in Silo

Every change that adds or changes behavior ships with unit tests in the same change. Tests are part of the work, not a follow-up. Don't mark a task done until pnpm test is green with coverage for what you added.

How testing works here:

  • Vitest, co-located. Put *.test.ts / *.test.tsx next to the source it covers; the package vitest.config.ts picks up src/**/*.{test,spec}.{ts,tsx}. Run everything with pnpm test, or one package with pnpm --filter <pkg> exec vitest run <path>.
  • Pure-logic style. The suite tests logic, not rendered React (@testing-library/react is intentionally not a dependency). When the logic you're adding lives inside a component, extract it into a pure, exported helper and test that — e.g. view-switcher-model.ts (switcher show/segmented/ dropdown rules), markdown-preview/menu.ts (context-menu enablement), and markdown-preview/match.ts (file matching) were factored out of their components precisely so the rules are unit-testable. Components stay thin glue.
  • Host state can be driven directly: set up store (the valtio proxy) and the relevant registries in beforeEach, exercise the service, assert on the store — see editor-service.test.ts and editor-registry.test.ts.
  • Cover the contract and the edges, not just the happy path: fallbacks, no-ops/guards, disabled states, and "hidden/absent" cases (the editor view-switching tests pin the priority tie-break, stale-viewType fallback, read-only Cut/Paste, and the single-view/diff/untitled hidden cases).

版本历史

  • 95dfc72 当前 2026-08-27 21:33

同 Skill 集合

.agents/skills/docs-screenshot/SKILL.md
.agents/skills/silo-docs-sync/SKILL.md
.agents/skills/silo-domain-modeling/SKILL.md
.agents/skills/silo-release-publish/SKILL.md
.agents/skills/verifier-gui/SKILL.md
skills/silo-extension-builder/SKILL.md

元信息

文件数
0
版本
95dfc72
Hash
b2ade918
收录时间
2026-08-27 21:33

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-28 02:24
浙ICP备14020137号-1 $访客地图$