drafael/coding-harness / skills/typesafe-ai
typesafe-ai
VerifiedBuild AI-powered software with TypeSafe: small units of AI intelligence you can use like programming primitives. Its System One models, including Jev, turn natural language and application state into typed judgments and probabilities that code can combine. Use when a feature needs programmable common sense, when brainstorming what AI could make possible in an app, or when an LLM prompt-and-parse step could become a structured decision. Applications include routing, ranking, extraction, verification, and interactive experiences; these are starting points, not the limits. Read live docs and cookbooks to find useful patterns and discover new combinations.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 1.0 KB |
| README.md | markdown | 2.5 KB |
| SKILL.md | skill md | 10.9 KB |
| scripts/evaluate.mjsexecutable | script | 3.4 KB |
| scripts/evaluate.test.mjs | script | 6.1 KB |
scripts/evaluate.mjs
View on GitHub#!/usr/bin/env node
import { readFile } from "node:fs/promises";
const API_ENDPOINT = "https://api.typesafe.ai/v1/systemone";
const API_TIMEOUT_MS = 10_000;
const DEFAULT_MODEL = "jev-latest";
function printUsage(stream = process.stdout) {
stream.write(`Usage: node scripts/evaluate.mjs [request.json | -]
Reads a TypeSafe System One request from a file or stdin.
Requires TYPESAFE_API_KEY in the environment.
`);
}
function fail(message) {
throw new Error(message);
}
async function readRequestSource(argument) {
if (argument && argument !== "-") {
try {
return await readFile(argument, "utf8");
} catch (error) {
fail(`Cannot read request file "${argument}": ${error.message}`);
}
}
if (process.stdin.isTTY) {
fail("Provide a request file or pipe request JSON through stdin.");
}
process.stdin.setEncoding("utf8");
let source = "";
for await (const chunk of process.stdin) {
source += chunk;
}
return source;
}
function parseRequest(source) {
let request;
try {
request = JSON.parse(source);
} catch (error) {
fail(`Request is not valid JSON: ${error.message}`);
}
if (request === null || typeof request !== "object" || Array.isArray(request)) {
fail("Request must be a JSON object.");
}
if (!Object.hasOwn(request, "state")) {
fail('Request must contain a "state" field.');
}
const { questions } = request;
if (
questions === null ||
typeof questions !== "object" ||
Array.isArray(questions) ||
Object.keys(questions).length === 0
) {
fail('Request must contain a non-empty "questions" object.');
}
return {
...request,
model: request.model ?? DEFAULT_MODEL,
};
}
async function evaluate(request, apiKey) {
let response;
try {
response = await fetch(API_ENDPOINT, {
method: "POST",
headers: {
Accept: "application/json",
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify(request),
signal: AbortSignal.timeout(API_TIMEOUT_MS),
});
} catch (error) {
if (error.name === "TimeoutError") {
fail(`TypeSafe API request timed out after ${API_TIMEOUT_MS} ms.`);
}
fail(`TypeSafe API request failed: ${error.message}`);
}
if (!response.ok) {
await response.body?.cancel();
fail(`TypeSafe API returned HTTP ${response.status}. Response body omitted to protect request data.`);
}
const body = await response.text();
try {
return JSON.parse(body);
} catch (error) {
fail(`TypeSafe API returned invalid JSON: ${error.message}`);
}
}
async function main() {
const nodeMajor = Number.parseInt(process.versions.node.split(".")[0], 10);
if (nodeMajor < 20) {
fail(`Node.js 20 or newer is required; found ${process.versions.node}.`);
}
const args = process.argv.slice(2);
if (args.includes("--help") || args.includes("-h")) {
printUsage();
return;
}
if (args.length > 1) {
printUsage(process.stderr);
fail("Expected at most one request file.");
}
const apiKey = process.env.TYPESAFE_API_KEY?.trim();
if (!apiKey) {
fail("TYPESAFE_API_KEY is not set.");
}
const source = await readRequestSource(args[0]);
const request = parseRequest(source);
const response = await evaluate(request, apiKey);
process.stdout.write(`${JSON.stringify(response, null, 2)}\n`);
}
try {
await main();
} catch (error) {
process.stderr.write(`Error: ${error.message}\n`);
process.exitCode = 1;
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization. | Stars: 467k | Updated | Claude CodeCodex | Verified | Install |
| academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file). | Stars: 196k | Updated | Claude CodeCodex | Unverified | Install |
| doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |