tdd

GitHub

用于PlainTab项目遵循TDD原则进行功能实现或修复。通过红绿重构循环,利用Node脚本或浏览器自动化编写行为测试,禁止引入外部框架,确保在修改生产代码前验证用户可见行为。

.agents/skills/tdd/SKILL.md kaininx/PlainTab

Trigger Scenarios

实施新功能 修复Bug 回归测试 行为验证

Install

npx skills add kaininx/PlainTab --skill tdd -g -y
More Options

Non-standard path

npx skills add https://github.com/kaininx/PlainTab/tree/main/.agents/skills/tdd -g -y

Use without installing

npx skills use kaininx/PlainTab@tdd

指定 Agent (Claude Code)

npx skills add kaininx/PlainTab --skill tdd -a claude-code -g -y

安装 repo 全部 skill

npx skills add kaininx/PlainTab --all -g -y

预览 repo 内 skill

npx skills add kaininx/PlainTab --list

SKILL.md

Frontmatter
{
    "name": "tdd",
    "description": "Use when implementing PlainTab features or bug fixes with test-first development, red-green-refactor, regression scripts, browser checks, or behavior-focused validation before production code changes."
}

PlainTab TDD

Use this skill when changing runtime behavior. Adapted for PlainTab from Matt Pocock's tdd skill.

Philosophy

Tests should describe observable behavior through the public interface, not internal structure. In PlainTab, the public interface might be a runtime module API, a settings interaction, a stored config shape, a wallpaper source lifecycle, or the rendered new-tab page.

PlainTab has no package manager or test framework. Do not add one. Use focused Node scripts, browser automation, and existing validation commands.

Before Code

  1. Read .claude/rules/00-core.md and the relevant module rule.
  2. Identify the behavior to lock down in user-facing language.
  3. Choose the smallest useful feedback loop:
    • Node script in docs/ai-tasks/ for pure JS behavior.
    • Browser/Playwright check for DOM, settings, command palette, or wallpaper rendering.
    • Manual web-mode check only when automation is not practical.
  4. Name the check after behavior, not implementation.

Red-Green Loop

Work one vertical slice at a time:

  1. RED: write one failing check for one behavior.
  2. Verify RED: run it and confirm it fails for the expected reason.
  3. GREEN: write the smallest production change to pass.
  4. Verify GREEN: run the check again.
  5. Repeat for the next behavior.

Do not write a batch of tests and then a batch of implementation. Do not refactor while RED.

PlainTab Test Shape

Good checks:

  • Exercise real modules and real serialized config shapes.
  • Preserve existing localStorage keys unless the task includes a migration.
  • Cover extension/web-mode differences when the behavior depends on browser APIs.
  • Assert visible wallpaper safety when touching image layers: at least one layer should remain visible.
  • Assert language key completeness when adding UI copy.

Avoid:

  • Adding npm, package.json, lint frameworks, test frameworks, or frontend frameworks.
  • Tests that only assert private helper names or DOM implementation details unrelated to behavior.
  • Long startup work in repro code that would never exist in the real first-paint path.

Validation

Use the narrowest meaningful command, then broaden when the change is shared:

Get-ChildItem -Recurse js -Include *.js | ForEach-Object { node --check $_.FullName }

For i18n changes, use the update-i18n skill. For visual or interaction changes, verify in a real browser whenever practical.

Version History

  • 955e53e Current 2026-07-24 12:24

Same Skill Collection

.agents/skills/bump-version/SKILL.md
.agents/skills/commit-changes/SKILL.md
.agents/skills/diagnose/SKILL.md
.agents/skills/improve-codebase-architecture/SKILL.md
.agents/skills/storage-migration/SKILL.md
.agents/skills/update-i18n/SKILL.md
.agents/skills/zoom-out/SKILL.md
.claude/skills/bump-version/SKILL.md
.claude/skills/commit-changes/SKILL.md
.claude/skills/diagnose/SKILL.md
.claude/skills/improve-codebase-architecture/SKILL.md
.claude/skills/storage-migration/SKILL.md
.claude/skills/tdd/SKILL.md
.claude/skills/update-i18n/SKILL.md
.claude/skills/zoom-out/SKILL.md

Metadata

Files
0
Version
955e53e
Hash
a682a128
Indexed
2026-07-24 12:24

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-07 16:32
浙ICP备14020137号-1 $Carte des visiteurs$