[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EV7905ET2X8WYGGPVM87XR":3,"skill-same:01M7EV7905ET2X8WYGGPVM87XR":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M7EV7905ET2X8WYGGPVM87XR","outlines-library",null,"Constrain LLM generation to exact structures with Outlines — regex, JSON schema, and grammar-guided decoding.","TanNhatCMS\u002Fjarvis","TanNhatCMS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F113796420?v=4","01M753MV17KG5CD3152G3WQEQY","KietNT","01M7EKEDYVYQ6PWVJJMZ911VMX",0,"MIT","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fams-outlines-library\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: outlines-library\ndescription: Constrain LLM generation to exact structures with Outlines — regex, JSON schema, and grammar-guided decoding.\ncategory: ai-research\n---\n\n## Overview\n\nOutlines controls what a language model is allowed to generate at the token\nlevel. Instead of asking for JSON and hoping, you give Outlines a schema (JSON\nschema, regex, or context-free grammar) and it constrains decoding so every\noutput is valid by construction — invalid tokens are masked out during\ngeneration. The difference from post-hoc validation is fundamental: Outlines\ncan't produce invalid output, so there's no retry loop, no parse failures, and no\nwasted tokens on doomed generations.\n\nThis is the right tool when structure is non-negotiable: strict JSON APIs,\ndomain-specific languages, formatted outputs (dates, codes, enums), and anywhere\ndownstream code parses the result. It trades some flexibility (constrained\ndecoding adds per-step overhead and needs logits access, so it works with\nlocal\u002Fself-hosted models, not opaque APIs) for a hard guarantee.\n\nThe guarantee changes the engineering: downstream code can parse without\ntry\u002Fexcept, retry budgets drop to zero for format issues, and \"the model produced\ninvalid JSON\" disappears as a failure class entirely.\n\n## When to use\n\n- Generating JSON that must validate against a schema — every time, with zero\n  retries.\n- Domain-specific formats: structured codes, templated text, multiple-choice with\n  exact labels.\n- High-throughput structured generation where retry loops would be expensive.\n- Grammar-constrained tasks: arithmetic expressions, simple DSLs, nested\n  structures.\n- Replacing brittle \"output JSON\" prompting with a guarantee.\n- Pipelines where a single malformed output breaks the batch.\n\n## Core concepts\n\n- **Constrained decoding**: at each generation step, the allowed token set is\n  restricted to tokens that keep some valid completion possible. Implemented via\n  finite-state machines (for regex) or pushdown automata (for grammars) compiled\n  from your schema.\n- **JSON schema mode**: the most common — define the schema, get guaranteed-valid\n  JSON. Supports nested objects, arrays, enums, and string patterns. The schema is\n  both the constraint and the documentation.\n- **Regex mode**: for formatted strings — dates, IDs, phone numbers, fixed\n  vocabularies. Lighter than a full schema when you need one patterned field.\n- **Grammar mode**: context-free grammars for nested\u002Frecursive structures\n  (expressions, DSLs). Most expressive; most expensive to compile.\n- **Logits access requirement**: Outlines needs to modify the sampling\n  distribution, so it runs against models you host (Transformers, vLLM, llama.cpp\n  integrations) — not against black-box APIs that hide logits.\n- **Few-shot + constraints**: constraints guarantee shape; examples still improve\n  content. Combine: constrained decoding for structure, demonstrations for\n  quality.\n- **Choice mode**: constrain output to one of a fixed set of strings — the\n  simplest constraint, ideal for classification with exact labels.\n- **Compilation cost**: schemas compile to automata once; complex grammars take\n  longer. Compile at startup, not per request.\n\n## Practical workflow\n\n1. **Write the schema first.** JSON schema (or regex\u002Fgrammar) describing exactly\n   the valid output space. Test the schema itself against example valid\u002Finvalid\n   outputs before involving the model.\n2. **Choose the integration.** Pick the backend matching your serving setup (local\n   Transformers for dev, vLLM\u002Fllama.cpp for production). Verify constrained\n   generation works end-to-end on your model.\n3. **Prompt for content, constrain for form.** The prompt should focus on what to\n   say; the constraint handles how it's shaped. Don't waste prompt tokens\n   enforcing format the decoder already guarantees.\n4. **Benchmark the overhead.** Constrained decoding adds per-token cost (mask\n   computation). Measure tokens\u002Fsec with and without constraints at your sequence\n   lengths; for huge schemas or deep grammars, consider simplifying.\n5. **Test edge cases.** Empty outputs, maximum-length outputs, adversarial prompts\n   trying to break the format. The guarantee should hold — verify it rather than\n   assuming.\n6. **Precompile schemas.** Compile at startup or deploy time, not per request.\n   Cache compiled automata for schemas you reuse.\n7. **Monitor in production.** Log constraint violations (should be zero) and\n   generation latency. A sudden latency spike often means the constraint is\n   fighting the model's instincts — a sign the prompt and schema disagree.\n\nChecklist for constrained generation:\n- Schema tested against valid\u002Finvalid examples independently of the model.\n- Backend integration verified on the deployment model.\n- Schemas precompiled; compilation cost measured.\n- Latency overhead measured and acceptable.\n- Prompt focuses on content; format left to the constraint.\n\n## Common pitfalls\n\n- **Over-constrained schemas.** A schema so tight the model can't express the\n  answer degrades content quality. Constrain the shape, not the substance.\n- **Expecting it to fix bad prompts.** Outlines guarantees valid JSON, not good\n  JSON. Content quality still comes from the prompt and the model.\n- **Grammar complexity blowup.** Deeply recursive grammars compile to expensive\n  automata. Simplify the grammar or accept the latency.\n- **Using it with black-box APIs.** Without logits access there's nothing to\n  constrain. For API models, use schema-validated retries (Instructor-style)\n  instead.\n- **Schema\u002Fprompt mismatch.** The prompt asks for a summary plus JSON while the\n  schema allows only JSON — the model fights the mask, latency spikes, quality\n  drops. Align them.\n- **No content evaluation.** \"100% valid JSON\" is not a quality metric. Evaluate\n  the values inside, not just the brackets outside.\n- **Per-request compilation.** Compiling the automaton on every call. Precompile\n  once; the per-request cost should be just the masking.\n- **Constraint as crutch for bad data.** Forcing structure onto outputs the model\n  doesn't understand produces valid-shaped nonsense. Fix understanding first.\n","## Overview\n\nOutlines controls what a language model is allowed to generate at the token\nlevel. Instead of asking for JSON and hoping, you give Outlines a schema (JSON\nschema, regex, or context-free grammar) and it constrains decoding so every\noutput is valid by construction — invalid tokens are masked out during\ngeneration. The difference from post-hoc validation is fundamental: Outlines\ncan't produce invalid output, so there's no retry loop, no parse failures, and no\nwasted tokens on doomed generations.\n\nThis is the right tool when structure is non-negotiable: strict JSON APIs,\ndomain-specific languages, formatted outputs (dates, codes, enums), and anywhere\ndownstream code parses the result. It trades some flexibility (constrained\ndecoding adds per-step overhead and needs logits access, so it works with\nlocal\u002Fself-hosted models, not opaque APIs) for a hard guarantee.\n\nThe guarantee changes the engineering: downstream code can parse without\ntry\u002Fexcept, retry budgets drop to zero for format issues, and \"the model produced\ninvalid JSON\" disappears as a failure class entirely.\n\n## When to use\n\n- Generating JSON that must validate against a schema — every time, with zero\n  retries.\n- Domain-specific formats: structured codes, templated text, multiple-choice with\n  exact labels.\n- High-throughput structured generation where retry loops would be expensive.\n- Grammar-constrained tasks: arithmetic expressions, simple DSLs, nested\n  structures.\n- Replacing brittle \"output JSON\" prompting with a guarantee.\n- Pipelines where a single malformed output breaks the batch.\n\n## Core concepts\n\n- **Constrained decoding**: at each generation step, the allowed token set is\n  restricted to tokens that keep some valid completion possible. Implemented via\n  finite-state machines (for regex) or pushdown automata (for grammars) compiled\n  from your schema.\n- **JSON schema mode**: the most common — define the schema, get guaranteed-valid\n  JSON. Supports nested objects, arrays, enums, and string patterns. The schema is\n  both the constraint and the documentation.\n- **Regex mode**: for formatted strings — dates, IDs, phone numbers, fixed\n  vocabularies. Lighter than a full schema when you need one patterned field.\n- **Grammar mode**: context-free grammars for nested\u002Frecursive structures\n  (expressions, DSLs). Most expressive; most expensive to compile.\n- **Logits access requirement**: Outlines needs to modify the sampling\n  distribution, so it runs against models you host (Transformers, vLLM, llama.cpp\n  integrations) — not against black-box APIs that hide logits.\n- **Few-shot + constraints**: constraints guarantee shape; examples still improve\n  content. Combine: constrained decoding for structure, demonstrations for\n  quality.\n- **Choice mode**: constrain output to one of a fixed set of strings — the\n  simplest constraint, ideal for classification with exact labels.\n- **Compilation cost**: schemas compile to automata once; complex grammars take\n  longer. Compile at startup, not per request.\n\n## Practical workflow\n\n1. **Write the schema first.** JSON schema (or regex\u002Fgrammar) describing exactly\n   the valid output space. Test the schema itself against example valid\u002Finvalid\n   outputs before involving the model.\n2. **Choose the integration.** Pick the backend matching your serving setup (local\n   Transformers for dev, vLLM\u002Fllama.cpp for production). Verify constrained\n   generation works end-to-end on your model.\n3. **Prompt for content, constrain for form.** The prompt should focus on what to\n   say; the constraint handles how it's shaped. Don't waste prompt tokens\n   enforcing format the decoder already guarantees.\n4. **Benchmark the overhead.** Constrained decoding adds per-token cost (mask\n   computation). Measure tokens\u002Fsec with and without constraints at your sequence\n   lengths; for huge schemas or deep grammars, consider simplifying.\n5. **Test edge cases.** Empty outputs, maximum-length outputs, adversarial prompts\n   trying to break the format. The guarantee should hold — verify it rather than\n   assuming.\n6. **Precompile schemas.** Compile at startup or deploy time, not per request.\n   Cache compiled automata for schemas you reuse.\n7. **Monitor in production.** Log constraint violations (should be zero) and\n   generation latency. A sudden latency spike often means the constraint is\n   fighting the model's instincts — a sign the prompt and schema disagree.\n\nChecklist for constrained generation:\n- Schema tested against valid\u002Finvalid examples independently of the model.\n- Backend integration verified on the deployment model.\n- Schemas precompiled; compilation cost measured.\n- Latency overhead measured and acceptable.\n- Prompt focuses on content; format left to the constraint.\n\n## Common pitfalls\n\n- **Over-constrained schemas.** A schema so tight the model can't express the\n  answer degrades content quality. Constrain the shape, not the substance.\n- **Expecting it to fix bad prompts.** Outlines guarantees valid JSON, not good\n  JSON. Content quality still comes from the prompt and the model.\n- **Grammar complexity blowup.** Deeply recursive grammars compile to expensive\n  automata. Simplify the grammar or accept the latency.\n- **Using it with black-box APIs.** Without logits access there's nothing to\n  constrain. For API models, use schema-validated retries (Instructor-style)\n  instead.\n- **Schema\u002Fprompt mismatch.** The prompt asks for a summary plus JSON while the\n  schema allows only JSON — the model fights the mask, latency spikes, quality\n  drops. Align them.\n- **No content evaluation.** \"100% valid JSON\" is not a quality metric. Evaluate\n  the values inside, not just the brackets outside.\n- **Per-request compilation.** Compiling the automaton on every call. Precompile\n  once; the per-request cost should be just the masking.\n- **Constraint as crutch for bad data.** Forcing structure onto outputs the model\n  doesn't understand produces valid-shaped nonsense. Fix understanding first.\n",{"name":5,"category":24,"description":7},"ai-research","main","af388a77c2fe5e0b4fd879cca4300a0ffa9a6579","skills\u002Fams-outlines-library",1,"https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis","https:\u002F\u002Fgithub.com\u002FTanNhatCMS","https:\u002F\u002Fmrkiet.name.vn","2026-11-07 14:23:08",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add TanNhatCMS\u002Fjarvis --skill outlines-library",{"tool":39,"command":40},"bunx","bunx skills add TanNhatCMS\u002Fjarvis --skill outlines-library",{"tool":42,"command":43},"pnpm","pnpm dlx skills add TanNhatCMS\u002Fjarvis --skill outlines-library","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fams-outlines-library\u002FSKILL.md",true,[],[48,55,63,70,77,84],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7EWYJR0J8DARY7E59Z6Y9MV","web-scrape","Turn web pages into LLM-ready markdown via the Firecrawl API (renders JS, anti-bot handling). Use when browser_open\u002Ffetch fails on JS-heavy pages, or when you need clean markdown\u002Fstructured extraction from a site. Requires FIRECRAWL_API_KEY.","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fweb-scrape\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":59,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7EWYBN5P6F2AJG3FR24T9BP","design-taste-frontend","tasteskill v2, the anti-slop frontend skill. Art direction for websites, distilled from a study of 247 curated gallery sites (One Page Love, Awwwards Sites of the Day). Deals researched directions (idea, composition, type, palette, photographs, section blueprints) from a library, enforces a strict no-slop house style with a real-browser inspector, and runs a look-and-fix loop on screenshots. Use this whenever you build, design, redesign, restyle, polish or review a landing page, marketing site, portfolio, product page, one-pager, hero or any public-facing web page, in any stack (HTML\u002FCSS, React, Next.js, Vue, Svelte, Astro, Tailwind) — also when the user says a page looks generic, templated, \"AI-made\", sloppy, or asks to make it look designed, premium, award-level or less like every other site. Not for dashboards or app screens.","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Ftaste-design\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Ftaste-design\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7EWY8FQFNQ2GB7NZZWGSSDX","test-driven-development","Use when implementing any feature or bugfix, before writing implementation code","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-tdd\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7EWY5SHBFRH1HDHVWM9K7TV","systematic-debugging","Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-debugging\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7EWY3NM0Z0JAKS7HDZ24K66","requesting-code-review","Use when completing tasks, implementing major features, or before merging to verify work meets requirements","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-code-review\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7EWY0WRMWX4M9ZFY0WKC593","brainstorming","You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-brainstorming\u002FSKILL.md",[],[]]