agentleFS
blackbenjaminblackbenjamin/etps/.claude/skills/llm-integration/SKILL.md

llm-integration

Skill1 starsChanged 11 months agoMITView on GitHub

Integrate Claude and GPT-4o LLMs, manage prompts, handle responses, and implement critic loops. Use when working with LLM services, prompt templates, quality evaluation, or AI-powered features.

  • Reads credentials

12 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ci-cd-pipelines, database-design and 3 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • harrissohail6Skill

    ci-cd-pipelines

    CI/CD pipeline design and implementation. Auto-activates when discussing deployment, automation, or pipelines.

    Also in 3 projects that use this

  • harrissohail6Skill

    database-design

    Database schema design and SQL best practices. Use when designing tables, writing queries, or optimizing database performance.

    Also in 3 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 5 projects that use this

  • Microsoft AzureSkill

    git-workflow

    Squad branching model: dev-first workflow with insiders preview channel

    Also in 6 projects that use this

  • NVIDIASkill

    testing

    Run Python and Rust tests for physicsnemo-curator using uv + pytest with coverage reporting via pytest-cov, and cargo-nextest for Rust tests. Includes benchmark workflows with pytest-benchmark and criterion.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Truthfulness: No hallucinations, matches source data

    line 51
  2. Distinctive:

    Always use async/await for LLM calls

    line 70
  3. Distinctive:

    Use MockLLM in tests, never call real APIs

    line 72

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

LLM Integration for ETPS

LLM Architecture

  • Primary: Claude (via Anthropic API)
  • Fallback: GPT-4o
  • Embeddings: text-embedding-3-small (OpenAI)
  • Mock for testing: backend/services/llm/mock_llm.py

Key Files

backend/services/llm/
├── __init__.py      # create_llm() factory
├── base.py          # Abstract base class
├── mock_llm.py      # Testing mock (no API calls)
└── claude_llm.py    # Claude API implementation

LLM Factory Pattern

from services.llm import create_llm

# Auto-selects based on ANTHROPIC_API_KEY env var
llm = create_llm()  # Returns ClaudeLLM or MockLLM

# Use in async context
response = await llm.generate(prompt="...", max_tokens=500)

Critic Loop Pattern

The critic service evaluates output quality:

from services.critic import evaluate_content

result = await evaluate_content(
    content=generated_text,
    content_type="resume",  # or "cover_letter"
    job_profile=job_profile,
    llm=llm
)
# Returns: CriticResult with scores, issues, suggestions

Quality Dimensions

  • ATS Score: Keyword matching, format compatibility
  • Style: Follows docs/cover_letter_style_guide.md
  • Truthfulness: No hallucinations, matches source data
  • Tone: Professional, confident, not sycophantic

Testing with Mock LLM

from services.llm.mock_llm import MockLLM

@pytest.mark.asyncio
async def test_with_mock():
    mock_llm = MockLLM()
    result = await my_service(llm=mock_llm)
    # Mock returns template-based responses

Environment Variables

  • ANTHROPIC_API_KEY - Enables Claude (required for production)
  • OPENAI_API_KEY - For embeddings

Best Practices

  1. Always use async/await for LLM calls
  2. Pass LLM instance as parameter (dependency injection)
  3. Use MockLLM in tests, never call real APIs
  4. Implement retry logic for API failures
  5. Log prompts/responses for debugging (not in prod)
  6. Set appropriate max_tokens to control cost

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.