Answers from the documentation; checking which model is on duty
Hi - I answer from the OpenSmartRoute documentation: routing, the API, plans and quotas, self-hosting. Ask away, or open a support ticket if you need a person.
Grounded in the docs - follow a source before acting on it.
ts-best-practices - Skill - OpenSmartRoute
Skillv1.0.0
ts-best-practices
TypeScript type safety guidelines for writing maximally type-safe code. Apply these patterns when writing or reviewing any TypeScript: discriminated unions, type narrowing, type guards…
Imported from poteto/noodle (.agents/skills/ts-best-practices/SKILL.md). Install upstream with npx skills add poteto/noodle --skill ts-best-practices. Copyright stays with the author.
Type Safety
This project's TypeScript policy. Apply when writing or reviewing TypeScript.
Rule
Summary
No as casts
Every as is a potential runtime crash. Validate at boundaries, then cast only if earned. Prefer Zod/Valibot over manual validation.
unknown over any
any disables type checking for everything it touches. External data is always unknown.
Discriminated unions
Model variants with a shared literal discriminant. No optional-field bags.
Narrowing hierarchy
Prefer: discriminated union switch > in operator > typeof/instanceof > type guard > as
Type guards
Must actually verify the claim. Name them isX or hasX. Prefer discriminant narrowing when possible.
Exhaustiveness checks
Always add default: never arm to switches over discriminated unions. Use an absurd() helper to reduce boilerplate.
satisfies over as
When verifying a value matches a type without widening, use satisfies to preserve literal types.
Impossible states
If a bug requires asking "can this combination happen?" the type is too loose. Tighten it.
Copy one of these into your project. Installing also returns the manifest and these snippets.
Installed into a catalogue, chosen by a router
Install ts-best-practices and it becomes one more candidate the router can pick - when it fits.
A listing is a routing target with a manifest: what it does, which domains it covers, what it costs and who publishes it. Once installed it sits beside your own models and tools, is scored like any other candidate for each request, and shows up in the trace when it wins. Ratings come from workspaces that installed it, one per account.
When a provider is down or over quota the request moves on; the trace says it did.
# after Install: the listing is in your workspace's routing pool - a plan picks it for its slotcurl-s-X POST https://api.opensmartroute.ai/api/v1/route -H 'Authorization: Bearer $OSR_API_KEY' -H 'Content-Type: application/json' -d '{"text": "...", "plan": true}'
Manifest
An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.
poteto-noodle-ts-best-practices.ocm.jsonjson
{
"ocm": "1",
"id": "poteto-noodle-ts-best-practices",
"kind": "skill",
"name": "ts-best-practices",
"description": "TypeScript type safety guidelines for writing maximally type-safe code. Apply these patterns when writing or reviewing any TypeScript: discriminated unions, type narrowing, type guards, exhaustiveness checks, avoiding `as` casts, preferring `unknown` over `any`, and making impossible states unrepresentable. Use this skill whenever writing TypeScript code, reviewing TypeScript for type safety issues, or when the user mentions type safety, type narrowing, discriminated unions, or asks to make types stricter/more explicit.",
"publisher": "poteto",
"version": "1.0.0",
"capabilities": {
"domains": [
"coding"
],
"tags": [
"skill-md",
"skills-sh"
],
"languages": [
"en"
]
},
"quality_prior": 0.6,
"examples": [
"TypeScript type safety guidelines for writing maximally type-safe code. Apply these patterns when writing or reviewing any TypeScript: discriminated unions, type narrowing, type guards, exhaustiveness checks, avoiding `as` casts, preferring `unknown` over `any`, and making impossible states unrepresentable. Use this skill whenever writing TypeScript code, reviewing TypeScript for type safety issues, or when the user mentions type safety, type narrowing, discriminated unions, or asks to make types stricter/more explicit."
],
"primary": false,
"metadata": {
"source": {
"provider": "skills.sh",
"repository": "https://github.com/poteto/noodle",
"path": ".agents/skills/ts-best-practices/SKILL.md",
"ref": "HEAD",
"url": "https://github.com/poteto/noodle/blob/HEAD/.agents/skills/ts-best-practices/SKILL.md",
"key": "poteto/noodle/.agents/skills/ts-best-practices/SKILL.md"
}
},
"instructions": "# Type Safety\n\nThis project's TypeScript policy. Apply when writing or reviewing TypeScript.\n\n| Rule | Summary |\n|------|---------|\n| No `as` casts | Every `as` is a potential runtime crash. Validate at boundaries, then cast only if earned. Prefer Zod/Valibot over manual validation. |\n| `unknown` over `any` | `any` disables type checking for everything it touches. External data is always `unknown`. |\n| Discriminated unions | Model variants with a shared literal discriminant. No optional-field bags. |\n| Narrowing hierarchy | Prefer: discriminated union switch > `in` operator > typeof/instanceof > type guard > `as` |\n| Type guards | Must actually verify the claim. Name them `isX` or `hasX`. Prefer discriminant narrowing when possible. |\n| Exhaustiveness checks | Always add `default: never` arm to switches over discriminated unions. Use an `absurd()` helper to reduce boilerplate. |\n| `satisfies` over `as` | When verifying a value matches a type without widening, use `satisfies` to preserve literal types. |\n| Impossible states | If a bug requires asking \"can this combination happen?\" the type is too loose. Tighten it. |\n\nRead [references/patterns.md](references/patterns.md) for code examples of each rule.",
"cost": {
"context_tokens": 305
}
}
Fetch it by URL: GET /api/v1/registry/poteto-noodle-ts-best-practices/manifest?version=1.0.0
Reviews
Star ratings from people who tried it. One review per account; edit yours any time.
No reviews yet. Install it, try it, and be the first to rate it.