agentleFS
badhopebadhope/AI-SKILL/skills/deepeval-eval-suite/SKILL.md

deepeval Pytest Eval Suite

Skill11 starsChanged 6 months agoMITView on GitHub

Targeted fix to attempt next round

  • Reads credentials

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use deepeval-tracing first.

    line 169
  2. Very specific:

    The user wants a one-off prompt grading: Use a notebook or the deepeval CLI directly.

    line 174

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “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

When to use

You're adding a repeatable eval loop to an AI application (LLM app, agent, RAG pipeline, chatbot). You want a committed pytest suite — not a notebook or a throwaway script — that you can re-run after every change, with metrics, a dataset, and failure traces you can actually look at.

This is the pytest + deepeval test run path. It's separate from deepeval-tracing (which is just the instrumentation) and deepeval-otel (raw OpenTelemetry without the deepeval package). You need the instrumentation done first if you want traced evals.

The job is: pick the right test shape (chatbot / agent / RAG / single-turn), pick the right metrics for that shape, reuse the dataset if it exists or generate one with deepeval generate, run the suite with deepeval test run, and iterate on failures for N rounds.

Don't use this skill for non-AI software or for ad-hoc "is this prompt OK" checks. The pytest suite is the deliverable. For one-off prompt grading, just run the metric in a notebook.

Inputs

FieldRequiredNotes
use_caseyesExactly one. Drives test shape.
dataset_sourceyesexisting or generate. Never hand-roll.
eval_modelyesThe judge. Separate creds from the app's model.
tracingyestrue when an integration exists.
confident_aiyestrue when reports / dashboards are wanted.
iteration_roundsyesDefault 5. Capped 10.

Output

Plain-text confirmation of what was created and the latest run status. Typical return:

Created:
  tests/evals/test_single_turn_tracing.py
  tests/evals/metrics.py
  tests/evals/datasets/qa_v1.json
Latest run: 18/20 passing (90%), 2 failures
Top failure: Answer Relevancy on prompts asking for pricing
Next change: tighten system prompt to refuse off-topic
             pricing questions explicitly; rerun round 2/5

Prompt

You are building a pytest eval suite for an AI app with DeepEval.
Follow the steps in order. Do not skip the intake questions.

1. Inspect the codebase.
   Grep for framework imports, model calls, existing DeepEval
   metrics, and any committed dataset (look for `*.json` with
   `input` / `expected_output` keys in `tests/evals/datasets/`
   or `data/evals/`). If DeepEval is already in use, KEEP its
   existing metrics and thresholds unless the user explicitly
   asks to change them.

2. Ask the intake questions before writing any test code:
   - Which use case: chatbot, multi-turn agent, agent, RAG, or
     single-turn LLM? (Pick exactly one; precedence is
     chatbot / multi-turn-agent > agent > rag.)
   - Dataset: does the user already have a committed dataset, or
     should we run `deepeval generate`?
   - Eval model: which model is the judge / scorer? (Separate
     from the app's own model.)
   - Tracing: should each test case capture a trace? (Default
     `true` when a supported integration exists.)
   - Confident AI: should results push to Confident AI for
     hosted reports? (Requires `CONFIDENT_API_KEY` or `deepeval
     login`.)
   - Iteration rounds: how many failure → fix → rerun cycles?
     (Default 5. Cap 10.)

3. Choose the test shape. The skill uses these templates:
     - chatbot / multi-turn agent  → `templates/test_multi_turn_e2e.py`
     - agent / RAG / single-turn, tracing available
                                    → `templates/test_single_turn_tracing.py`
     - single-turn, no tracing
                                    → `templates/test_single_turn_no_tracing.py`
   Do not write a single-turn test when the use case is multi-turn.
   Do not skip tracing when an integration is available.

4. Choose metrics. Put metric instances in a separate
   `tests/evals/metrics.py` module — NOT inline in the test
   file. Reuse the project's existing metrics module if there
   is one. Pick from:
     - General: Answer Relevancy, Faithfulness, Hallucination
     - RAG: Contextual Precision / Recall / Relevancy
     - Agent: Tool Correctness, Task Completion, Plan Quality
     - Chatbot: Knowledge Retention, Role Adherence, Conversation Completeness

5. Prepare the dataset.
     - If `dataset_source = existing`, read the existing
       `*.json` and reuse it. Do not regenerate.
     - If `dataset_source = generate`, run `deepeval generate`
       with the target model and the chosen source corpus.
       Do not hand-write goldens.

6. If `tracing = true` AND no deepeval-tracing has been done,
   STOP and tell the user to run the deepeval-tracing skill
   first. Traced evals need the app instrumented.

7. Run the suite.
     - Use `deepeval test run tests/evals/` — NOT bare `pytest`.
       `deepeval test run` is what wires the metrics, the
       dataset, and the (optional) Confident AI push.
     - Capture pass rate and per-test failures.
     - If `confident_ai = true`, the report link is the next
       step for the user; surface it.

8. Iterate for `iteration_rounds` rounds (default 5).
   For each round:
     a. Read the failure details + (if `tracing`) the trace.
     b. Pick the SINGLE highest-leverage change — a system prompt
        tweak, a retrieval re-rank, a tool signature fix.
     c. Apply it. Don't bundle multiple changes in one round.
     d. Rerun. If pass rate drops, revert that round and pick a
        different change.
   Stop when pass rate plateaus, target metric thresholds are
   met, or rounds are exhausted.

9. Final report: test files created, metric module, dataset path,
   final pass rate, and a one-line summary of what changed
   across rounds.

When NOT to use

  • The target is not an AI app. DeepEval metrics describe LLM / agent behaviour. Running them on a regular CRUD app is meaningless.
  • You want to instrument the app, not build a test suite. Use deepeval-tracing first. This skill assumes that step is done (when tracing = true).
  • You want to define metrics inline in the test file. Metric instances belong in a separate metrics.py module so multiple test files can import them. This is a hard rule, not taste.
  • The user wants a one-off prompt grading. Use a notebook or the deepeval CLI directly. A pytest suite is overkill for a single check.
  • You can't decide between tracing and no-tracing without user input. Default to tracing = true when a supported integration exists; ask otherwise.
  • You have access to PII or secrets in the eval corpus. The dataset is uploaded to Confident AI if confident_ai = true. Redact before committing.

Example

Input:

use_case: agent
dataset_source: generate
eval_model: gpt-4.1
tracing: true
confident_ai: true
iteration_rounds: 3

Output:

Created:
  tests/evals/test_single_turn_tracing.py
  tests/evals/metrics.py
  tests/evals/datasets/agent_v1.json
Run 1/3: 12/15 (80%); failures: Tool Correctness on 'search_orders'
Change: tighten tool signature to require `order_id: str`; rerun
Run 2/3: 14/15 (93%); failure: Task Completion on 'refund_request'
Change: add explicit refund-policy tool to agent prompt; rerun
Run 3/3: 15/15 (100%)
Report: https://app.confident-ai.com/evals/runs/abc123

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.