superstruct 2.x
Use Superstruct ^2.0.0 for runtime validation, coercion, defaults, refinements, and object-shape utilities. Prefer the current named-export API; do not copy older struct.object/User.assert examples.
- For
superstruct@2.0.2- Verified
- 2026-09-08, 4 examples executed
- Package
@modootoday/pmcp-superstruct@2.0.0
What it covers
- Import and version boundary
- Core operations
- Struct factories
- Refinements
- Coercion and defaults
- Struct utilities
- v2 migration traps
- What this skill does not cover
One example from this skill
This is the skill's own text, not a summary of it. It runs: that is what verifying means here.
import { strict as nodeAssert } from 'node:assert'
import { StructError, assert, create, is, mask, number, object, string, validate } from 'superstruct'
const User = object({ id: number(), name: string() })
const input = { id: 1, name: 'Ada' }
nodeAssert.equal(is(input, User), true)
nodeAssert.deepEqual(create(input, User), input)
nodeAssert.deepEqual(mask(input, User), input)
const [error, value] = validate(input, User, {})
nodeAssert.equal(error, undefined)
nodeAssert.deepEqual(value, input)
assert(input, User, 'The user is invalid!')
const [badError] = validate({ id: 'wrong', name: 'Ada' }, User, {})
nodeAssert.ok(badError instanceof StructError)
What it did in the sandbox
Verifying this skill meant installing the package and running code against it with no route out. Nothing was observed. The full ledger lists every package examined, including the ones that never became a skill.
Nothing observed is not a finding of safety. It means one run, under one policy, produced nothing to report.
Getting it
With a subscription:
npx -y @modootoday/pmcp login
npx -y @modootoday/pmcp install @modootoday/pmcp-superstruct
It installs as a dev dependency of your project, and the MCP server finds it there like any other skill.