Agent skill

Minitest Pbt Lua

by kokusenz in kokusenz/deltaview.nvim

This skill should be used when the user asks to write property-based tests, PBT, or pseudo property-based tests for a Neovim plugin using the MiniTest (mini.test) framework in Lua.

MITAuto-check passed

Install Minitest Pbt Lua

skills CLI
$ npx skills add kokusenz/deltaview.nvim --skill minitest-pbt-lua -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install kokusenz/deltaview.nvim minitest-pbt-lua --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/kokusenz/deltaview.nvim.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/minitest-pbt-lua .claude/skills/minitest-pbt-lua && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
minitest-pbt-lua
GitHub stars
127
Token cost
~2.6k tokens
SKILL.md length
604 words
Files
1
Skills in repo
3
Repo updated
First seen
Licence
MIT

At a glance

This skill should be used when the user asks to write property-based tests, PBT, or pseudo property-based tests for a Neovim plugin using the MiniTest (mini.test) framework in Lua.

  • Works in 3 steps: Input generators — functions that… → Property cases — curated scenarios… → Properties — assertions expressed as Lua…
  • Asks to write property-based tests
  • SKILL.md covers Core Concept, File Structure, Input Generators and Property Structure, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Minitest Pbt Lua is an agent skill from kokusenz/deltaview.nvim. This skill should be used when the user asks to write property-based tests, PBT, or pseudo property-based tests for a Neovim plugin using the MiniTest (mini.test) framework in Lua. Use when the user says things like "add property tests", "write a PBT for", "property based test for", "mini.test property", or "fuzz inputs for".

Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It works with Lua. The repository describes itself as: inline/unified diff view in neovim with delta highlighting. The licence is MIT.

When your agent uses it

  • Asks to write property-based tests
  • Pseudo property-based tests for a Neovim plugin using the MiniTest (mini.test) framework in Lua
  • The user says things like add property tests
  • Write a PBT for

Example prompts

  • “add property tests”
  • “write a PBT for”
  • “property based test for”
  • “/minitest-pbt-lua”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Input generators — functions that produce exhaustive or edge-covering input sets
  2. Property cases — curated scenarios (different data shapes, buffer contents, configurations) that each run against every property
  3. Properties — assertions expressed as Lua strings evaluated inside a child neovim process

What it can do on your machine

Read from SKILL.md and the folder at commit 3893d56. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are lua).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Minitest Pbt Lua loads about 2.6k tokens when it runs. Until then it costs about 86 tokens; SKILL.md has 604 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~86
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from kokusenz/deltaview.nvim at commit 3893d56, republished under its MIT licence (© kokusenz). 604 words, ~2,576 tokens.

Download SKILL.mdSave it as .claude/skills/minitest-pbt-lua/SKILL.md (or your agent's skills folder).
name
minitest-pbt-lua
description
This skill should be used when the user asks to write property-based tests, PBT, or pseudo property-based tests for a Neovim plugin using the MiniTest (mini.test) framework in Lua. Use when the user says things like "add property tests", "write a PBT for", "property based test for", "mini.test property", or "fuzz inputs for".
version
1.0.0

Property-Based Testing with MiniTest for Neovim Plugins

A pattern for writing pseudo property-based tests (PBT) in Lua using mini.test, where test cases are curated hard-coded inputs iterated exhaustively against one or more properties. This is not a true PBT framework — there is no random generation — but it achieves the same goal: separating what inputs to test from what to assert.

Core Concept

Split the test into three concerns:

  1. Input generators — functions that produce exhaustive or edge-covering input sets
  2. Property cases — curated scenarios (different data shapes, buffer contents, configurations) that each run against every property
  3. Properties — assertions expressed as Lua strings evaluated inside a child neovim process

Properties and cases are combined in a nested loop: every property runs against every case.

File Structure

lua
-- ─────────────────────────────────────────────────────────────────
-- function_name() - property based tests

local FunctionName = {}

-- Input generator: returns a list of inputs to iterate in the property
FunctionName.get_inputs = function(buf_contents) ... end

-- Property cases: each case defines a distinct data shape / scenario
--- @class function_name__property_cases
FunctionName.function_name__property_cases = {
    { name = '...', buf_contents = {...}, get_inputs = FunctionName.get_inputs, ... },
    { name = '...', buf_contents = {...}, get_inputs = FunctionName.get_inputs, ... },
}

-- Properties: each is a Lua string that returns true/false when evaluated in child neovim
FunctionName.properties = {}
FunctionName.properties.property_name = [[(function() ... return true end)()]]

-- Test loop: cross-product of properties × cases
T['function_name() properties'] = new_set()
for func_name, func in pairs(FunctionName.properties) do
    for _, case in ipairs(FunctionName.function_name__property_cases) do
        T['function_name() properties'][func_name .. ': ' .. case.name] = function()
            -- pass inputs into child neovim via _G.fixture
            child.lua([[_G.fixture.inputs = ...]], { case.get_inputs(case.buf_contents) })
            -- set up buffer in child neovim
            child.lua([[
                local bufnr = vim.api.nvim_create_buf(true, true)
                vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, ...)
                vim.api.nvim_set_current_buf(bufnr)
                _G.fixture.bufnr = bufnr
                _G.fixture.winnr = vim.api.nvim_get_current_win()
            ]], { case.buf_contents })
            -- pass any additional fixture data
            child.lua([[vim.b[_G.fixture.bufnr].some_data = ...]], { case.some_data })
            local result = child.lua_get(func)
            eq(result, true)
        end
    end
end

Input Generators

Generate inputs exhaustively, including boundary and invalid values. The assume pattern (see below) filters out invalid combinations inside the property.

lua
-- Cursor-style: every (row, col) in the buffer, including zero-indexed cols
FunctionName.get_cursors_set = function(buf_contents)
    local set = {}
    for i, v in ipairs(buf_contents) do
        for j = 1, #v do
            table.insert(set, { i, j - 1 })
        end
    end
    return set
end

-- Numeric inputs: sweep a range including below-zero and beyond-max edge cases
FunctionName.get_inputs = function(buf_contents)
    local set = {}
    for winline = -1, #buf_contents + 1 do
        for row, line in ipairs(buf_contents) do
            for col = -1, #line + 1 do
                table.insert(set, { target_row = row, target_col = col, og_winline = winline })
            end
        end
    end
    -- extreme edge cases
    table.insert(set, { target_row = 9999, target_col = 9999, og_winline = 9999 })
    table.insert(set, { target_row = -9999, target_col = -9999, og_winline = -9999 })
    return set
end

Property Structure

Properties are Lua strings ([[(function() ... end)()]]) evaluated in the child neovim via child.lua_get. They must return true (pass) or false (fail). They read from _G.fixture which was populated by the test loop before evaluation.

lua
FunctionName.properties.property_name = [[(function()
    local inputs  = _G.fixture.inputs
    local bufnr   = _G.fixture.bufnr
    local winnr   = _G.fixture.winnr

    for _, input in ipairs(inputs) do
        -- [assume] skip invalid inputs vacuously
        if input.value < 0 then goto continue end

        -- call the function under test
        M.some_function(bufnr, winnr, input.value)

        -- assert the property
        local actual = vim.api.nvim_win_get_cursor(winnr)
        if actual[1] ~= input.expected_row then return false end

        ::continue::
    end

    return true
end)()]]
Assume Semantics

Use goto continue + ::continue:: to skip inputs that violate preconditions (analogous to assume/guard in real PBT frameworks). This makes the property vacuously true for those inputs rather than failing.

For single-value properties (no loop), use an early return true:

lua
if precondition_not_met then return true end

Mocking

What to mock

Mock functions that:

  • Are side-effectful and not under test (vim.api.nvim_echo, vim.defer_fn, vim.cmd for file opens)
  • Are plugin-internal functions on M that the function under test calls but you want to isolate (M.setup_something, M.set_restview)
  • Return runtime values that can't be known at fixture-setup time (M.get_cursor_placement_current_buffer)
What NOT to mock

Do not mock native Neovim/Vim API functions (vim.api.*, vim.fn.*). These are the ground truth of the running environment. Mocking them undermines the value of the test. Let the child neovim execute them for real.

How to mock in a property string

Replace functions by direct Lua assignment inside the property string. Always save and restore originals if the mock changes global state that other properties or iterations might depend on.

lua
FunctionName.properties.some_property = [[(function()
    local winnr = _G.fixture.winnr

    -- mock plugin-internal function; capture runtime value via closure
    local current_cursor = nil
    M.get_cursor_placement_current_buffer = function()
        return { winnr = winnr, cursor = current_cursor }
    end

    -- mock side-effectful calls not under test
    local orig_nvim_echo = vim.api.nvim_echo
    local orig_defer_fn  = vim.defer_fn
    vim.api.nvim_echo = function() end
    vim.defer_fn      = function() end

    -- mock plugin helpers
    M.set_restview            = function() end
    M.setup_cursor_placement  = function() end

    local result = true
    for _, input in ipairs(_G.fixture.inputs) do
        current_cursor = input.cursor  -- update closure each iteration
        M.function_under_test(_G.fixture.bufnr, input.forward)
        local new_row = vim.api.nvim_win_get_cursor(winnr)[1]
        if not valid_rows[new_row] then result = false; break end
    end

    -- restore originals
    vim.api.nvim_echo = orig_nvim_echo
    vim.defer_fn      = orig_defer_fn
    return result
end)()]]
Show full SKILL.md (257 more words)Show less

Passing State via _G.fixture

Use _G.fixture as the namespace for all data passed from the host test process into the child neovim. Populate it with separate child.lua(...) calls before evaluating the property.

lua
-- scalars / tables serialized by MiniTest's RPC
child.lua([[_G.fixture = {}]])  -- reset between cases (or rely on child.restart())
child.lua([[_G.fixture.inputs = ...]], { case.get_inputs(case.buf_contents) })

-- runtime values (bufnr, winnr) must be captured inside child.lua, not passed as args
child.lua([[
    local bufnr = vim.api.nvim_create_buf(true, true)
    vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, ...)
    vim.api.nvim_set_current_buf(bufnr)
    _G.fixture.bufnr = bufnr
    _G.fixture.winnr = vim.api.nvim_get_current_win()
]], { case.buf_contents })

-- buffer-local variables
child.lua([[vim.b[_G.fixture.bufnr].some_buf_var = ...]], { case.some_data })

-- conditional fixture values (e.g. a bufnr that may or may not exist)
if case.use_alternative_bufnr then
    child.lua([[_G.fixture.alternative_bufnr = vim.api.nvim_create_buf(true, true)]])
else
    child.lua([[_G.fixture.alternative_bufnr = nil]])
end

Buffer Setup Best Practices

  • Create buffers inside child.lua (never pass bufnr from host — the integer won't match)
  • Set the buffer as current immediately after creation so nvim_get_current_win() reflects it
  • Capture winnr from inside the same child.lua call that sets the current buffer
  • Set buffer-local variables (vim.b[bufnr].x) in a separate child.lua call after the bufnr is in _G.fixture

Property Case Design Guidelines

Each case should represent a distinct scenario (not just different numeric inputs). Good axes for variation:

  • Different data shapes: single hunk vs. multiple hunks, one file vs. two files
  • Presence/absence of optional fields: filepath = nil vs. filepath = 'src/foo.lua'
  • Line types: context-only, added-only, removed-only, mixed
  • Boundary conditions: empty buffer, single-line buffer, cursor at first/last row
  • Known edge cases or documented bugs: document them in a comment even if the test can't catch them in headless mode

Aim for 3–5 cases. More cases slow the suite; fewer miss meaningful variation.

When Properties Can't Catch Real Bugs

Some bugs only manifest with an attached terminal (e.g., vim.fn.screenpos() returning 0 for off-screen lines in interactive mode but not in headless child neovim). When this happens:

  • Document the limitation in a comment above the property
  • Add an assume (goto continue) to exclude the inputs that trigger the bug, rather than letting the property silently pass for wrong reasons
  • Note the bug in the function's source comments for manual testing

© kokusenz, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/minitest-pbt-lua of kokusenz/deltaview.nvim.

Open the folder on GitHubat commit 3893d56

Compare with similar skills

Minitest Pbt Lua next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Minitest Pbt Lua compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Minitest Pbt Lua this skillkokusenz/deltaview.nvim127—~2.6kAutomated safety check: PassMIT
Pandoc DOCX TemplateAchuan-2/pandoc_docx_template1.1k—~1kAutomated safety check: PassNone
Add Lua Binding Simplecataclysmbn/Cataclysm-BN1.3k—~846Automated safety check: PassCustom licence
Cpp Compiler FlagsSerial-Studio/Serial-Studio7.2k—~2.1kAutomated safety check: PassCustom licence
Agentic GitHub Discussioncarlos-algms/agentic.nvim641—~1.1kAutomated safety check: PassMIT
Luamakeactboy168/luamake210—~2kAutomated safety check: PassMIT

Similar skills

  • Pandoc DOCX Template

    Achuan-2/pandoc_docx_template

    A skill your agent uses when converting Markdown to Word DOCX or DOCX back to Markdown with Pandoc, especially when the output should use the bundled Chinese Word reference templates, heading…

    1.1k GitHub stars~1k tokensUpdated 3 mo ago
    Documents & OfficeAuto-check passed
  • Add Lua Binding Simple

    cataclysmbn/Cataclysm-BN

    Add simple Cataclysm-BN Lua bindings for stringid types, enums, and basic read-only C++ types.

    1.3k GitHub stars~846 tokensUpdated today
    Auto-check passed
  • Cpp Compiler Flags

    Serial-Studio/Serial-Studio

    C++ compiler/linker flag guidance for Serial Studio's build (GCC, Clang, AppleClang, MSVC cl.exe, clang-cl, MinGW, IntelLLVM).

    7.2k GitHub stars~2.1k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Agentic GitHub Discussion

    carlos-algms/agentic.nvim

    A skill your agent uses when creating, listing, or managing GitHub discussions in carlos-algms/agentic.nvim repository

    641 GitHub stars~1.1k tokensUpdated 2 days ago
    Auto-check passed
  • Luamake

    actboy168/luamake

    Luamake 构建系统指南——用于当前项目的 luamake / make.lua / Ninja 生成流程。当用户需要编写、修改、排查或理解 make.lua、目标定义、lm:conf、deps / objdeps、代码生成、Lua C 模块、Bee 运行时集成,或需要解决当前项目中由 luamake 驱动的构建问题时,使用此 skill。即使用户没有明确提到…

    210 GitHub stars~2k tokensUpdated today
    Auto-check passed
  • Lua Eco

    zhaojh329/lua-eco

    International lua-eco public API skill for writing, reviewing, explaining, and fixing Lua 5.4 code that runs on the eco runtime.

    103 GitHub stars~1.7k tokensUpdated 8 days ago
    Backend & APIsAuto-check passed

More from kokusenz/deltaview.nvim

  • Minitest Ebt Lua

    kokusenz/deltaview.nvim

    This skill should be used when the user asks to write example-based tests, unit tests, or EBT for a Neovim plugin using the MiniTest (mini.test) framework in Lua.

    127 GitHub stars~4k tokensUpdated 1 mo ago
    Auto-check passed
  • Minitest Integration Lua

    kokusenz/deltaview.nvim

    This skill should be used when the user asks to write integration tests for a Neovim plugin using the MiniTest (mini.test) framework in Lua.

    127 GitHub stars~4.5k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Questions about Minitest Pbt Lua

What does Minitest Pbt Lua do?

This skill should be used when the user asks to write property-based tests, PBT, or pseudo property-based tests for a Neovim plugin using the MiniTest (mini.test) framework in Lua. nvim.test) framework in Lua.

When should I use Minitest Pbt Lua?

Minitest Pbt Lua fits situations like: asks to write property-based tests; pseudo property-based tests for a Neovim plugin using the MiniTest (mini.test) framework in Lua; the user says things like add property tests; write a PBT for.

How do I install Minitest Pbt Lua in Claude Code?

Run `npx skills add kokusenz/deltaview.nvim --skill minitest-pbt-lua -a claude-code`. Or copy the skill folder (.claude/skills/minitest-pbt-lua in kokusenz/deltaview.nvim) into .claude/skills/minitest-pbt-lua in your project. Claude Code loads it when a task matches its description.

How do I install Minitest Pbt Lua in Codex?

Run `npx skills add kokusenz/deltaview.nvim --skill minitest-pbt-lua -a codex`. Or copy the skill folder (.claude/skills/minitest-pbt-lua in kokusenz/deltaview.nvim) into .agents/skills/minitest-pbt-lua in your project. Codex loads it when a task matches its description.

Can I use Minitest Pbt Lua in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add kokusenz/deltaview.nvim --skill minitest-pbt-lua -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/minitest-pbt-lua, .gemini/skills/minitest-pbt-lua, .github/skills/minitest-pbt-lua and .opencode/skills/minitest-pbt-lua in your project.

What does Minitest Pbt Lua need to run?

SKILL.md names no scripts, command-line tools or credentials: Minitest Pbt Lua is instructions for the agent only.

Does Minitest Pbt Lua access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Minitest Pbt Lua safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Minitest Pbt Lua use?

Minitest Pbt Lua is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Minitest Pbt Lua use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Minitest Pbt Lua?

Skills that share tags, products or a category with Minitest Pbt Lua: Pandoc DOCX Template (Achuan-2/pandoc_docx_template, 1.1k stars), Add Lua Binding Simple (cataclysmbn/Cataclysm-BN, 1.3k stars), Cpp Compiler Flags (Serial-Studio/Serial-Studio, 7.2k stars) and Agentic GitHub Discussion (carlos-algms/agentic.nvim, 641 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Minitest Pbt Lua?

kokusenz (a GitHub user) maintains it in kokusenz/deltaview.nvim, which has 127 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on August 12, 2026.

Source: kokusenz/deltaview.nvim on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.