复制安装命令
用 Codex 或 Claude 安装复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它先审查 Skill 页面再帮你安装。
复制前请先查看来源、License 和安全提示。
Kamae (構え) — a stance of readiness.
用 Codex 或 Claude 安装复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它先审查 Skill 页面再帮你安装。
复制前请先查看来源、License 和安全提示。
来源文件:README.md
日本語版: README.ja.md
Kamae (構え) — a stance of readiness.
An extensible harness of skill plugins for designing and implementing robust server-side TypeScript applications. Each skill encodes a kamae — a practiced stance for a specific design concern — that coding agents apply when generating or reviewing code.
The current stances focus on functional domain modeling; more will be added over time.
Via gh skill (the GitHub CLI's agent skills extension):
# Install a single skill (interactive prompt for agent/scope)
gh skill install iwasa-kosui/kamae-ts kamae
# Install non-interactively for Claude Code at user scope
gh skill install iwasa-kosui/kamae-ts kamae \
--agent claude-code --scope user
# Pin to a specific release
gh skill install iwasa-kosui/kamae-ts kamae@v1.0.0
Or via skills CLI:
npx skills add iwasa-kosui/kamae-ts
kamaeTriggered when writing server-side TypeScript code (domain models, use cases, repositories, state transitions, error handling, boundary validation, PII protection). Guides code generation through a thin dispatcher SKILL.md that lazy-loads topic sub-files (domain-modeling.md, state-modeling.md, error-handling.md, boundary-defense.md, declarative-style.md, test-data.md) and library-specific guides only when relevant.
kamae-reviewTriggered during code review. Walks a checklist of severity-tagged review items (split across checklist/*.md sub-files) and reports findings citing the canonical principle in kamae. Depends on kamae being installed for the knowledge base — install both together.
Both skills load applicable rules at the start of each invocation, in priority order:
.claude/rules/*.md (project)~/.claude/rules/*.md (user-global)rules/defaults/*.mdA rule applies to kamae-ts when its frontmatter declares applies-to: kamae, applies-to: kamae-review, or applies-to: "*". Four rule types are supported:
library-preference — pin a specific Result or validation library (overrides auto-detection)check-toggle — disable a named review check (e.g., PII protection for projects with no personal data)convention — declare project-specific conventions (e.g., "Branded Types live in src/types/brand.ts")override — replace specific guidance from a topic sub-fileSee rules/README.md for the rule format and concrete examples.
For full skill replacement, use Claude Code's standard skill path-shadowing (.claude/skills/kamae/SKILL.md overrides the installed plugin's).
Skill quality is continuously evaluated with microsoft/waza.
evals/kamae/ and evals/kamae-review/..github/workflows/eval.yml runs both suites on every pull_request that touches skills/**, evals/**, rules/**, or .waza.yaml, using the copilot-sdk executor.A reading version of the principles is published at https://iwasa-kosui.github.io/kamae-ts/, in both English (/en/) and Japanese (/ja/).
Join the official Discord server to discuss server-side TypeScript, ask questions, and share what you are working on: https://discord.gg/Z9HVbqEWzd
These principles are based on the following articles:
MIT
name: kamae
description: |
Kamae (構え) — robust server-side TypeScript design. Functional domain modeling with
discriminated unions, pure state transitions, Result types, schema-validated boundaries,
and PII protection.
TRIGGER when: writing TypeScript domain models, use cases, repositories, state transitions,
error handling, boundary validation, or PII handling on the server side; designing types
for business logic; implementing entity/value-object semantics in TS.
SKIP: frontend React/Vue components, browser code, build tooling, code generation scripts,
pure infrastructure-as-code; code unrelated to domain logic.
license: MITSix topic files cover the principles. Read only the file(s) relevant to the current task. The library guides under result-libraries/ and validation-libraries/ are read on demand based on the project's package.json.
Before any other step, glob and Read rules in priority order:
.claude/rules/*.md (project-level overrides at the working-tree root)~/.claude/rules/*.md (user-global preferences)../../rules/defaults/*.md relative to this SKILL.md (plugin defaults)For each file:
applies-to is kamae or *.name. For each name, keep only the highest-tier instance (1 > 2 > 3); within a tier the lexicographically last filename wins.library-preference rule overrides Step 1 detection; a convention rule shapes generated code; an override rule replaces guidance from a specific topic file.If no rules are found, proceed with the plugin defaults already documented in ../../rules/defaults/.
See ../../rules/README.md for the rule format.
Read package.json once. Note which Result library and validation library are present:
neverthrow > byethrow > fp-ts > option-t. Load the matching guide under result-libraries/ when error-handling is in scope.zod > valibot > arktype. Load the matching guide under validation-libraries/ when boundary or branded-type work is in scope.If none are present, ask the user before proceeding.
Each topic below is one file. Read it lazily — only the file(s) you need for the current task.
Represent states with discriminated unions using kind as the unified discriminant. Use type (not interface), Companion Object pattern, branded types via the project's validation library, Readonly<>, function property notation, and one-concept-per-file structure.
Express transitions with pure functions. Argument types constrain valid source states; return types make targets explicit. Invalid transitions become compile errors. Use assertNever for exhaustiveness.
Treat errors as values via Result. Define error types as discriminated unions so callers branch exhaustively. Do not throw exceptions in domain code.
Validate every external input (API requests, DB results, file/queue/env) with a schema at runtime. Trust types inside the domain. Do not use type assertions — as const and as const satisfies Type are the only allowed forms; when the type is unknown, parse through a validation-library schema instead. Apply Sensitive<T> to PII fields; the validation schema auto-wraps them.
Use filter / map / reduce with companion-object predicates instead of imperative loops. Model domain events as immutable records.
Define fixtures with as const satisfies Type to preserve discriminant literal types and prevent widening.
Worked end-to-end examples are in examples/. Read them only when the topic guide cites a specific example.
These are recommendations, not strict rules. Use judgment based on context. If you deviate from a principle, state the reason in a comment. Justifiable reasons include: external library requires class inheritance, immutable object creation cost is a measured performance concern, or a different pattern has been adopted by team agreement.
评论 (0)
暂无评论,成为第一个评论者吧!