giskard-checks-new-check
Guides implementation of new or changed eval checks in the giskard-checks package—Check subclasses, discriminated kind registration, public exports, and…
by Giskard-AI★ 5,976 GitHub stars
Install giskard-checks-new-check in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
giskard-checks — new check
Scope
Library code lives under libs/giskard-checks/. Follow existing patterns; use absolute imports inside giskard.checks. Python 3.12+, Pydantic v2.
Read project rules when relevant: libs/giskard-checks/.cursor/rules/02-project.mdc, 03-development.mdc.
Classify the check
| Kind | Module | Base class |
|---|---|---|
| Deterministic (string, numeric, custom logic on trace) | src/giskard/checks/builtin/ |
Check (often shared helpers in existing builtins) |
| Uses LLM to score or classify | src/giskard/checks/judges/ |
BaseLLMCheck |
For one-off or experimental logic, users can use from_fn / FnCheck without a new class—only add a new type when it is a reusable, serializable primitive.
JSONPath fields (key and *_key)
Naming and typing (required)
Any Check field named key or whose name ends with _key is a JSONPath into the trace. It must be annotated with JSONPathStr, or JSONPathStr | None, or JSONPathStr | MISSING (import MISSING from pydantic.experimental.missing_sentinel). Otherwise tests/core/test_jsonpath_enforcement.py fails.
Inside the library, import from ..core.extraction (module giskard.checks.core.extraction).
Path syntax
- Every path must start with
trace.(validated at model construction viajsonpath_ng). - Resolution runs against
{"trace": trace.model_dump()}. Prefertrace.last.outputs,trace.last.inputs,trace.last.metadata.*over brittle indices;trace.lastis the usual default for “current turn” data.
Reading values
resolve(trace, key)— Use when the value always comes from the trace (e.g. the subjecttarget_key).provided_or_resolve(trace, key=..., value=...)— Use when the user may pass an inline value or fall back to a path (e.g.keyword+keyword_key). Ifvalue is not MISSING, that wins; otherwise the path is evaluated.
Naming JSONPath fields
- The field naming the value under test is always
target_key(matches the Giskard Hub). It is the only accepted name for that selector and serializes astarget_key. - Every other JSONPath field is
{static}_key, named after the sibling static field holding the literal it would otherwise resolve (keyword/keyword_key,context/context_key). - Both rules are enforced by
tests/core/test_key_naming_convention.py.
Optional inline-or-path fields: type as T | MISSING = MISSING (and JSONPathStr | MISSING = MISSING for optional *_key fields). Pass fields directly to provided_or_resolve; validate combinations with a @model_validator if only one of (inline, *_key) may be set (see StringMatching / ComparisonCheck). Do not use None to mean "extract from trace"—omit the field so it stays MISSING. Explicit None is only valid when comparing against or supplying None as a real value (e.g. Equals(expected_value=None)).
Failures and types
- Missing matches become
NoMatch. Check withisinstance(x, NoMatch)and returnCheckResult.errorwith a message that names the field/key (structural — the assertion could not be evaluated). The same applies to wrong type for the configured mode, unsupported comparison, and similar preconditions. - When the assertion runs and does not hold, return
CheckResult.failure. - Some paths return a list (multiple matches or list-producing JSONPath). See
resolveincore/extraction.pyif the check must treat collections differently.
Defaults
Use Field(default="trace.last.outputs", ...) (or another sensible default) so typical scenarios need no extra configuration.
More detail: reference.md.
Implementation checklist
Kind string — Pick a unique snake_case discriminator. Search the repo for
@Check.register("to avoid duplicates.Class — Subclass
Check[...]orBaseLLMCheck[...]from..core.check/..judges.base. Use PydanticFieldfor config. For non-LLM checks, implementasync def run(self, trace: TraceType) -> CheckResult(useCheckResult.success/CheckResult.failure/CheckResult.error; put extra data indetails=when useful).Registration — Decorate with
@Check.register("your_kind")on the class definition.Wire imports so the kind is registered — Discriminated unions only know subclasses that were imported. Add an import of the new module to the appropriate package
__init__.py(e.g.builtin/__init__.pyre-exports;judges/__init__.pyfor judges). Updatesrc/giskard/checks/__init__.pyexports and__all__if the type is public API.JSONPath fields — Follow the section above for every
key/*_key; run tests sotest_jsonpath_enforcementpasses.Tests — Add
tests/builtin/test_<feature>.pyor extend an existing file (e.g.test_judge.py). Mirror package layout. Usepytestand async tests whererunis async. Cover pass, fail, and edge cases (missing values, wrong types).**Validate
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- reference.md
FAQ
What does the giskard-checks-new-check skill do?
Guides implementation of new or changed eval checks in the giskard-checks package—Check subclasses, discriminated kind registration, public exports, and tests. Use when adding or modifying built-in checks, LLM-based judges, @Check.register kinds, serialization of TestCase or Scenario, or when editing files under libs/giskard-checks/src/giskard/checks related to checks.
How do I install the giskard-checks-new-check skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the giskard-checks-new-check skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…