kmt-code-rules

A set of Japanese-language rules for keeping code organized according to Clean Architecture, a design approach that separates business logic from databases, interfaces, and frameworks.

In plain words
What is it for?
Use it when adding or changing code to check layer responsibilities, control dependencies, define boundaries around external systems, and keep data conversion near those boundaries.
Why use it?
It prevents business rules from becoming tied directly to web frameworks, databases, user interfaces, or external services.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/tkumata/agents.md/kmt-code-rules
Any agent
npx skills add tkumata/AGENTS.md --skill kmt-code-rules
Clone the repo
git clone --depth 1 https://github.com/tkumata/AGENTS.md

Made for: Claude Code, Codex.

Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 667 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00035 $0.00667
Opus 5 $0.00017 $0.00333
Sonnet 5 $0.00007 $0.00133
Haiku 4.5 $0.00003 $0.00067

Measured yesterday against content hash a011d9971345, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

kmt-code-rules 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 yesterday.

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.

codex-skills/kmt-code-rules/SKILL.md · 70 lines

What it actually says

Kmt Code Rules

コードを変更するときは、既存構成を尊重しつつクリーンアーキテクチャの依存規則を維持する。

Dependency Rule

依存は外側から内側へのみ許可する。

Frameworks / Drivers -> Adapters -> Application -> Domain

内側のレイヤは外側のレイヤを import、include、参照してはならない。

  • Domain は Application、Adapter、Framework に依存しない。
  • Application は Adapter、Framework に依存しない。
  • Adapter は Framework の詳細を Application / Domain に漏らさない。
  • 外部システムへの依存は境界で抽象化する。

Responsibilities

Domain

業務ルール、Entity、Value Object、ドメイン固有の不変条件を置く。

I/O、DB、HTTP、UI、OS、SDK、Framework の詳細を置かない。

Application

Use Case とアプリケーション固有の処理フローを置く。

Domain を操作し、外部機能は Port / Interface 経由で利用する。

Adapters

Port の実装、DTO 変換、Controller、Presenter、Repository Adapter を置く。

外部形式と内部モデルの変換を境界で行う。

Frameworks / Drivers

DB、HTTP Client、GUI、CLI、デバイス、OS、SDK、Framework 固有コードを置く。

Implementation Rules

  • Business logic を Controller、UI、DB、SDK 呼び出しへ直接記述しない。
  • Domain 型を外部 API や永続化形式に直接依存させない。
  • 外部依存は Application 側で定義した Port を介して扱う。
  • DTO と Domain Model を必要に応じて分離する。
  • レイヤを跨ぐデータ変換は境界付近で行う。
  • 循環依存を作らない。
  • グローバル状態への依存を増やさない。
  • テストのためだけの不要な抽象化を追加しない。
  • 単純な処理に形式的な Use Case や Interface を量産しない。
  • 既存構造で依存規則を満たせる場合は新しいレイヤを追加しない。

Before Editing

変更対象について、責務、依存元、依存先を確認する。

依存規則に違反する変更が必要なら、そのまま実装せず境界または責務配置を修正する。

Verification

実装後、変更された依存関係を確認する。

外側の詳細が Domain / Application に侵入していないこと、Business logic が Framework 側へ流出していないこと、不要な抽象化を追加していないことを確認する。

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. yesterday First seen · 70 lines · 35 tokens per session scan A a011d9971345

Subscribe to this mod's changes

kmt-code-rules is a skill published in the GitHub repository tkumata/AGENTS.md (1 stars, last pushed 2d ago), licensed MIT. It adds 35 tokens to every session and 667 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-08-31.

Related

Other skills, from other repositories

codex-autoresearch

Run autonomous, measurable experiments in a Git repository: change one hypothesis, verify a numeric metric, keep improvements, and revert failures. Use when the user wants Codex to keep iterating toward a numeric target in the foreground or as a detached background run. Do not use for ordinary one-shot coding…

leo-lilinxiao/codex-autoresearch · 80 tokens

map-wayfind

Decision-frontier wayfinding: build and work a durable map of open design decisions BEFORE planning, for large or foggy efforts where /map-plan would force premature decomposition. Use when a task is too big or too vague to decompose — many unknowns, tangled decisions, or "I'm not even sure what to build yet" — and…

azalio/map-framework · 182 tokens

map-fast

Minimal workflow for small, low-risk changes — no planning, no learning.

azalio/map-framework · 17 tokens

clipboard

Copy text to clipboard with optional rich formatting. Triggers on "copy to clipboard", "copy that", "pbcopy", "copy formatted", "copy rich text".

CodeAlive-AI/ai-driven-development · 36 tokens

neo4j-modeling-skill

Design, review, and refactor Neo4j graph data models. Use when choosing node labels vs relationship types vs properties, migrating relational/document schemas to graph, detecting anti-patterns (generic labels, supernodes, missing constraints), designing intermediate nodes for n-ary relationships, enforcing schema with…

neo4j-contrib/neo4j-skills · 152 tokens

alphafold-database

Access AlphaFold 200M+ AI-predicted protein structures. Retrieve structures by UniProt ID, download PDB/mmCIF files, analyze confidence metrics (pLDDT, PAE), for drug discovery and structural biology.

agent-skills-hub/agent-skills-hub · 54 tokens