promptfoo-evals
Write, refine, run, and QA promptfoo evaluation suites: promptfooconfig.yaml, prompts, providers, vars, tests, assertions,…
URL search param and hash state management. Use when adding or modifying URL search params, working with useSearchParams, setSearchParams, useSearchParamState, or navigate() with query strings or hash fragments, or fixing browser back/forward button issues.
Claude Code
$ npx -y skills add promptfoo/promptfoo --skill search-params --agent claude-code
Codex
$ npx skills add promptfoo/promptfoo --skill search-params -a codex -y
Cursor
$ npx skills add promptfoo/promptfoo --skill search-params -a cursor -y
Gemini CLI
$ npx skills add promptfoo/promptfoo --skill search-params -a gemini-cli -y
GitHub Copilot
$ npx skills add promptfoo/promptfoo --skill search-params -a github-copilot -y
OpenCode
$ npx skills add promptfoo/promptfoo --skill search-params -a opencode -y
Windsurf
$ npx skills add promptfoo/promptfoo --skill search-params -a windsurf -y
name: search-params description: URL search param and hash state management. Use when adding or modifying URL search params, working with useSearchParams, setSearchParams, useSearchParamState, or navigate() with query strings or hash fragments, or fixing browser back/forward button issues.
When updating the URL (search params or hash), choose between **replace** and **push** based on whether the change represents in-page state or a user-navigable step:
| Change type | Examples | History behavior | | ------------------ | ------------------------------------------------------- | --------------------------------------------------- | | **In-page state** | Filters, sort, pagination, tab switches, search queries | `replace` - don't pollute history | | **Navigable step** | Wizard progression, multi-step forms | `push` - back button should return to previous step | | **Unsure?** | | **Ask the developer** before choosing |
**Why this matters:** Pushing in-page state changes clutters the browser history. Users clicking "back" expect to leave the page, not undo a filter toggle. This is the #1 cause of "back button is broken" bugs.
This hook validates with Zod and **always uses `replace: true` internally**, so you get correct history behavior for free.
import { useSearchParamState } from '@app/hooks/useSearchParamState';
import { z } from 'zod';
const TabSchema = z.enum(['overview', 'details', 'settings']);
const [activeTab, setActiveTab] = useSearchParamState('tab', TabSchema, 'overview');**Key file:** `src/app/src/hooks/useSearchParamState.ts`
When updating multiple params at once, use `setSearchParams` directly but always pass `{ replace: true }` for in-page state:
const [searchParams, setSearchParams] = useSearchParams();
// Updating filters (in-page state -> replace)
setSearchParams(
(params) => {
params.set('status', 'active');
params.set('sort', 'name');
return params;
},
{ replace: true },
);For wizard/multi-step flows where back button should traverse steps, use **push** (the default):
// Wizard step navigation - push so back button works between steps
// See: src/app/src/pages/redteam/setup/page.tsx
const updateHash = (newStep: string) => {
navigate(`#${newStep}`); // push (default) - intentional
};For hash changes that represent in-page state, use replace:
// Tab switch on a detail page - replace to avoid history clutter
navigate(`#${section}`, { replace: true });When the URL needs to be updated to include a new ID after a create/save operation (not a user action), use replace:
// After first save, update URL to include new ID without adding history entry
navigate(`/evals/${newConfigId}`, { replace: true });// WRONG - every filter change adds a history entry
setSearchParams((params) => {
params.set('filter', value);
return params;
});
// WRONG - navigate without replace for state change
navigate(`?tab=${newTab}`);// WRONG - no validation, easy to forget { replace: true }
const [searchParams, setSearchParams] = useSearchParams();
const tab = searchParams.get('tab');
const setTab = (v: string) => {
setSearchParams((p) => {
p.set('tab', v);
return p;
});
};
// RIGHT - use the hook instead
const [tab, setTab] = useSearchParamState('tab', TabSchema, 'overview');// WRONG - useSearchParamState will throw an invariant error
setTab('');
// RIGHT - use null to clear a param
setTab(null);promptfoo is a CLI and library for evaluating and red-teaming LLM-based apps. Stop using trial-and-error... start shipping secure, reliable agents Website · Getting Started · Red Teaming · Documentation · Discord Promptfoo is now part of OpenAI.
Write, refine, run, and QA promptfoo evaluation suites: promptfooconfig.yaml, prompts, providers, vars, tests, assertions,…
Standards for creating redteam plugins and graders. Use when creating new plugins, writing graders, or modifying attack templates.
Connect Promptfoo to a model, live HTTP API, local Python/JavaScript provider, or app code. Use for request/auth mapping,…
Execute, inspect, and rerun an existing Promptfoo redteam scan. Use for generated YAML, result exports, attack success rates,…
Create or refine a Promptfoo redteam config and generate probes from target behavior, code, or OpenAPI evidence. Use for purpose,…
Produce the "Playwright 1.xx API Review" artifact for a range of commits - the public API additions and the breaking or behavior…
DeepEval evaluation workflow for AI agents and LLM applications. TRIGGER when the user wants to evaluate or improve an AI agent,…
Development workflows for the playwright-cli repository. Use when the user asks about rolling dependencies, releasing, or other…