agentleFS
theseus-runtheseus-run/theseus/.agents/skills/typescript-strict/SKILL.md

typescript-strict

Skill1 starsChanged 6 months agoMITView on GitHub

Use when writing, refactoring, reviewing, or debugging strict TypeScript in this repo, including tsconfig paths, package exports, typecheck failures, unknown vs any, readonly data, module boundaries, and Effect language-service diagnostics.

13 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use react-patterns, api-design and 1 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • xenitV1Skill

    react-patterns

    Modern React patterns and principles. Hooks, composition, performance, TypeScript best practices.

    Also in 3 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 5 projects that use this

  • Microsoft AzureSkill

    git-workflow

    Squad branching model: dev-first workflow with insiders preview channel

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

39 rules. 0 are common, 25 are distinctive, and 14 are very specific to this project.

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 25

    Distinctive

    This author's own choices. Worth a look.

  • 14

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Use this skill for TypeScript mechanics that are not specific to Effect.

    line 8
  2. Very specific:

    Prefer unknown over any at external boundaries.

    line 21
  3. Distinctive:

    Use explicit return types on exported functions when they define public API.

    line 23
  4. Very specific:

    Use ReadonlyArray<T> and readonly object fields for inputs and data contracts.

    line 24
  5. Very specific:

    Prefer literal unions or as const objects over numeric enums.

    line 25
  6. Distinctive:

    Use template literal types or branded types for structured strings that cross boundaries.

    line 26
  7. Distinctive:

    Avoid non-null assertions.

    line 27
  8. Distinctive:

    Avoid type assertions that erase useful errors or requirements.

    line 28
  9. Distinctive:

    Use branded/schema-backed IDs for values that cross package, persistence, tool, or RPC boundaries.

    line 42
  10. Very specific:

    Prefer constructors/builders for exported protocol variants so defaults and _tag literals are centralized.

    line 43
  11. Distinctive:

    Avoid booleans by default for domain state.

    line 44
  12. Distinctive:

    Prefer discriminated unions for simple states and an explicit state-machine module/service for complex state transitions.

    line 45
  13. Distinctive:

    Prefer explicit required inputs over optional-parameter soup.

    line 46
  14. Distinctive:

    Use explicit domain sentinels or variants when absence has semantics.

    line 47
  15. Distinctive:

    Use exhaustive matching for closed internal protocols.

    line 48
  16. Distinctive:

    Avoid stringly typed protocols when the set is closed.

    line 49
  17. Very specific:

    Use satisfies when checking object shape without widening or erasing useful literal information.

    line 50
  18. Distinctive:

    Keep package public exports intentional.

    line 55
  19. Very specific:

    Use workspace path mappings from package tsconfig.json.

    line 57
  20. Distinctive:

    Keep browser-safe packages free of Bun-only imports.

    line 58
  21. Very specific:

    Keep generated dist/ output derived from source.

    line 59
  22. Very specific:

    Read the relevant package tsconfig.json.

    line 63
  23. Very specific:

    Run bun run typecheck for cross-package signatures, exports, schemas, or shared types.

    line 66
  24. Distinctive:

    Use typed result/error models for recoverable failures.

    line 70
  25. Distinctive:

    Do not silently default malformed or incomplete input unless the default is a named domain rule.

    line 73
  26. Distinctive:

    When converting foreign errors, add stable context without leaking secrets or large payloads.

    line 75
  27. Very specific:

    Do not use as any or as never to escape a type error without explaining the invariant.

    line 79
  28. Very specific:

    Do not widen closed sets to string unless external extensions can add values at runtime.

    line 80
  29. Very specific:

    Do not use T[] for input collections that should not be mutated.

    line 81
  30. Distinctive:

    Do not add default exports to packages that use named export style.

    line 82
  31. Distinctive:

    Do not hide package-boundary type errors by changing root compiler options.

    line 83
  32. Distinctive:

    Do not model mutually exclusive states as one object with many optional fields.

    line 84
  33. Distinctive:

    Do not model lifecycle or protocol state as a matrix of booleans.

    line 85
  34. Distinctive:

    Do not use broad index signatures when explicit keys or a typed map would preserve more information.

    line 86
  35. Very specific:

    Do not build object literals with conditional spread fragments like ...(x !== undefined ?

    line 87
  36. Distinctive:

    Do not scatter nullish defaults through function bodies.

    line 88
  37. Distinctive:

    Do not let defaults creep inward through multiple call layers.

    line 89
  38. Distinctive:

    Do not add default branches that hide unsupported internal message types, protocol variants, or state transitions.

    line 90
  39. Very specific:

    Do not use Partial<T> for domain update APIs.

    line 91

“Common” is measured: kept by at least 6 in 10 of the 13 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

TypeScript Strict

Use this skill for TypeScript mechanics that are not specific to Effect.

Repo Facts

  • Root tsconfig.json is strict and no-emit.
  • Module mode: Preserve; module resolution: bundler.
  • TS extension imports are allowed.
  • exactOptionalPropertyTypes, noUncheckedIndexedAccess, and noPropertyAccessFromIndexSignature are enabled.
  • @effect/language-service is configured in root tsconfig.json.
  • Root typecheck runs package configs explicitly.

Type Rules

  • Prefer unknown over any at external boundaries.
  • Narrow unknown before use.
  • Use explicit return types on exported functions when they define public API.
  • Use ReadonlyArray<T> and readonly object fields for inputs and data contracts.
  • Prefer literal unions or as const objects over numeric enums.
  • Use template literal types or branded types for structured strings that cross boundaries.
  • Avoid non-null assertions; prove presence through narrowing.
  • Avoid type assertions that erase useful errors or requirements.

Type-First Modeling

For new public APIs, protocols, or domain states, design the type shape before filling in implementation details.

  1. Define the data model: IDs, state variants, schemas, and external wire shape.
  2. Define function signatures: input, output, recoverable errors, and Effect requirements.
  3. Implement to satisfy the types; let compiler errors expose missing cases.
  4. Validate at boundaries where unknown data enters or leaves the system.

Rules:

  • Make illegal states unrepresentable with discriminated unions instead of correlated optional fields or boolean flags.
  • Use branded/schema-backed IDs for values that cross package, persistence, tool, or RPC boundaries.
  • Prefer constructors/builders for exported protocol variants so defaults and _tag literals are centralized.
  • Avoid booleans by default for domain state. Use booleans only for truly binary values that are unlikely to grow into a state space.
  • Prefer discriminated unions for simple states and an explicit state-machine module/service for complex state transitions.
  • Prefer explicit required inputs over optional-parameter soup. If a value has a meaningful default, normalize it once at the boundary into a required field.
  • Use explicit domain sentinels or variants when absence has semantics; do not rely on omission to mean a real state.
  • Use exhaustive matching for closed internal protocols. Unknown internal variants are defects, not fallback cases.
  • Avoid stringly typed protocols when the set is closed. Use literal unions or schemas.
  • Use satisfies when checking object shape without widening or erasing useful literal information.
  • Let TypeScript infer local obvious values, but write explicit return types for exported functions that define public API.

Module And Package Rules

  • Keep package public exports intentional.
  • Match package.json exports with actual source entrypoints.
  • Use workspace path mappings from package tsconfig.json; do not invent import paths.
  • Keep browser-safe packages free of Bun-only imports.
  • Keep generated dist/ output derived from source.

Typecheck Workflow

  1. Read the relevant package tsconfig.json.
  2. Reproduce with the narrow package typecheck if available.
  3. Fix the type model, not just the local symptom.
  4. Run bun run typecheck for cross-package signatures, exports, schemas, or shared types.

Error-Handling Types

  • Use typed result/error models for recoverable failures.
  • In Effect code, preserve the E channel instead of collapsing errors to unknown.
  • In non-Effect code, prefer discriminated unions for recoverable results when exceptions are not the right boundary.
  • Do not silently default malformed or incomplete input unless the default is a named domain rule. Prefer explicit validation and a typed failure.
  • Recover from expected external uncertainty; fail loud on impossible internal states and violated invariants.
  • When converting foreign errors, add stable context without leaking secrets or large payloads.

Anti-Patterns

  • Do not use as any or as never to escape a type error without explaining the invariant.
  • Do not widen closed sets to string unless external extensions can add values at runtime.
  • Do not use T[] for input collections that should not be mutated.
  • Do not add default exports to packages that use named export style.
  • Do not hide package-boundary type errors by changing root compiler options.
  • Do not model mutually exclusive states as one object with many optional fields.
  • Do not model lifecycle or protocol state as a matrix of booleans.
  • Do not use broad index signatures when explicit keys or a typed map would preserve more information.
  • Do not build object literals with conditional spread fragments like ...(x !== undefined ? { x } : {}). Normalize options first and pass an explicit required object.
  • Do not scatter nullish defaults through function bodies. Defaults should live in constructors, boundary normalizers, config layers, or clearly named constants.
  • Do not let defaults creep inward through multiple call layers. Once normalized, pass the explicit normalized value.
  • Do not add default branches that hide unsupported internal message types, protocol variants, or state transitions.
  • Do not use Partial<T> for domain update APIs. Prefer named commands such as recordUsage, markCompleted, or setIteration. Partial<T> is acceptable for tests, low-level persistence plumbing, or external patch surfaces after normalization.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.