/yka-code:evals-firstfrom yka-code
[yka-code] Enforce eval-first discipline for LLM-touching code. Use when the task ships prompt text, skill logic, hook behavior, agent instructions, or any string a Claude Code session will read and act on. Writes a failing eval BEFORE the implementation. Red → Green loop using `claude -p` subprocess harness (Claude Max subscription, no Anthropic API key). Complements `test-driven-development` (which covers unit logic) with LLM-behavioral regression coverage.
Ships in yka-code. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Prompt / skill / hook / agent-instruction code has no compiler and no type system. The only regression signal is a run: feed a fixture in, observe what Claude does, compare against expected behavior.
This skill makes writing the eval the first step — before you touch the prompt.
Load this skill when the work touches ANY of:
Skip this skill for pure TypeScript / shell / non-prompt code — that's test-driven-development territory.
claude -p subprocessThis project uses Claude Max subscription. Evals MUST shell out to claude -p via Bun.spawnSync. Do NOT use the Anthropic SDK — that requires a separate ANTHROPIC_API_KEY with its own billing.
Minimal harness shape (TypeScript, tests/evals/<name>.ts):
import { spawnSync } from "bun";
type EvalResult = { transcript: string; finalMessage: string; toolUses: string[]; durationMs: number };
function runClaude(prompt: string, opts: { cwd?: string; timeoutMs?: number } = {}): EvalResult {
const start = Date.now();
const proc = spawnSync([
"claude", "-p", prompt,
"--output-format", "json",
], {
cwd: opts.cwd ?? process.cwd(),
timeout: opts.timeoutMs ?? 120_000,
stdout: "pipe",
stderr: "pipe",
});
const raw = new TextDecoder().decode(proc.stdout);
const lines = raw.trim().split("\n").filter(Boolean).map((l) => JSON.parse(l));
const finalMessage = lines.filter((e) => e.type === "assistant").pop()?.message?.content
?.filter((c: { type: string }) => c.type === "text")
?.map((c: { text: string }) => c.text)
?.join("\n") ?? "";
const toolUses = lines
.flatMap((e) => e.message?.content ?? [])
.filter((c: { type: string }) => c.type === "tool_use")
.map((c: { name: string }) => c.name);
return { transcript: raw, finalMessage, toolUses, durationMs: Date.now() - start };
}
Key flags:
-p <prompt>: one-shot mode, no REPL--output-format json: structured output (each event on its own line; final assistant message + tool uses parseable)--bare: we WANT hooks to load (that's part of what we test)cwd to pin the session to a fixture directory when hooks depend on CWDSkill routing (do.md): prompt = "I want to build a rate limiter" → assert toolUses includes Skill("ship-feature", ...).
Hook behavior (pre-destructive-blocker): prompt = "run rm -rf /" → assert finalMessage contains the block message; assert NO Bash tool_use fires.
SKILL.md body: prompt = "How do I use X library?" with research-first skill in scope → assert toolUses includes mcp__docfork__search_docs before any Write/Edit.
Prompt template: run the template with 3-5 canonical inputs, assert the output shape (regex for headings, JSON structure, tone check).
Don't write 50 evals. Write 3-5 that cover the surprise failures.
| Step | Check |
|---|---|
| Red | eval fails for the right reason (not harness bug, not timeout) |
| Green | smallest change that passes; don't refactor the prompt to "look cleaner" while in green |
| Keep | eval stays in tests/evals/ — name it after the behavior, not the fix (routes-ship-feature.ts, not fix-do-router.ts) |
tests/evals/<name>.tsbun test tests/evals/ (picks up .test.ts / explicit imports)EVAL_SLOW=1 env — otherwise they run on every bun testtests/evals/fixtures/ — don't inline long promptstest-driven-development — covers unit/integration code; evals-first covers LLM behavior. Both can fire for the same feature.writing-skills — when adding or modifying a skill, writing-skills delegates the eval to this skill.ship-feature Phase 1 — if the feature touches prompt surface, insert this skill before the implementation step.claude -p subprocess. Mocked "Claude would output X" proves nothing.bun test is enough; add frameworks only when the pattern outgrows 20 evals.What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (youssefkadaouiabbassi/yka-code) — no native marketplace selected
npx claudepluginhub p/youssefkadaouiabbassi-code-tools-setup20 skills in this plugin
/audit-rigor[yka-code] Discipline for audit, review, and technology-comparison tasks. Use when the request is "audit X", "review our stack", "is this the best option", "compare alternatives", "what should we swap / add / drop", or any task that produces prioritized recommendations rather than new code. Enforces a ≥70% confidence threshold, delegate-retrieval-to-subagent pattern, inline citations with ISO dates, MCP-first sourcing, and a fixed output format (SWAP / ADD / DROP / KEEP-BUT-UPGRADE / SURPRISE). Pair with research-first (retrieval discipline) and karpathy-guidelines (surgical scope). Chained from security-audit, onboard-codebase, and any /do route that smells like "is this the best we have"./ci-hygiene[yka-code] CI/CD and DevOps hygiene enforcer. Activates when editing GitHub Actions workflows, Dockerfiles, docker-compose, justfile, deploy scripts, or any CI configuration. Enforces pinned versions, proper Claude Code invocation in CI (--bare, API key not Max sub), secret management, and reproducibility. Fills the DevOps gap — no plugin covers this in the wild./coding-style[yka-code] Enforce minimalist, self-documenting, defensively-sane coding style. Use ALWAYS when writing, editing, or reviewing ANY code in ANY language — every function, every edit, every diff, no exceptions. Covers five rules: (1) no comments unless critical (WHY only, never WHAT, never history), (2) clean + optimized (no dead code, no speculative abstractions, no stale imports, delete over deprecate), (3) self-documenting names (full words, verbs for functions, nouns for data), (4) smallest surface (one function one concern, extract only on 3rd reuse, validate only at boundaries), (5) no dead defense (no try/catch for impossible cases, no fallbacks for inputs you control, let errors bubble to the right handler). Pair with karpathy-guidelines for behavioral principles (Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution).Other plugins' skills for the same job