agent-skills-lab is a research scaffold for measuring how Claude-style project skills affect real LLM agents built with LangChain and LangGraph.
The lab benchmarks three regimes on the same task suite:
no-skill: the agent gets only the base system prompt.full-library: the agent gets the entire.claude/skills/library in context.retrieved-skill: the agent gets only the top-k relevant skills.
The goal is to answer four research questions with actual model calls:
- How do agents behave differently when skills are present?
- Do skills improve success rate enough to justify their context cost?
- Can we build a practical framework for drafting, linting, and refining skills?
- Can a human-in-the-loop optimization loop revise skills from traces the way prompt optimizers revise prompts?
- Anthropic documents that Claude Code subagents live in
.claude/skills/, use YAML frontmatter, and help with context preservation while potentially adding latency. That maps directly to the experiment design here. - LangGraph is used as the stateful runtime so each model step, tool call, and stop condition is explicit.
- LangChain gives provider-neutral model access and token usage metadata, which the lab converts into cost and context-efficiency metrics.
The benchmark focuses on the metrics most aligned with current agent engineering practice:
success_rate: primary metric.judge_score: weighted score from an LLM judge.input_tokens: direct measure of context pressure.cost_usd: computed from actual token usage and prices in.env.latency_seconds: wall-clock time.tool_calls: how much work the agent needed to do.tool_efficiency: successful tasks divided by tool calls.skill_lift: change in success rate versusno-skill.context_savings_vs_full_library: token savings from skill retrieval versus injecting the full library.
The metric choice is grounded by benchmark and production literature emphasizing task success, observability, latency, and cost rather than prompt-only quality.
agent-skills-lab/
├── .claude/skills/ # Claude Code-compatible skills/subagents
├── data/documents/ # Local corpus that the agent must search/read
├── data/tasks/default_tasks.json
├── src/agent_skills_lab/
│ ├── agent.py # LangGraph agent runtime
│ ├── evaluation.py # LLM judge + deterministic checks
│ ├── optimizer.py # skill drafting and revision loop
│ ├── skills.py # skill loading, retrieval, linting
│ ├── tools.py # search/read/calculator tools
│ └── cli.py # Typer entrypoint
└── artifacts/ # benchmark outputs and candidate skill revisions
cd /Users/tarunsingh/aiml/gen_ai/agent-skills-lab
cp .env.example .env
uv syncSet one provider:
# OpenAI LLM_PROVIDER=openai OPENAI_API_KEY=... # or Anthropic LLM_PROVIDER=anthropic ANTHROPIC_API_KEY=... # or Ollama LLM_PROVIDER=ollama LLM_MODEL=qwen2.5:7b
uv run skilllab benchmark run
Useful variants:
uv run skilllab benchmark run --regimes no-skill,retrieved-skill uv run skilllab benchmark run --top-k-skills 1 uv run skilllab benchmark run --task-ids regime_recommendation,context_optimization uv run skilllab benchmark summarize --results artifacts/runs/latest/results.json
Each run writes:
results.jsonsummary.mdtraces/<task>__<regime>.json
Lint the current library:
uv run skilllab skills lint .claude/agents
Draft a new skill from a brief:
uv run skilllab skills draft \ --name pricing-auditor \ --description "Use for pricing and token-cost analysis tasks." \ --brief "Guide the agent to normalize pricing units and verify arithmetic with the calculator tool."
Run a human-in-the-loop optimization pass on one skill:
uv run skilllab skills optimize \ --skill-path .claude/skills/pricing-auditor/SKILL.md \ --task-id pricing_audit_root_cause \ --interactive
The optimizer compares a no-skill trace with a single-skill trace, asks an optimizer model to propose a revised skill, saves the candidate under artifacts/skill_candidates/, and optionally applies it after approval.
This section explains a critical design decision. Misunderstanding it would invalidate every result this benchmark produces.
Skills live in .claude/skills/. Claude Code — the AI assistant you are working with right now — also reads .claude/skills/ to inform its own responses to you. This raises an immediate question:
If Claude Code already loads these skills automatically, does the no-skill regime actually run without skills?
The answer is yes — and here is exactly why.
┌──────────────────────────────────────────────────────────────────┐
│ Path 1: Claude Code (your AI assistant) │
│ │
│ You ──chat──► Claude Code ──reads──► .claude/skills/*/SKILL.md │
│ │
│ Purpose: helps the assistant give you better answers │
│ Scope: only affects the Claude Code chat session │
└──────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Path 2: The benchmark agent (the experiment) │
│ │
│ uv run skilllab ──► Python ──► LangChain ──► Anthropic API │
│ │ │
│ agent.py builds │
│ system prompt │
│ explicitly per regime │
│ │
│ Purpose: measures skill impact on task performance │
│ Scope: direct API calls, Claude Code has no visibility │
└─────────────────────────────────────────────────────────────┘
These two paths never cross. Claude Code's skill loading does not touch LangChain API calls. The benchmark's API calls do not go through Claude Code.
The no-skill regime is not just a label — it is hard-coded in agent.py to pass an empty skill list to the system prompt builder:
# agent.py def _select_skills(self, task, regime, ...): if regime == "no-skill": return [] # skills physically absent from API call def _system_prompt(self, selected_skills): if not selected_skills: return BASE_SYSTEM_PROMPT # base prompt only, zero skill content skill_blocks = "\n\n".join(...) return f"{BASE_SYSTEM_PROMPT}\n\nRelevant skills:\n\n{skill_blocks}"
Every API call the benchmark sends to Anthropic or OpenAI contains exactly the system prompt that regime dictates — no more, no less. The skills sitting in .claude/skills/ are loaded into Python memory at startup but injected only when the regime explicitly permits it.
If this isolation did not hold, the no-skill baseline would be contaminated — it would already have skill content in the context window — and the measured skill_lift (the difference between skill regimes and no-skill) would be meaningless or artificially deflated. Every metric this benchmark reports depends on no-skill being a true zero-skill baseline.
Concretely: if skills leaked into no-skill runs, a result like "skills improved success rate from 0.44 to 0.67" could not be trusted. It might really be "skills improved success rate from 0.60 to 0.67" with the real baseline hidden.
This isolation holds as long as skills are used as prompt injections (the current design). It would break if skills were wired as Claude Code subagents that autonomously spawn their own API calls. In that mode, Claude Code itself becomes an actor in the agent loop and skill selection is no longer under the benchmark's control.
This project deliberately does not use that invocation mode. Skills are plain text injected into a single system prompt, not autonomous subagents. The distinction is:
| Mode | How it works | Benchmark safe? |
|---|---|---|
| Prompt injection (current) | Skill text appended to system prompt, one API call | ✅ Yes — full regime control |
| Subagent invocation | Claude Code spawns a subprocess with its own context | ❌ No — regime isolation breaks |
- Skills can improve task completion by injecting procedural knowledge the base agent lacks.
- Full skill injection can improve quality but bloat prompt tokens.
- Retrieval can preserve most of the quality lift while reducing input tokens and often latency.
- Trace-driven skill revision is feasible: failed runs become training data for better skill prompts.
This project is grounded in current primary sources:
- Anthropic Claude Code subagents docs: project skills in
.claude/skills/, separate context windows, context-preservation benefits, latency tradeoff, and focused subagent design. docs - Anthropic common workflows: project-specific subagents for shared team workflows. docs
- LangChain/LangGraph docs: agents on LangGraph’s durable runtime, middleware hooks, and human-in-the-loop patterns. overview
- LangSmith/LangChain positioning: observability, evaluation, and deployment are central to agent engineering. platform
- ReAct: reasoning plus acting is the baseline agent pattern. paper
- Toolformer: tool use can be learned and improves task performance. paper
- AgentBench: success should be measured on tasks, not only static prompt quality. paper
- Opsahl-Ong et al. 2024: prompt optimization for multi-stage LM programs can improve downstream task metrics without module-level labels, which motivates skill optimization from traces. paper
- TextGrad: textual feedback can optimize compound AI systems, which is directly analogous to skill optimization from agent traces. paper
- LangChain State of Agent Engineering 2025: production teams prioritize quality, latency, and observability over raw model spend. report
flowchart LR
A["Task"] --> B["Skill Regime"]
B --> C["Context Builder"]
C --> D["LangGraph Agent"]
D --> E["Local Tools"]
D --> F["Trace + Token Usage"]
F --> G["LLM Judge"]
G --> H["Metrics Summary"]
F --> I["Skill Optimizer"]
I --> J["Human Approval"]
J --> K["Revised .claude/agents Skill"]
- The benchmark is intentionally small and local so it is easy to inspect and rerun.
- Skill retrieval defaults to a heuristic selector to keep dependencies light; the benchmarked agent calls themselves are still real LLM calls.
- Provider pricing is environment-driven because model pricing changes over time.