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.
npx skills add ncaq/konoka --skill react-use-refgit clone --depth 1 https://github.com/ncaq/konokaWrote 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.
[](https://agentmods.dev/skills/ncaq/konoka/react-use-ref)<a href="https://agentmods.dev/skills/ncaq/konoka/react-use-ref"><img src="https://agentmods.dev/badge/skills/ncaq/konoka/react-use-ref/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.
<a href="https://agentmods.dev/skills/ncaq/konoka/react-use-ref"><img src="https://agentmods.dev/badge/skills/ncaq/konoka/react-use-ref.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00034 | $0.01365 |
| Opus 5 | $0.00017 | $0.00682 |
| Sonnet 5 | $0.00007 | $0.00273 |
| Haiku 4.5 | $0.00003 | $0.00136 |
Grade A, and why
react-use-ref 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 4d 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.
How it starts
The opening of the file, as written. The whole thing — 155 lines — stays where its author put it; the contents beside it link to each section on GitHub.
useRefの使用を避ける
useRefは命令的なコードになりやすく、
Reactの宣言的なモデルと相性がよくありません。
使う前に代替手段がないか検討してください。
なぜuseRefを避けたいのか
ref.currentはミュータブルであり、レンダリングサイクルと同期しません。値の変更がUIに反映されず、予期しない挙動を起こしやすいです- 命令的なDOM操作はReactの状態管理と二重管理になりやすいです
- テストが難しくなります。DOMの状態をテストするにはDOMのセットアップが必要になります
- コンポーネントの再利用性が下がります。DOM構造に依存したロジックは別の場所で使い回しにくいです
ref.currentへの代入は「いつ読んでも最新」という暗黙の前提に依存しており、データフローが追いにくくなります
代替手段の検討
HTML標準の機能を使う
ブラウザが提供する宣言的なHTML要素や属性で解決できないか、 まず検討してください。
// Bad: useRefで開閉を命令的に管理
const detailsRef = useRef<HTMLDetailsElement>(null);
const toggle = () => {
if (detailsRef.current) {
detailsRef.current.open = !detailsRef.current.open;
}
};
// Good: HTML標準の<details>要素なら宣言的に開閉できる
<details>
<summary>詳細を表示</summary>
<p>ここに詳細が表示されます。</p>
</details>;
// Bad: useRefでポップオーバーの表示を命令的に管理
const popoverRef = useRef<HTMLDivElement>(null);
const showPopover = () => popoverRef.current?.showPopover();
// Good: popover属性とpopoverTargetで宣言的に表現
<button popoverTarget="my-popover">開く</button>
<div id="my-popover" popover="auto">ポップオーバーの内容</div>
<details>、<dialog>、popover属性、<input type="date">など、
以前はJavaScriptが必要だった機能の多くが現在はHTML標準で提供されています。
宣言的なライブラリを使う
DOM操作を抽象化してくれるライブラリがあれば、 そちらを優先してください。
// Bad: useRefとuseEffectでIntersectionObserverを管理
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
const observer = new IntersectionObserver(([entry]) => {
setIsVisible(entry.isIntersecting);
});
if (ref.current) observer.observe(ref.current);
return () => observer.disconnect();
}, []);
// Good: ライブラリに任せる(react-intersection-observerの例)
const { ref, inView } = useInView();
stateで管理する
レンダリングに反映すべき値をuseRefで持っているなら、
それはuseStateで管理すべきです。
// Bad: useRefで値を保持してレンダリングと同期しない
const countRef = useRef(0);
countRef.current += 1;
// Good: stateで管理してUIに反映する
const [count, setCount] = useState(0);
クロージャやローカル変数で済ませる
useEffect内だけで使う値は、
useEffectのクロージャ内で管理すれば十分です。
// Bad: タイマーIDをuseRefで保持
const timerIdRef = useRef<number>();
useEffect(() => {
timerIdRef.current = window.setInterval(() => {
/* ... */
}, 1000);
return () => clearInterval(timerIdRef.current);
}, []);
// Good: useEffect内のローカル変数で完結
useEffect(() => {
const timerId = window.setInterval(() => {
/* ... */
}, 1000);
return () => clearInterval(timerId);
}, []);
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.
- 4d ago First seen · 155 lines · 34 tokens per session scan A 6a11fd70e464
react-use-ref is a skill published in the GitHub repository ncaq/konoka (3 stars, last pushed yesterday), licensed Apache-2.0. It adds 34 tokens to every session and 1,365 once invoked, about $0.0002 per session on Opus 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-09-05.
Other skills, from other repositories
cloudflare-nextjs
Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare). Use for SSR/ISR/SSG/App or Pages Router, getCloudflareContext, bindings (D1/R2/KV/AI/Hyperdrive), caching tiers, skew protection, multi-worker, custom worker, env vars, or worker…
aceternity-ui
100+ animated React components (Aceternity UI) for Next.js with Tailwind. Use for hero sections, parallax, 3D effects, or encountering animation, shadcn CLI integration errors.
auto-animate
AutoAnimate (@formkit/auto-animate) zero-config animations for React. Use for list transitions, accordions, toasts, or encountering SSR errors, animation libraries complexity.
base-ui-react
MUI Base UI unstyled React components with Floating UI. Use for accessible components, Radix UI migration, render props API, or encountering positioning, popup, v1.0 rc / pre-GA issues.
bun-nextjs
This skill should be used when the user asks about "Next.js with Bun", "Bun and Next", "running Next.js on Bun", "Next.js development with Bun", "create-next-app with Bun", or building Next.js applications using Bun as the runtime.
bun-react-ssr
Use when building server-rendered React with Bun, including streaming SSR, hydration, renderToString, or custom SSR without a framework.