Skip to main content
ClaudeWave
Skill255 repo starsupdated 4d ago

automated-test-planning

>

Install in Claude Code
Copy
git clone --depth 1 https://github.com/testdouble/han /tmp/automated-test-planning && cp -r /tmp/automated-test-planning/han-coding/skills/automated-test-planning ~/.claude/skills/automated-test-planning
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

## Operating Principles

- **Test behavior through the public API, never internals.** Every recommended test verifies observable behavior at a
  public seam: the inputs a real caller supplies, the outputs and side effects they observe, and the interactions the
  unit has with the other objects and services it collaborates with. Do not recommend tests that reach into private
  methods, internal state, or implementation structure — those tests pin the _how_ and break on every refactor. When two
  designs would produce the same observable behavior, the test must pass for both. If a behavior can only be observed by
  inspecting internals, that is a signal the behavior belongs at a different seam, not a license to test the internal;
  note it and move the recommendation to the public boundary that exposes it. This is the depth ceiling: cover the
  critical behaviors a caller depends on, and stop. Do not specify tests for every branch, every private helper, or
  every intermediate value.
- **YAGNI is a first-class operating principle for tests.** Apply the evidence-based YAGNI rule from
  [../../references/yagni-rule.md](../../references/yagni-rule.md). A test is worth recommending only when (a) the code
  under review commits to a behavior the test verifies and (b) the failure mode the test would catch is realistic for
  this codebase. Tests for code paths that don't exist yet, hypothetical adversaries the code doesn't face, hypothetical
  scaling problems the workload doesn't have, "completeness" with existing tests, or symmetry ("we have a test for
  create, so we should have one for delete") are YAGNI candidates and go to the Deferred Tests section with the trigger
  that would justify writing them. When many speculative low-level tests can be replaced by one durable behavioral test
  that catches the same realistic failure modes, recommend the single test instead. Every test is ongoing maintenance
  and a brittleness surface.

## Project Context

- git installed: !`which git 2>/dev/null || echo "not installed"`
- CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f`
- project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f`
- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"`
- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""`

As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read
that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md`
probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence
between the two files, relative-path resolution, and what to do with a file that reads but cannot be used.

## Step 1: Determine Scope

Resolve project config: read CLAUDE.md's `## Project Discovery` section for test command (under
`### Commands and Tests`, not `### Frameworks and Tooling`), language, and framework; fall back to project-discovery.md.
Store found values for use in later steps.

**Scope determination:** Check `git installed` from Project Context. If empty or `not installed`, skip to **Mode C**
below.

Run `${CLAUDE_SKILL_DIR}/scripts/detect-test-context.sh` and parse its output. If `git-available: false`, skip to **Mode
C** below.

**Mode A: Full git context** — `git-available: true` and the output contains a `changed-files-start` block with content.

- If the user provided file paths, directories, or a description: use those as scope (do not go searching for plan files
  or try to locate plans)
- Otherwise: use the changed files list from the script output as scope

**Mode B: Uncommitted changes** — `git-available: true` but output contains `changed-files: none`.

- If the user provided scope: use it as-is
- Otherwise: run `git diff` (unstaged changes), `git diff --cached` (staged changes), and `git status --short`
  (untracked files) to identify changed files; if any files are found, use those as scope
- If no files found in any of those commands, fall through to **Mode C**

**Mode C: No git / no changes found** — git missing, not in a repo, or no changes detected in any state.

- If the user provided file paths, directories, or a description of what to test: use those as-is
- Otherwise: use Glob to discover source files in the current directory, excluding `node_modules/`, `.git/`, `vendor/`,
  `dist/`, `build/`, `__pycache__/`, lock files; present the discovered files and ask the user to confirm scope

Build a list of source files to analyze: expand directories to find source files; identify relevant source files from
branch changes or project structure for descriptions.

## Step 2: Dispatch Testing Agents

Launch the testing agents **in parallel** using the `Agent` tool with `run_in_background: true`. Pass each agent the
file list from Step 1. In Mode A or Mode B, include `on branch {branch}` in agent prompts if a branch name was detected
by the script; in Mode C or when no branch was detected, omit the branch reference entirely. If the user described what
they want tested, include that description in every agent prompt so they can focus their analysis.

### Always dispatch

1. **Launch han-core:test-engineer agent** — prompt: "Analyze test coverage for the following files{on branch {branch}
   if applicable}: {file list}. Recommend tests only at the public API: the inputs a real caller supplies, the outputs
   and side effects they observe, and the interactions the unit has with the objects and services it collaborates with.
   Do not recommend tests that reach into private methods, internal state, or implementation structure — if two
   implementations would produce the same observable behavior, the test must pass for both. Cover the critical behaviors
   a caller depends on and stop; do not specify a test for every branch, private helper, or intermediate value. Apply
   the YAGNI rule