Skip to content

Efficient Workflows: Four Architecture Patterns with a Coding Agent ​

💡 Goal: Master the four architecture patterns from the official Patterns doc in about 44 minutes and assemble your first production-grade Jev workflow—ask a batch of questions in one request, route by confidence tiers, merge weighted atomic scores, and finally let Claude Code write the code that calls Jev for you.

🎯 Stage Goals ​

  • Break a business process into atomic decisions, and explain what problem each of the four official architecture patterns solves and what its benefits are
  • Write code that fits "three question types in one request," and explain how much cheaper and faster it is than one request per question
  • Put brakes on automation: use confidence tiers to decide whether to execute automatically, ask the user for confirmation, or hand off to a human
  • Install the TypeSafe Agent Skill in Claude Code so the agent generates correct Jev call code

⏳ Estimated Time ​

  • 4 lessons totaling about 44 minutes; with buffer, about 31–57 minutes
  • Each lesson stands on its own and can also be read individually; 3.1 is the foundation for the following lessons, so start there

🚀 Before You Start ​

  • Completed Daily Use: Master the Five Ways to Ask Jev Questions: can pose Choice / Score / Noul questions—the confidence gating in this stage relies entirely on the foundation from the Confidence lesson
  • The environment from the Installation and First Request lesson still runs: TYPESAFE_API_KEY is in the environment variables
  • (Only lesson 4 requires this) Claude Code or another coding agent installed; not having it doesn't affect the first three lessons
  • A cup of water ☕—this stage is mostly about architecture, with not much code

📚 Lessons in This Stage ​

First, see what problems this Jev workflow can help you solve. If this is how you usually write things, this stage is made for you:

How You Write It NowSwitch to a Jev Workflow
❌ Begging the LLM in a prompt to "please return JSON," then writing a pile of parsing code to guard against format drift✅ The answer is inherently among the options you provide, so code can just if, with no need to recover values from generated text
❌ One request per message—cost and latency climb as volume grows✅ Ask N questions in parallel in one request: adding questions barely increases response time, only the tokens for a few more questions
❌ The model never admits "I'm not sure" and answers even when wrong, so you have to watch it manually the whole time✅ confidence is a certainty measure computed from the probability distribution (0–1); when it's low, it automatically escalates to a human

The official Patterns doc summarizes these practices into four architecture patterns. The first 3 lessons of this stage break them down one by one, and lesson 4 answers "who writes this code":

PatternIn One SentenceBenefits
Speculative fan-outAsk all the "might be needed" questions in one request; the code decides afterwards which to useCost, speed
Confidence-gated routingThe answer tells you "what it is"; confidence tells you "whether to act"Reliability, safety
Composite scoringBreak complex judgments into atomic scores and merge them with weights in codeCost, reliability, speed
Intent routingClassify the intent first, then route to deterministic logic, an expert LLM, or a humanCost, speed

How to choose? The official doc has no ready-made "selection" section, so the Benefits column is the most practical guide: if you're stuck on cost and speed, look at fan-out and routing first; if you fear errors and need safety, look at confidence-gated routing first.

Lesson schedule:

LessonContentDuration
3.1 Parallel Questions and Speculative Fan-OutOfficial test of asking 13 questions in one request: 12.2x cheaper, 10.0x faster, same answers; speculative questions that are "asked but unused" are nearly free12 minutes
3.2 Smart RoutingUse Choice to classify intent + Score to assess complexity, then dispatch by confidence to deterministic code, an expert LLM, or a human; thresholds flex with risk—0.6 as fallback, automatic transfers require 0.8512 minutes
3.3 Composite ScoringResume-screening case: 4 dimensions each scored with Score, normalized and merged with weights; if rankings look wrong, adjust the weights, not the prompt10 minutes
3.4 developed together with Claude CodeJev is not a model for coding agents—install the TypeSafe Agent Skill so your agent writes code that calls Jev; 3 official example prompts and 5 FAQs10 minutes

💡 Try it now

The TypeSafe Agent Skill from Lesson 4 can be installed in Claude Code with just two commands:

bash
claude plugin marketplace add typesafe-ai/skills
claude plugin install typesafe@typesafe-ai

After installation, mention「use the TypeSafe skill」in the conversation, or directly invoke /typesafe:typesafe-ai. Other agents (such as Codex) use npx skills add typesafe-ai/skills --skill typesafe-ai.

🎒 What you'll gain ​

  • The design method of「first break down into atomic judgments, then choose a pattern to assemble」—the official docs call this the key skill for using TypeSafe well
  • The applicable scenarios and benefit trade-offs of the four architecture patterns, with official code skeletons in every lesson you can copy directly
  • A hands-on feel for grading automation: auto-execute at high confidence, ask for confirmation at medium confidence, hand off to a human at low confidence
  • The right way to collaborate with a coding agent: Jev makes the decisions, you review the questions and thresholds, the agent writes the code

Finished practicing the patterns and want to see how they land in real projects? The next stage Scenario Practice: Choose Your Route has 15 complete case studies (for example LLM Guardrails: a single request that security-checks both the inbound and outbound messages of an LLM application).


Ready? Start Lesson 1: Parallel Questions and Speculative Fan-out →

gaodong.aiAboutPrivacyContact

Independent tutorials, not affiliated with any product mentioned. Product names and trademarks belong to their owners. Check official pages for prices and policies.