.claude/skills/llm/SKILL.md
Guidelines for implementing LLM (Language Model) functionality in the application
npx skillsauth add elie222/inbox-zero llmInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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/usage.ts - Usage tracking and monitoringFollow this standard structure for LLM-related functions:
import { 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";
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 = getModel(emailAccount.user);
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;
}
System and User Prompts:
Schema Validation:
Logging:
Error Handling:
withRetryInput Formatting:
Type Safety:
Code Organization:
AI-First Behavior:
Draft Attribution Versioning:
apps/web/utils/ai/reply/draft-attribution.ts DRAFT_PIPELINE_VERSIONSee llm-test.mdc
tools
Use the Inbox Zero API CLI to inspect the live API schema, list and manage automation rules, and read inbox analytics through the public API. Use this when a task involves Inbox Zero rules, stats, or API-driven automation and can be solved through the CLI instead of browser interaction.
tools
Write focused unit tests for backend and utility logic
testing
Pause execution for a user-specified duration
testing
Update workspace packages while respecting the repo's pinned package list in .ncurc.cjs. Use when the user asks to update dependencies or refresh package versions.