Evaluate Code Generation with Claude
A prompt workflow that runs Promptfoo evaluations against Anthropic Messages API using an existing local Claude Code session instead of creating a separate API
Why it matters
Streamline your code generation and review process by leveraging Promptfoo to evaluate Anthropic's Claude API. This asset enables automated testing and quality assurance for your code generation tasks.
Outcomes
What it gets done
Run Promptfoo evaluations against the Anthropic Messages API.
Utilize model-graded assertions for code quality assessment.
Reuse existing local Claude Code sessions for API interactions.
Automate code generation and review workflows.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/pfoo-claude-code-session | bash Capabilities
What this chain does
Analyzes code for bugs, style issues, and improvements.
Traces errors to their root cause and suggests fixes.
Writes source code or scripts from a description.
Overview
Claude Code Session
What it does
This prompt chain enables Promptfoo evaluations against the Anthropic Messages API by leveraging an existing local Claude Code session. It supports llm-rubric model-graded assertions and eliminates the need to create or manage a separate Anthropic Console API key. The workflow connects Promptfoo's testing framework directly to your active Claude Code environment.
How it connects
Use this when you want to run prompt evaluations against Claude models but prefer to reuse your existing Claude Code session rather than set up additional API credentials. Ideal for developers who already work in Claude Code and need to integrate prompt testing into their workflow without credential overhead.
Source README
This example shows how to run Promptfoo evals against the Anthropic Messages API - including llm-rubric model-graded assertions - by reusing an existing local Claude Code session instead of creating a separate Anthropic Console API key.
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.