Prompt Chain

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

Works with anthropic

81
Spark score
out of 100
Updated 17 days ago
Version 1.0.0
Models

Add to Favorites

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

01

Run Promptfoo evaluations against the Anthropic Messages API.

02

Utilize model-graded assertions for code quality assessment.

03

Reuse existing local Claude Code sessions for API interactions.

04

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

Review code

Analyzes code for bugs, style issues, and improvements.

Debug

Traces errors to their root cause and suggests fixes.

Generate code

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.