Skip to content

Add promptfoo eval infrastructure for skills - #28

Open
sachiniSam wants to merge 2 commits into
wso2:mainfrom
sachiniSam:promptfooEval
Open

Add promptfoo eval infrastructure for skills#28
sachiniSam wants to merge 2 commits into
wso2:mainfrom
sachiniSam:promptfooEval

Conversation

@sachiniSam

Copy link
Copy Markdown
Contributor

What

Introduces the "how to evaluate skills" tooling and docs so contributors can add a promptfoo eval suite for any skill.

  • EVALS.md — contributor guide: suite layout, prerequisites, and the scaffold → sync → run workflow.
  • tools/scaffold-eval.js — generates a starter eval suite (config, triggering + task-quality tests, fixtures) for a given <plugin> <skill>.
  • tools/sync-fixtures.js — refreshes the fixture workspace copies from the live skill.
  • AGENTS.md / CLAUDE.md / DEVELOPMENT.md — wire evals into the skill-authoring flow and directory-layout docs.

Scope

This PR is the generic infrastructure only. The api-design reference suite is intentionally not included — it lands separately once its tests are finalized.

How it works

An eval runs a skill the way it runs in production: the agent SDK discovers the skill from a fixture workspace and invokes it, then assertions check both triggering (does it activate on the right prompts / stay out of the way on the wrong ones) and task quality (is the output correct). Promptfoo is a dev/test tool here — configs and fixtures are shipped, contributors run promptfoo locally.

🤖 Generated with Claude Code

Introduce the "how to evaluate skills" tooling and docs so contributors
can add a promptfoo eval suite for any skill:

- EVALS.md: contributor guide (layout, prerequisites, scaffold/sync/run)
- tools/scaffold-eval.js: generate a starter suite for a skill
- tools/sync-fixtures.js: refresh fixture copies from the live skill
- AGENTS.md / CLAUDE.md / DEVELOPMENT.md: wire evals into the
  skill-authoring and directory-layout docs

The api-design reference suite is intentionally left out of this commit;
it will land separately once its tests are finalized.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary

  • Introduced generic Promptfoo evaluation infrastructure for agent skills, including per-skill documentation and a consistent evals directory layout.
  • Added tools/scaffold-eval.js to generate starter evaluation suites (triggering/routing and task-quality tests), along with provider-specific fixture workspace scaffolding.
  • Added tools/sync-fixtures.js to refresh fixture workspace copies from the live skill contents, supporting targeted runs and bulk --all sync with warnings for missing SKILL.md.
  • Updated contributor/development guides (AGENTS.md, CLAUDE.md, DEVELOPMENT.md) to incorporate eval suite creation and running as part of skill authoring.
  • Created EVALS.md covering prerequisites, workflow (scaffold → sync → run), test dimensions, execution guidance, and known provider-specific gotchas; excluded the api-design reference suite for separate follow-up work.

Walkthrough

Adds repository guidance for Promptfoo-based skill evaluations, including suite structure, test expectations, execution, tracing, and fixture maintenance. Adds a scaffolding CLI that generates provider-specific eval suites with starter tests and configuration. Adds a synchronization CLI that refreshes fixture copies for individual skills or all eligible skills. Updates contributor documentation to reference the new evaluation workflow.

Sequence Diagram(s)

sequenceDiagram
  participant Contributor
  participant ScaffoldEval
  participant SkillWorkspace
  participant Promptfoo
  Contributor->>ScaffoldEval: Provide plugin, skill, providers, and grader
  ScaffoldEval->>SkillWorkspace: Validate skill and create fixture copies
  ScaffoldEval-->>Contributor: Generate eval configuration and starter tests
  Contributor->>Promptfoo: Run the skill evaluation suite
  Promptfoo->>SkillWorkspace: Discover provider-specific fixtures
  Promptfoo-->>Contributor: Return triggering and task-quality results
Loading

Suggested reviewers: gigara, hevayo

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change at a high level but omits most required template sections such as Purpose, Goals, Release note, tests, and security checks. Add the missing template sections and fill in concise details for purpose, goals, approach, user stories, release note, documentation, tests, security, and related items.
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding promptfoo evaluation infrastructure for skills.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
EVALS.md (1)

13-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Specify a language for the fenced code block.

Specifying a language resolves the linter warning.

♻️ Proposed fix
-```
+```text
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@EVALS.md` at line 13, Specify the appropriate language identifier on the
fenced code block in EVALS.md, using text if the block contains plain text, to
resolve the linter warning.

Source: Linters/SAST tools

DEVELOPMENT.md (1)

110-110: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Specify a language for the fenced code block.

Specifying a language resolves the linter warning and improves syntax highlighting.

♻️ Proposed fix
-```
+```bash
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@DEVELOPMENT.md` at line 110, Specify the Bash language on the fenced code
block in DEVELOPMENT.md by changing the opening fence to use the bash language
identifier, while preserving the block’s existing contents and closing fence.

Source: Linters/SAST tools

tools/sync-fixtures.js (1)

29-31: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Prevent early termination during batch processing.

When syncSkill is called via the --all flag, a missing SKILL.md triggers fail(), which terminates the script and prevents any remaining valid skills from syncing. Logging an error and returning 0 allows the batch process to continue gracefully.

♻️ Proposed fix
   if (!fs.existsSync(path.join(skillDir, 'SKILL.md'))) {
-    fail(`no SKILL.md at plugins/${plugin}/skills/${skill}`);
+    console.error(`  (error) no SKILL.md at plugins/${plugin}/skills/${skill}`);
+    return 0;
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/sync-fixtures.js` around lines 29 - 31, Update syncSkill’s
missing-SKILL.md branch to log an error instead of calling fail(), then return 0
so --all batch processing continues with remaining skills while preserving the
existing successful sync behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tools/scaffold-eval.js`:
- Around line 102-104: Update the positional-argument validation near plugin and
skill so both values are restricted to safe directory-name components before any
downstream path construction. Reject values containing path separators,
traversal segments, or other invalid path characters, and call fail(USAGE)
consistently with the existing missing-argument handling.

In `@tools/sync-fixtures.js`:
- Around line 84-87: Update the CLI argument validation around `plugin` and
`skill` to reject either input when it contains path separators, while
preserving the existing missing-argument usage failure and `--all` handling.
Keep subsequent file operations limited to validated directory-name inputs.

---

Nitpick comments:
In `@DEVELOPMENT.md`:
- Line 110: Specify the Bash language on the fenced code block in DEVELOPMENT.md
by changing the opening fence to use the bash language identifier, while
preserving the block’s existing contents and closing fence.

In `@EVALS.md`:
- Line 13: Specify the appropriate language identifier on the fenced code block
in EVALS.md, using text if the block contains plain text, to resolve the linter
warning.

In `@tools/sync-fixtures.js`:
- Around line 29-31: Update syncSkill’s missing-SKILL.md branch to log an error
instead of calling fail(), then return 0 so --all batch processing continues
with remaining skills while preserving the existing successful sync behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6a653972-12dc-43c1-aa16-124bca4a309b

📥 Commits

Reviewing files that changed from the base of the PR and between 27b7da1 and 2074829.

📒 Files selected for processing (6)
  • AGENTS.md
  • CLAUDE.md
  • DEVELOPMENT.md
  • EVALS.md
  • tools/scaffold-eval.js
  • tools/sync-fixtures.js

Comment thread tools/scaffold-eval.js
Comment thread tools/sync-fixtures.js
- scaffold-eval.js / sync-fixtures.js: validate <plugin>/<skill> as plain
  directory names before using them as path segments
- sync-fixtures.js: skip (warn) instead of fail() on a missing SKILL.md so
  a single bad entry no longer aborts a --all run
- EVALS.md / DEVELOPMENT.md: add languages to fenced code blocks

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
DEVELOPMENT.md (1)

20-20: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Qualify the “each skill” eval-suite claim.

The PR objective states that the api-design reference suite is intentionally excluded, so saying every skill carries an evals/ suite is currently inaccurate. Qualify this as applying to eligible/new skills or document the exception explicitly.

Proposed wording
-        evals/                    — promptfoo eval suite for the skill (see EVALS.md)
+        evals/                    — promptfoo eval suite for eligible skills (see EVALS.md)

-Each skill carries a promptfoo eval suite under `evals/` that runs the skill the
+Eligible skills carry a promptfoo eval suite under `evals/` that runs the skill the

As per path instructions, this is a concise documentation correctness fix.

Also applies to: 106-108

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@DEVELOPMENT.md` at line 20, Update the DEVELOPMENT.md description of the
evals/ directory to qualify the claim that each skill has an eval suite,
limiting it to eligible or new skills and explicitly acknowledging the excluded
api-design reference suite. Apply the same wording correction to the
corresponding repeated references.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@DEVELOPMENT.md`:
- Line 20: Update the DEVELOPMENT.md description of the evals/ directory to
qualify the claim that each skill has an eval suite, limiting it to eligible or
new skills and explicitly acknowledging the excluded api-design reference suite.
Apply the same wording correction to the corresponding repeated references.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e67cbf78-8736-4506-a763-593ce0333cac

📥 Commits

Reviewing files that changed from the base of the PR and between 2074829 and f0ca113.

📒 Files selected for processing (4)
  • DEVELOPMENT.md
  • EVALS.md
  • tools/scaffold-eval.js
  • tools/sync-fixtures.js
🚧 Files skipped from review as they are similar to previous changes (3)
  • tools/sync-fixtures.js
  • tools/scaffold-eval.js
  • EVALS.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant