llm-engineering

Provide LLM application development patterns for prompts, structured outputs, and observability.

1|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/aleonsa/claude-config --skill llm-engineering-aleonsa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: llm-engineering
Source: https://github.com/aleonsa/claude-config/tree/main/claude/skills/llm-engineering
Command: npx skills add https://github.com/aleonsa/claude-config --skill llm-engineering-aleonsa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires instructor, anthropic, pydantic, tiktoken, langfuse, fastapi, and includes references (resource) components.

What problem does it solve?

This Skill provides best practices and code patterns for building robust, efficient, and observable LLM-powered applications, addressing common challenges in prompt design, structured output generation, tool use, context management, and cost optimization.

Core Features & Use Cases

  • Prompt Engineering: Techniques for designing effective system and user prompts, including structured formats and versioning.
  • Structured Outputs: Using libraries like instructor with Pydantic for reliable data extraction and tool calling.
  • Context Management: Strategies for handling conversation history and token limits, such as trimming and rolling summaries.
  • Observability & Cost: Implementing logging, cost tracking, and integration with tools like Langfuse.
  • Use Case: When developing a customer support chatbot, use these patterns to ensure consistent, structured responses, manage long conversations efficiently, and monitor operational costs.

Quick Start

Use the llm-engineering skill to analyze a user review and extract sentiment, score, and key issues into a structured format.

Frequently Asked Questions about llm-engineering

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

FAQPage Schema
How do I get structured outputs from LLMs using Pydantic?

To get structured outputs from LLMs, use the instructor library with Pydantic models for reliable data extraction. This pattern ensures type-safe responses by validating generated text against your defined schema during application development.

What's the best way to manage context window limits and long conversation history in LLM apps?

Manage context window limits by implementing token trimming and rolling summaries for long conversation history. This approach uses tiktoken to track token counts and condenses older messages, keeping total token counts within model limits.

How do I track LLM API costs and monitor application observability?

Track LLM API costs and monitor observability by integrating Langfuse into your application. This setup provides detailed logging, operational cost tracking, and performance monitoring for production-ready LLM systems to identify usage bottlenecks.

Does Anthropic tool use support retry logic for failed API calls?

Anthropic tool use supports retry logic to handle failed API calls and transient errors. Implementing retry mechanisms ensures robust execution when integrating external functions, preventing complete application failure during intermittent network issues.

How do I implement prompt caching and PII scrubbing for production LLM systems?

Implement prompt caching to reduce repeated token processing costs and apply PII scrubbing to remove sensitive data before sending requests. These techniques optimize operational expenses and maintain data privacy in production LLM systems.

Can I use FastAPI with instructor for streaming responses and model selection routing?

FastAPI pairs with instructor to deliver streaming responses and handle model selection routing. This architecture dynamically directs requests to appropriate models based on task complexity while serving real-time token generation to end users.