llm-generation

Implements application LLM generation workflows with prompt versioning, model policy, and tracing.

Updated Jan 27, 2026
One-click install
npx skills add https://github.com/SmallAi-API/smaihub --skill llm-generation-smallai-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: llm-generation
Source: https://github.com/SmallAi-API/smaihub/tree/main/.agents/skills/llm-generation
Command: npx skills add https://github.com/SmallAi-API/smaihub --skill llm-generation-smallai-api

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Application LLM calls often end up with prompts buried in services, reused tracing scenarios, and untracked prompt versions, which corrupts latency, cost, and quality data. This Skill enforces a consistent structure for prompt ownership, versioning, scenario semantics, model policy, and structured output validation. ## Core Features & Use Cases - Prompt Ownership and Versioning: Places reusable generation contracts in packages/prompts with co-located *_PROMPT_VERSION constants formatted as v<major> or v<major>.<minor>. - Scenario and Tracing Discipline: Guides correct use of TRACING_SCENARIOS, schemaName, and entity IDs so each business workflow gets its own tracing cohort. - Model Policy and Structured Output: Resolves models through the owning service's configuration and validates generated JSON against Zod schemas at the service boundary. - Use Case: When adding a new goal-criteria drafting feature, use this Skill to create a versioned prompt chain, register a distinct tracing scenario, configure the service model, and write tests asserting scenario, promptVersion, and schemaName. ## Quick Start Use the llm-generation skill to implement a new structured generation workflow with a versioned prompt, correct tracing scenario, and validation tests.

Frequently Asked Questions about llm-generation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I version LLM prompts in an application?

Keep a *_PROMPT_VERSION constant beside the prompt it versions and export both from the same module. Format versions as v<major> or v<major>.<minor>, store only the version in promptVersion, and bump it whenever the prompt or output contract changes.

How do I add tracing to an LLM generation call?

Check TRACING_SCENARIOS first and reuse a scenario only for the same user-visible workflow and lifecycle stage. Pass schemaName for structured generation and relevant entity IDs, and never borrow a nearby scenario as a placeholder.

Where should system prompts live in a server codebase?

Reusable generation contracts belong in packages/prompts/src/chains, exporting the message builder, JSON schema, schema name, and prompt version together. Execution concerns like model configuration, persistence, and error handling stay in the owning server service.

When should I create a new tracing scenario instead of reusing one?

Add a new scenario when the business action differs, even if another call shares its prompt or JSON schema. Reusing a scenario across different workflows contaminates latency, cost, success-rate, and quality metrics.

What tests should an LLM generation workflow have?

Assert the emitted scenario, promptVersion, and schemaName, test the prompt's key behavioral constraints without snapshotting full prose, and test structured-output validation and failure behavior. Also search for stale inline prompts and incorrectly reused scenarios.