goccy/tobari/tobari-duplicated-tests-remover

Claude Code and agent skill by goccy/tobari

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Analyze test coverage data from tobari.toon to find and remove duplicate test cases that cover nearly identical code paths. Use when the user has run go test with tobari enabled (e.g., `GOFLAGS="$(tobari flags)" go test ./...`) and wants to find redundant tests. Triggers on phrases like "find duplicate tests", "remove redundant tests", "duplicated tests", or "test overlap".

Install

npx vskill@latest install goccy/tobari/tobari-duplicated-tests-remover

SKILL.md

Remove Duplicated Tests

This skill analyzes test coverage data from tobari to find and remove duplicate test cases that cover nearly identical code paths.

Prerequisites

Ensure you have run tests with tobari enabled:

bash
GOFLAGS="$(tobari flags)" go test ./...

How to Read Coverage Data

  1. Check if TOBARI_COVERDIR environment variable is set:

``bash echo $TOBARI_COVERDIR ``

  1. If set, read $TOBARI_COVERDIR/tobari/tobari.toon
  2. If not set or empty, read ./tobari/tobari.toon from current directory

TOON Format Parsing

The tobari.toon file uses Token-Oriented Object Notation format:

TestName[N]{FileName,StartLine,StartCol,EndLine,EndCol,StatementCount,Count}:
/path/to/file.go,7,24,9,2,1,4
/path/to/file.go,11,29,12,22,1,0
  • Top-level key is the test name (e.g., Add corresponds to TestAdd function)
  • [N] indicates the number of entries
  • Each indented line (starting with tab) is a coverage entry with comma-separated values:
  • FileName: source file path
  • StartLine, StartCol: start position
  • EndLine, EndCol: end position
  • StatementCount: number of statements in this block
  • Count: execution count (0 = not covered)
Reports with passedBlocksOnly

If tobari.toon ends with a passedBlocksOnly[N]: section, the tests listed there come from a binary built with --passed-blocks-only: their per-test lists hold only blocks that were actually passed, so none of their entries has Count = 0. Do not conclude that everything is covered. Derive the full set of blocks from the all[N]: list in the metadata: section instead (each line is FileName,StartLine,StartCol,EndLine,EndCol,StatementCount), and treat a block of all that appears in no test as not covered. If the metadata: section also has a sources[N]{Source,Files}: list and the file ends with a source[N]{Name,Source}: section, the report merges several programs: restrict all to the files of the test's own source.

Detect Duplicate Test Cases

Compare coverage entries between all test cases to find tests that cover nearly identical code paths.

Calculate Match Rate

For each pair of tests (TestA, TestB):

  1. Create a set of "coverage signatures" for each test:
  • Signature = FileName:StartLine:StartCol:EndLine:EndCol:IsCovered
  • IsCovered = 1 if Count > 0, else 0
  1. Calculate match rate:

`` CommonSignatures = signatures in both TestA and TestB with same IsCovered value AllSignatures = union of all signatures from both tests MatchRate = len(CommonSignatures) / len(AllSignatures) * 100 ``

  1. If MatchRate > 95%, these tests are considered duplicates
Action for Duplicates

If duplicate test pairs are found:

  1. List all test pairs with >95% match rate, showing:
  • Test names
  • Match percentage
  • Number of shared coverage entries
  1. Use AskUserQuestion to ask the user:
  • Question: "The following test pairs cover almost identical code paths. Which test(s) would you like to remove?"
  • Options for each duplicate pair, plus "Keep all tests"
  1. If user selects tests to remove:
  • Find the test file containing those tests
  • Delete the selected test functions
  • Re-run tests with tobari to verify:

``bash GOFLAGS="$(tobari flags)" go test ./... ``

  1. If no duplicates found, inform the user that all tests have unique coverage patterns

Guidelines

  • Before removing tests, ensure they don't have different assertions even if coverage is similar
  • Consider if tests document different use cases or edge cases
  • Table-driven tests with multiple cases may show as duplicates - review the test logic before removal

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
48
Repository forks
2
7-day trend score
19

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 24 Mar 2026, 7 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/goccy/tobari/tobari-duplicated-tests-remover/badge)](https://verified-skill.com/skills/goccy/tobari/tobari-duplicated-tests-remover)

Something wrong with this skill or its page? Tell us.