Agent skill
ts-standards
Enforces TypeScript/Effect standards with snippet-first guidance: algebraic data types, exhaustive pattern matching, schema-derived types, hard-minimal export surface, and auto-integrated internal functionality. Use when writing, refactoring, or reviewing TypeScript code.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/ts-standards
SKILL.md
[H1][TS-STANDARDS]
Dictum: Consolidation-first, polymorphic TypeScript. Effect orchestrates; domain computes.
Write dense, integrated modules with minimal public APIs. Prefer capability facades, command algebras, and auto-registration over helper proliferation and manual wiring.
Tasks:
- Read index.md.
- Read references/snippets.md first.
- Read domain references as needed: consolidation.md, composition.md, adts-and-matching.md, errors-and-services.md, repo-conventions.md.
- Implement by reusing canonical snippet IDs (
SNIP-*) instead of inventing new patterns. - Run validator:
bash ./.claude/skills/ts-standards/scripts/validate-ts-standards.sh --mode check. - Validate against [VERIFY] checklist.
Versions: TypeScript 6.0-dev, Effect 3.19+, React 19, Vite 7.
[1][WORKFLOW]
Dictum: Snippet-first workflow prevents style drift and file bloat.
- Select target behavior and public surface.
- Route to snippet IDs from references/snippets.md.
- Compose in this order: command algebra -> service surface -> layer integration -> boundary mapping.
- Keep internal symbols internal; integrate via registry/layer composition.
- Run policy validator and fix violations before final output.
[2][CORE_POLICY]
Dictum: Few powerful interfaces beat many narrow functions.
- Hard-minimal public APIs -- stable capability entrypoints only.
- Auto-integration by default -- new internal logic becomes active via registration, not extra exports.
- Polymorphism over proliferation -- one command/config function replaces clusters of near-duplicate methods.
- Exhaustive branching -- closed variants require
Match.exhaustive. - Schema-derived types only -- no parallel manual types.
[3][NON_NEGOTIABLES]
Dictum: Compiler-visible constraints remove ambiguity.
[IMPORTANT]:
- [ALWAYS] Prefix private/internal symbols with
_. - [ALWAYS] Gather public exports in final
[EXPORT]section. - [ALWAYS] Use
Effect.Servicefor services andEffect.fn('Service.method')for methods. - [ALWAYS] Reuse snippet IDs for shared patterns before authoring new variants.
- [ALWAYS] Keep each file in this skill directory at
<=275LOC.
[CRITICAL]:
- [NEVER]
any,let,var,for,while,try/catch, default exports (except config files). - [NEVER]
if (...)statements in TypeScript policy scope. - [NEVER]
Effect.if(...). - [NEVER] Helper/utility file sprawl (
helpers.ts,utils.ts, thin wrappers). - [NEVER] Export
_-prefixed symbols. - [NEVER] Widen package export surface without explicit policy update.
[4][PUBLIC_SURFACE_POLICY]
Dictum: Packages expose capabilities, not internals.
Server allowed exports:
./api./runtime./errors./testing
Database allowed exports:
./runtime./models./migrator./testing
Everything else is internal-by-default and consumed via internal composition.
[5][SNIPPET_ROUTING]
Dictum: Use canonical snippets as stable building blocks.
| [INDEX] | [PROBLEM] | [SNIPPET] |
|---|---|---|
| [1] | Too many sibling methods | SNIP-01 |
| [2] | Manual handler wiring | SNIP-02 |
| [3] | Wide service object | SNIP-03 |
| [4] | Weak generic polymorphism | SNIP-04 |
| [5] | Error union leaks at boundaries | SNIP-05 |
| [6] | Hook/check validator architecture | SNIP-06 |
[REFERENCE] Canonical code snippets: references/snippets.md
[6][VALIDATION]
Dictum: Automated gates enforce consistency at scale.
[FILE_LAYOUT]: Types -> Schema -> Constants -> Errors -> Services -> Functions -> Layers -> Export.
[VERIFY]:
- No forbidden syntax (
any,let/var, loops,try/catch, default exports, inline export style violations). - No
if (...)and noEffect.if(...). - No exported
_-prefixed symbols. - Public export map complies with hard-minimal policy.
- Deep imports from server/database follow approved allowlist.
- All files under
/.claude/skills/ts-standards/are<=275LOC. - Snippet-first reuse applied before adding custom variants.
Commands:
bash ./.claude/skills/ts-standards/scripts/validate-ts-standards.sh --mode checkpnpm run check:ts-standards
[REFERENCE] Script: scripts/validate-ts-standards.sh
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?