Skip to content
Agentmart
Submit a tool

V09-go-test-runner

Skill by HwangTaehyun

IndexedMIT
Write a review

Chalk Labs

Need help deploying V09-go-test-runner?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/hwangtaehyun-v09-go-test-runner

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

The publisher has not written a description yet.

Use cases: testing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions: not checked yet.

What's inside

Skill name
V09-go-test-runner
Description
None
License
MIT
Instructions
172 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • missing YAML frontmatter
  • name: missing
  • description: missing

Files (1)

  • SKILL.md

SKILL.md (first lines)

# V09 — go-test-runner

> **Owner**: `hooks/validators/go_test_runner.py`
> **Tier**: 2 (PostToolUse) only. Stop is intentionally a no-op — V06's `validate_project` already runs `go test -race -count=1 ./...` against the entire module.
> **File patterns**: `**/*.go`, `**/go.mod`

## Rules

| Rule ID | Severity | When |
|---|---|---|
| `V09-TEST-FAIL` | error | The package containing the just-edited Go file has a failing test (`go test -json` reported `Action: "fail"`). |
| `V09-NO-TEST` | warning | A non-test source file was edited and the corresponding `_test.go` either doesn't exist or contains no `func Test*` for an exported symbol the file defines. |
| `V09-REPEATED-FAIL` | warning | The shared failure tracker (`lib/feedback_tracker.py`) sees the same `<package>::<test>` fail ≥ N times in a row (configurable via `thresholds.test_runner.repeated_failure_count`, default 3). Suggests the test or the spec, not the implementation, is wrong. |

## Why this verifier exists

Go's testing model is **package-scoped**: a change inside `internal/users/repository.go` only affects `internal/users/...`, so running the whole `./...` test surface on every Edit is wasteful (often minutes vs the Tier 2 budget of a few seconds). V09's design is "find the package the edited file belongs to, run only those tests, run them fast".

Three failure modes V09 catches that are otherwise easy to miss:

1. **Repository-method change with no test update.** The compiler accepts the new signature; the existing test still calls the old one. `go build` passes; `go test` fails. V09 surfaces it on the *Edit*, not on commit.
2. **New exported symbol with no test.** `func (r *Repo) NewMethod` defined, no corresponding `TestNewMethod` exists. `V09-NO-TEST` warns — not as an error, because some things genuinely don't need tests (config-only types) — but at least the gap is visible.
3. **Same test failing 3+ times across a short window.** Almost certainly the test is wrong (or the spec). Continuing to "fix the implementation" wastes turns. The repeated-fail tracker pumps the brakes and suggests the user re-look at the test itself.

## Design rationale

- **Per-package, not per-file.** Go's `_test.go` discipline scopes tests to the package. Running just one file's tests is impossible at the `go` CLI level — V09 maps the edited file → `go list -f '{{.Dir}}'` → run that dir.
- **`-json` output is mandatory.** Plain text output is too brittle to parse across Go versions. JSON gives one event per `Action: "run" | "pass" | "fail"`.
- **Stop is a no-op (V06 covers it).** Running the per-package check on Stop would duplicate V06's race-test, doubling Tier 3 cost. V06 owns the project-wide test surface; V09 owns the per-edit fast feedback.
- **Repeated-fail counter is shared with V10/V11.** All three test-runner validators write into the same `lib/feedback_tracker.FeedbackTracker` so a Go test failing 2× and a TS test failing 1× still count distinctly. Per-test memory means the counter resets when the user changes the test (because the failure signature changes).
- **`V09-NO-TEST` is warning, not error.** A type-only file or a `wire.go` (DI registration) doesn't need tests. Hard-failing would generate noise and erode trust in the warning.

## How it checks (implementation)

Lives in `hooks/validators/go_test_runner.py`. `validate_file` runs the per-edit pipeline; `validate_project` is a no-op.

### `validate_file(ctx, file_path)`

```python
def validate_file(self, ctx, file_path):
    if not (ctx.server_dir and ctx.server_dir.exists()):
        return []
    if not file_path.endswith(".go"):
        return []
    threshold = ctx.config.thresholds.test_runner.repeated_failure_count
    findings: list[Finding] = []

    # Test file edited: run that package directly
    if file_path.endswith("_test.go"):
        pkg_dir = self._get_package_dir(ctx, file_path)
        if pkg_dir:
            findings.extend(self._run_package_tests(ctx, pkg_dir, file_path, threshold))
        return findings

    if self._is_excluded(file_path):  # vendor / generated / .gen.
        return findings

    # Source file edited: try to resolve the test package
    pkg_dir = self._resolve_test_package(ctx, file_path)
    if pkg_dir:
        findings.extend(self._run_package_tests(ctx, pkg_dir, file_path, threshold))
    else:
        findings.extend(self._check_test_exists(ctx, file_path))
    return findings
```

### `_resolve_test_package(ctx, file_path)`

```python
# `go list -f '{{.Dir}}' <import-path>` would be ideal, but it requires
# a build. V09 uses the convention "test file lives in the same dir":
parent = Path(file_path).parent
if any(parent.glob("*_test.go")):
    return parent
return None
```

### `_run_package_tests(ctx, pkg_dir, file_path, threshold)` — V09-TEST-FAIL

```python
result = subprocess.run(
    ["go", "test", "-json", "-count=1", "./..."],
    cwd=str(pkg_dir),
    capture_output=True, text=True, timeout=60,
)
failures: list[tuple[str, str]] = []  # (package, test_name)
for line in result.stdout.splitlines():
    try:
        evt = json.loads(line)
    except json.JSONDecodeError:
        continue
    if evt.get("Action") == "fail" and "Test" in evt.get("Test", ""):
        failures.append((evt["Package"], evt["Test"]))

# Record into the shared tracker; emit V09-REPEATED-FAIL when streak ≥ threshold
tracker = FeedbackTracker(ctx)
for pkg, test in failures:
    sig = f"V09::{pkg}::{test}"
    streak = tracker.record_failure(sig)
    yield Finding(
        severity="error",
        rule="V09-TEST-FAIL" if streak < threshold else "V09-REPEATED-FAIL",
        ...
    )
```

### `_check_test_exists(ctx, file_path)` — V09-NO-TEST

```python
# Heuristic: count exported symbols (Test should exist for at least one)
EXPORT = re.compile(r'^func\s+(?:\(\w+\s+\*?\w+\)\s+)?([A-Z]\w+)\s*\(', re.MULTILINE)
src = Path(file_path).read_text()
exports = [m.group(1) for m in EXPORT.finditer(src) if not m.group(1).startswith("Test")]
if not exports:
    return []  # nothing to test

test_file = Path(file_path).with_name(Path(file_path).stem + "_test.go")
if not test_file.exists():
    yield Finding(severity="warning", rule="V09-NO-TEST", ...)
    return

From HwangTaehyun/verifiers, MIT.

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Apr 29, 2026 (6 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get V09-go-test-runner running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying V09-go-test-runner?

CallGet help
Cite this page

V09-go-test-runner skill. Agent Mart. https://agentmart.dev/skills/hwangtaehyun-v09-go-test-runner (last updated 2026-10-24)