agentleFS
steveusteveu/skills/typesafe-ai/SKILL.md

typesafe-ai

Skill1 starsChanged 6 months agoMITView on GitHub

TypeSafe integration craft for System One models (sometimes called Decision Models) such as Jev, which answer typed questions about text, images, and application state with calibrated probabilities. Use when building, reviewing, or debugging code that calls TypeSafe; when writing its questions or state; when replacing an LLM prompt-and-parse step, keyword matching, or a brittle heuristic with a typed question; or when brainstorming where programmable common sense fits in an app.

  • Reads credentials

35 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use computer-use, diagnosing-bugs and 6 more.

Other files people use alongside this one.

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

    computer-use

    Use Orca's computer-use CLI to inspect and operate local desktop app windows through accessibility trees, screenshots, and safe UI actions. Use for desktop app interaction: list apps/windows, get app state, read visible UI, click controls, type, press keys, scroll, drag, set values, or perform accessibility actions. Also use for browser windows, webviews, Orca app UI, or other desktop UI. Triggers include "computer use", "orca computer", "read Spotify", "read Slack", "control/click/read in a desktop app", and "get app state".

    Also in 3 projects that use this

  • GoogleSkill

    diagnosing-bugs

    Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.

    Also in 3 projects that use this

  • Hugging FaceSkill

    implement

    Make tests pass. Invoke after /write-tests produces failing tests.

    Also in 4 projects that use this

  • GoogleSkill

    codebase-design

    Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

    Also in 3 projects that use this

  • MicrosoftSkill

    grill-with-docs

    Grilling session that challenges your plan against the existing domain model, sharpens terminology, and updates documentation (CONTEXT.md, ADRs) inline as decisions crystallise. Use when user wants to stress-test a plan against their project's language and documented decisions.

    Also in 3 projects that use this

  • VercelSkill

    find-skills

    Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

    Also in 3 projects that use this

  • +1 more from google

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. 1 is common, 12 are distinctive, and 1 is very specific to this project.

  • 1

    Common

    Most of the 33 edited versions we read keep these.

  • 12

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Start at the documentation index.

    line 44
  2. Distinctive:

    If you can't reach the live docs, use the installed SDK's types or local docs, and tell the user you did.

    line 61
  3. Distinctive:

    If the user's request is open-ended, offer the few directions from Cookbooks that best serve their goal, and recommend one.

    line 83
  4. Distinctive:

    Anchor intent to the goal: When the judgment is about what someone wants, it helps to name their goal: "Which of these files does the user …

    line 124
  5. Distinctive:

    Name the case that causes confusion: If answers keep mixing up two outcomes, say in the criteria what separates them, using the specific …

    line 141
  6. Distinctive:

    Start with a few representative cases, plus hard ones and some whose answer is "no" or "nothing fits".

    line 219
  7. Distinctive:

    Read individual answers, not only aggregates.

    line 223
  8. Distinctive:

    Keep the exact request payload for each case so any result can be rerun.

    line 224
  9. Distinctive:

    Check each change against cases you didn't use while tuning.

    line 225
  10. Distinctive:

    Make sure any agent that sends test requests has network access to the API endpoint.

    line 227
  11. Distinctive:

    Check these, in this order:

    line 231
  12. Distinctive:

    If a clear question with complete state still gets an answer you're confident is wrong, check the jaggedness page for the model you're …

    line 239
  13. Distinctive:

    If the behavior isn't listed, the TypeSafe team welcomes examples through the channel linked on that page.

    line 241
  14. Common:

    Verify and escalate: Check claims or fields against their evidence, and send the cases that fail to a person or a reasoning model.

    line 281

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

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

Build with TypeSafe

TypeSafe's Jev, the first public System One model, answers typed questions about state your application supplies. State is the text, images, and application data your code sends with a request. Jev can answer a Choice among options, a Noul (the probability that a statement is true), a Score on levels you describe, or a Box that locates something in an image. Each answer comes back as typed data with calibrated probabilities, for your code to use.

The rest of this skill is guidance: patterns that tend to produce reliable integrations. None of it is absolute. Models change, applications differ, and edge cases exist. When a situation calls for something else, test the alternative and use your judgment.

Judgments from Jev, decisions in code

Integrations tend to work best when Jev makes the judgments and code decides what to do with them. Think of each decision as a truth table. Jev supplies the inputs, such as "Does the customer sound frustrated?" or "Which product is the message about?". Code holds the logic that maps those inputs to an action.

A question that asks Jev to make the decision, such as "Should this ticket be escalated?" or "What should the agent do next?", usually means the question is at the wrong layer. Instead, break the decision into the judgments it depends on, and write the decision itself in code, where it's visible and testable. Writing out the table often shows gaps in the business logic too. A combination of judgments with no defined outcome is a design question about the system, and it is best settled in code.

Live docs

The live docs are the source of truth for request syntax, SDKs, question types, limits, and current model behavior. Read the relevant pages as part of the task.

If you can't reach the live docs, use the installed SDK's types or local docs, and tell the user you did. Leave out details that depend on the version rather than guessing them.

Workflow

  1. Start from the decision logic. Begin with what the application will show, select, change, or hand off. Sketch the truth table or rules that decide it, and list the inputs they need. Inputs that need an understanding of language or images make good questions. Arithmetic, dates, exact lookups, and policy usually belong in code. Aim for every question to feed the table, and give every combination of answers an outcome, including the case where a Noul lands between your thresholds. If code alone can already make the decision reliably, tell the user.
  2. Keep all question wording in one place. Questions, options, criteria, and thresholds are the parts of an integration people audit and edit most. Keeping them together in one module makes that easier. Design the state and Write the questions describe what tends to work.
  3. Probe the live API: send test requests as described in Test with the live API. Use representative cases, hard cases, and negative cases. Keep going until the application behaves as intended.
  4. Integrate. A few habits help here. Expose or log the exact request payload. When a call to the API fails, surface it as an error, not as an answer; for example, don't treat a failed call as a "no". Keep API keys on the server.

If the user's request is open-ended, offer the few directions from Cookbooks that best serve their goal, and recommend one. If the request is concrete, build it.

Design the state

A useful check for any question is the human test: could a smart person, shown only this state and this question, answer quickly by intuition? When a question fails the test, the fix is usually in the state, not in the wording.

  • Give what a person would look at. That means who sent each message, the full thread rather than a truncated last line, names rather than raw IDs or @-mention markup, and the item the question is about rather than the whole catalogue. State facts your code already knows, such as "all messages in replies were sent after the refund was issued", rather than leaving the model to work them out again.
  • Supply facts the model may lack, such as what an internal product name or codename refers to.
  • Ensure every field in the state is relevant. Irrelevant detail clutters the context and reduces accuracy. A field added for one question can sway the answer to another, and the model can read an empty list as a signal.
  • Be mindful when truncating. Truncate long strings only when you need to, and check that the cut doesn't remove context the questions need.
  • Structure with named fields. JSON objects with descriptive keys work better than a string of serialized JSON. They also let a question refer to each part by its path. Stable names such as candidates.refund_policy are easier to refer to than array positions.
  • Consider leaving out what no person could judge, such as an unreadable crop or a distinction experts dispute. The model's answer there tends to be noise, and code will treat that noise as signal.

Write the questions

Break complex judgments or decisions into their parts, and combine the answers in code with weighted sums, boolean logic, thresholds, or other heuristics to reach the final decision. For example, rather than asking "Is this fraud?" or "Is this spam?", ask the set of atomic questions about what might make something fraud or spam. Each question tends to work best when it asks for one judgment that a person could make at a glance.

  • Ask the concrete, observable thing. Aim for something a person could point to: "Is a SQL query built by string concatenation here?" rather than "Are there SQL injection risks?".
  • One judgment per question; beware the "or". Two conditions joined by "or" or "and" usually work better as two questions. Likewise, a list of rules usually works better as one question per rule.
  • Anchor intent to the goal. When the judgment is about what someone wants, it helps to name their goal: "Which of these files does the user want copied?" rather than "Which of these names the main input?".
  • Name the subject directly. "Where is the coffee mug in photo?" reads better than "Where is target in photo?" with the target defined somewhere else. Context that only one question needs, including an image, usually fits best in that question's instructions (the question text) or its criteria (the descriptions of its options, its levels, or what yes and no mean). Context that many questions share can go in the state once, and each question can refer to it by its exact path in backticks. When you ask the same question about many items, it usually works better to put each item into its own question than to give an ID the model has to look up in a shared list.
  • Each question is answered on its own. Questions in a request can't see each other or each other's answers. Any context a question relies on belongs in the state or in that question.
  • Write plainly. A question isn't an LLM prompt. Preambles, "consider X, Y, and Z" lists, and output-format instructions add noise. Descriptions of the options belong in the criteria, not in the question. Phrase the question so that a true answer means yes. Watch for double negatives, and for presuppositions such as "the next step".
  • Name the case that causes confusion. If answers keep mixing up two outcomes, say in the criteria what separates them, using the specific case. For example, for "Is this a refund request?", note that a question about the refund policy is not a request. A vague exclusion such as "not other kinds of message" helps less, and can draw attention to the wrong answer.

Criteria

  • Ask about the null case separately. A Box always returns a location and a Choice always picks an option, even when nothing fits. Pair either one with a Noul in the same request that asks whether anything fits ("Is there a coffee mug in photo?", "Does message name any of our products?"), so code can tell when nothing does. As of Jev 1.14, this companion Noul usually works better than a "none of the above" option.
  • Option names are sent to the model; question IDs are not. Names that describe the content (refund_request, shipping_delay) help the model. Positional names (A, left, option_1) give it nothing meaningful to go on and can bias the answer.
  • Keep options distinct and concrete. Wording that options share with each other, or with the input, can pull probability toward those options. An option that covers several meanings is often worth splitting, because its probability can't tell code which meaning applied. Direction and magnitude usually work better as separate questions, so that the answer to one doesn't get mixed into the other.
  • Describe each Score level as a situation. Each level should make sense when read on its own: "The customer mentions a minor inconvenience" rather than "More upset than the previous level".
  • Describe a Noul's false criterion as a concrete situation, such as "the package arrived on time", rather than as "not late".
  • Use a Noul per statement when more than one can be true. A Choice picks one option, so a message that is both a refund request and a complaint forces it to split probability between the two. Separate Nouls let each one be true on its own.

Compose requests

Bundle questions that share state. A handy heuristic: if two calls would send the same state with different questions, they can likely be one call. Questions are cheap and run in parallel, and the state is read and paid for once. See parallel questions.

Ask speculatively, meaning ask a question before you know whether you'll need its answer. A question that only matters in some cases can go in the same request as the question that identifies the case. Ask "Is order a return request?" and "Which item in order.items is being returned?" together, and have code read the second answer only when the first is yes. The second question doesn't need an "if" clause, because code handles the condition. See speculative fan-out.

A second request is usually worth it when:

  • code needs an answer to build the next state, fetch evidence, or choose the next options;
  • a state field needed for one question measurably misleads another;
  • different sets of questions need to be cached or versioned separately.

Read the answers

Confidence is rarely the gate

Naive implementations often use an answer's confidence as the check that decides whether code acts. Confidence measures how concentrated an answer's probability distribution is, which is not the same as how likely the answer is to be correct. Think about what the probabilities should look like in your use case; another calculation over them may suit it better.

Probabilities and thresholds

  • A probability is the likelihood that an answer is correct. Jev isn't a calculator for probability problems. Ask it for judgments, and do any math on odds or probabilities in code. A Noul near 0.5 usually means the state doesn't settle the question.
  • The top answer is a good default: the Choice's top option, or the Score's position.
  • 0.7 and 0.3 make good starting thresholds for a Noul: above 0.7 reads as yes, below 0.3 as no, and the band between means the question isn't settled, which can get its own row in the truth table. Adjust them when the application calls for it, and be wary of over-fitting them to a handful of test cases.
  • Look at Score distributions. The Score's position can get pulled toward the middle and hide two-peaked answers, so look at the level probabilities before deciding which value your code reads.

Test with the live API

Sending test requests to the live API is a great way to test questions against your data. Ask the user for permission first. Get a budget for experimentation (TypeSafe is very inexpensive, so a little can go a very long way), disclose what data will be sent (point out any personal or private data), and say that their TYPESAFE_API_KEY will be used.

  • Start with a few representative cases, plus hard ones and some whose answer is "no" or "nothing fits".
  • Compare wordings by sending each variant as a separate question in one request, over the same state.
  • Read individual answers, not only aggregates.
  • Keep the exact request payload for each case so any result can be rerun.
  • Check each change against cases you didn't use while tuning.

Make sure any agent that sends test requests has network access to the API endpoint.

When an answer looks wrong

Check these, in this order:

  1. the payload as actually sent;
  2. the state, against the human test;
  3. the options and candidates: is the right answer among them?
  4. the scope of the questions: can each one be broken down into smaller judgments?
  5. the wording.

If a clear question with complete state still gets an answer you're confident is wrong, check the jaggedness page for the model you're using. It lists known weak spots and how to work around them. If the behavior isn't listed, the TypeSafe team welcomes examples through the channel linked on that page. In the meantime, work out an alternative approach with the user that avoids the weak spot.

Yellow flags

Typically, a good change is one that makes the definition clearer or improves the state. Check each change on cases you didn't tune on. Wording written to produce a particular value is prompt gymnastics, and it tends to break on new inputs and on the next model version. Some yellow flags:

  • criteria that name specific test items, or that gain a clause for each failing case;
  • caveats that explain away a model quirk;
  • thresholds fitted to particular cases;
  • tests that assert an exact probability;
  • code that quietly overrides answers.

The structural fix is usually better state, a separate question, or code.

Cookbooks

Each of these starting points combines questions to serve one goal. Ideas outside this list are welcome.

The TypeSafe team is constantly adding cookbooks of well-tested patterns to the live documentation. It's a good idea to check the cookbooks index for one that fits the problem you're solving.

Download now (ZIP)

Does it work?

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

No reviews yet

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

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

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

Your trail

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

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

Now do this for your own.

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