reactuse: Skill for Claude Code

.claude/skills/hook-test/SKILL.md

hook-test is a skill for Claude Code from childrentime/reactuse. It costs 77 tokens per session (1,022 once invoked), scanned A, original, Unlicense.

A testing guide for React hooks in the @reactuses/core package, using Jest and React Testing Library. It explains where tests go and how to check state changes, timers, server-side rendering, and cleanup.

In plain words
What is it for?
Use it to add tests, test new hook behavior, check prop changes and cleanup, or investigate a failing hook test.
Why use it?
It gives developers a consistent way to test hooks without searching through the repository for examples.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is childrentime/reactuse's own configuration. It tells Claude Code how to work on reactuse itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything reactuse configures →

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is * @jest-environment ./.test/ssr-environment.

About the project

ReactUse is a TypeScript library of reusable React Hooks for browser APIs, state, sensors, animations, and DOM interactions. React developers use it when building React applications that need these common behaviors. The catalogue skills and commands help coding agents discover or work with ReactUse hooks.

childrentime/reactuse · 1,068 stars · on GitHub · reactuse.com

Reuse

Borrowing it

Nothing to install: this file belongs to childrentime/reactuse. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/childrentime/reactuse/main/.claude/skills/hook-test/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/childrentime/reactuse

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 hook-test

README.md
[![agentmods](https://agentmods.dev/badge/skills/childrentime/reactuse/hook-test/github.svg)](https://agentmods.dev/skills/childrentime/reactuse/hook-test)
Your own site
<a href="https://agentmods.dev/skills/childrentime/reactuse/hook-test"><img src="https://agentmods.dev/badge/skills/childrentime/reactuse/hook-test/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 hook-test

Your own site · 80×15
<a href="https://agentmods.dev/skills/childrentime/reactuse/hook-test"><img src="https://agentmods.dev/badge/skills/childrentime/reactuse/hook-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 77 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,022 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found 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.00077 $0.01022
Opus 5.5 $0.00031 $0.00409
Sonnet 5.5 $0.00015 $0.00204
Haiku 4.5 $0.00008 $0.00102

Measured 2mo ago against content hash 72db6b81b996, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

hook-test 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 2mo 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.

.claude/skills/hook-test/SKILL.md · 123 lines

How it starts

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

hook-test — test a hook the ReactUse way

The core package uses jest (not vitest), testEnvironment: 'jsdom'. Tests run via babel-jest against src/ directly — no build step needed.

Where tests live

Co-located with the hook: packages/core/src/useX/index.spec.ts (a couple use .test.ts, but prefer index.spec.ts). There is no central __tests__ directory.

Basic pattern

import { act, renderHook } from '@testing-library/react'
import { useX } from '.'

describe('useX', () => {
  function setUp(initial?: number) {
    return renderHook(() => useX(initial))
  }

  it('inits with the given value', () => {
    const { result } = setUp(5)
    expect(result.current[0]).toBe(5)
  })

  it('updates on set', () => {
    const { result } = setUp(0)
    act(() => {
      result.current[1](10)        // wrap every state mutation in act()
    })
    expect(result.current[0]).toBe(10)
  })
})

Key rules:

  • Wrap a renderHook call in a small setUp() helper.
  • Every state mutation goes inside act(() => { … }).
  • Read current values via result.current; use rerender() / unmount() from the renderHook return for prop changes and cleanup assertions.

Timer hooks

describe('useInterval', () => {
  jest.useFakeTimers()
  jest.spyOn(global, 'clearInterval')

  it('fires on the interval', () => {
    const cb = jest.fn()
    renderHook(() => useInterval(cb, 20))
    expect(cb).not.toBeCalled()
    jest.advanceTimersByTime(70)
    expect(cb).toHaveBeenCalledTimes(3)
  })

  it('clears on unmount', () => {
    const { unmount } = renderHook(() => useInterval(jest.fn(), 200))
    unmount()
    expect(clearInterval).toHaveBeenCalledTimes(1)
  })
})

SSR / hydration tests

For hooks that must not break SSR or cause hydration mismatch, use the custom environment and render on the server, then hydrate:

/**
 * @jest-environment ./.test/ssr-environment
 */
import { act } from '@testing-library/react'
import ReactDOMServer from 'react-dom/server'
import ReactDOMClient from 'react-dom/client'
import { createMockMediaMatcher } from '../../.test'
import { createTestComponent } from '../../.test/testingHelpers'

describe('useX SSR', () => {
  beforeEach(() => {
    jest.resetModules()
    window.matchMedia = createMockMediaMatcher({ '(prefers-color-scheme: dark)': true }) as any
  })

  it('does not mismatch during hydration', async () => {
    const TestComponent = createTestComponent(() => useX())
    const el = document.createElement('div')
    const markup = ReactDOMServer.renderToString(<TestComponent />)
    el.innerHTML = markup
    const root = await act(() => ReactDOMClient.hydrateRoot(el, <TestComponent />))
    expect(el.innerHTML).toBe(markup)
    await act(() => root.unmount())
  })
})

Read the full file on GitHub · 123 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. 2mo ago First seen · 123 lines · 77 tokens per session scan A 72db6b81b996

Subscribe to this mod's changes

hook-test is a skill published in the GitHub repository childrentime/reactuse (1,068 stars, last pushed 8d ago), licensed Unlicense. It adds 77 tokens to every session and 1,022 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

hook-test compared with skills from other repositories

hook-test next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
hook-testchildrentime/reactuseSkill1.1k8d agoUnlicenseA77Claude Code
testing-best-practicessiberiacancode/agent-skillsSkill2327d agoMITA47Claude Code, Codex
unit-test-grillsiberiacancode/agent-skillsSkill2327d agoMITA22Codex
react-native-testingcallstack/react-native-testing-librarySkill3.4kyesterdayMITA134Claude Code, Codex
verify-workHoangNguyen0403/agent-skills-standardSkill583todayMITA23Codex
vitestjezweb/claude-skillsSkill1.1k28d agoMITA87Claude Code
authoring-data-quality-checksPostHog/posthogSkill41kyesterdaynoneA174Claude Code, Codex