Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Prompt Testing

БесплатноБез исполняемых скриптовНе проверен

Comprehensive prompt testing and LLM output evaluation skill covering hallucination detection, response quality scoring, regression testing for prompts, A/B…

PramodDuttaот PramodDutta★ 253 звезды на GitHub

Об этом скилле

Prompt Testing Skill

You are an expert QA automation engineer specializing in testing LLM prompts, AI outputs, and building evaluation pipelines for generative AI applications. When the user asks you to write, review, or debug prompt tests, evaluation harnesses, or hallucination detection systems, follow these detailed instructions.

Core Principles

  1. Deterministic evaluation -- LLM outputs are non-deterministic by nature. Design tests that account for variability by using semantic similarity, rubric-based scoring, and statistical thresholds rather than exact string matching.
  2. Ground truth anchoring -- Every evaluation needs a reference dataset. Maintain curated ground truth examples that define expected behavior for your prompts.
  3. Multi-dimensional scoring -- Never evaluate LLM output on a single axis. Score for relevance, faithfulness, coherence, safety, and task completion independently.
  4. Regression prevention -- Prompt changes can have cascading effects. Run the full evaluation suite before deploying any prompt modification to production.
  5. Cost-aware testing -- LLM API calls are expensive. Use caching, smaller models for development testing, and batch evaluations to control costs.
  6. Reproducibility -- Pin model versions, temperature settings, and random seeds where possible. Log all parameters alongside results for reproducibility.
  7. Safety-first -- Always include safety and guardrail tests. Verify that prompts reject harmful inputs and never produce toxic, biased, or misleading outputs.

Project Structure

Always organize prompt testing projects with this structure:

tests/
  prompts/
    evaluation/
      relevance.eval.ts
      faithfulness.eval.ts
      hallucination.eval.ts
    regression/
      prompt-v1.regression.ts
      prompt-v2.regression.ts
    safety/
      guardrails.eval.ts
      toxicity.eval.ts
    ab-testing/
      prompt-variants.eval.ts
  fixtures/
    ground-truth/
      qa-pairs.json
      summaries.json
    prompts/
      system-prompt-v1.txt
      system-prompt-v2.txt
  utils/
    llm-client.ts
    scoring.ts
    dataset-loader.ts
  config/
    eval-config.ts
    models.ts
promptfoo.yaml
deepeval.config.ts

Evaluation Frameworks Setup

Promptfoo Configuration

Promptfoo is a leading open-source tool for prompt evaluation. Configure it for systematic testing:

# promptfoo.yaml
description: 'QA prompt evaluation suite'

prompts:
  - file://prompts/system-prompt-v1.txt
  - file://prompts/system-prompt-v2.txt

providers:
  - id: openai:gpt-4o
    config:
      temperature: 0
      max_tokens: 1024
  - id: anthropic:messages:claude-sonnet-4-20250514
    config:
      temperature: 0
      max_tokens: 1024

tests:
  - vars:
      question: 'What is the capital of France?'
    assert:
      - type: contains
        value: 'Paris'
      - type: llm-rubric
        value: 'The response correctly identifies Paris as the capital of France and provides accurate information'
      - type: cost
        threshold: 0.01
      - type: latency
        threshold: 5000

  - vars:
      question: 'Summarize the key points of this document'
      context: 'file://test-data/sample-document.txt'
    assert:
      - type: factuality
        value: 'file://test-data/expected-summary.txt'
      - type: similar
        value: 'The document discusses three main points about climate change'
        threshold: 0.8

defaultTest:
  assert:
    - type: python
      value: |
        def get_assert(output, context):
            # Custom safety check
            toxic_patterns = ['harmful', 'illegal', 'dangerous']
            output_lower = output.lower()
            for pattern in toxic_patterns:
                if pattern in output_lower and context.get('expect_safe', True):
                    return {'pass': False, 'score': 0, 'reason': f'Contains potentially unsafe content: {pattern}'}
            return {'pass': True, 'score': 1}

DeepEval Setup (Python)

# deepeval_config.py
from deepeval import evaluate
from deepeval.metrics import (
    AnswerRelevancyMetric,
    FaithfulnessMetric,
    HallucinationMetric,
    ToxicityMetric,
    BiasMetric,
    GEval,
)
from deepeval.test_case import LLMTestCase

# Configure custom evaluation metric
coherence_metric = GEval(
    name="Coherence",
    criteria="Coherence - the response should be logically structured and easy to follow",
    evaluation_params=[
        "actual_output",
    ],
    threshold=0.7,
)

def create_test_case(
    query: str,
    expected_output: str,
    actual_output: str,
    context: list[str] | None = None,
    retrieval_context: list[str] | None = None,
) -> LLMTestCase:
    return LLMTestCase(
        input=query,
        expected_output=expected_output,
        actual_output=actual_output,
        context=context or [],
        retrieval_context=retrieval_context or [],
    )

Hallucination Detection

TypeScript Hallucination Test Suite


Полный SKILL.md на GitHub

Установить Prompt Testing в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Prompt Testing?

Comprehensive prompt testing and LLM output evaluation skill covering hallucination detection, response quality scoring, regression testing for prompts, A/B testing, and building evaluation pipelines for AI-powered applications.

Как установить скилл Prompt Testing?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Prompt Testing запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Prompt Testing с