Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Guidelines for implementing LLM (Language Model) functionality in the application
.claude/skills/elie222-llm/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 17% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 157% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 5% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -12% | 0% |
| case-06 | ✗→✓ | ▲ Improved | -35% | 0% |
LLM-related code is organized in specific directories:
apps/web/utils/ai/ - Main LLM implementationsapps/web/utils/llms/ - Core LLM utilities and configurationsapps/web/__tests__/ - LLM-specific testsutils/llms/index.ts - Core LLM functionalityutils/llms/model.ts - Model definitions and configurationsutils/llms/use-cases.ts - Product use-case to model-role routingutils/usage.ts - Usage tracking and monitoringFor product features with a static model choice, use getModelForUseCase(emailAccount.user, LlmUseCase.FeatureName) from utils/llms/use-cases.ts. Keep direct getModel(user, modelType) calls for generic helpers where the model role is intentionally passed from upstream. When adding or changing a use case, update utils/llms/use-cases.test.ts.
Follow this standard structure for LLM-related functions:
typescriptimport { z } from "zod"; import { createScopedLogger } from "@/utils/logger"; import { chatCompletionObject } from "@/utils/llms"; import type { EmailAccountWithAI } from "@/utils/llms/types"; import { createGenerateObject } from "@/utils/llms"; import { getModelForUseCase, LlmUseCase } from "@/utils/llms/use-cases"; export async function featureFunction(options: { inputData: InputType; emailAccount: EmailAccountWithAI; }) { const { inputData, user } = options; if (!inputData || [other validation conditions]) { logger.warn("Invalid input for feature function"); return null; } const system = `[Detailed system prompt that defines the LLM's role and task]`; const prompt = `[User prompt with context and specific instructions] <data> ... </data> ${emailAccount.about ? `<user_info>${emailAccount.about}</user_info>` : ""}`; const modelOptions = getModelForUseCase( emailAccount.user, LlmUseCase.FeatureName, ); const generateObject = createGenerateObject({ userEmail: emailAccount.email, label: "Feature Name", modelOptions, }); const result = await generateObject({ ...modelOptions, system, prompt, schema: z.object({ field1: z.string(), field2: z.number(), nested: z.object({ subfield: z.string(), }), array_field: z.array(z.string()), }), }); return result.object; }
withRetryapps/web/utils/ai/reply/draft-attribution.ts DRAFT_PIPELINE_VERSIONSee llm-test.mdc
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 14,587 | 11,891 | -18% | 1 | 1 | 0% | 3,100 | 3,641 | +17% | 0 | 0 | — |
case-02 | fail→pass | 9,191 | 13,583 | +48% | 1 | 1 | 0% | 1,597 | 4,097 | +157% | 0 | 0 | — |
case-03 | fail→pass | 19,047 | 22,341 | +17% | 1 | 1 | 0% | 4,068 | 4,287 | +5% | 0 | 0 | — |
case-04 | fail→pass | 10,469 | 3,153 | -70% | 1 | 1 | 0% | 1,938 | 1,707 | -12% | 0 | 0 | — |
case-05 | pass→pass | 10,317 | 1,663 | -84% | 1 | 1 | 0% | 1,887 | 1,416 | -25% | 0 | 0 | — |
case-06 | fail→pass | 12,820 | 3,008 | -77% | 1 | 1 | 0% | 2,454 | 1,597 | -35% | 0 | 0 | — |
case-07 | fail→pass | 12,623 | 4,955 | -61% | 1 | 1 | 0% | 1,830 | 1,865 | +2% | 0 | 0 | — |
case-08 | pass→pass | 9,109 | 2,738 | -70% | 1 | 1 | 0% | 1,498 | 1,663 | +11% | 0 | 0 | — |
case-09 | fail→pass | 13,418 | 2,684 | -80% | 1 | 1 | 0% | 2,124 | 1,598 | -25% | 0 | 0 | — |
case-10 | fail→pass | 36,870 | 3,059 | -92% | 1 | 1 | 0% | 1,232 | 1,728 | +40% | 0 | 0 | — |
case-11 | fail→pass | 14,368 | 2,418 | -83% | 1 | 1 | 0% | 2,399 | 1,496 | -38% | 0 | 0 | — |
case-12 | fail→pass | 4,429 | 1,891 | -57% | 1 | 1 | 0% | 623 | 1,435 | +130% | 0 | 0 | — |
case-13 | pass→pass | 14,199 | 4,839 | -66% | 1 | 1 | 0% | 2,124 | 1,988 | -6% | 0 | 0 | — |
case-14 | pass→pass | 15,007 | 3,201 | -79% | 1 | 1 | 0% | 2,442 | 1,649 | -32% | 0 | 0 | — |
case-15 | fail→pass | 18,465 | 4,973 | -73% | 1 | 1 | 0% | 3,012 | 1,940 | -36% | 0 | 0 | — |
case-16 | fail→pass | 8,845 | 1,480 | -83% | 1 | 1 | 0% | 1,170 | 1,411 | +21% | 0 | 0 | — |
case-17 | fail→pass | 12,478 | 2,402 | -81% | 1 | 1 | 0% | 1,741 | 1,450 | -17% | 0 | 0 | — |
case-18 | pass→pass | 11,511 | 3,888 | -66% | 1 | 1 | 0% | 1,809 | 1,661 | -8% | 0 | 0 | — |
case-19 | fail→pass | 12,095 | 2,368 | -80% | 1 | 1 | 0% | 2,026 | 1,543 | -24% | 0 | 0 | — |
case-20 | pass→pass | 10,845 | 5,764 | -47% | 1 | 1 | 0% | 1,746 | 2,320 | +33% | 0 | 0 | — |
case-21 | pass→pass | 26,248 | 21,364 | -19% | 1 | 1 | 0% | 5,841 | 4,652 | -20% | 0 | 0 | — |
case-22 | pass→pass | 12,766 | 12,394 | -3% | 1 | 1 | 0% | 2,119 | 3,302 | +56% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +64 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.