lsp-test-correlation

lsp-test-correlation is a skill for Claude Code from OKHP3/skillz. It costs 42 tokens per session (1,353 once invoked), scanned A, a copy of lsp-test-correlation, MIT.

A tool that finds the tests associated with a source file and runs only those tests. It uses language-server information to connect implementation files with their relevant test files.

In plain words
What is it for?
Use it after editing code, before committing, or while investigating a failure to discover and run targeted tests.
Why use it?
It avoids running an entire test suite when a change affects only a small part of a project. It also helps identify coverage and the likely tests for a failing source file.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it after editing code, before committing, or while investigating a failure to discover and run targeted tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/okhp3/skillz/lsp-test-correlation
View source ↗ OKHP3/skillz
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add OKHP3/skillz --skill lsp-test-correlation
Clone the repo
git clone --depth 1 https://github.com/OKHP3/skillz

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for lsp-test-correlation

README.md
[![agentmods](https://agentmods.dev/badge/skills/okhp3/skillz/lsp-test-correlation/github.svg)](https://agentmods.dev/skills/okhp3/skillz/lsp-test-correlation)
Your own site
<a href="https://agentmods.dev/skills/okhp3/skillz/lsp-test-correlation"><img src="https://agentmods.dev/badge/skills/okhp3/skillz/lsp-test-correlation/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for lsp-test-correlation

Your own site · 80×15
<a href="https://agentmods.dev/skills/okhp3/skillz/lsp-test-correlation"><img src="https://agentmods.dev/badge/skills/okhp3/skillz/lsp-test-correlation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,353 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00042 $0.01353
Opus 5 $0.00021 $0.00677
Sonnet 5 $0.00008 $0.00271
Haiku 4.5 $0.00004 $0.00135

Measured 6d ago against content hash d2a1b7c67ccb, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

lsp-test-correlation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to lsp-test-correlation — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

community/lsp-test-correlation/SKILL.md · 180 lines

How it starts

The opening of the file, as written. The whole thing — 180 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Requires the agent-lsp MCP server.

lsp-test-correlation

Discover which tests cover a source file, then run only those tests. Faster than running the full suite when you've changed one or two files and want targeted feedback.

When to use

  • After editing a source file: "Which tests do I need to run for this change?"
  • Before committing: run only the tests that cover what you touched
  • Debugging a failure: find which test file corresponds to a broken source file
  • Code review: understand what test coverage exists for a file before merging

Use /lsp-verify instead when you want to run the full suite and check all three layers (diagnostics + build + tests). Use this skill when you want fast, scoped test execution.


Workflow

Step 1 — Find correlated test files

Call get_tests_for_file for each edited source file:

mcp__lsp__get_tests_for_file({ "file_path": "/abs/path/to/source.go" })

Returns the test files that correspond to the source file. For multiple edited files, call once per file.

If no test files are returned: the source file may have no dedicated test file, or the mapping is not resolvable (e.g. integration tests in a separate directory). See Step 2 for fallback.

Step 2 — Enumerate test functions (fallback or enrichment)

If get_tests_for_file returns test files, use find_symbol to list the test functions defined in those files:

mcp__lsp__find_symbol({ "query": "Test" })

Filter results to the correlated test files from Step 1. This gives you the specific test function names to run rather than the whole test file.

Fallback (no test files found): query find_symbol for test functions that contain the changed symbol's name:

mcp__lsp__find_symbol({ "query": "Test<ChangedFunctionName>" })

This catches cases where get_tests_for_file misses indirect coverage.

Step 3 — Report the correlation map

Before running, report what was found:

## Test correlation for <file>

Source file: internal/tools/analysis.go
Test files:
  → internal/tools/analysis_test.go
     Tests: TestHandleGetCodeActions, TestHandleGetCompletions, TestHandleGetDocumentSymbols

No correlated test files found for: internal/lsp/normalize.go
  → Fallback: TestNormalizeCompletion, TestNormalizeDocumentSymbols (from workspace symbol search)

Read the full file on GitHub · 180 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 180 lines · 42 tokens per session scan A d2a1b7c67ccb

Subscribe to this mod's changes

lsp-test-correlation is a skill published in the GitHub repository OKHP3/skillz (3 stars, last pushed yesterday), licensed MIT. It adds 42 tokens to every session and 1,353 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to lsp-test-correlation, differing in 0 lines, and is treated as a copy.