[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DB7ZXT272P9Y0DKBYYK4EC":3,"skill-same:01M7DB7ZXT272P9Y0DKBYYK4EC":44},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7DB7ZXT272P9Y0DKBYYK4EC","structured-decisions",null,"Choosing how an application makes small repeated decisions at runtime — routing, classification, moderation, triage, scoring, filtering. Covers the ladder from constants and rules up to typed-output classification models and full LLM calls, with the cost, latency and failure mode of each rung. Use when designing or reviewing any code path that must decide \"which one\", \"how urgent\", or \"is this allowed\" on every request.","MoradDev\u002Fskills-unified","MoradDev","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F72839584?v=4","01M7DASN3HYHFBYW4ZNMPTHQ63","01M7DASN4N6P4P9WMEFRE2V0TF",2,"MIT","https:\u002F\u002Fgithub.com\u002FMoradDev\u002Fskills-unified\u002Fblob\u002Fmain\u002Fcuration\u002Fskills\u002Fstructured-decisions\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: structured-decisions\ndescription: Choosing how an application makes small repeated decisions at runtime — routing, classification, moderation, triage, scoring, filtering. Covers the ladder from constants and rules up to typed-output classification models and full LLM calls, with the cost, latency and failure mode of each rung. Use when designing or reviewing any code path that must decide \"which one\", \"how urgent\", or \"is this allowed\" on every request.\n---\n\n# Structured decisions at runtime\n\nAn application that decides something on every request — which model to route to, whether\na message is abusive, how urgent a ticket is, whether a tool call is safe — needs that\ndecision to be cheap, fast and predictable. The common mistake is to reach straight for an\nLLM call because it is the most familiar tool, and to discover in production that it costs\ntoo much, answers too slowly, and occasionally invents a category that does not exist.\n\n## The ladder\n\nClimb one rung only when the one below has actually failed. Each rung costs more in money,\nlatency and operational surface than the one under it.\n\n| Rung | Use when | Cost | Fails when |\n|---|---|---|---|\n| **1. Constant or config** | The answer never varies per request | Free | The answer does vary |\n| **2. Rule, regex, lookup table** | The decision is expressible in conditions you can enumerate | Free, microseconds | The rules multiply past readability, or inputs are natural language |\n| **3. Deterministic code with a scoring function** | You can define the criteria numerically | Free, microseconds | Criteria are fuzzy or depend on meaning |\n| **4. Classification model with typed output** | Natural-language input, bounded output, high volume, latency matters | Orders of magnitude below an LLM call; free per call if you run it yourself | You need generated text, or multi-step reasoning |\n| **5. LLM call** | Open-ended output, reasoning, generation | Orders of magnitude above rung 4 | Volume or latency makes it untenable |\n\n**Most decisions belong on rungs 1 to 3.** \"Is this file a test file?\" is a suffix check,\nnot a classification problem. Write the rule first and let it fail before spending money.\n\n## Rung 4 in practice — a classification model with typed output\n\nThe rung-4 tool is a model that **generates no text**. You hand it a block of state and a set\nof typed questions; it returns typed values with probabilities and confidence scores, meant to\nbe consumed by code rather than read. The question shapes are nearly always the same three:\n\n- a **boolean** — a yes\u002Fno statement, answered with a probability from 0 to 1\n- a **choice** — pick one option from a set you name\n- a **score** — rate against a scale you define\n\nThe property that earns the rung is that the model **cannot return a value outside the schema\nyou supply**. That removes a whole class of parsing and hallucination bugs, and removes all\nflexibility along with it.\n\nSuch models exist both as hosted APIs and as open-source weights you run yourself. The choice\nbetween those two is the usual one — operational surface against per-call cost and data\nresidency — and it belongs in the ADR, not in this skill.\n\n### Calling one — Laya as a concrete example\n\n[Laya](https:\u002F\u002Fgithub.com\u002FNandhaKishorM\u002Flaya) (Apache-2.0, `pip install laya`) is one open\nsource option: multilingual, non-autoregressive, runs locally on CPU or GPU, and ships its own\nMCP server. Taken from its documentation:\n\n```python\nfrom laya import Router\n\nrouter = Router()  # downloads a checkpoint on first use\n\nstate = \"Hi, we were billed twice for March. Please refund the duplicate today or we will cancel our plan.\"\nquestions = {\n    \"department\": {\"type\": \"choice\", \"instructions\": \"Which department should handle this?\",\n                   \"criteria\": {\"billing\": \"invoices, payments, refunds\",\n                                \"technical\": \"bugs, outages, system errors\",\n                                \"other\": \"everything else\"}},\n    \"urgency\": {\"type\": \"score\", \"instructions\": \"How urgent is this?\",\n                \"criteria\": [\"not urgent\", \"soon\", \"blocking\"]},\n    \"churn_risk\": {\"type\": \"noul\", \"instructions\": \"Does the user threaten to cancel or leave?\"},\n}\n\nresult = router.predict(state, questions, min_confidence=0.6)\nprint(result[\"answers\"][\"department\"][\"choice\"])   # billing\nprint(result[\"answers\"][\"churn_risk\"][\"noul\"])     # probability the answer is yes\n```\n\n`min_confidence` is the part worth copying whatever tool you pick: it marks any answer below\nthe threshold `low_confidence` and reports an `abstention` state, so the calling code can tell\na check that cleared from a check that never ran. Without it you get a bare probability and\nno way to distinguish the two.\n\nThe same questions are reachable over MCP as the `laya_predict` and `laya_decide` tools, and\nin batch — `decide_batch`, `laya_predict_batch` — which shares one forward pass across\nrequests with the same question schema. Batch whenever you have more than a couple of items.\n\n### Before committing to a rung-4 model in a plan\n\nCheck these, and record the answers in an ADR — they are the reasons a future maintainer\nwill need:\n\n- **Measure its accuracy on your own decisions, zero-shot, before designing around it.**\n  These models are small, and out-of-the-box accuracy on a specific domain is often\n  unimpressive: Laya's own typed-decisions benchmark reports 0.362 for the base English\n  checkpoint against 0.766 after fine-tuning on the domain. Budget for fine-tuning or for a\n  confidence threshold that sends the uncertain cases up a rung.\n- **Price the operational surface, not just the per-call cost.** A hosted API costs money per\n  request and scales with your traffic. A local model costs nothing per call but has to be\n  deployed, given CPU or GPU, and kept alive — Laya's checkpoints are 322M–421M parameters and\n  download from Hugging Face on first use, so the first request is slow and the container\n  needs room for the weights.\n- **Check the licence of the weights, not only of the code.** They are often different, and a\n  non-commercial model licence rules out a commercial application however permissive the\n  surrounding library is. Laya is Apache-2.0 for both.\n- **Design the fallback path.** Any rung-4 model, hosted or local, will be unavailable at some\n  point. Decide now whether a failure falls back to rung-2 rules or up to an LLM call, rather\n  than discovering it in production.\n- **It replaces no LLM.** No text out. If any part of the response must be prose, this is the\n  wrong rung.\n\n## Reviewing an existing decision path\n\nWhen you find an LLM call making a small bounded decision, ask in order: could a rule do\nit? could a scoring function? is the volume high enough that the cost difference is real?\nOnly then propose a classifier. Moving a decision from rung 5 to rung 4 is worth doing at\nscale and is pure churn at ten calls a day.\n\nRecord whichever rung you land on, and why the one below was insufficient, in `STATE.md`\nor an ADR. The next person will otherwise assume the choice was arbitrary.\n","# Structured decisions at runtime\n\nAn application that decides something on every request — which model to route to, whether\na message is abusive, how urgent a ticket is, whether a tool call is safe — needs that\ndecision to be cheap, fast and predictable. The common mistake is to reach straight for an\nLLM call because it is the most familiar tool, and to discover in production that it costs\ntoo much, answers too slowly, and occasionally invents a category that does not exist.\n\n## The ladder\n\nClimb one rung only when the one below has actually failed. Each rung costs more in money,\nlatency and operational surface than the one under it.\n\n| Rung | Use when | Cost | Fails when |\n|---|---|---|---|\n| **1. Constant or config** | The answer never varies per request | Free | The answer does vary |\n| **2. Rule, regex, lookup table** | The decision is expressible in conditions you can enumerate | Free, microseconds | The rules multiply past readability, or inputs are natural language |\n| **3. Deterministic code with a scoring function** | You can define the criteria numerically | Free, microseconds | Criteria are fuzzy or depend on meaning |\n| **4. Classification model with typed output** | Natural-language input, bounded output, high volume, latency matters | Orders of magnitude below an LLM call; free per call if you run it yourself | You need generated text, or multi-step reasoning |\n| **5. LLM call** | Open-ended output, reasoning, generation | Orders of magnitude above rung 4 | Volume or latency makes it untenable |\n\n**Most decisions belong on rungs 1 to 3.** \"Is this file a test file?\" is a suffix check,\nnot a classification problem. Write the rule first and let it fail before spending money.\n\n## Rung 4 in practice — a classification model with typed output\n\nThe rung-4 tool is a model that **generates no text**. You hand it a block of state and a set\nof typed questions; it returns typed values with probabilities and confidence scores, meant to\nbe consumed by code rather than read. The question shapes are nearly always the same three:\n\n- a **boolean** — a yes\u002Fno statement, answered with a probability from 0 to 1\n- a **choice** — pick one option from a set you name\n- a **score** — rate against a scale you define\n\nThe property that earns the rung is that the model **cannot return a value outside the schema\nyou supply**. That removes a whole class of parsing and hallucination bugs, and removes all\nflexibility along with it.\n\nSuch models exist both as hosted APIs and as open-source weights you run yourself. The choice\nbetween those two is the usual one — operational surface against per-call cost and data\nresidency — and it belongs in the ADR, not in this skill.\n\n### Calling one — Laya as a concrete example\n\n[Laya](https:\u002F\u002Fgithub.com\u002FNandhaKishorM\u002Flaya) (Apache-2.0, `pip install laya`) is one open\nsource option: multilingual, non-autoregressive, runs locally on CPU or GPU, and ships its own\nMCP server. Taken from its documentation:\n\n```python\nfrom laya import Router\n\nrouter = Router()  # downloads a checkpoint on first use\n\nstate = \"Hi, we were billed twice for March. Please refund the duplicate today or we will cancel our plan.\"\nquestions = {\n    \"department\": {\"type\": \"choice\", \"instructions\": \"Which department should handle this?\",\n                   \"criteria\": {\"billing\": \"invoices, payments, refunds\",\n                                \"technical\": \"bugs, outages, system errors\",\n                                \"other\": \"everything else\"}},\n    \"urgency\": {\"type\": \"score\", \"instructions\": \"How urgent is this?\",\n                \"criteria\": [\"not urgent\", \"soon\", \"blocking\"]},\n    \"churn_risk\": {\"type\": \"noul\", \"instructions\": \"Does the user threaten to cancel or leave?\"},\n}\n\nresult = router.predict(state, questions, min_confidence=0.6)\nprint(result[\"answers\"][\"department\"][\"choice\"])   # billing\nprint(result[\"answers\"][\"churn_risk\"][\"noul\"])     # probability the answer is yes\n```\n\n`min_confidence` is the part worth copying whatever tool you pick: it marks any answer below\nthe threshold `low_confidence` and reports an `abstention` state, so the calling code can tell\na check that cleared from a check that never ran. Without it you get a bare probability and\nno way to distinguish the two.\n\nThe same questions are reachable over MCP as the `laya_predict` and `laya_decide` tools, and\nin batch — `decide_batch`, `laya_predict_batch` — which shares one forward pass across\nrequests with the same question schema. Batch whenever you have more than a couple of items.\n\n### Before committing to a rung-4 model in a plan\n\nCheck these, and record the answers in an ADR — they are the reasons a future maintainer\nwill need:\n\n- **Measure its accuracy on your own decisions, zero-shot, before designing around it.**\n  These models are small, and out-of-the-box accuracy on a specific domain is often\n  unimpressive: Laya's own typed-decisions benchmark reports 0.362 for the base English\n  checkpoint against 0.766 after fine-tuning on the domain. Budget for fine-tuning or for a\n  confidence threshold that sends the uncertain cases up a rung.\n- **Price the operational surface, not just the per-call cost.** A hosted API costs money per\n  request and scales with your traffic. A local model costs nothing per call but has to be\n  deployed, given CPU or GPU, and kept alive — Laya's checkpoints are 322M–421M parameters and\n  download from Hugging Face on first use, so the first request is slow and the container\n  needs room for the weights.\n- **Check the licence of the weights, not only of the code.** They are often different, and a\n  non-commercial model licence rules out a commercial application however permissive the\n  surrounding library is. Laya is Apache-2.0 for both.\n- **Design the fallback path.** Any rung-4 model, hosted or local, will be unavailable at some\n  point. Decide now whether a failure falls back to rung-2 rules or up to an LLM call, rather\n  than discovering it in production.\n- **It replaces no LLM.** No text out. If any part of the response must be prose, this is the\n  wrong rung.\n\n## Reviewing an existing decision path\n\nWhen you find an LLM call making a small bounded decision, ask in order: could a rule do\nit? could a scoring function? is the volume high enough that the cost difference is real?\nOnly then propose a classifier. Moving a decision from rung 5 to rung 4 is worth doing at\nscale and is pure churn at ten calls a day.\n\nRecord whichever rung you land on, and why the one below was insufficient, in `STATE.md`\nor an ADR. The next person will otherwise assume the choice was arbitrary.\n",{"name":5,"description":7},"main","7542b2fc80051758dfb288b450cb344d3bdfca35","curation\u002Fskills\u002Fstructured-decisions",0,"https:\u002F\u002Fgithub.com\u002FMoradDev\u002Fskills-unified","https:\u002F\u002Fgithub.com\u002FMoradDev","2026-11-07 21:53:24",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add MoradDev\u002Fskills-unified --skill structured-decisions",{"tool":36,"command":37},"bunx","bunx skills add MoradDev\u002Fskills-unified --skill structured-decisions",{"tool":39,"command":40},"pnpm","pnpm dlx skills add MoradDev\u002Fskills-unified --skill structured-decisions","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMoradDev\u002Fskills-unified\u002Fblob\u002Fmain\u002Fcuration\u002Fskills\u002Fstructured-decisions\u002FSKILL.md",true,[],[45,52,59,66,73,80],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M7DB9J6N2PSGECQ6FTWW7B2H","windows-desktop-e2e","E2E testing for Windows native desktop apps (WPF, WinForms, Win32\u002FMFC, Qt) using pywinauto and Windows UI Automation. Use when writing E2E tests for a Windows native desktop app with pywinauto or UI Automation.","https:\u002F\u002Fgithub.com\u002FMoradDev\u002Fskills-unified\u002Fblob\u002Fmain\u002Fcuration\u002Fskills\u002Fwindows-desktop-e2e\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":18},"01M7DB9CCWT4YW7B791QN43E3Q","vue-patterns","Vue.js 3 Composition API patterns, component architecture, reactivity best practices, Pinia state management, Vue Router navigation, and Nuxt SSR patterns. Activates for Vue, Nuxt, Vite, or Pinia projects. Use when building or reviewing Vue 3, Nuxt, or Pinia code — Composition API, reactivity, or router navigation.","https:\u002F\u002Fgithub.com\u002FMoradDev\u002Fskills-unified\u002Fblob\u002Fmain\u002Fcuration\u002Fskills\u002Fvue-patterns\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":18},"01M7DB976FM2CAWT807EA36MXM","vite-patterns","Vite build tool patterns including config, plugins, HMR, env variables, proxy setup, SSR, library mode, dependency pre-bundling, and build optimization. Activate when working with vite.config.ts, Vite plugins, or Vite-based projects.","https:\u002F\u002Fgithub.com\u002FMoradDev\u002Fskills-unified\u002Fblob\u002Fmain\u002Fcuration\u002Fskills\u002Fvite-patterns\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":18},"01M7DB93JZRAWFB5QHH0C8DZ8N","using-agent-skills","Discovers and invokes agent skills. Use when starting a session, or when you need to decide which skill or workflow applies to the piece of work at hand. This is the meta-skill that governs how all other skills are discovered and invoked.","https:\u002F\u002Fgithub.com\u002FMoradDev\u002Fskills-unified\u002Fblob\u002Fmain\u002Fcuration\u002Fskills\u002Fusing-agent-skills\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M7DB8YYW1PEDS7H2AA86TE2E","ui-demo","Record polished UI demo videos using Playwright. Use when the user asks to create a demo, walkthrough, screen recording, or tutorial video of a web application. Produces WebM videos with visible cursor, natural pacing, and professional feel.","https:\u002F\u002Fgithub.com\u002FMoradDev\u002Fskills-unified\u002Fblob\u002Fmain\u002Fcuration\u002Fskills\u002Fui-demo\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":18},"01M7DB8RPQPW2R6GKJW618VDST","swiftui-patterns","SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS\u002FmacOS UI best practices. Use when building or reviewing SwiftUI views, @Observable state, navigation, or render performance.","https:\u002F\u002Fgithub.com\u002FMoradDev\u002Fskills-unified\u002Fblob\u002Fmain\u002Fcuration\u002Fskills\u002Fswiftui-patterns\u002FSKILL.md",[],[]]