prefer-specific-method

prefer-specific-method is a skill for Claude Code from ncaq/konoka. It costs 94 tokens per session (1,529 once invoked), scanned A, original, Apache-2.0.

A TypeScript and JavaScript coding guideline that favors a built-in method designed for the exact task, such as `includes` for checking membership or `find` for locating an item.

In plain words
What is it for?
It helps choose clearer methods for membership checks, condition checks, finding items, getting positions, flattening mapped results, accessing the last item, and cloning data.
Why use it?
It makes code's intent easier to read and can avoid unnecessary work, such as creating a filtered list just to check whether a match exists. Some choices also handle edge cases more accurately, such as finding `NaN` with `includes`.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the web-tasuke plugin — 17 skills shipped together

Good fit It helps choose clearer methods for membership checks, condition checks, finding items, getting positions, flattening mapped results, accessing the last item, and cloning data.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ncaq/konoka/prefer-specific-method
View source ↗ ncaq/konoka
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 ncaq/konoka --skill prefer-specific-method
Clone the repo
git clone --depth 1 https://github.com/ncaq/konoka

Made for: Claude Code.

Or install web-tasuke, the plugin that ships this one along with the rest of its 17 skills.

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 prefer-specific-method

README.md
[![agentmods](https://agentmods.dev/badge/skills/ncaq/konoka/prefer-specific-method/github.svg)](https://agentmods.dev/skills/ncaq/konoka/prefer-specific-method)
Your own site
<a href="https://agentmods.dev/skills/ncaq/konoka/prefer-specific-method"><img src="https://agentmods.dev/badge/skills/ncaq/konoka/prefer-specific-method/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 prefer-specific-method

Your own site · 80×15
<a href="https://agentmods.dev/skills/ncaq/konoka/prefer-specific-method"><img src="https://agentmods.dev/badge/skills/ncaq/konoka/prefer-specific-method.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 94 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,529 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 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.00094 $0.01529
Opus 5 $0.00047 $0.00764
Sonnet 5 $0.00019 $0.00306
Haiku 4.5 $0.00009 $0.00153

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

Security

Grade A, and why

prefer-specific-method 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.

plugins/web-tasuke/skills/prefer-specific-method/SKILL.md · 191 lines

How it starts

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

より特化した関数を優先する

同じ結果が得られる方法が複数ある場合は、 やりたいことに最も特化した関数を選んでください。

特化した関数は名前そのものが意図を表すので、 読み手が「この比較は何のためか」を推測せずに済みます。 汎用的な関数を条件式と組み合わせて目的を表現すると、 意図が式の形に埋もれて読みにくくなります。

これはavoid-forforを高抽象度の関数に置き換えるのと同じ発想を、 関数同士の選択にも広げたものです。

存在するかどうかを調べる

要素が含まれるかを知りたいだけなら、 位置を返すindexOfではなく、 真偽値を返すincludesを使います。

// 避ける
if (items.indexOf(target) !== -1) {
}

// 良い
if (items.includes(target)) {
}

includesは意図が明確なだけでなく、 NaNを正しく見つけられるという正確性の利点もあります。 indexOfは厳密等価(===)で比較するためNaNを見つけられませんが、 includesはSameValueZeroで比較するためNaNも見つけられます。

[NaN].indexOf(NaN); // -1 (見つからない)
[NaN].includes(NaN); // true

条件を満たす要素の有無を調べる

絞り込んだ結果の件数を見るのではなく、 someeveryで真偽を直接求めます。

// 避ける
if (0 < users.filter((user) => user.active).length) {
}

// 良い
if (users.some((user) => user.active)) {
}

someは最初に条件を満たした時点で打ち切るので、 全件を絞り込むfilterより無駄がありません。 「すべてが条件を満たすか」はeveryを使います。

条件を満たす最初の要素を取り出す

絞り込んでから先頭を取るのではなく、 findで直接取り出します。

// 避ける
const found = users.filter((user) => user.id === targetId)[0];

// 良い
const found = users.find((user) => user.id === targetId);

最後の要素が欲しい場合はfindLast、 位置が欲しい場合はfindIndexfindLastIndexを使います。

変換してから平坦化する

mapしてからflatするのではなく、 flatMapを使います。

// 避ける
const tags = posts.map((post) => post.tags).flat();

// 良い
const tags = posts.flatMap((post) => post.tags);

末尾や負の位置の要素にアクセスする

lengthを使った添字計算ではなく、 atを使います。

// 避ける
const last = items[items.length - 1];

// 良い
const last = items.at(-1);

atは文字列にもあります。

文字列の前方一致と後方一致を調べる

位置を計算するのではなく、 専用のメソッドを使います。

// 避ける
if (path.indexOf("/etc/") === 0) {
}
if (name.lastIndexOf("hosts") === name.length - "hosts".length) {
}

// 良い
if (path.startsWith("/etc/")) {
}
if (name.endsWith("hosts")) {
}

文字列に部分文字列が含まれるかも、 indexOfではなくincludesで調べます。

文字列をすべて置換する

グローバルフラグ付きの正規表現ではなく、 replaceAllで意図を示せます。

// 避ける
const escaped = text.replace(/&/g, "&amp;");

// 良い
const escaped = text.replaceAll("&", "&amp;");

Read the full file on GitHub · 191 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. 4d ago First seen · 191 lines · 94 tokens per session scan A f5bbfee78eb5

Subscribe to this mod's changes

prefer-specific-method is a skill published in the GitHub repository ncaq/konoka (3 stars, last pushed yesterday), licensed Apache-2.0. It adds 94 tokens to every session and 1,529 once invoked, about $0.0005 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.

Related

Other skills, from other repositories

better-auth

Skill for integrating Better Auth - comprehensive TypeScript authentication framework for Cloudflare D1, Next.js, Nuxt, and 15+ frameworks. Use when adding auth, encountering D1 adapter errors, or implementing OAuth/2FA/RBAC features.

secondsky/claude-skills · 53 tokens

bun-bundler

This skill should be used when the user asks about "bun build", "Bun.build", "bundling with Bun", "code splitting", "tree shaking", "minification", "sourcemaps", "bundle optimization", "esbuild alternative", "building for production", "bundling TypeScript", "bundling for browser", "bundling for Node", or…

secondsky/claude-skills · 90 tokens

bun-hot-reloading

Use when implementing hot reloading with Bun (--hot, --watch), HMR, or automatic code reloading during development. Covers watch mode, hot mode, and HTTP server reload.

secondsky/claude-skills · 42 tokens

language-typescript

TypeScript conventions with generic guidance plus a monorepo-specific addendum.

developer239/michals-opencode-cookbook · 19 tokens

frontend-ai-guide

Applies React/TypeScript-specific technical decision criteria, anti-pattern detection, debugging, and frontend quality gates. Use when reviewing components, hooks, browser behavior, or frontend implementation completeness.

shinpr/claude-code-workflows · 41 tokens

typescript-rules

React/TypeScript frontend development rules including type safety, component design, state management, and error handling. Use when implementing React components, TypeScript code, or frontend features.

shinpr/claude-code-workflows · 39 tokens