[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7800V46HT065BBAQCTGW0VA":3,"skill-same:01M7800V46HT065BBAQCTGW0VA":115},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7800V46HT065BBAQCTGW0VA","effect-v4-schema",null,"Use when designing, reading, reviewing, or debugging any Effect v4 Schema — the Class-vs-Struct decision, fields and optionality, checks\u002Frefine\u002FmakeFilter, tagged unions, transformations and codecs (decodeTo, the FromString static), make-vs-new construction, brand\u002FOpaque scalars, custom Equal\u002FHash, and derived tooling (Arbitrary.schema, toJsonSchemaDocument). Also covers primitives, records, recursive schemas, custom declare types, serialization (JSON\u002FXML\u002FFormData), and error formatting.","spencerbeggs\u002Feffected","spencerbeggs","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F109114?v=4","01M77ZTHB70K5Y2VVTRCFY50A5","C. Spencer Beggs","01M77ZTHCC41NXBT3X906K6QM1",8,"MIT","https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: effect-v4-schema\ndescription: Use when designing, reading, reviewing, or debugging any Effect v4 Schema — the Class-vs-Struct decision, fields and optionality, checks\u002Frefine\u002FmakeFilter, tagged unions, transformations and codecs (decodeTo, the FromString static), make-vs-new construction, brand\u002FOpaque scalars, custom Equal\u002FHash, and derived tooling (Arbitrary.schema, toJsonSchemaDocument). Also covers primitives, records, recursive schemas, custom declare types, serialization (JSON\u002FXML\u002FFormData), and error formatting.\n---\n\n# Effect v4 Schema\n\nThe single skill for Effect v4 `Schema`. (For which of the `Schema*` satellite\nmodules is consumer-facing vs machinery, see `effect-v4-module-index`.) It\ncarries three layers:\n\n1. **The house rules** — the [Do this, not this](#do-this-not-this) table below,\n   our opinionated defaults distilled from the `@effected` packages.\n2. **[references\u002Fhouse-style.md](.\u002Freferences\u002Fhouse-style.md)** — the worked\n   examples and the reasoning behind each rule (the traps that only surface at\n   test\u002Fproperty-test time).\n3. **[`references\u002F`](.\u002Freferences\u002F)** — **Effect's own canonical Schema guide**\n   (`Effect-TS\u002Feffect`, `packages\u002Feffect\u002FSCHEMA.md`) split by topic, for the exhaustive\n   detail on any construct.\n\nDo not load all references at once — each is a standalone topic (some >1000\nlines).\n\n## Do this, not this\n\nEach row is a hard house default; reasoning and worked code in\n[house-style.md](.\u002Freferences\u002Fhouse-style.md).\n\nNaming trap: `Schema.TaggedErrorClass` and `Schema.ErrorClass` are both\n`undefined` on the `Schema` namespace — the current names are\n`Schema.TaggedError` (`Schema.ts:17947`) and `Schema.Error` (`:17886`), with the same\ncurried call shape. Code written against the older names fails with\n\"TaggedErrorClass is not a function\".\n\n| Do | Not |\n| --- | --- |\n| `Schema.Class` \u002F `TaggedClass` \u002F `TaggedError` for any reusable model, union member, or error | a bare `Schema.Struct` for a domain type — `Struct` is for throwaway inline shapes |\n| `X.make({...})` as the default constructor — EXCEPT `TaggedError`, where failing with the yieldable `yield* new SomeError({...})` is the house idiom (glob, workspaces, walker all construct errors with `new`) | `new X({...})` for models outside a measured hot path (both validate identically) |\n| copy-with-patch a class instance by spreading it into the factory: `X.make({ ...x, field: next })` — own fields carry over, an absent `optionalKey` stays absent, a default-bearing field keeps its value, checks re-run on the result, and `#` private fields and class-body own props are rebuilt by the subclass, not copied | enumerating the fields by hand in a transform meant to preserve them (`X.make({ a: x.a, b: x.b, ... })`) — a complete-looking literal type-checks today and silently drops any field added later (the `Lockfile.withImporterNames` peer-map loss); a hand-written list is only right when the transform is *meant* to choose fields |\n| reach for `{ disableChecks: true }` only to accept *trusted* data that would fail a `.check(...)` | reach for it as a **speed** switch — as its docstring says (\"skip filters and checks while still parsing types and structure\", `Schema.ts:137`), it gates only the check phase: a failing `.check(...)` is skipped but a *type* error still throws, and the structural re-parse still runs. There is no speed to buy: a depth-20 recursive build measures **sub-millisecond either way**, with or without it — see the retracted exponential-cost claim below for what the numbers were once wrongly believed to be |\n| treat a nested `Schema.Class` field identically whether it is **foreign** or **self-recursive** — both accept a plain literal, deep-validate it, promote it to a real instance, and pass a real instance through **by reference** ([table](#a-nested-schemaclass-field-foreign-and-self-recursive-behave-identically)) | assume the two ever split — that a self-recursive field *rejects* literals, or that a foreign field is re-constructed so `Outer.make({ inner: x }).inner !== x`. A **prototype-forged** instance is accepted unexamined either way |\n| dodge the class factory's reserved static names when designing domain statics — every `Schema.Class`\u002F`TaggedClass`\u002F`TaggedError` base already declares `identifier`, `fields`, `ast`, `pipe`, `rebuild`, `make`, `makeOption`, `makeEffect`, `annotate`, `annotateKey`, `check`, `extend`, `mapFields` (`makeClass`, `Schema.ts:17518`; all thirteen confirmed present by probe, against a control key correctly reported absent) | a domain static reusing one of those names — an incompatible signature is a TS2417 compile error (*static side incorrectly extends base*); the lockfiles port had to rename an approved `LockfileIntegrity.check(lockfile, manifests)` design to `compare` on exactly this |\n| name a validating string constructor `parse` \u002F `parseResult` — **`make` is reserved and cannot be overloaded**, and this pair is the kit-wide shape ([worked example](#the-reserved-make-collision-parse--parseresult-is-the-house-resolution)) | `static make(raw: string)` on a `Schema.Class` — TS2417, every time |\n| conditional-spread an absent optional field | pass an explicit `undefined` for a `Schema.optionalKey` — a *present* `undefined` throws |\n| cross-field validation on a class: pass a **checked Struct** to the factory — `Schema.Class\u003CX>(\"X\")(Schema.Struct(fields).check(...))`; `check` returns `this[\"Rebuild\"]` (`Schema.ts:213`), so a checked `Struct\u003CFields>` is still a `Struct\u003CFields>` the factory accepts, and the check sees the whole record (worked precedent: `CacheKey`'s restore-depths bound against its own segment count) | per-field checks that need a sibling's value (a field check sees only its field), or validating cross-field invariants in a `parse` wrapper the direct `make` path never runs |\n| `Schema.optionalKey` for object fields — it yields `field?: T`, the exact-optional contract these `exactOptionalPropertyTypes` repos want ([why](#schemaoptional-is-not-exact-optional)) | `Schema.optional` unless the *value* itself must carry `undefined` — it is documented as \"Equivalent to `optionalKey(UndefinedOr(S))`\" (`Schema.ts:2449`), so it yields `field?: T \\| undefined` and **admits `{ field: undefined }`** |\n| `.check(is*)` to constrain, `refine` to narrow, `check(makeFilter(...))` for cross-field | `positive`\u002F`negative`, or the `filter`\u002F`greaterThan` spellings — none of them exist |\n| tagged unions of `TaggedClass` members (`_tag` branching) | untagged unions for domain variants |\n| `Schema.Literals([\"a\", \"b\", \"c\"])` for any multi-literal union (reason fields, enums) | the variadic `Schema.Literal(\"a\", \"b\", \"c\")` — v4 `Literal` takes ONE argument; tsgo rejects the variadic call (TS2554), but the **runtime silently keeps only the first literal**, so a suite run before typecheck green-lights a schema that rejects every other member: `Schema.Literal(\"a\",\"b\",\"c\")` accepts `\"a\"`, rejects `\"b\"` and `\"c\"` |\n| `Source.pipe(decodeTo(Target, SchemaTransformation.transform({...})))` | a top-level `Schema.transform` \u002F `transformEffect` — **not callable** — both are `undefined` on the `Schema` namespace |\n| pin `transformEffect`'s type params explicitly when a union codec's members carry instance methods — `SchemaTransformation.transformEffect\u003C(typeof Classified)[\"Encoded\"], string>({...})` | relying on inference after adding an instance method to a `Schema.TaggedClass` union member — `transformEffect` unifies one `T` from decode-out and encode-in, and `decodeTo` pins both to the union's **Encoded** side, which no longer satisfies the method-bearing instance type; the existing codec breaks at the declaration site (hit adding a method to a `DependencySpecifier.FromString` member) |\n| return an **`Effect`** from both `transformEffect` callbacks, failing with `SchemaIssue.InvalidValue({ message }, value)` ([contract](#transformeffects-callback-contract)) | return a `Result` (or a bare value) from a `transformEffect` callback — the signature demands `Effect\u003CT, SchemaIssue.Issue, R>` (`SchemaTransformation.ts:390`); a `Result` is not an Effect and will not bridge itself |\n| a `FromString` `Schema.Codec\u003CSelf, string>` static (string = the encoded form of the same schema) | a second parser divorced from the schema |\n| `cause: Schema.Defect()` on an error class | `cause: Schema.Defect` — the bare (uncalled) form throws at construction (`Schema.ts:9433` is a *function*; `Schema.ErrorInstance` at `:9355` is the same trap — `Schema.Error` (`:17886`) is the error-**class factory**, not an instance schema — full list of the call-not-value family in **`effect-v4-idioms`**) |\n| `Schema.decodeUnknownEffect` \u002F `encodeUnknownEffect` in Effect flows | `*Sync` outside a genuine sync boundary |\n| `Schema.fromJsonString(S)` (`Schema.ts:9918`) when the encoded form is a JSON **string** — one codec that parses-then-decodes and encodes-then-stringifies (`reviver` \u002F `replacer` \u002F `space` options); for a config or action input, `Config.schema(Schema.fromJsonString(S), \"NAME\")` (`Config.ts:854`) — behaviour under `withDefault` is probed and written up in **`effect-v4-idioms`** | `JSON.parse` \u002F `JSON.stringify` around `decodeUnknown*` \u002F `encodeUnknown*` — a second parser divorced from the schema, with a throwing host call in the seam that no downstream `Effect.catch` sees (five such sites had accreted in `github-actions` before #769 caught them) |\n| `Schema.DurationFromMillis` \u002F `Schema.DateTimeUtcFromString` (composed with `Schema.fromJsonString` for byte stores) when the value must **serialize** | `Schema.Duration` \u002F `Schema.DateTimeUtc` in a persisted or wire schema — both are `declare` schemas with **no JSON encoding** (`Schema.ts:13957,11773`), so they round-trip in memory and fail at the serialization boundary; the ts-vfs cache metadata hit exactly this |\n| annotate recursive `Schema.suspend` refs `Schema.Codec\u003CT>` (services default `never`) | `Schema.Schema\u003CT>` as the suspend annotation — it compiles at the declaration but leaves `DecodingServices` `unknown`, so every decode entrypoint rejects the schema (`unknown is not assignable to never`); a schema nobody decodes directly hides the trap until a consumer tries |\n| derive variants via `mapFields(Struct.pick\u002Fomit\u002Fmap(...))` | duplicate a schema to re-encode the same data |\n| re-apply a struct-level `.check(...)` after `mapFields` or `Schema.fieldsAssign` — `S.mapFields(f).check(...)`, or `mapFields(f, { unsafePreserveChecks: true })` once the check is known to still hold over the new fields | expect a derived struct to keep the original's `.check(...)` refinements — `mapFields` rebuilds the struct with `options?.unsafePreserveChecks ? this.ast.checks : undefined` (`Schema.ts:3566`), so the cross-field checks are **dropped by default**, and `fieldsAssign` is `struct.mapFields(Struct.assign(fields))` with no option at all (`Schema.ts:3646`), so it always drops them; per-field checks travel with their fields and survive |\n| attach brand statics with `Object.assign`; export the type as `string & Brand.Brand\u003C\"N\">` | try to merge a `namespace` into the brand `const` (impossible) |\n| override BOTH `[Equal.symbol]` AND `[Hash.symbol]` when equality ignores fields | override `[Equal.symbol]` alone — the hash fast-path silently defeats it |\n| `Schema.isSchema(x)` (`Schema.ts:2349`) to recognise a schema value at runtime — every schema is a **function** (`typeof === \"function\"`) ([why](#a-schema-value-is-a-function-at-runtime)) | `typeof x === \"object\" && x !== null` as a schema guard — it rejects **every** schema, so a config loader that \"accepts objects\" silently drops all of them |\n| `S extends Schema.ConstraintDecoder\u003Cunknown>` as the bound of a helper that wraps `decodeUnknownResult` \u002F `decodeUnknownExit` \u002F `decodeUnknownOption` — that is the bound core's own decode entry points use (`Schema.ts:1737,1605,1673`) | `S extends Schema.Top` — `Top` erases `DecodingServices` to `unknown`, so the helper's call into `decodeUnknownResult` fails to type-check (`unknown` is not assignable to `never`); `Top` is for utilities that never decode (its docstring at `Schema.ts:770` sends decode-only APIs to `ConstraintDecoder`) |\n| `Schema.toJsonSchemaDocument(S)` | `Schema.toJsonSchema(S)` — that export does not exist. It returns `{ dialect, schema, definitions }`, **not** `$defs` \u002F `properties` |\n| a single-return **ternary chain** in an error's `message` getter | an exhaustive `switch` with no terminal return — tsgo accepts it, but Biome's `useGetterReturn` rejects it (see below) |\n| `Schema.Class` + `Schema.tag(\"literal\")` on an explicitly-named field when the discriminator belongs to a FOREIGN contract | `Schema.TaggedClass` for a foreign discriminator — it hardwires the key `_tag` (see below) |\n\n## Decoding tolerates excess keys silently — and a typo is the common case\n\n`Schema.Struct` **drops unknown keys without complaint** on decode under\n`onExcessProperty`'s default of `\"ignore\"`. The only other value is `\"error\"`,\nwhich rejects them; there is no `\"preserve\"`, and a struct keeps unknown keys\nonly when it declares them with `Schema.StructWithRest`. A struct of\nall-`optionalKey` fields decodes `{ mxa: 100 }` to `{}` and reports success, so a\ntypo'd key and a correct-but-absent one are indistinguishable.\n\n| Do this | Not this |\n| --- | --- |\n| `Schema.decodeUnknownEffect(S)(input, { onExcessProperty: \"error\", errors: \"all\" })` for anything a **human typed** | a bare decode of user-authored config, where a typo is silently discarded |\n| let it default to `\"ignore\"` for a **machine-produced** payload you do not own | `\"error\"` on a third-party API response, which breaks the moment they add a field |\n\nTwo failures this has already caused in the kit, from independent directions:\n\n- A typo'd rule-option key passed config validation, so the rule ran on defaults\n  while the design promised \"a typo'd option fails loudly naming the field\"\n  (`@effected\u002Fyaml` lint system, #129).\n- A config loader could report neither a typo'd section **nor a field the schema\n  deliberately removed** — a user migrating an older file kept a dead credential\n  and was told nothing (`@spencerbeggs\u002Freposets`). Their first\n  conclusion was that v4 had dropped the feature entirely, and they began writing\n  one hand-rolled filter per removed field before a probe found `onExcessProperty`\n  alive and well.\n\nPair it with **`errors: \"all\"`**. The default reports the first issue only, so a\nfile with three typos surfaces one per run — fix, re-run, discover the next. The\nextra work only happens on a document that is already failing.\n\n**A rest does not make a struct stricter — it switches excess checking off.**\nThis is the opposite of what the shape suggests, and it is worth probing rather\nthan reasoning about:\n\n| Spelling | `{ a: \"x\", b: 1 }` under `onExcessProperty: \"error\"` |\n| --- | --- |\n| `Schema.Struct({ a })` | **rejected** — the strict path |\n| `Schema.StructWithRest(Struct({ a }), [Record(String, Unknown)])` | **accepted**, and `b` is *preserved* |\n| `Schema.Struct({ a }, { rest: Never })` | accepted, `b` dropped — v4's `Struct` takes only `fields`, so a `rest` option is an ignored extra argument |\n| `Schema.StructWithRest(Struct({ a }), [Record(String, Never)])` | rejected — but so is the valid `{ a: \"x\" }`, because the index signature covers `a` too |\n\n`SchemaAST.ts` runs the excess pass only when the struct has no index signature,\nso **owning a rest disables it for that struct entirely**, not merely for the\nkeys the rest covers. A schema that deliberately admits a pass-through section\ntherefore keeps working under `\"error\"` — but it is permissive about *every*\nkey at that level, and siblings without a rest stay strict independently.\n\nSo a rest cannot express \"these keys and no others\" in either direction, and\n`onExcessProperty: \"error\"` is the only strict path.\n\n## `Schema.optional` is not exact-optional\n\nThese repos compile with `exactOptionalPropertyTypes: true`, and the two\noptionality combinators differ in exactly the way that setting cares about:\n\n```ts\nSchema.optional(Schema.String)      \u002F\u002F field?: string | undefined  — { field: undefined } is LEGAL\nSchema.optionalKey(Schema.String)   \u002F\u002F field?: string             — { field: undefined } is TS2375\n```\n\nThe mechanism is in the vendored source — `optional` is `optionalKey` widened\nwith `UndefinedOr`:\n\n```ts\n\u002F\u002F Schema.ts:2472 — the docstring at Schema.ts:2449 reads \"Equivalent to `optionalKey(UndefinedOr(S))`\"\nexport const optional: optionalLambda = Struct_.lambda\u003CoptionalLambda>((self) => {\n  const schema = UndefinedOr(self)\n  return make(SchemaAST.optional(self.ast), { schema })\n})\n```\n\n**The trap is that `Schema.optional` reads like the neutral default and\ncompiles clean.** Nothing fails; the schema simply admits a present-but-\n`undefined` key forever after. A partial-merge patch schema\n(`{ name, url?, path?, sha? }`) built with `Schema.optional` type-checked, and\n`{ name: \"a\", url: undefined }` still compiled — violating the \"omitted fields\nare absent\" invariant the patch depended on. Only review caught it.\n\nProbed, `packages\u002Fsemver` (control: `Schema.optionalElement`\n→ TS2339, harness live):\n\n```text\noptional    + explicit undefined -> compiles (no error)          \u003C-- the bug\noptionalKey + explicit undefined -> TS2375 ... with 'exactOptionalPropertyTypes: true'\n```\n\n`optionalKey` also lowers cleaner: the field is absent from `required` in the\nderived JSON Schema, with no `undefined`\u002F`null` sentinel in the type. Reach for\n`Schema.optional` **only** when the value genuinely must carry `undefined` as a\ndistinct inhabitant — not merely because the field is optional.\n\n## The reserved `make` collision: `parse` \u002F `parseResult` is the house resolution\n\nEvery class factory reserves a static `make`, so a validating\n`make(input: string)` is impossible — the signatures are incompatible and TS\nrejects the whole static side:\n\n```text\nTS2417: Class static side 'typeof Version' incorrectly extends base class static side ...\n  Types of property 'make' are incompatible.\n    Type '(_raw: string) => Version' is not assignable to\n      type '(input: ReadonlyMakeIn\u003C{ readonly major: Number; }>, options?: MakeOptions) => Version'\n```\n\nThere is no overload escape: `make` belongs to the base. The kit's answer,\nused by `SemVer`, `Range`, `Comparator`, `Jsonc`, `Markdown`, `MarkdownDocument`\nand `Lockfile`, is a **pair** — the sync `Result` primitive plus the `Effect`\nform defined in terms of it:\n\n```ts\nexport class SemVer extends Schema.Class\u003CSemVer>(\"SemVer\")({ \u002F* fields *\u002F }) {\n  \u002F\u002F sync, total, no Effect runtime needed — the primitive\n  static parseResult(input: string): Result.Result\u003CSemVer, InvalidVersionError> { \u002F* ... *\u002F }\n\n  \u002F\u002F the Effect form: a named span + the Result bridge, nothing more\n  static readonly parse = Effect.fn(\"SemVer.parse\")((input: string) =>\n    Effect.fromResult(SemVer.parseResult(input)));\n}\n```\n\n`make` stays what the factory made it — the validated field constructor —\nwhile `parse`\u002F`parseResult` own string input. (Why both forms: see\n`formatter-convention` in the design docs. The `Effect.fromResult` bridge, and\nwhy `yield* someResult` does not work, are owned by `effect-v4-idioms`.)\n\n## `transformEffect`'s callback contract\n\nBoth callbacks must return an **`Effect`** — not a `Result`, not a bare value —\nfailing with a `SchemaIssue`. The vendored signature\n(`SchemaTransformation.ts:390`):\n\n```ts\nexport function transformEffect\u003CT, E, RD = never, RE = never>(options: {\n  readonly decode: (e: E, options: SchemaAST.ParseOptions) => Effect.Effect\u003CT, SchemaIssue.Issue, RD>\n  readonly encode: (t: T, options: SchemaAST.ParseOptions) => Effect.Effect\u003CE, SchemaIssue.Issue, RE>\n}): Transformation\u003CT, E, RD, RE>\n```\n\nThe house failure shape is `InvalidValue` carrying a message annotation, with\nthe offending value as the second argument:\n\n```ts\nSchema.String.pipe(Schema.decodeTo(Schema.Date,\n  SchemaTransformation.transformEffect({\n    decode: (s) => {\n      const d = new Date(s);\n      return isNaN(d.getTime())\n        ? Effect.fail(new SchemaIssue.InvalidValue({ message: \"Invalid date\" }, s))\n        : Effect.succeed(d);\n    },\n    encode: (d) => Effect.succeed(d.toISOString()),\n  })))\n```\n\nSignature trap: `SchemaIssue.InvalidValue`'s constructor is\n`(annotations?, input?, options?)` (`SchemaIssue.ts:768`), not\n`(Option.some(s), { message })` — a plain annotations object is the first\nargument, with no `Option` wrapper. The input is retained on the issue only\nwhen parse options set `reportInput: true` (`SchemaIssue.ts:172-173`);\n`InvalidType`'s constructor is `(ast, input?, options?)`\n(`SchemaIssue.ts:687`). If your transformation is infallible, use\n`SchemaTransformation.transform` (plain values, no Effect) instead; reach for\n`transformEffect` only when it can fail.\n\n## A nested `Schema.Class` field: foreign and self-recursive behave identically\n\n`make`'s treatment of a class-typed field does not split on whether the\nfield's schema refers to the class being defined: a *foreign* field and a\n*self-recursive* field behave the same way in every case that matters.\n\n| Field shape | plain-object literal | invalid plain literal | prototype-forged bad instance | passes a good instance through by reference |\n| --- | --- | --- | --- | --- |\n| **foreign** class — `inner: Inner`, `suspend(() => Inner)`, `Array(suspend(() => Inner))` | accepted, **promoted** to a real instance | **rejected**, with a path | **accepted** unexamined | **yes** — identity preserved |\n| **self-recursive** — `suspend(() => Self)`, bare, `optionalKey`-wrapped or inside `Array` | accepted, **promoted** to a real instance | **rejected**, with a path (`at [\"kid\"][\"v\"]`) | **accepted** unexamined | **yes** — identity preserved |\n\nWhat follows from the one row you are always in:\n\n- **Hand either kind of field a literal.** It is deep-validated and promoted to\n  a real instance (`instanceof` is true). Hand-built trees and fixtures do not\n  need real instances at every level — constructing `Inner.make({...})` purely\n  to satisfy a self-recursive field is unnecessary, though harmless.\n- **Identity is preserved.** `Outer.make({ inner: x }).inner === x` is **true**\n  for a foreign field as much as a self-recursive one — do not assume a\n  foreign field is re-constructed and skip a `strictEqual` assertion on it.\n  `deepStrictEqual` \u002F `Equal.equals` remain the better assertion anyway,\n  because they keep passing across a schema's own internal refactors.\n- **A prototype-forged instance is still accepted unexamined**, in both rows —\n  the `instanceof` check short-circuits the field's validation. Anything that\n  forges instances to skip validation (`@effected\u002Fjsonc`'s `makeNodeUnsafe`)\n  therefore owns its own correctness.\n- **The TYPE level is a separate axis.** `make`'s input type for a class-typed\n  field is the class's **instance type**, so a member-less value class is\n  structurally satisfied by a literal and compiles, while a class carrying any\n  member the literal lacks (a getter, a method — most real classes) rejects\n  the literal at compile time (TS2741 \u002F TS2740) even though runtime would\n  validate and promote it. Do not read that error as \"the check narrowed\n  `make`\" — wrapping the field in `.pipe(Schema.check(...))` changes nothing\n  on this axis.\n- **Construction is linear**: a recursive tree built node-by-node measures\n  well under a millisecond at every depth from 10 to 60.\n\n> **Not exponential.** Node-by-node construction of a recursive `Schema.Class`\n> does not re-validate its whole subtree on every level — a left-spine build\n> stays flat, sub-millisecond, from depth 10 through depth 60. A control that\n> does genuinely exponential work (2^d) measures in the tens of milliseconds\n> at the same depths, so a harness built to see exponential cost here would\n> see it if it were real. Do **not** add a validation bypass for cost reasons.\n\n## Class-factory equality is deep and structural — but instances are not frozen\n\n`Equal.equals` on two class-factory instances recurses. It is not reference\nequality, and it is not shallow: it walks **nested `Schema.Class` fields**,\n`Schema.optionalKey` fields (a present key and an absent one compare **unequal**,\nwhich is the discrimination `exactOptionalPropertyTypes` semantics need), and\n`Schema.Array`-of-class fields element by element. **`Hash` agrees wherever\n`Equal` agrees**, so these instances are safe as `HashMap`\u002F`HashSet` keys with no\ncustom `[Hash.symbol]`.\n\nThe full matrix was probed 14\u002F14 including discriminating controls — a\none-field difference at each nesting depth compared unequal, so the probe\ncould fail and did not. **Do not pay for this probe again**, and do not\nhand-write a recursive comparator for a class tree: `Equal.equals` already\nis one. (It is also what keeps assertions stable across the identity churn\nthe table above documents.)\n\nTwo `Schema.Record` rows, probed with discriminating controls: a\nplain `Schema.Record(String, String)` field compares structurally and\n**order-insensitively** (same pairs in different insertion orders are equal; a\nvalue-change control is unequal), and the `optionalKey` present-vs-absent rule\nabove applies to records too — a PRESENT `{}` and an ABSENT key compare\n**unequal**. The design consequence: a field whose contract is \"absent ≡\nempty\" must be always-present with a constructor default\n(`Schema.Record(...).pipe(Schema.withConstructorDefault(Effect.succeed({})))`),\nbecause the `optionalKey` shape makes an explicit-`{}` value drift forever\nagainst an omitted one.\n\n**But nothing is frozen.** A `Schema.Class` instance is a plain object at\nruntime; `Schema.ts` calls `Object.freeze` nowhere. Validation happens at\nconstruction and never again, so a mutated instance keeps **stale derived and\nprovenance state** — a cached hash, a `_tag`-adjacent invariant, the wire-form\nbookkeeping the `Person` codec below relies on — while still satisfying its type.\nGuard anything that **replays a value onto the wire, or caches keyed on instance\nidentity**: treat instances as immutable by discipline, and rebuild with\n`make` rather than assigning a field, because the type system will not stop you.\n\n## A homogeneous-Type union is encode-lossy: keep the Type heterogeneous when the wire form must survive\n\n`Schema.Union([A, A.FromString])` — the reflex for \"accept either the object\nor its string shorthand\" — **cannot round-trip the input encoding** when both\nmembers decode to the *same* Type. On encode the union collapses to the\n**first** member that produces that Type, regardless of which branch decoded\nthe value. A value parsed from the string form re-encodes as the object form,\nsilently. This is the mechanism behind the round-4 `@effected\u002Fpackage-json`\n`Person` data-loss bug (string-form `author` rewritten to object form), and it\nis why `Person.FromValue` carries a `wireForms` WeakMap plus a faithfulness\ncheck — the union cannot remember which branch a value came from, so the code\nmust.\n\nProbed, `packages\u002Fpackage-json`, with a control proving the object form\nround-trips:\n\n```ts\nconst A = Schema.Struct({ name: Schema.String })            \u002F\u002F Type {name}, Encoded {name}\nconst AFromString = Schema.String.pipe(Schema.decodeTo(A,   \u002F\u002F Type {name}, Encoded string\n  SchemaTransformation.transform({ decode: (s) => ({ name: s }), encode: (a) => a.name })))\nconst U = Schema.Union([A, AFromString])\n\nconst v = Schema.decodeUnknownSync(U)(\"alice\")              \u002F\u002F via AFromString → {name:\"alice\"}\nSchema.encodeUnknownSync(U)(v)                              \u002F\u002F → {name:\"alice\"} (OBJECT), not \"alice\"\n\u002F\u002F round-trips to the string form? false\n```\n\nThe rule: **if two union members decode to the same Type, that union cannot\npreserve which encoding an input used.** When wire-form fidelity matters, keep\nthe Type heterogeneous (a distinct `_tag` or shape per encoding), or remember\nthe original wire form out of band and replay it on encode as `Person` does.\nA \"class IS the schema\" homogeneous union reads as symmetric and is not.\n\n## Out-of-band provenance needs `Schema.instanceOf(C)` as the `decodeTo` target, not `C`\n\nThe remedy above — remember the wire form in a `WeakMap` keyed on the decoded\ninstance — is defeated by the obvious spelling of it. **`Schema.decodeTo(C, …)`\nwhere `C` is a `Schema.Class` re-validates the transform's output and hands the\ncaller a DIFFERENT instance.** Every `WeakMap` the transform populated misses,\nand the encode side silently takes its rebuild-from-fields fallback: no error,\nno type complaint, just the fidelity the map existed to provide, gone.\n\n`Schema.instanceOf(C)` as the target passes the instance through by reference.\nThat is why `@effected\u002Fpackage-json`'s `Person.schema`, `Person.FromString` and\n`Person.FromValue` all target `Schema.instanceOf(Person)` — the class is what\nthe transform CONSTRUCTS, never what the codec decodes TO.\n\nProbed:\n\n```ts\nclass Item extends Schema.Class\u003CItem>(\"Item\")({ url: Schema.String }) {}\nlet produced: Item | undefined\nconst tx = SchemaTransformation.transform({\n  decode: (s: string) => (produced = Item.make({ url: s })),\n  encode: (a: Item) => a.url,\n})\n\nSchema.decodeUnknownSync(Schema.String.pipe(Schema.decodeTo(Item, tx)))(\"a\") === produced\n\u002F\u002F false — reconstructed\n\nSchema.decodeUnknownSync(Schema.String.pipe(Schema.decodeTo(Schema.instanceOf(Item), tx)))(\"b\") === produced\n\u002F\u002F true — same reference, and still true nested in Schema.Array and Schema.Struct\n```\n\n**The target you switch to validates less.** `Schema.instanceOf(C)` is an\n`instanceof` check and nothing more — it does not apply `C`'s field schemas or\nits checks, so whatever the transform returns passes straight through. Moving\nthe target from `C` to `Schema.instanceOf(C)` to keep identity therefore also\nremoves the field validation the class target was performing, and the\ntransform has to carry it instead:\n\n```ts\nconst invalid = Object.assign(Item.make({ url: \"ok\" }), { url: 1 })\nSchema.decodeUnknownSync(Schema.instanceOf(Item))(invalid)  \u002F\u002F accepted, url === 1\nSchema.decodeUnknownSync(Item)(invalid)                     \u002F\u002F rejected\n```\n\nConstruct with `C.make` inside the transform, and validate any input the\nconstructor does not — `@effected\u002Fpackage-json`'s `Person.schema` decodes the\nraw object through a separate `PersonFields` struct first, precisely so the\nissue tree stays identical to what a direct class decode produced.\n\nTwo more riders, both learned the hard way in that package:\n\n- **Key the map on the element, never on a container.** `Schema.Array` rebuilds\n  the array itself, so an array-keyed `WeakMap` is empty by the time `encode`\n  runs even when every element's identity survived. When the provenance is a\n  property of the collection (`@effected\u002Fpackage-json`'s `Funding` remembers\n  whether an entry was written bare rather than inside an array), hang it on the\n  one element that carried it and guard the replay on that element still being\n  alone.\n- **Guard every replay on the instance still matching.** `Schema.Class`\n  instances are not frozen, so an instance edited in place keeps provenance that\n  no longer describes it, and an unguarded replay writes the ORIGINAL wire back\n  — discarding the edit. The guard must cover the fields the wire form cannot\n  express, not only the ones it can: the shorthand-string branch of `Person`\n  matched on `name`\u002F`email`\u002F`url`, replayed, and dropped any key added to `rest`\n  afterwards.\n\n## The `message` getter: ternary chain, not an exhaustive switch\n\nEvery `TaggedError` with a multi-reason `message` hits this. A `switch` over\na `Schema.Literals`-typed `reason` in which **every case returns** is exhaustive,\nand tsgo is happy — but Biome's `lint\u002Fsuspicious\u002FuseGetterReturn` sees a getter\nwith no terminal return and fails the lint gate:\n\n> `× This getter should return a value.`\n\n```text\n\u002F\u002F REJECTED by `pnpm lint` (useGetterReturn), accepted by tsgo:\nget message(): string {\n switch (this.reason) {\n  case \"missing\":  return `missing ${this.key}`;\n  case \"invalid\":  return `invalid ${this.key}`;\n  case \"conflict\": return `conflict on ${this.key}`;\n }\n}\n\n\u002F\u002F The house pattern — one return, a ternary chain:\nget message(): string {\n return this.reason === \"missing\"\n  ? `missing ${this.key}`\n  : this.reason === \"invalid\"\n    ? `invalid ${this.key}`\n    : `conflict on ${this.key}`;\n}\n```\n\nVerified through `pnpm lint` (a bare `npx biome check \u003Cfile>` from inside a\npackage exits 0 without reading the repo config — it is not a check).\n\n## Foreign JSON contracts: `TaggedClass` owns `_tag`, `Schema.tag` serves everyone else\n\n`Schema.TaggedClass` hardwires its discriminator key to `_tag` (the vendored\n`TaggedStruct` is `Simplify\u003C{ readonly _tag: tag\u003CTag> } & Fields>`,\n`Schema.ts:6313`), so it\nserves only contracts **we** own. When shaping classes to a foreign JSON\ncontract whose discriminator has its own name — mdast's `type`, JSON Schema's\n`type`\u002F`$ref`, OpenAPI, LSP — use `Schema.Class` with `Schema.tag(\"literal\")`\non an explicitly-named field:\n\n```ts\nexport class Paragraph extends Schema.Class\u003CParagraph>(\"Paragraph\")({\n type: Schema.tag(\"paragraph\"), \u002F\u002F the FOREIGN key, not _tag\n children: PhrasingContent,\n}) {}\n```\n\n`Schema.tag` gives the same three properties `TaggedClass` would: a\nconstructor default (`X.make` omits it), literal narrowing for union\nbranching, and presence on the encoded side. `@effected\u002Fmarkdown`'s\n`MarkdownNode` classes are the worked precedent — the encoded trees are\nspec-valid mdast because the tag field is literally named `type`.\n\nWhile here, the factory-signature trap between the two\n(`Schema.ts:17766`\u002F`:17826`): `Schema.Class\u003CSelf>(\"Identifier\")(fields)` takes\nthe **identifier in the first call** and fields in the second, while\n`Schema.TaggedClass\u003CSelf>()(\"Tag\", fields)` takes an **optional identifier\nfirst** and the tag+fields in the second. Mixing them up produces confusing\ninference errors, not a clear TS message.\n\nFor any other field, the general form is `Schema.withConstructorDefault`, and\nits argument is an **Effect**, not a thunk and not an `Option`\n(`defaultValue: Effect.Effect\u003C...>`, `Schema.ts:5988`):\n`field.pipe(Schema.withConstructorDefault(Effect.succeed(value)))`. Passing a\nthunk like `() => Option.some(value)` typechecks against nothing helpful and\ndies at construction with the unhelpful defect `Fiber.runLoop: Not a valid\neffect`. The default runs per construction — a `succeed({})` object is NOT\nshared across instances.\n\n## A `Schema.check` narrowing is ERASED from the published type\n\nA check narrows what **decodes**, not what the value is **typed** as — so a\nchecked schema and its base publish as the *same* declared type.\n`CorepackIntegrityHash` (corepack-form-only) and the wide `IntegrityHash`\nbrand both emit as `Schema.brand\u003CSchema.String, \"IntegrityHash\">` in\n`@effected\u002Fnpm`'s built `.d.ts`; a consumer reading the types cannot tell\nthem apart. The consequence bites in two directions:\n\n- **A faithful private re-fork of a shared checked schema is invisible** to\n  `tsc` AND to every behavioral test — the mutant that re-forks the schema\n  keeps the entire rejection matrix green. When two modules must share a\n  checked narrowing of one brand, the only proven guard is a **runtime\n  identity assertion** on the consumer's field schema\n  (`X.fields.integrity.schema === CorepackIntegrityHash`; through\n  `Schema.Option`, `.fields.\u003Cname>.value === …`), with a control proving it\n  discriminates (`=== IntegrityHash` must be false). The failing assert\n  prints \"Compared values have no visual difference\" — which is the point.\n  Do not downgrade it to a behavioral test, which cannot fail, or a\n  source-text import walker, which passes if the import is left unused.\n- **A behavioral break can be type-invisible**: strictening a field's check\n  (package-json's `PackageManager` version fold) ships a byte-identical\n  `.d.ts` while previously-accepted inputs now fail at decode. Announce\n  such changes loudly in handoffs — nothing downstream fails to compile.\n\n## A schema value is a function at runtime\n\nEvery schema — `Schema.String`, a `Struct`, a `Literals`, a `Schema.Class`\nfactory result, a `.check(...)`-ed schema — is built by `internal\u002Fschema\u002Fmake.ts:46`\nas `function Schema() {}` with its prototype swapped to the schema proto, so\n`typeof` reports `\"function\"`, never `\"object\"`. Probed against a\ncontrol (`Schema.isSchema(42)` → `false`):\n\n```text\nSchema.String:                        typeof=function  isSchema=true  objectGuardAccepts=false\nSchema.Struct({...}):                 typeof=function  isSchema=true  objectGuardAccepts=false\nSchema.Literals([...]):               typeof=function  isSchema=true  objectGuardAccepts=false\nSchema.Class factory result (Person): typeof=function  isSchema=true  objectGuardAccepts=false\nSchema.String.check(...):             typeof=function  isSchema=true  objectGuardAccepts=false\n```\n\nThe trap this replaces: a `typeof value === \"object\"` guard in a config loader\nthat classified every user-supplied schema as \"not a schema\" and reported a\nconfig with five schemas as declaring none — a false *negative* the loader's\nown tests could not see because their fixtures were objects too. Use\n`Schema.isSchema` (`Schema.ts:2349`, a `TypeId` brand check), and when a guard\nmust also accept plain objects, test `isSchema` **first**.\n\n## A `SchemaIssue` as `{ code, path, message }` diagnostics\n\n`SchemaIssue.makeFormatterStandardSchemaV1()` returns `{ message, path }` per\nfailure and no code. For a diagnostic-code surface, walk the issue tree\n(`Issue` is `Leaf | Filter | Encoding | Pointer | Composite | AnyOf`,\n`SchemaIssue.ts:147`), accumulate `Pointer` paths, and take the node's `_tag` as\nthe code, with `makeFormatterDefault()` for the message:\n\n```ts\nimport { SchemaIssue } from \"effect\"\n\ninterface Diagnostic {\n  readonly code: string\n  readonly path: ReadonlyArray\u003CPropertyKey>\n  readonly message: string\n}\n\nconst format = SchemaIssue.makeFormatterDefault()\nconst diagnostics = (issue: SchemaIssue.Issue, path: ReadonlyArray\u003CPropertyKey> = []): Array\u003CDiagnostic> => {\n  switch (issue._tag) {\n    case \"Encoding\":\n      return diagnostics(issue.issue, path)\n    case \"Pointer\":\n      return diagnostics(issue.issue, [...path, ...issue.path])\n    case \"Composite\":\n      return issue.issues.flatMap((child) => diagnostics(child, path))\n    case \"AnyOf\":\n      if (issue.issues.length > 0) return issue.issues.flatMap((child) => diagnostics(child, path))\n      return [{ code: issue._tag, path, message: format(issue) }]\n    default:\n      return [{ code: issue._tag, path, message: format(issue) }]\n  }\n}\n```\n\nProbed with `{ errors: \"all\" }` on `Struct({ name: NonEmptyString, age: Number, tags: Array(String) })`\nagainst `{ name: \"\", age: \"x\", tags: [1] }`: `Filter` at `[\"name\"]`\n(\"Expected a value with a length of at least 1\"), `InvalidType` at `[\"age\"]` and\nat `[\"tags\", 0]`, and `MissingKey` at `[\"name\"]` for a missing key; path and\nmessage match the Standard Schema formatter's. A failed check reports as\n`Filter`, so a code per check needs your own mapping.\n\n## Verify against the installed source, not the references\n\nThe `references\u002F` track **upstream `Effect-TS\u002Feffect` main**, which runs AHEAD\nof this repo's pinned `effect`. Treat them as authoritative on *shape and\nintent*, not on exact export names. Before relying on any specific API, probe\nit from a package on the v4 catalog:\n\n```bash\nnode --input-type=module -e \"import * as S from 'effect\u002FSchema'; console.log(typeof S.TheApiYouWant)\"\n```\n\nIf it prints `undefined`, the name moved or has not landed yet — check\n`node_modules\u002Feffect\u002Fdist\u002FSchema.d.ts`, or climb the `effect-v4-source-lookup`\nladder. The \"Do this, not this\" rules above already fold in the gotchas the\nupstream prose does not flag.\n\nThe skew is real and it cuts both ways: the vendored `09-classes-and-opaque-types`\nreference still documents `Schema.asClass`, which is **`undefined`** —\nyou now subclass the schema value directly (`class MyString extends Schema.String {}`).\n\n## Reference map\n\nLoad the one section you need. Each file carries a provenance banner (upstream\nsource + the version-skew warning).\n\n| Reference | Load when |\n| --- | --- |\n| [01-overview](.\u002Freferences\u002F01-overview.md) | Orienting on the design philosophy — codecs, the Type\u002FEncoded split, the `~`-prefixed internal type members. |\n| [02-elementary-schemas](.\u002Freferences\u002F02-elementary-schemas.md) | Primitives, literals, strings & string formats, numbers\u002Fintegers\u002Fbigints, dates, template literals. |\n| [03-composite-schemas](.\u002Freferences\u002F03-composite-schemas.md) | Structs, tuples, arrays, records, unions, recursive schemas. The biggest section — the day-to-day modeling vocabulary. |\n| [04-custom-types](.\u002Freferences\u002F04-custom-types.md) | Declaring a schema for a type Schema doesn't know — `Schema.declare` (non-parametric) and `declareConstructor` (parametric). |\n| [05-validation](.\u002Freferences\u002F05-validation.md) | Filters as first-class, checks\u002Frefinements\u002Fbranding, structural & effectful filters, multiple-issue reporting, aborting, filter groups & factories. |\n| [06-constructors](.\u002Freferences\u002F06-constructors.md) | `make` in composed\u002Fbranded\u002Frefined schemas, default values (incl. effectful defaults). |\n| [07-transformations](.\u002Freferences\u002F07-transformations.md) | `decodeTo`\u002F`encodeTo`, the transformation type, composing, passthrough helpers, optional-key management, omit-on-encode. |\n| [08-flipping-schemas](.\u002Freferences\u002F08-flipping-schemas.md) | `Schema.flip` — swapping Type and Encoded, and what it does to constructors. |\n| [09-classes-and-opaque-types](.\u002Freferences\u002F09-classes-and-opaque-types.md) | Opaque structs, schema-as-a-class, the `Schema.Class` family (methods, statics, extension). |\n| [10-serialization](.\u002Freferences\u002F10-serialization.md) | JSON, string-encoding, FormData, URLSearchParams, canonical codecs, the XML encoder. |\n| [11-generation-and-tooling](.\u002Freferences\u002F11-generation-and-tooling.md) | Deriving JSON Schema (`onExcessProperty`, open by default), the native `Arbitrary` generator (no fast-check bridge; size clamp, `-0`, exhaustion and regexp traps), Equivalence, Optic; type-safe JSON patches via Differ. |\n| [12-schema-representation](.\u002Freferences\u002F12-schema-representation.md) | The introspectable representation data model, its limitations, JSON round-tripping, rebuilding runtime schemas, code generation. |\n| [13-error-handling-and-formatting](.\u002Freferences\u002F13-error-handling-and-formatting.md) | `SchemaError`\u002F`SchemaIssue`, formatters, Standard-Schema-v1 issue output. |\n| [14-middlewares](.\u002Freferences\u002F14-middlewares.md) | Decode\u002Fencode middlewares and fallbacks. |\n| [15-advanced-topics](.\u002Freferences\u002F15-advanced-topics.md) | The internal model, type hierarchy, typed annotations, generics & separate requirement type params. |\n| [16-integrations](.\u002Freferences\u002F16-integrations.md) | Framework integrations (TanStack Form, Elysia). |\n\n## Related skills\n\n- **`effect-v4-idioms`** — core Effect patterns, and the **call-not-value** list\n  (`Schema.Defect()`, `Schema.ErrorInstance()`, `TestClock.layer()`) — names that\n  exist, type-check uncalled, and fail somewhere else.\n- **`effect-v4-source-lookup`** — when a Schema name doesn't resolve:\n  the evidence ladder that settles existence, signature and semantics.\n- **`effect-api-extractor-bases`** — the anonymous-base \u002F `ae-forgotten-export`\n  discipline for `Schema.Class` and `Context.Service`.\n- **`effect-v4-services-layers`** — the sibling for `Context.Service` and Layers.\n- **`effect-v4-planning`** — design a schema\u002Fservice before writing it.\n","# Effect v4 Schema\n\nThe single skill for Effect v4 `Schema`. (For which of the `Schema*` satellite\nmodules is consumer-facing vs machinery, see `effect-v4-module-index`.) It\ncarries three layers:\n\n1. **The house rules** — the [Do this, not this](#do-this-not-this) table below,\n   our opinionated defaults distilled from the `@effected` packages.\n2. **[references\u002Fhouse-style.md](.\u002Freferences\u002Fhouse-style.md)** — the worked\n   examples and the reasoning behind each rule (the traps that only surface at\n   test\u002Fproperty-test time).\n3. **[`references\u002F`](.\u002Freferences\u002F)** — **Effect's own canonical Schema guide**\n   (`Effect-TS\u002Feffect`, `packages\u002Feffect\u002FSCHEMA.md`) split by topic, for the exhaustive\n   detail on any construct.\n\nDo not load all references at once — each is a standalone topic (some >1000\nlines).\n\n## Do this, not this\n\nEach row is a hard house default; reasoning and worked code in\n[house-style.md](.\u002Freferences\u002Fhouse-style.md).\n\nNaming trap: `Schema.TaggedErrorClass` and `Schema.ErrorClass` are both\n`undefined` on the `Schema` namespace — the current names are\n`Schema.TaggedError` (`Schema.ts:17947`) and `Schema.Error` (`:17886`), with the same\ncurried call shape. Code written against the older names fails with\n\"TaggedErrorClass is not a function\".\n\n| Do | Not |\n| --- | --- |\n| `Schema.Class` \u002F `TaggedClass` \u002F `TaggedError` for any reusable model, union member, or error | a bare `Schema.Struct` for a domain type — `Struct` is for throwaway inline shapes |\n| `X.make({...})` as the default constructor — EXCEPT `TaggedError`, where failing with the yieldable `yield* new SomeError({...})` is the house idiom (glob, workspaces, walker all construct errors with `new`) | `new X({...})` for models outside a measured hot path (both validate identically) |\n| copy-with-patch a class instance by spreading it into the factory: `X.make({ ...x, field: next })` — own fields carry over, an absent `optionalKey` stays absent, a default-bearing field keeps its value, checks re-run on the result, and `#` private fields and class-body own props are rebuilt by the subclass, not copied | enumerating the fields by hand in a transform meant to preserve them (`X.make({ a: x.a, b: x.b, ... })`) — a complete-looking literal type-checks today and silently drops any field added later (the `Lockfile.withImporterNames` peer-map loss); a hand-written list is only right when the transform is *meant* to choose fields |\n| reach for `{ disableChecks: true }` only to accept *trusted* data that would fail a `.check(...)` | reach for it as a **speed** switch — as its docstring says (\"skip filters and checks while still parsing types and structure\", `Schema.ts:137`), it gates only the check phase: a failing `.check(...)` is skipped but a *type* error still throws, and the structural re-parse still runs. There is no speed to buy: a depth-20 recursive build measures **sub-millisecond either way**, with or without it — see the retracted exponential-cost claim below for what the numbers were once wrongly believed to be |\n| treat a nested `Schema.Class` field identically whether it is **foreign** or **self-recursive** — both accept a plain literal, deep-validate it, promote it to a real instance, and pass a real instance through **by reference** ([table](#a-nested-schemaclass-field-foreign-and-self-recursive-behave-identically)) | assume the two ever split — that a self-recursive field *rejects* literals, or that a foreign field is re-constructed so `Outer.make({ inner: x }).inner !== x`. A **prototype-forged** instance is accepted unexamined either way |\n| dodge the class factory's reserved static names when designing domain statics — every `Schema.Class`\u002F`TaggedClass`\u002F`TaggedError` base already declares `identifier`, `fields`, `ast`, `pipe`, `rebuild`, `make`, `makeOption`, `makeEffect`, `annotate`, `annotateKey`, `check`, `extend`, `mapFields` (`makeClass`, `Schema.ts:17518`; all thirteen confirmed present by probe, against a control key correctly reported absent) | a domain static reusing one of those names — an incompatible signature is a TS2417 compile error (*static side incorrectly extends base*); the lockfiles port had to rename an approved `LockfileIntegrity.check(lockfile, manifests)` design to `compare` on exactly this |\n| name a validating string constructor `parse` \u002F `parseResult` — **`make` is reserved and cannot be overloaded**, and this pair is the kit-wide shape ([worked example](#the-reserved-make-collision-parse--parseresult-is-the-house-resolution)) | `static make(raw: string)` on a `Schema.Class` — TS2417, every time |\n| conditional-spread an absent optional field | pass an explicit `undefined` for a `Schema.optionalKey` — a *present* `undefined` throws |\n| cross-field validation on a class: pass a **checked Struct** to the factory — `Schema.Class\u003CX>(\"X\")(Schema.Struct(fields).check(...))`; `check` returns `this[\"Rebuild\"]` (`Schema.ts:213`), so a checked `Struct\u003CFields>` is still a `Struct\u003CFields>` the factory accepts, and the check sees the whole record (worked precedent: `CacheKey`'s restore-depths bound against its own segment count) | per-field checks that need a sibling's value (a field check sees only its field), or validating cross-field invariants in a `parse` wrapper the direct `make` path never runs |\n| `Schema.optionalKey` for object fields — it yields `field?: T`, the exact-optional contract these `exactOptionalPropertyTypes` repos want ([why](#schemaoptional-is-not-exact-optional)) | `Schema.optional` unless the *value* itself must carry `undefined` — it is documented as \"Equivalent to `optionalKey(UndefinedOr(S))`\" (`Schema.ts:2449`), so it yields `field?: T \\| undefined` and **admits `{ field: undefined }`** |\n| `.check(is*)` to constrain, `refine` to narrow, `check(makeFilter(...))` for cross-field | `positive`\u002F`negative`, or the `filter`\u002F`greaterThan` spellings — none of them exist |\n| tagged unions of `TaggedClass` members (`_tag` branching) | untagged unions for domain variants |\n| `Schema.Literals([\"a\", \"b\", \"c\"])` for any multi-literal union (reason fields, enums) | the variadic `Schema.Literal(\"a\", \"b\", \"c\")` — v4 `Literal` takes ONE argument; tsgo rejects the variadic call (TS2554), but the **runtime silently keeps only the first literal**, so a suite run before typecheck green-lights a schema that rejects every other member: `Schema.Literal(\"a\",\"b\",\"c\")` accepts `\"a\"`, rejects `\"b\"` and `\"c\"` |\n| `Source.pipe(decodeTo(Target, SchemaTransformation.transform({...})))` | a top-level `Schema.transform` \u002F `transformEffect` — **not callable** — both are `undefined` on the `Schema` namespace |\n| pin `transformEffect`'s type params explicitly when a union codec's members carry instance methods — `SchemaTransformation.transformEffect\u003C(typeof Classified)[\"Encoded\"], string>({...})` | relying on inference after adding an instance method to a `Schema.TaggedClass` union member — `transformEffect` unifies one `T` from decode-out and encode-in, and `decodeTo` pins both to the union's **Encoded** side, which no longer satisfies the method-bearing instance type; the existing codec breaks at the declaration site (hit adding a method to a `DependencySpecifier.FromString` member) |\n| return an **`Effect`** from both `transformEffect` callbacks, failing with `SchemaIssue.InvalidValue({ message }, value)` ([contract](#transformeffects-callback-contract)) | return a `Result` (or a bare value) from a `transformEffect` callback — the signature demands `Effect\u003CT, SchemaIssue.Issue, R>` (`SchemaTransformation.ts:390`); a `Result` is not an Effect and will not bridge itself |\n| a `FromString` `Schema.Codec\u003CSelf, string>` static (string = the encoded form of the same schema) | a second parser divorced from the schema |\n| `cause: Schema.Defect()` on an error class | `cause: Schema.Defect` — the bare (uncalled) form throws at construction (`Schema.ts:9433` is a *function*; `Schema.ErrorInstance` at `:9355` is the same trap — `Schema.Error` (`:17886`) is the error-**class factory**, not an instance schema — full list of the call-not-value family in **`effect-v4-idioms`**) |\n| `Schema.decodeUnknownEffect` \u002F `encodeUnknownEffect` in Effect flows | `*Sync` outside a genuine sync boundary |\n| `Schema.fromJsonString(S)` (`Schema.ts:9918`) when the encoded form is a JSON **string** — one codec that parses-then-decodes and encodes-then-stringifies (`reviver` \u002F `replacer` \u002F `space` options); for a config or action input, `Config.schema(Schema.fromJsonString(S), \"NAME\")` (`Config.ts:854`) — behaviour under `withDefault` is probed and written up in **`effect-v4-idioms`** | `JSON.parse` \u002F `JSON.stringify` around `decodeUnknown*` \u002F `encodeUnknown*` — a second parser divorced from the schema, with a throwing host call in the seam that no downstream `Effect.catch` sees (five such sites had accreted in `github-actions` before #769 caught them) |\n| `Schema.DurationFromMillis` \u002F `Schema.DateTimeUtcFromString` (composed with `Schema.fromJsonString` for byte stores) when the value must **serialize** | `Schema.Duration` \u002F `Schema.DateTimeUtc` in a persisted or wire schema — both are `declare` schemas with **no JSON encoding** (`Schema.ts:13957,11773`), so they round-trip in memory and fail at the serialization boundary; the ts-vfs cache metadata hit exactly this |\n| annotate recursive `Schema.suspend` refs `Schema.Codec\u003CT>` (services default `never`) | `Schema.Schema\u003CT>` as the suspend annotation — it compiles at the declaration but leaves `DecodingServices` `unknown`, so every decode entrypoint rejects the schema (`unknown is not assignable to never`); a schema nobody decodes directly hides the trap until a consumer tries |\n| derive variants via `mapFields(Struct.pick\u002Fomit\u002Fmap(...))` | duplicate a schema to re-encode the same data |\n| re-apply a struct-level `.check(...)` after `mapFields` or `Schema.fieldsAssign` — `S.mapFields(f).check(...)`, or `mapFields(f, { unsafePreserveChecks: true })` once the check is known to still hold over the new fields | expect a derived struct to keep the original's `.check(...)` refinements — `mapFields` rebuilds the struct with `options?.unsafePreserveChecks ? this.ast.checks : undefined` (`Schema.ts:3566`), so the cross-field checks are **dropped by default**, and `fieldsAssign` is `struct.mapFields(Struct.assign(fields))` with no option at all (`Schema.ts:3646`), so it always drops them; per-field checks travel with their fields and survive |\n| attach brand statics with `Object.assign`; export the type as `string & Brand.Brand\u003C\"N\">` | try to merge a `namespace` into the brand `const` (impossible) |\n| override BOTH `[Equal.symbol]` AND `[Hash.symbol]` when equality ignores fields | override `[Equal.symbol]` alone — the hash fast-path silently defeats it |\n| `Schema.isSchema(x)` (`Schema.ts:2349`) to recognise a schema value at runtime — every schema is a **function** (`typeof === \"function\"`) ([why](#a-schema-value-is-a-function-at-runtime)) | `typeof x === \"object\" && x !== null` as a schema guard — it rejects **every** schema, so a config loader that \"accepts objects\" silently drops all of them |\n| `S extends Schema.ConstraintDecoder\u003Cunknown>` as the bound of a helper that wraps `decodeUnknownResult` \u002F `decodeUnknownExit` \u002F `decodeUnknownOption` — that is the bound core's own decode entry points use (`Schema.ts:1737,1605,1673`) | `S extends Schema.Top` — `Top` erases `DecodingServices` to `unknown`, so the helper's call into `decodeUnknownResult` fails to type-check (`unknown` is not assignable to `never`); `Top` is for utilities that never decode (its docstring at `Schema.ts:770` sends decode-only APIs to `ConstraintDecoder`) |\n| `Schema.toJsonSchemaDocument(S)` | `Schema.toJsonSchema(S)` — that export does not exist. It returns `{ dialect, schema, definitions }`, **not** `$defs` \u002F `properties` |\n| a single-return **ternary chain** in an error's `message` getter | an exhaustive `switch` with no terminal return — tsgo accepts it, but Biome's `useGetterReturn` rejects it (see below) |\n| `Schema.Class` + `Schema.tag(\"literal\")` on an explicitly-named field when the discriminator belongs to a FOREIGN contract | `Schema.TaggedClass` for a foreign discriminator — it hardwires the key `_tag` (see below) |\n\n## Decoding tolerates excess keys silently — and a typo is the common case\n\n`Schema.Struct` **drops unknown keys without complaint** on decode under\n`onExcessProperty`'s default of `\"ignore\"`. The only other value is `\"error\"`,\nwhich rejects them; there is no `\"preserve\"`, and a struct keeps unknown keys\nonly when it declares them with `Schema.StructWithRest`. A struct of\nall-`optionalKey` fields decodes `{ mxa: 100 }` to `{}` and reports success, so a\ntypo'd key and a correct-but-absent one are indistinguishable.\n\n| Do this | Not this |\n| --- | --- |\n| `Schema.decodeUnknownEffect(S)(input, { onExcessProperty: \"error\", errors: \"all\" })` for anything a **human typed** | a bare decode of user-authored config, where a typo is silently discarded |\n| let it default to `\"ignore\"` for a **machine-produced** payload you do not own | `\"error\"` on a third-party API response, which breaks the moment they add a field |\n\nTwo failures this has already caused in the kit, from independent directions:\n\n- A typo'd rule-option key passed config validation, so the rule ran on defaults\n  while the design promised \"a typo'd option fails loudly naming the field\"\n  (`@effected\u002Fyaml` lint system, #129).\n- A config loader could report neither a typo'd section **nor a field the schema\n  deliberately removed** — a user migrating an older file kept a dead credential\n  and was told nothing (`@spencerbeggs\u002Freposets`). Their first\n  conclusion was that v4 had dropped the feature entirely, and they began writing\n  one hand-rolled filter per removed field before a probe found `onExcessProperty`\n  alive and well.\n\nPair it with **`errors: \"all\"`**. The default reports the first issue only, so a\nfile with three typos surfaces one per run — fix, re-run, discover the next. The\nextra work only happens on a document that is already failing.\n\n**A rest does not make a struct stricter — it switches excess checking off.**\nThis is the opposite of what the shape suggests, and it is worth probing rather\nthan reasoning about:\n\n| Spelling | `{ a: \"x\", b: 1 }` under `onExcessProperty: \"error\"` |\n| --- | --- |\n| `Schema.Struct({ a })` | **rejected** — the strict path |\n| `Schema.StructWithRest(Struct({ a }), [Record(String, Unknown)])` | **accepted**, and `b` is *preserved* |\n| `Schema.Struct({ a }, { rest: Never })` | accepted, `b` dropped — v4's `Struct` takes only `fields`, so a `rest` option is an ignored extra argument |\n| `Schema.StructWithRest(Struct({ a }), [Record(String, Never)])` | rejected — but so is the valid `{ a: \"x\" }`, because the index signature covers `a` too |\n\n`SchemaAST.ts` runs the excess pass only when the struct has no index signature,\nso **owning a rest disables it for that struct entirely**, not merely for the\nkeys the rest covers. A schema that deliberately admits a pass-through section\ntherefore keeps working under `\"error\"` — but it is permissive about *every*\nkey at that level, and siblings without a rest stay strict independently.\n\nSo a rest cannot express \"these keys and no others\" in either direction, and\n`onExcessProperty: \"error\"` is the only strict path.\n\n## `Schema.optional` is not exact-optional\n\nThese repos compile with `exactOptionalPropertyTypes: true`, and the two\noptionality combinators differ in exactly the way that setting cares about:\n\n```ts\nSchema.optional(Schema.String)      \u002F\u002F field?: string | undefined  — { field: undefined } is LEGAL\nSchema.optionalKey(Schema.String)   \u002F\u002F field?: string             — { field: undefined } is TS2375\n```\n\nThe mechanism is in the vendored source — `optional` is `optionalKey` widened\nwith `UndefinedOr`:\n\n```ts\n\u002F\u002F Schema.ts:2472 — the docstring at Schema.ts:2449 reads \"Equivalent to `optionalKey(UndefinedOr(S))`\"\nexport const optional: optionalLambda = Struct_.lambda\u003CoptionalLambda>((self) => {\n  const schema = UndefinedOr(self)\n  return make(SchemaAST.optional(self.ast), { schema })\n})\n```\n\n**The trap is that `Schema.optional` reads like the neutral default and\ncompiles clean.** Nothing fails; the schema simply admits a present-but-\n`undefined` key forever after. A partial-merge patch schema\n(`{ name, url?, path?, sha? }`) built with `Schema.optional` type-checked, and\n`{ name: \"a\", url: undefined }` still compiled — violating the \"omitted fields\nare absent\" invariant the patch depended on. Only review caught it.\n\nProbed, `packages\u002Fsemver` (control: `Schema.optionalElement`\n→ TS2339, harness live):\n\n```text\noptional    + explicit undefined -> compiles (no error)          \u003C-- the bug\noptionalKey + explicit undefined -> TS2375 ... with 'exactOptionalPropertyTypes: true'\n```\n\n`optionalKey` also lowers cleaner: the field is absent from `required` in the\nderived JSON Schema, with no `undefined`\u002F`null` sentinel in the type. Reach for\n`Schema.optional` **only** when the value genuinely must carry `undefined` as a\ndistinct inhabitant — not merely because the field is optional.\n\n## The reserved `make` collision: `parse` \u002F `parseResult` is the house resolution\n\nEvery class factory reserves a static `make`, so a validating\n`make(input: string)` is impossible — the signatures are incompatible and TS\nrejects the whole static side:\n\n```text\nTS2417: Class static side 'typeof Version' incorrectly extends base class static side ...\n  Types of property 'make' are incompatible.\n    Type '(_raw: string) => Version' is not assignable to\n      type '(input: ReadonlyMakeIn\u003C{ readonly major: Number; }>, options?: MakeOptions) => Version'\n```\n\nThere is no overload escape: `make` belongs to the base. The kit's answer,\nused by `SemVer`, `Range`, `Comparator`, `Jsonc`, `Markdown`, `MarkdownDocument`\nand `Lockfile`, is a **pair** — the sync `Result` primitive plus the `Effect`\nform defined in terms of it:\n\n```ts\nexport class SemVer extends Schema.Class\u003CSemVer>(\"SemVer\")({ \u002F* fields *\u002F }) {\n  \u002F\u002F sync, total, no Effect runtime needed — the primitive\n  static parseResult(input: string): Result.Result\u003CSemVer, InvalidVersionError> { \u002F* ... *\u002F }\n\n  \u002F\u002F the Effect form: a named span + the Result bridge, nothing more\n  static readonly parse = Effect.fn(\"SemVer.parse\")((input: string) =>\n    Effect.fromResult(SemVer.parseResult(input)));\n}\n```\n\n`make` stays what the factory made it — the validated field constructor —\nwhile `parse`\u002F`parseResult` own string input. (Why both forms: see\n`formatter-convention` in the design docs. The `Effect.fromResult` bridge, and\nwhy `yield* someResult` does not work, are owned by `effect-v4-idioms`.)\n\n## `transformEffect`'s callback contract\n\nBoth callbacks must return an **`Effect`** — not a `Result`, not a bare value —\nfailing with a `SchemaIssue`. The vendored signature\n(`SchemaTransformation.ts:390`):\n\n```ts\nexport function transformEffect\u003CT, E, RD = never, RE = never>(options: {\n  readonly decode: (e: E, options: SchemaAST.ParseOptions) => Effect.Effect\u003CT, SchemaIssue.Issue, RD>\n  readonly encode: (t: T, options: SchemaAST.ParseOptions) => Effect.Effect\u003CE, SchemaIssue.Issue, RE>\n}): Transformation\u003CT, E, RD, RE>\n```\n\nThe house failure shape is `InvalidValue` carrying a message annotation, with\nthe offending value as the second argument:\n\n```ts\nSchema.String.pipe(Schema.decodeTo(Schema.Date,\n  SchemaTransformation.transformEffect({\n    decode: (s) => {\n      const d = new Date(s);\n      return isNaN(d.getTime())\n        ? Effect.fail(new SchemaIssue.InvalidValue({ message: \"Invalid date\" }, s))\n        : Effect.succeed(d);\n    },\n    encode: (d) => Effect.succeed(d.toISOString()),\n  })))\n```\n\nSignature trap: `SchemaIssue.InvalidValue`'s constructor is\n`(annotations?, input?, options?)` (`SchemaIssue.ts:768`), not\n`(Option.some(s), { message })` — a plain annotations object is the first\nargument, with no `Option` wrapper. The input is retained on the issue only\nwhen parse options set `reportInput: true` (`SchemaIssue.ts:172-173`);\n`InvalidType`'s constructor is `(ast, input?, options?)`\n(`SchemaIssue.ts:687`). If your transformation is infallible, use\n`SchemaTransformation.transform` (plain values, no Effect) instead; reach for\n`transformEffect` only when it can fail.\n\n## A nested `Schema.Class` field: foreign and self-recursive behave identically\n\n`make`'s treatment of a class-typed field does not split on whether the\nfield's schema refers to the class being defined: a *foreign* field and a\n*self-recursive* field behave the same way in every case that matters.\n\n| Field shape | plain-object literal | invalid plain literal | prototype-forged bad instance | passes a good instance through by reference |\n| --- | --- | --- | --- | --- |\n| **foreign** class — `inner: Inner`, `suspend(() => Inner)`, `Array(suspend(() => Inner))` | accepted, **promoted** to a real instance | **rejected**, with a path | **accepted** unexamined | **yes** — identity preserved |\n| **self-recursive** — `suspend(() => Self)`, bare, `optionalKey`-wrapped or inside `Array` | accepted, **promoted** to a real instance | **rejected**, with a path (`at [\"kid\"][\"v\"]`) | **accepted** unexamined | **yes** — identity preserved |\n\nWhat follows from the one row you are always in:\n\n- **Hand either kind of field a literal.** It is deep-validated and promoted to\n  a real instance (`instanceof` is true). Hand-built trees and fixtures do not\n  need real instances at every level — constructing `Inner.make({...})` purely\n  to satisfy a self-recursive field is unnecessary, though harmless.\n- **Identity is preserved.** `Outer.make({ inner: x }).inner === x` is **true**\n  for a foreign field as much as a self-recursive one — do not assume a\n  foreign field is re-constructed and skip a `strictEqual` assertion on it.\n  `deepStrictEqual` \u002F `Equal.equals` remain the better assertion anyway,\n  because they keep passing across a schema's own internal refactors.\n- **A prototype-forged instance is still accepted unexamined**, in both rows —\n  the `instanceof` check short-circuits the field's validation. Anything that\n  forges instances to skip validation (`@effected\u002Fjsonc`'s `makeNodeUnsafe`)\n  therefore owns its own correctness.\n- **The TYPE level is a separate axis.** `make`'s input type for a class-typed\n  field is the class's **instance type**, so a member-less value class is\n  structurally satisfied by a literal and compiles, while a class carrying any\n  member the literal lacks (a getter, a method — most real classes) rejects\n  the literal at compile time (TS2741 \u002F TS2740) even though runtime would\n  validate and promote it. Do not read that error as \"the check narrowed\n  `make`\" — wrapping the field in `.pipe(Schema.check(...))` changes nothing\n  on this axis.\n- **Construction is linear**: a recursive tree built node-by-node measures\n  well under a millisecond at every depth from 10 to 60.\n\n> **Not exponential.** Node-by-node construction of a recursive `Schema.Class`\n> does not re-validate its whole subtree on every level — a left-spine build\n> stays flat, sub-millisecond, from depth 10 through depth 60. A control that\n> does genuinely exponential work (2^d) measures in the tens of milliseconds\n> at the same depths, so a harness built to see exponential cost here would\n> see it if it were real. Do **not** add a validation bypass for cost reasons.\n\n## Class-factory equality is deep and structural — but instances are not frozen\n\n`Equal.equals` on two class-factory instances recurses. It is not reference\nequality, and it is not shallow: it walks **nested `Schema.Class` fields**,\n`Schema.optionalKey` fields (a present key and an absent one compare **unequal**,\nwhich is the discrimination `exactOptionalPropertyTypes` semantics need), and\n`Schema.Array`-of-class fields element by element. **`Hash` agrees wherever\n`Equal` agrees**, so these instances are safe as `HashMap`\u002F`HashSet` keys with no\ncustom `[Hash.symbol]`.\n\nThe full matrix was probed 14\u002F14 including discriminating controls — a\none-field difference at each nesting depth compared unequal, so the probe\ncould fail and did not. **Do not pay for this probe again**, and do not\nhand-write a recursive comparator for a class tree: `Equal.equals` already\nis one. (It is also what keeps assertions stable across the identity churn\nthe table above documents.)\n\nTwo `Schema.Record` rows, probed with discriminating controls: a\nplain `Schema.Record(String, String)` field compares structurally and\n**order-insensitively** (same pairs in different insertion orders are equal; a\nvalue-change control is unequal), and the `optionalKey` present-vs-absent rule\nabove applies to records too — a PRESENT `{}` and an ABSENT key compare\n**unequal**. The design consequence: a field whose contract is \"absent ≡\nempty\" must be always-present with a constructor default\n(`Schema.Record(...).pipe(Schema.withConstructorDefault(Effect.succeed({})))`),\nbecause the `optionalKey` shape makes an explicit-`{}` value drift forever\nagainst an omitted one.\n\n**But nothing is frozen.** A `Schema.Class` instance is a plain object at\nruntime; `Schema.ts` calls `Object.freeze` nowhere. Validation happens at\nconstruction and never again, so a mutated instance keeps **stale derived and\nprovenance state** — a cached hash, a `_tag`-adjacent invariant, the wire-form\nbookkeeping the `Person` codec below relies on — while still satisfying its type.\nGuard anything that **replays a value onto the wire, or caches keyed on instance\nidentity**: treat instances as immutable by discipline, and rebuild with\n`make` rather than assigning a field, because the type system will not stop you.\n\n## A homogeneous-Type union is encode-lossy: keep the Type heterogeneous when the wire form must survive\n\n`Schema.Union([A, A.FromString])` — the reflex for \"accept either the object\nor its string shorthand\" — **cannot round-trip the input encoding** when both\nmembers decode to the *same* Type. On encode the union collapses to the\n**first** member that produces that Type, regardless of which branch decoded\nthe value. A value parsed from the string form re-encodes as the object form,\nsilently. This is the mechanism behind the round-4 `@effected\u002Fpackage-json`\n`Person` data-loss bug (string-form `author` rewritten to object form), and it\nis why `Person.FromValue` carries a `wireForms` WeakMap plus a faithfulness\ncheck — the union cannot remember which branch a value came from, so the code\nmust.\n\nProbed, `packages\u002Fpackage-json`, with a control proving the object form\nround-trips:\n\n```ts\nconst A = Schema.Struct({ name: Schema.String })            \u002F\u002F Type {name}, Encoded {name}\nconst AFromString = Schema.String.pipe(Schema.decodeTo(A,   \u002F\u002F Type {name}, Encoded string\n  SchemaTransformation.transform({ decode: (s) => ({ name: s }), encode: (a) => a.name })))\nconst U = Schema.Union([A, AFromString])\n\nconst v = Schema.decodeUnknownSync(U)(\"alice\")              \u002F\u002F via AFromString → {name:\"alice\"}\nSchema.encodeUnknownSync(U)(v)                              \u002F\u002F → {name:\"alice\"} (OBJECT), not \"alice\"\n\u002F\u002F round-trips to the string form? false\n```\n\nThe rule: **if two union members decode to the same Type, that union cannot\npreserve which encoding an input used.** When wire-form fidelity matters, keep\nthe Type heterogeneous (a distinct `_tag` or shape per encoding), or remember\nthe original wire form out of band and replay it on encode as `Person` does.\nA \"class IS the schema\" homogeneous union reads as symmetric and is not.\n\n## Out-of-band provenance needs `Schema.instanceOf(C)` as the `decodeTo` target, not `C`\n\nThe remedy above — remember the wire form in a `WeakMap` keyed on the decoded\ninstance — is defeated by the obvious spelling of it. **`Schema.decodeTo(C, …)`\nwhere `C` is a `Schema.Class` re-validates the transform's output and hands the\ncaller a DIFFERENT instance.** Every `WeakMap` the transform populated misses,\nand the encode side silently takes its rebuild-from-fields fallback: no error,\nno type complaint, just the fidelity the map existed to provide, gone.\n\n`Schema.instanceOf(C)` as the target passes the instance through by reference.\nThat is why `@effected\u002Fpackage-json`'s `Person.schema`, `Person.FromString` and\n`Person.FromValue` all target `Schema.instanceOf(Person)` — the class is what\nthe transform CONSTRUCTS, never what the codec decodes TO.\n\nProbed:\n\n```ts\nclass Item extends Schema.Class\u003CItem>(\"Item\")({ url: Schema.String }) {}\nlet produced: Item | undefined\nconst tx = SchemaTransformation.transform({\n  decode: (s: string) => (produced = Item.make({ url: s })),\n  encode: (a: Item) => a.url,\n})\n\nSchema.decodeUnknownSync(Schema.String.pipe(Schema.decodeTo(Item, tx)))(\"a\") === produced\n\u002F\u002F false — reconstructed\n\nSchema.decodeUnknownSync(Schema.String.pipe(Schema.decodeTo(Schema.instanceOf(Item), tx)))(\"b\") === produced\n\u002F\u002F true — same reference, and still true nested in Schema.Array and Schema.Struct\n```\n\n**The target you switch to validates less.** `Schema.instanceOf(C)` is an\n`instanceof` check and nothing more — it does not apply `C`'s field schemas or\nits checks, so whatever the transform returns passes straight through. Moving\nthe target from `C` to `Schema.instanceOf(C)` to keep identity therefore also\nremoves the field validation the class target was performing, and the\ntransform has to carry it instead:\n\n```ts\nconst invalid = Object.assign(Item.make({ url: \"ok\" }), { url: 1 })\nSchema.decodeUnknownSync(Schema.instanceOf(Item))(invalid)  \u002F\u002F accepted, url === 1\nSchema.decodeUnknownSync(Item)(invalid)                     \u002F\u002F rejected\n```\n\nConstruct with `C.make` inside the transform, and validate any input the\nconstructor does not — `@effected\u002Fpackage-json`'s `Person.schema` decodes the\nraw object through a separate `PersonFields` struct first, precisely so the\nissue tree stays identical to what a direct class decode produced.\n\nTwo more riders, both learned the hard way in that package:\n\n- **Key the map on the element, never on a container.** `Schema.Array` rebuilds\n  the array itself, so an array-keyed `WeakMap` is empty by the time `encode`\n  runs even when every element's identity survived. When the provenance is a\n  property of the collection (`@effected\u002Fpackage-json`'s `Funding` remembers\n  whether an entry was written bare rather than inside an array), hang it on the\n  one element that carried it and guard the replay on that element still being\n  alone.\n- **Guard every replay on the instance still matching.** `Schema.Class`\n  instances are not frozen, so an instance edited in place keeps provenance that\n  no longer describes it, and an unguarded replay writes the ORIGINAL wire back\n  — discarding the edit. The guard must cover the fields the wire form cannot\n  express, not only the ones it can: the shorthand-string branch of `Person`\n  matched on `name`\u002F`email`\u002F`url`, replayed, and dropped any key added to `rest`\n  afterwards.\n\n## The `message` getter: ternary chain, not an exhaustive switch\n\nEvery `TaggedError` with a multi-reason `message` hits this. A `switch` over\na `Schema.Literals`-typed `reason` in which **every case returns** is exhaustive,\nand tsgo is happy — but Biome's `lint\u002Fsuspicious\u002FuseGetterReturn` sees a getter\nwith no terminal return and fails the lint gate:\n\n> `× This getter should return a value.`\n\n```text\n\u002F\u002F REJECTED by `pnpm lint` (useGetterReturn), accepted by tsgo:\nget message(): string {\n switch (this.reason) {\n  case \"missing\":  return `missing ${this.key}`;\n  case \"invalid\":  return `invalid ${this.key}`;\n  case \"conflict\": return `conflict on ${this.key}`;\n }\n}\n\n\u002F\u002F The house pattern — one return, a ternary chain:\nget message(): string {\n return this.reason === \"missing\"\n  ? `missing ${this.key}`\n  : this.reason === \"invalid\"\n    ? `invalid ${this.key}`\n    : `conflict on ${this.key}`;\n}\n```\n\nVerified through `pnpm lint` (a bare `npx biome check \u003Cfile>` from inside a\npackage exits 0 without reading the repo config — it is not a check).\n\n## Foreign JSON contracts: `TaggedClass` owns `_tag`, `Schema.tag` serves everyone else\n\n`Schema.TaggedClass` hardwires its discriminator key to `_tag` (the vendored\n`TaggedStruct` is `Simplify\u003C{ readonly _tag: tag\u003CTag> } & Fields>`,\n`Schema.ts:6313`), so it\nserves only contracts **we** own. When shaping classes to a foreign JSON\ncontract whose discriminator has its own name — mdast's `type`, JSON Schema's\n`type`\u002F`$ref`, OpenAPI, LSP — use `Schema.Class` with `Schema.tag(\"literal\")`\non an explicitly-named field:\n\n```ts\nexport class Paragraph extends Schema.Class\u003CParagraph>(\"Paragraph\")({\n type: Schema.tag(\"paragraph\"), \u002F\u002F the FOREIGN key, not _tag\n children: PhrasingContent,\n}) {}\n```\n\n`Schema.tag` gives the same three properties `TaggedClass` would: a\nconstructor default (`X.make` omits it), literal narrowing for union\nbranching, and presence on the encoded side. `@effected\u002Fmarkdown`'s\n`MarkdownNode` classes are the worked precedent — the encoded trees are\nspec-valid mdast because the tag field is literally named `type`.\n\nWhile here, the factory-signature trap between the two\n(`Schema.ts:17766`\u002F`:17826`): `Schema.Class\u003CSelf>(\"Identifier\")(fields)` takes\nthe **identifier in the first call** and fields in the second, while\n`Schema.TaggedClass\u003CSelf>()(\"Tag\", fields)` takes an **optional identifier\nfirst** and the tag+fields in the second. Mixing them up produces confusing\ninference errors, not a clear TS message.\n\nFor any other field, the general form is `Schema.withConstructorDefault`, and\nits argument is an **Effect**, not a thunk and not an `Option`\n(`defaultValue: Effect.Effect\u003C...>`, `Schema.ts:5988`):\n`field.pipe(Schema.withConstructorDefault(Effect.succeed(value)))`. Passing a\nthunk like `() => Option.some(value)` typechecks against nothing helpful and\ndies at construction with the unhelpful defect `Fiber.runLoop: Not a valid\neffect`. The default runs per construction — a `succeed({})` object is NOT\nshared across instances.\n\n## A `Schema.check` narrowing is ERASED from the published type\n\nA check narrows what **decodes**, not what the value is **typed** as — so a\nchecked schema and its base publish as the *same* declared type.\n`CorepackIntegrityHash` (corepack-form-only) and the wide `IntegrityHash`\nbrand both emit as `Schema.brand\u003CSchema.String, \"IntegrityHash\">` in\n`@effected\u002Fnpm`'s built `.d.ts`; a consumer reading the types cannot tell\nthem apart. The consequence bites in two directions:\n\n- **A faithful private re-fork of a shared checked schema is invisible** to\n  `tsc` AND to every behavioral test — the mutant that re-forks the schema\n  keeps the entire rejection matrix green. When two modules must share a\n  checked narrowing of one brand, the only proven guard is a **runtime\n  identity assertion** on the consumer's field schema\n  (`X.fields.integrity.schema === CorepackIntegrityHash`; through\n  `Schema.Option`, `.fields.\u003Cname>.value === …`), with a control proving it\n  discriminates (`=== IntegrityHash` must be false). The failing assert\n  prints \"Compared values have no visual difference\" — which is the point.\n  Do not downgrade it to a behavioral test, which cannot fail, or a\n  source-text import walker, which passes if the import is left unused.\n- **A behavioral break can be type-invisible**: strictening a field's check\n  (package-json's `PackageManager` version fold) ships a byte-identical\n  `.d.ts` while previously-accepted inputs now fail at decode. Announce\n  such changes loudly in handoffs — nothing downstream fails to compile.\n\n## A schema value is a function at runtime\n\nEvery schema — `Schema.String`, a `Struct`, a `Literals`, a `Schema.Class`\nfactory result, a `.check(...)`-ed schema — is built by `internal\u002Fschema\u002Fmake.ts:46`\nas `function Schema() {}` with its prototype swapped to the schema proto, so\n`typeof` reports `\"function\"`, never `\"object\"`. Probed against a\ncontrol (`Schema.isSchema(42)` → `false`):\n\n```text\nSchema.String:                        typeof=function  isSchema=true  objectGuardAccepts=false\nSchema.Struct({...}):                 typeof=function  isSchema=true  objectGuardAccepts=false\nSchema.Literals([...]):               typeof=function  isSchema=true  objectGuardAccepts=false\nSchema.Class factory result (Person): typeof=function  isSchema=true  objectGuardAccepts=false\nSchema.String.check(...):             typeof=function  isSchema=true  objectGuardAccepts=false\n```\n\nThe trap this replaces: a `typeof value === \"object\"` guard in a config loader\nthat classified every user-supplied schema as \"not a schema\" and reported a\nconfig with five schemas as declaring none — a false *negative* the loader's\nown tests could not see because their fixtures were objects too. Use\n`Schema.isSchema` (`Schema.ts:2349`, a `TypeId` brand check), and when a guard\nmust also accept plain objects, test `isSchema` **first**.\n\n## A `SchemaIssue` as `{ code, path, message }` diagnostics\n\n`SchemaIssue.makeFormatterStandardSchemaV1()` returns `{ message, path }` per\nfailure and no code. For a diagnostic-code surface, walk the issue tree\n(`Issue` is `Leaf | Filter | Encoding | Pointer | Composite | AnyOf`,\n`SchemaIssue.ts:147`), accumulate `Pointer` paths, and take the node's `_tag` as\nthe code, with `makeFormatterDefault()` for the message:\n\n```ts\nimport { SchemaIssue } from \"effect\"\n\ninterface Diagnostic {\n  readonly code: string\n  readonly path: ReadonlyArray\u003CPropertyKey>\n  readonly message: string\n}\n\nconst format = SchemaIssue.makeFormatterDefault()\nconst diagnostics = (issue: SchemaIssue.Issue, path: ReadonlyArray\u003CPropertyKey> = []): Array\u003CDiagnostic> => {\n  switch (issue._tag) {\n    case \"Encoding\":\n      return diagnostics(issue.issue, path)\n    case \"Pointer\":\n      return diagnostics(issue.issue, [...path, ...issue.path])\n    case \"Composite\":\n      return issue.issues.flatMap((child) => diagnostics(child, path))\n    case \"AnyOf\":\n      if (issue.issues.length > 0) return issue.issues.flatMap((child) => diagnostics(child, path))\n      return [{ code: issue._tag, path, message: format(issue) }]\n    default:\n      return [{ code: issue._tag, path, message: format(issue) }]\n  }\n}\n```\n\nProbed with `{ errors: \"all\" }` on `Struct({ name: NonEmptyString, age: Number, tags: Array(String) })`\nagainst `{ name: \"\", age: \"x\", tags: [1] }`: `Filter` at `[\"name\"]`\n(\"Expected a value with a length of at least 1\"), `InvalidType` at `[\"age\"]` and\nat `[\"tags\", 0]`, and `MissingKey` at `[\"name\"]` for a missing key; path and\nmessage match the Standard Schema formatter's. A failed check reports as\n`Filter`, so a code per check needs your own mapping.\n\n## Verify against the installed source, not the references\n\nThe `references\u002F` track **upstream `Effect-TS\u002Feffect` main**, which runs AHEAD\nof this repo's pinned `effect`. Treat them as authoritative on *shape and\nintent*, not on exact export names. Before relying on any specific API, probe\nit from a package on the v4 catalog:\n\n```bash\nnode --input-type=module -e \"import * as S from 'effect\u002FSchema'; console.log(typeof S.TheApiYouWant)\"\n```\n\nIf it prints `undefined`, the name moved or has not landed yet — check\n`node_modules\u002Feffect\u002Fdist\u002FSchema.d.ts`, or climb the `effect-v4-source-lookup`\nladder. The \"Do this, not this\" rules above already fold in the gotchas the\nupstream prose does not flag.\n\nThe skew is real and it cuts both ways: the vendored `09-classes-and-opaque-types`\nreference still documents `Schema.asClass`, which is **`undefined`** —\nyou now subclass the schema value directly (`class MyString extends Schema.String {}`).\n\n## Reference map\n\nLoad the one section you need. Each file carries a provenance banner (upstream\nsource + the version-skew warning).\n\n| Reference | Load when |\n| --- | --- |\n| [01-overview](.\u002Freferences\u002F01-overview.md) | Orienting on the design philosophy — codecs, the Type\u002FEncoded split, the `~`-prefixed internal type members. |\n| [02-elementary-schemas](.\u002Freferences\u002F02-elementary-schemas.md) | Primitives, literals, strings & string formats, numbers\u002Fintegers\u002Fbigints, dates, template literals. |\n| [03-composite-schemas](.\u002Freferences\u002F03-composite-schemas.md) | Structs, tuples, arrays, records, unions, recursive schemas. The biggest section — the day-to-day modeling vocabulary. |\n| [04-custom-types](.\u002Freferences\u002F04-custom-types.md) | Declaring a schema for a type Schema doesn't know — `Schema.declare` (non-parametric) and `declareConstructor` (parametric). |\n| [05-validation](.\u002Freferences\u002F05-validation.md) | Filters as first-class, checks\u002Frefinements\u002Fbranding, structural & effectful filters, multiple-issue reporting, aborting, filter groups & factories. |\n| [06-constructors](.\u002Freferences\u002F06-constructors.md) | `make` in composed\u002Fbranded\u002Frefined schemas, default values (incl. effectful defaults). |\n| [07-transformations](.\u002Freferences\u002F07-transformations.md) | `decodeTo`\u002F`encodeTo`, the transformation type, composing, passthrough helpers, optional-key management, omit-on-encode. |\n| [08-flipping-schemas](.\u002Freferences\u002F08-flipping-schemas.md) | `Schema.flip` — swapping Type and Encoded, and what it does to constructors. |\n| [09-classes-and-opaque-types](.\u002Freferences\u002F09-classes-and-opaque-types.md) | Opaque structs, schema-as-a-class, the `Schema.Class` family (methods, statics, extension). |\n| [10-serialization](.\u002Freferences\u002F10-serialization.md) | JSON, string-encoding, FormData, URLSearchParams, canonical codecs, the XML encoder. |\n| [11-generation-and-tooling](.\u002Freferences\u002F11-generation-and-tooling.md) | Deriving JSON Schema (`onExcessProperty`, open by default), the native `Arbitrary` generator (no fast-check bridge; size clamp, `-0`, exhaustion and regexp traps), Equivalence, Optic; type-safe JSON patches via Differ. |\n| [12-schema-representation](.\u002Freferences\u002F12-schema-representation.md) | The introspectable representation data model, its limitations, JSON round-tripping, rebuilding runtime schemas, code generation. |\n| [13-error-handling-and-formatting](.\u002Freferences\u002F13-error-handling-and-formatting.md) | `SchemaError`\u002F`SchemaIssue`, formatters, Standard-Schema-v1 issue output. |\n| [14-middlewares](.\u002Freferences\u002F14-middlewares.md) | Decode\u002Fencode middlewares and fallbacks. |\n| [15-advanced-topics](.\u002Freferences\u002F15-advanced-topics.md) | The internal model, type hierarchy, typed annotations, generics & separate requirement type params. |\n| [16-integrations](.\u002Freferences\u002F16-integrations.md) | Framework integrations (TanStack Form, Elysia). |\n\n## Related skills\n\n- **`effect-v4-idioms`** — core Effect patterns, and the **call-not-value** list\n  (`Schema.Defect()`, `Schema.ErrorInstance()`, `TestClock.layer()`) — names that\n  exist, type-check uncalled, and fail somewhere else.\n- **`effect-v4-source-lookup`** — when a Schema name doesn't resolve:\n  the evidence ladder that settles existence, signature and semantics.\n- **`effect-api-extractor-bases`** — the anonymous-base \u002F `ae-forgotten-export`\n  discipline for `Schema.Class` and `Context.Service`.\n- **`effect-v4-services-layers`** — the sibling for `Context.Service` and Layers.\n- **`effect-v4-planning`** — design a schema\u002Fservice before writing it.\n",{"name":5,"description":7},"main","11d6b3ae59538b0e16ad67c315ecb0c25fcb0125","plugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema",2,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected","https:\u002F\u002Fgithub.com\u002Fspencerbeggs","2026-11-14 07:03:25",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add spencerbeggs\u002Feffected --skill effect-v4-schema",{"tool":37,"command":38},"bunx","bunx skills add spencerbeggs\u002Feffected --skill effect-v4-schema",{"tool":40,"command":41},"pnpm","pnpm dlx skills add spencerbeggs\u002Feffected --skill effect-v4-schema","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002FSKILL.md",true,[45,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"references\u002F01-overview.md","REFERENCE","参考文档",3576,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F01-overview.md",{"path":52,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":53,"sourceHtmlUrl":54},"references\u002F02-elementary-schemas.md",10117,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F02-elementary-schemas.md",{"path":56,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002F03-composite-schemas.md",54167,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F03-composite-schemas.md",{"path":60,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":61,"sourceHtmlUrl":62},"references\u002F04-custom-types.md",10278,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F04-custom-types.md",{"path":64,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":65,"sourceHtmlUrl":66},"references\u002F05-validation.md",16023,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F05-validation.md",{"path":68,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":69,"sourceHtmlUrl":70},"references\u002F06-constructors.md",8045,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F06-constructors.md",{"path":72,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002F07-transformations.md",14622,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F07-transformations.md",{"path":76,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002F08-flipping-schemas.md",2888,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F08-flipping-schemas.md",{"path":80,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":81,"sourceHtmlUrl":82},"references\u002F09-classes-and-opaque-types.md",26814,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F09-classes-and-opaque-types.md",{"path":84,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":85,"sourceHtmlUrl":86},"references\u002F10-serialization.md",20729,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F10-serialization.md",{"path":88,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":89,"sourceHtmlUrl":90},"references\u002F11-generation-and-tooling.md",35197,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F11-generation-and-tooling.md",{"path":92,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":93,"sourceHtmlUrl":94},"references\u002F12-schema-representation.md",15951,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F12-schema-representation.md",{"path":96,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":97,"sourceHtmlUrl":98},"references\u002F13-error-handling-and-formatting.md",13913,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F13-error-handling-and-formatting.md",{"path":100,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":101,"sourceHtmlUrl":102},"references\u002F14-middlewares.md",3173,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F14-middlewares.md",{"path":104,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":105,"sourceHtmlUrl":106},"references\u002F15-advanced-topics.md",10964,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F15-advanced-topics.md",{"path":108,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":109,"sourceHtmlUrl":110},"references\u002F16-integrations.md",10673,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002F16-integrations.md",{"path":112,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":113,"sourceHtmlUrl":114},"references\u002Fhouse-style.md",23361,"https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fbuilds\u002Fclaude\u002Fskills\u002Feffect-v4-schema\u002Freferences\u002Fhouse-style.md",[116,123,130,137,144,151],{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":122,"publishedAt":19},"01M780NVTD800KMFV869YNZED6","testing-actions","Use when writing or reviewing tests for @effected\u002Fgithub-actions, @effected\u002Fgithub, @effected\u002Fsbom or @effected\u002Fcommands — stubbing the GitHub API, writing a service's layerTest or makeTest double, testing the pre\u002Fmain\u002Fpost lifecycle through Action.run, or debugging why a test hits the real network or hangs.","https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fskills\u002Ftesting-actions\u002FSKILL.md",[],[],{"skillNo":124,"name":125,"nameZh":6,"description":126,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":127,"categories":128,"keywords":129,"publishedAt":19},"01M780NPDSGFC0FCP7696NW11J","supply-chain-attestation","Use when generating a CycloneDX SBOM, checking NTIA minimum elements, building an in-toto statement or a SLSA provenance predicate, signing into a Sigstore DSSE bundle, or uploading an attestation to GitHub.","https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fskills\u002Fsupply-chain-attestation\u002FSKILL.md",[],[],{"skillNo":131,"name":132,"nameZh":6,"description":133,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":134,"categories":135,"keywords":136,"publishedAt":19},"01M780NGP4QNZDH8T8Q8WZ18SA","structuring-an-action","Use when laying out a new GitHub Action repository on the @effected suite, deciding where a piece of code belongs (an entry point, a step, a shared service, a shim), or reviewing an existing action's file structure against the canonical shape.","https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fskills\u002Fstructuring-an-action\u002FSKILL.md",[],[],{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":19},"01M780NCD52H1Y03FS83WJ8BT5","running-commands-and-tools","Use when running a subprocess in Effect v4, spawning a command, capturing stdout\u002Fstderr\u002Fexit code, checking whether a CLI tool is installed or which copy to run, running a package-manager script through the project's launcher, detaching a background process, or redacting a secret from argv or captured output.","https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fskills\u002Frunning-commands-and-tools\u002FSKILL.md",[],[],{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":19},"01M780N823DWNRMSY5X2NT5MSR","release-and-publish","Use when publishing a package to npm, reading the npm registry from Effect v4, checking whether a version is already published, cutting a release tag or GitHub release from an action, applying a release-age gate, or deriving tracking tags for GitHub Actions distribution.","https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fskills\u002Frelease-and-publish\u002FSKILL.md",[],[],{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":157,"publishedAt":19},"01M780MXRF6H20KCESTSSFB3HQ","hardening-a-parser-port","Use when porting or writing a recursive-descent parser, lexer, or tree-walker over untrusted text in the @effected monorepo — the class of hardening the cloud reviewer scans for on every migration. Covers stack-overflow depth guards (on EVERY recursion surface, which a facade has N of — not two), numeric bound guards that must reject NaN and non-integers, code-point range checks scoped to formats with wide escapes, prototype-pollution, control-character rejection, and the invariant that malformed input must fail through the typed error channel, never as an unhandled defect.","https:\u002F\u002Fgithub.com\u002Fspencerbeggs\u002Feffected\u002Fblob\u002Fmain\u002Fplugin\u002Fskills\u002Fhardening-a-parser-port\u002FSKILL.md",[],[]]