Use for application prompts, generateObject/generateText, model selection and generation tracing. Excludes provider adapters and agent snapshots.
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-llm-generation-acae0c8397c5 ,按照其中的说明把「llm-generation」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Implement business-facing LLM calls as explicit, independently observable workflows. Keep prompt identity, model policy, structured output, and tracing responsibilities separate.
Before editing a call, inspect:
packages/prompts for reusable application prompts;apps/server/src/services/aiGeneration for the server-side structured generation wrapper;packages/const/src/llmGenerationTracing.ts for scenario names;packages/llm-generation-tracing for tracing option and registry behavior;Use agent-tracing for execution-snapshot diagnosis and agent-runtime-hooks for lifecycle hook behavior. Neither owns application LLM generation conventions.
packages/prompts/src/chains: the message builder, JSON schema, schema name, and prompt version should be exported together. Do not leave substantial system prompts or model-facing input serialization embedded in a service.AiGenerationService, tracing entity IDs, Zod validation, persistence, and business error handling do not belong in the prompt chain.*_PROMPT_VERSION beside the prompt it versions and export both from the same module.v<major> or v<major>.<minor>, for example v1 or v1.2.promptVersion. Do not include a feature or scenario prefix such as expertise-ingestion-v1; scenario carries workflow identity.export const EXAMPLE_PROMPT_VERSION = 'v1';
export const EXAMPLE_SYSTEM_PROMPT = `...`;
Treat scenario as the stable product workflow and lifecycle-stage partition, not as a label for a prompt, schema, model, or helper.
TRACING_SCENARIOS before adding a call.schemaName for structured generation and relevant entity IDs when available.For every new or corrected generation workflow:
scenario, promptVersion, and schemaName where applicable.bun run check <changed-files...> and bun run check --type for cross-package changes.Use the testing skill for test mechanics and the typescript skill for TypeScript changes.