as-const-satisfies

as-const-satisfies is a skill for Claude Code from ncaq/konoka. It costs 39 tokens per session (941 once invoked), scanned A, original, Apache-2.0.

A TypeScript coding pattern for defining constant values while keeping their exact literal types and checking that they match a required shape.

In plain words
What is it for?
It helps define constants, configuration objects, and string-based unions with stricter type checking.
Why use it?
It avoids losing precise type information while still catching configuration objects that do not follow the intended structure.

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 define constants, configuration objects, and string-based unions with stricter type checking.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ncaq/konoka/as-const-satisfies
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 as-const-satisfies
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 as-const-satisfies

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/ncaq/konoka/as-const-satisfies"><img src="https://agentmods.dev/badge/skills/ncaq/konoka/as-const-satisfies.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 941 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.00039 $0.00941
Opus 5.5 $0.00016 $0.00376
Sonnet 5.5 $0.00008 $0.00188
Haiku 4.5 $0.00004 $0.00094

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

Security

Grade A, and why

as-const-satisfies 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 2d 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/as-const-satisfies/SKILL.md · 87 lines

What it actually says

定数定義にはas constとas const satisfiesを使う

定数定義には基本的にas constを付けます。 リテラル型が保たれて型推論が厳密になり、型の上でreadonlyになるためです。 実行時にオブジェクトが凍結されるわけではありません。

名前の付いた型で型チェックもできる場合は、as const satisfies Typeにします。 as constの利点を保ったまま、その型を満たすことも保証できます。

const status = {
  pending: "pending",
  approved: "approved",
  rejected: "rejected",
} as const satisfies Record<string, string>;
// status.pendingの型は"pending"

: Typeや、as constを付けないsatisfies Typeは、 要素をpushする配列のように可変性が必要な場合と、 リテラル型が保たれると問題になる場合に限って使います。

satisfiesに指定する型の配列が可変な場合

satisfiesに指定する型の配列がstring[]のように可変だと、 配列リテラルはエラーにならないまま、readonlyの付かないタプルに推論されます。 既にreadonlyな配列を渡した場合はエラーになります。 どちらの場合も、satisfiesに指定する型の側をreadonlyにします。

type Config = {
  readonly values: readonly string[];
};

const config = {
  values: ["a", "b", "c"],
} as const satisfies Config;
// config.valuesの型はreadonly ["a", "b", "c"]

既存の型をreadonlyにするにはReadonlyを使えます。 Readonlyは浅いreadonly化なので、 プロパティにある配列までreadonlyにするには、再帰的なDeepReadonlyを自前で定義します。

// プレーンオブジェクトと配列だけを対象にした定義です。
// Map、Set、Dateなどのビルトインオブジェクトを含む型には専用の対応が必要です。
type DeepReadonly<T> = T extends readonly (infer U)[]
  ? readonly DeepReadonly<U>[]
  : T extends object
    ? { readonly [P in keyof T]: DeepReadonly<T[P]> }
    : T;

DeepReadonlyやビルトインオブジェクトへの対応などで、 型の側の調整が複雑になりすぎる場合は、 as constにこだわらず、通常の型推論や型注釈で済ませて構いません。 リテラル型のために可読性を大きく犠牲にする必要はありません。

文字列ユニオン型はas const配列から導く

文字列ユニオン型は直接書かず、 先にas const配列を作って、そこから型を導きます。

// 避ける
type Foo = "a" | "b" | "c";

// 良い
const fooValues = ["a", "b", "c"] as const;
type Foo = (typeof fooValues)[number];

配列として値を持っていれば、 バリデーションのように実行時にも値の列挙が必要な場合に再利用できます。 特にincludesで型を絞り込みやすいのが利点です。

実行時の列挙が今は必要ない場合も、一貫性のためにこの書き方に統一します。 後から実行時に値が必要になっても書き換えが発生せず、 コードベースに2つの書き方が混在することも防げます。

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. 2d ago Changed · -89 lines 5e6559634ba5
  2. 2mo ago First seen · 176 lines · 39 tokens per session scan A 91935c7574a1

Subscribe to this mod's changes

as-const-satisfies is a skill published in the GitHub repository ncaq/konoka (3 stars, last pushed today), licensed Apache-2.0. It adds 39 tokens to every session and 941 once invoked, about $0.0002 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-09-05.

Related

as-const-satisfies compared with skills from other repositories

as-const-satisfies next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
as-const-satisfiesncaq/konokaSkill3todayApache-2.0A39Claude Code
better-authsecondsky/claude-skillsSkill257yesterdayMITA53Claude Code
hono-routingsecondsky/claude-skillsSkill257yesterdayMITA41Claude Code
bun-bundlersecondsky/claude-skillsSkill257yesterdayMITA90Claude Code
bun-hot-reloadingsecondsky/claude-skillsSkill257yesterdayMITA42Claude Code
jest-generatorsecondsky/claude-skillsSkill257yesterdayMITA43Claude Code
language-typescriptdeveloper239/michals-opencode-cookbookSkill11mo agononeA66Claude Code, Codex