Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
A comprehensive collection of Agent Skills for context engineering, multi-agent architectures, and production agent systems.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
examples/llm-as-judge-skills/examples/generate-rubric.ts
1/**2* Rubric Generation Example3*4* Demonstrates how to generate evaluation rubrics for custom criteria.5*6* Run: npx tsx examples/generate-rubric.ts7*/89import 'dotenv/config';10import { EvaluatorAgent } from '../src/agents/evaluator.js';11import { validateConfig } from '../src/config/index.js';1213async function main() {14validateConfig();1516const agent = new EvaluatorAgent();1718console.log('=== Rubric Generation Example ===\n');1920// Generate a rubric for code review21const result = await agent.generateRubric({22criterionName: 'Code Readability',23criterionDescription: 'How easy the code is to read, understand, and maintain',24scale: '1-5',25domain: 'software engineering',26includeExamples: true,27strictness: 'balanced'28});2930if (result.success) {31console.log(`Criterion: ${result.criterion.name}`);32console.log(`Description: ${result.criterion.description}`);33console.log(`Scale: ${result.scale.min}-${result.scale.max}`);34console.log(`Domain: ${result.metadata.domain || 'General'}`);35console.log(`Strictness: ${result.metadata.strictness}`);3637console.log('\n--- Score Levels ---\n');38result.levels.forEach(level => {39console.log(`[${level.score}] ${level.label}`);40console.log(` ${level.description}`);41console.log(` Characteristics:`);42level.characteristics.forEach(c => console.log(` - ${c}`));43if (level.example) {44console.log(` Example: ${level.example.slice(0, 100)}...`);45}46console.log();47});4849console.log('--- Scoring Guidelines ---');50result.scoringGuidelines.forEach((g, i) => {51console.log(`${i + 1}. ${g}`);52});5354console.log('\n--- Edge Cases ---');55result.edgeCases.forEach(ec => {56console.log(`\nSituation: ${ec.situation}`);57console.log(`Guidance: ${ec.guidance}`);58});5960console.log(`\nGeneration Time: ${result.metadata.generationTimeMs}ms`);61} else {62console.error('Rubric generation failed');63}64}6566main().catch(console.error);6768