Agent skill

Eslint Vitest Rule Tester

by antfu-collective in antfu-collective/eslint-vitest-rule-tester

Help users test ESLint rules with Vitest, supporting snapshot testing and custom assertions

MITAuto-check passedTesting & QA

Install Eslint Vitest Rule Tester

skills CLI
$ npx skills add antfu-collective/eslint-vitest-rule-tester --skill eslint-vitest-rule-tester -a claude-code

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

GitHub CLI
$ gh skill install antfu-collective/eslint-vitest-rule-tester eslint-vitest-rule-tester --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/antfu-collective/eslint-vitest-rule-tester.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/eslint-vitest-rule-tester .claude/skills/eslint-vitest-rule-tester && 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
eslint-vitest-rule-tester
GitHub stars
142
Token cost
~1.3k tokens
SKILL.md length
347 words
Files
1
Skills in repo
1
Repo updated
First seen
Licence
MIT

At a glance

Help users test ESLint rules with Vitest, supporting snapshot testing and custom assertions

  • Works in 2 steps: run({ name, rule, valid, invalid,… → createRuleTester({ name, rule, configs…
  • Tasks that involve Unit testing
  • SKILL.md covers Core APIs, When Helping Users, Troubleshooting and Best Practices
  • Calls vitest

What it does

Eslint Vitest Rule Tester is an agent skill from antfu-collective/eslint-vitest-rule-tester. Help users test ESLint rules with Vitest, supporting snapshot testing and custom assertions

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

It sits in Testing & QA, covering Unit testing and Linting and formatting. It works with Vitest, ESLint and TypeScript. The repository describes itself as: ESLint rule tester with Vitest, with more powerful and friendly APIs. The licence is MIT.

When your agent uses it

  • Tasks that involve Unit testing
  • Tasks that involve Linting and formatting

Example prompts

  • “/eslint-vitest-rule-tester”

Workflow steps

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

  1. run({ name, rule, valid, invalid, ...config }) - All-in-one object style (config directly in object)
  2. createRuleTester({ name, rule, configs }) - Returns { valid, invalid } for explicit Vitest describe/it blocks (note: configs key, not…

What it can do on your machine

Read from SKILL.md and the folder at commit 8b669e7. 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

    Shell commands in SKILL.md call:

    • vitest

    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

Eslint Vitest Rule Tester loads about 1.3k tokens when it runs. Until then it costs about 29 tokens; SKILL.md has 347 words of instructions outside code blocks.

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

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 antfu-collective/eslint-vitest-rule-tester at commit 8b669e7, republished under its MIT licence (© antfu-collective). 347 words, ~1,280 tokens.

Download SKILL.mdSave it as .claude/skills/eslint-vitest-rule-tester/SKILL.md (or your agent's skills folder).
name
eslint-vitest-rule-tester
description
Help users test ESLint rules with Vitest, supporting snapshot testing and custom assertions
meta.version
3.0.1
meta.author
Anthony Fu

Instructions

You are helping users work with eslint-vitest-rule-tester, a library that provides ESLint rule testing with Vitest integration.

Core APIs

Two testing approaches:

  1. run({ name, rule, valid, invalid, ...config }) - All-in-one object style (config directly in object)
  2. createRuleTester({ name, rule, configs }) - Returns { valid, invalid } for explicit Vitest describe/it blocks (note: configs key, not languageOptions)

Key extensions:

  • output and errors fields can be functions for custom assertions and snapshots
  • onResult hook for full result object validation
  • No globals: true required in Vitest config

When Helping Users

Identify testing style first:

  • Check if they have existing tests to match their pattern
  • Default to run() for simplicity (see Pattern 1 below)
  • Use createRuleTester() for explicit Vitest test blocks with individual it() tests (Pattern 3)

Configuration:

  • Use languageOptions.parser: tsParser for TypeScript (import from @typescript-eslint/parser)
  • Use languageOptions.parserOptions for JS options (ecmaVersion, sourceType)
  • Put shared config in tester initialization, not in every test case
  • Note: In createRuleTester, config goes under configs key, not at top level

Type safety:

  • Use satisfies TestCasesOptions['valid'] for valid test arrays
  • Use satisfies TestCasesOptions['invalid'] for invalid test arrays
  • Extract test cases as constants before passing to run() (see Pattern 1)

Snapshots:

  • Use onResult hook with toMatchSnapshot() for all invalid cases (Pattern 1)
  • Use function-based output/errors with toMatchInlineSnapshot() for inline snapshots (Pattern 2)
  • Recommend toMatchInlineSnapshot() over toMatchSnapshot() when possible for better visibility

Common patterns:

ts
// Pattern 1: run() with extracted test cases (from top-level-function.test.ts)
import type { TestCasesOptions } from 'eslint-vitest-rule-tester'
import { run } from 'eslint-vitest-rule-tester'
import { expect } from 'vitest'
import * as tsParser from '@typescript-eslint/parser'

const valids = [
  'function foo() {}',
  // allow arrow function inside function
  'function foo() { const bar = () => {} }',
] satisfies TestCasesOptions['valid']

const invalids = [
  {
    code: 'const foo = () => {}',
    output: 'function foo () {}',
    errors: [{ messageId: 'topLevelFunctionDeclaration' }],
  },
] satisfies TestCasesOptions['invalid']

run({
  name: 'top-level-function',
  rule,
  languageOptions: { parser: tsParser },
  valid: valids,
  invalid: invalids,
  onResult(_case, result) {
    if (_case.type === 'invalid')
      expect(result.output).toMatchSnapshot()
  },
})

// Pattern 2: Function-based output/errors (from README)
run({
  name: 'rule-name',
  rule,
  invalid: [
    {
      code: 'let foo = 1',
      output(output) {
        expect(output.slice(0, 3)).toBe('let')
        expect(output).toMatchInlineSnapshot(`"const foo = 1;"`)
      },
      errors(errors) {
        expect(errors).toHaveLength(1)
        expect(errors.map(e => e.messageId))
          .toMatchInlineSnapshot(`["preferConst"]`)
      },
    },
  ],
})

// Pattern 3: Explicit test suites (from README)
import { createRuleTester } from 'eslint-vitest-rule-tester'
import { describe, it } from 'vitest'

describe('rule-name', () => {
  const { valid, invalid } = createRuleTester({
    name: 'rule-name',
    rule,
    configs: {
      languageOptions: {
        parserOptions: { ecmaVersion: 2020, sourceType: 'module' },
      },
    },
  })

  it('valid case 1', () => {
    valid('const foo = 1')
  })

  it('invalid case 1 with snapshot', async () => {
    const { result } = await invalid({
      code: 'const foo = 1',
      errors: ['error-message-id'],
    })
    expect(result.output).toMatchSnapshot()
  })
})

Troubleshooting

  • Version errors: Requires ESLint v9.10+, check package.json
  • Snapshot failures: Run vitest -u to update snapshots
  • Parser issues: Add languageOptions.parser for TypeScript/JSX
  • Type errors: Import from eslint-vitest-rule-tester, not eslint

Best Practices

  • Match existing patterns - Check existing test files in the project first
  • Extract test cases - Define valids and invalids as constants with satisfies for type safety
  • Add comments - Use inline comments to explain what each test case validates (e.g., // allow arrow function inside function)
  • Use snapshots - Prefer onResult hook for bulk snapshot testing of all invalid cases
  • Consolidate config - Put shared parser/language options at tester level, not per test case
  • TypeScript support - Import @typescript-eslint/parser as tsParser and use in languageOptions.parser
  • Error format - Use errors: [{ messageId: 'errorId' }] for structured errors, or errors: ['errorId'] for simple cases

© antfu-collective, 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 skills/eslint-vitest-rule-tester of antfu-collective/eslint-vitest-rule-tester.

Open the folder on GitHubat commit 8b669e7

Compare with similar skills

Eslint Vitest Rule Tester 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.

Eslint Vitest Rule Tester compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Eslint Vitest Rule Tester this skillantfu-collective/eslint-vitest-rule-tester142—~1.3kAutomated safety check: PassMIT
Npx CLIjwynia/agent-skills170—~2.4kAutomated safety check: PassNone
Typescript ToolingHoangNguyen0403/agent-skills-standard572—~688Automated safety check: PassMIT
Create Saleor Packagesaleor/apps162—~608Automated safety check: PassCustom licence
npm Packagejwynia/agent-skills170—~2.1kAutomated safety check: PassNone
Ha Frontend Testinghome-assistant/frontend5.7k—~1.7kAutomated safety check: PassApache-2.0

Similar skills

  • Npx CLI

    jwynia/agent-skills

    Build and publish npx-executable CLI tools using Bun as the primary toolchain with npm-compatible output.

    170 GitHub stars~2.4k tokensUpdated 7 mo ago
    DevelopmentAuto-check passed
  • Typescript Tooling

    HoangNguyen0403/agent-skills-standard

    Development tools, linting, and build config for TypeScript.

    572 GitHub stars~688 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Scaffold a new shared package in the saleor-apps monorepo under ./packages/.

    162 GitHub stars~608 tokensUpdated 4 days ago
    DevelopmentAuto-check passed
  • npm Package

    jwynia/agent-skills

    Build and publish npm packages using Bun as the primary toolchain with npm-compatible output.

    170 GitHub stars~2.1k tokensUpdated 7 mo ago
    DevelopmentAuto-check passed
  • Ha Frontend Testing

    home-assistant/frontend

    Home Assistant frontend testing and validation workflow. An agent skill from home-assistant/frontend.

    5.7k GitHub stars~1.7k tokensUpdated today
    Testing & QAAuto-check passed
  • Run Tests

    artcc/freelingo

    A skill your agent uses when the user asks to run tests, ejecutar tests, lanzar tests, pytest, vitest, check types, typecheck, lint, or verify the codebase.

    165 GitHub stars~976 tokensUpdated today
    Testing & QAAuto-check passed

Categories

Questions about Eslint Vitest Rule Tester

What does Eslint Vitest Rule Tester do?

Help users test ESLint rules with Vitest, supporting snapshot testing and custom assertions. Eslint Vitest Rule Tester is an agent skill from antfu-collective/eslint-vitest-rule-tester.

When should I use Eslint Vitest Rule Tester?

Eslint Vitest Rule Tester fits situations like: tasks that involve Unit testing; tasks that involve Linting and formatting.

How do I install Eslint Vitest Rule Tester in Claude Code?

Run `npx skills add antfu-collective/eslint-vitest-rule-tester --skill eslint-vitest-rule-tester -a claude-code`. Or copy the skill folder (skills/eslint-vitest-rule-tester in antfu-collective/eslint-vitest-rule-tester) into .claude/skills/eslint-vitest-rule-tester in your project. Claude Code loads it when a task matches its description.

How do I install Eslint Vitest Rule Tester in Codex?

Run `npx skills add antfu-collective/eslint-vitest-rule-tester --skill eslint-vitest-rule-tester -a codex`. Or copy the skill folder (skills/eslint-vitest-rule-tester in antfu-collective/eslint-vitest-rule-tester) into .agents/skills/eslint-vitest-rule-tester in your project. Codex loads it when a task matches its description.

Can I use Eslint Vitest Rule Tester 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 antfu-collective/eslint-vitest-rule-tester --skill eslint-vitest-rule-tester -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/eslint-vitest-rule-tester, .gemini/skills/eslint-vitest-rule-tester, .github/skills/eslint-vitest-rule-tester and .opencode/skills/eslint-vitest-rule-tester in your project.

What does Eslint Vitest Rule Tester need to run?

Going by SKILL.md and its folder, Eslint Vitest Rule Tester needs the command-line tools its instructions call (vitest).

Does Eslint Vitest Rule Tester 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 Eslint Vitest Rule Tester 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 Eslint Vitest Rule Tester use?

Eslint Vitest Rule Tester 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 Eslint Vitest Rule Tester use?

About 1.3k tokens (SKILL.md is roughly 5.1k 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 Eslint Vitest Rule Tester?

Skills that share tags, products or a category with Eslint Vitest Rule Tester: Npx CLI (jwynia/agent-skills, 170 stars), Typescript Tooling (HoangNguyen0403/agent-skills-standard, 572 stars), Create Saleor Package (saleor/apps, 162 stars) and npm Package (jwynia/agent-skills, 170 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Eslint Vitest Rule Tester?

antfu-collective (a GitHub organization) maintains it in antfu-collective/eslint-vitest-rule-tester, which has 142 GitHub stars. The repository was last updated on September 10, 2026.

Source: antfu-collective/eslint-vitest-rule-tester on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.