langsmith-dataset
Use this skill for ANY question about creating test or evaluation datasets for LangChain agents. Covers generating datasets from traces (final_response, single_step, trajectory, RAG types), uploading to LangSmith, and managing evaluation data.
What this skill does
# LangSmith Dataset
Auto-generate evaluation datasets from LangSmith traces for testing and validation.
## Setup
### Environment Variables
```bash
LANGSMITH_API_KEY=lsv2_pt_your_api_key_here # Required
LANGSMITH_PROJECT=your-project-name # Optional: default project
LANGSMITH_WORKSPACE_ID=your-workspace-id # Optional: for org-scoped keys
```
### Dependencies
```bash
pip install langsmith click rich python-dotenv
```
## Usage
Navigate to `skills/langsmith-dataset/scripts/` to run commands.
### Scripts
**`generate_datasets.py`** - Create evaluation datasets from traces
**`query_datasets.py`** - View and inspect datasets
### Common Flags
All dataset generation commands support:
- `--root-run-name <name>` - Filter traces by root run name (e.g., "LangGraph" for DeepAgents)
- `--limit <n>` - Number of traces to process (default: 30)
- `--last-n-minutes <n>` - Only recent traces
- `--output <path>` - Output file (.json or .csv)
- `--upload <name>` - Upload to LangSmith with this dataset name
- `--replace` - Overwrite existing file/dataset (will prompt for confirmation)
- `--yes` - Skip confirmation prompts (use with caution)
**IMPORTANT - Safety Prompts:**
- The script prompts for confirmation before deleting existing datasets with `--replace`
- **ALWAYS respect these prompts** - wait for user input before proceeding
- **NEVER use `--yes` flag unless the user explicitly requests it**
- The `--yes` flag skips all safety prompts and should only be used in automated workflows when explicitly authorized by the user
### Understanding Trace Hierarchy
Traces have depth levels based on parent-child relationships:
```
Depth 0: Root agent (e.g., "LangGraph")
├── Depth 1: Middleware/chains (model, tools, SummarizationMiddleware)
│ ├── Depth 2: Tool calls (sql_db_query, retriever, etc.)
│ └── Depth 2: LLM calls (ChatOpenAI, ChatAnthropic)
└── Depth 3+: Nested subagent calls
```
**Use `--root-run-name` to target specific agent frameworks:**
- DeepAgents: `--root-run-name LangGraph`
- Custom agents: Use your root node name
## Dataset Types
### 1. Final Response
Full conversation with expected output - tests complete agent behavior.
```bash
# Basic usage
python generate_datasets.py --type final_response \
--project my-project \
--root-run-name LangGraph \
--limit 30 \
--output /tmp/final_response.json
# With custom output fields
python generate_datasets.py --type final_response \
--project my-project \
--output-fields "answer,result" \
--output /tmp/final.json
# Messages only (ignore output dict keys)
python generate_datasets.py --type final_response \
--project my-project \
--messages-only \
--output /tmp/final.json
```
**Structure:**
```json
{
"trace_id": "...",
"inputs": {"query": "What are the top 3 genres?"},
"outputs": {
"expected_response": "The top 3 genres based on the number of tracks are:\n\n1. Rock with 1,297 tracks\n2. Latin with 579 tracks\n3. Metal with 374 tracks"
}
}
```
**Extraction Priority:**
1. Messages from root run (AI responses with content)
2. User-specified output fields (`--output-fields`)
3. Common keys (answer, output)
4. Full output dict
**Important:** Always checks root run first for final response to avoid intermediate tool outputs.
### 2. Single Step
Single node inputs/outputs - tests any specific node's behavior. **Supports multiple occurrences per trace** to capture conversation evolution.
```bash
# Extract all occurrences (default)
python generate_datasets.py --type single_step \
--project my-project \
--root-run-name LangGraph \
--run-name model \
--output /tmp/single_step.json
# Sample 2 occurrences per trace
python generate_datasets.py --type single_step \
--project my-project \
--root-run-name LangGraph \
--run-name model \
--sample-per-trace 2 \
--output /tmp/single_step_sampled.json
# Target specific tool at depth 2
python generate_datasets.py --type single_step \
--project my-project \
--root-run-name LangGraph \
--run-name sql_db_query \
--output /tmp/sql_query.json
```
**Structure:**
```json
{
"trace_id": "...",
"run_id": "...",
"occurrence": 2,
"inputs": {
"messages": [
{"type": "human", "content": "What are the top 3 genres?"},
{"type": "ai", "content": "", "tool_calls": [...]},
{"type": "tool", "content": "...results..."},
...
]
},
"outputs": {
"expected_output": {
"messages": [
{"type": "ai", "content": "", "tool_calls": [...]}
]
},
"node_name": "model"
}
}
```
**Key Features:**
- `occurrence` field tracks which invocation (1st, 2nd, 3rd, etc.)
- Later occurrences have more conversation history → tests context handling
- `--sample-per-trace` randomly samples N occurrences per trace
- Use `--run-name` to target any node at any depth
**Common targets:**
- `model` (depth 1) - LLM invocations with growing context
- `tools` (depth 1) - Tool execution chain
- Any custom node name
### 3. Trajectory
Tool call sequence - tests execution path with configurable depth.
```bash
# Include all tool calls (all depths)
python generate_datasets.py --type trajectory \
--project my-project \
--root-run-name LangGraph \
--limit 30 \
--output /tmp/trajectory_all.json
# Only tool calls up to depth 2
python generate_datasets.py --type trajectory \
--project my-project \
--root-run-name LangGraph \
--depth 2 \
--output /tmp/trajectory_depth2.json
# Only root-level tool calls (depth 0) - usually empty if tools are at depth 2+
python generate_datasets.py --type trajectory \
--project my-project \
--depth 0 \
--output /tmp/trajectory_root.json
```
**Structure:**
```json
{
"trace_id": "...",
"inputs": {"query": "What are the top 3 genres?"},
"outputs": {
"expected_trajectory": [
"sql_db_list_tables",
"sql_db_schema",
"sql_db_query_checker",
"sql_db_query"
]
}
}
```
**Depth Control:**
- Omit `--depth` = all levels (includes subagent tool calls)
- `--depth 2` = root + 2 levels (typical for capturing all main tools)
- `--depth 1` = often only middleware/chains, no actual tool calls
- `--depth 0` = root only (no tool calls)
**Note:** Tool calls are typically at depth 2 in LangGraph/DeepAgents architecture.
### 4. RAG
Question/chunks/answer/citations - tests retrieval quality.
```bash
python generate_datasets.py --type rag \
--project my-project \
--limit 30 \
--output /tmp/rag_ds.csv # Supports .json or .csv
```
**Structure (CSV format):**
```csv
question,retrieved_chunks,answer,cited_chunks
"How do I...","Chunk 1\n\nChunk 2","The answer is...","[\"Chunk 1\"]"
```
## Output Formats
All dataset types support both JSON and CSV:
```bash
# JSON output (default)
python generate_datasets.py --type trajectory --project my-project --output ds.json
# CSV output (use .csv extension)
python generate_datasets.py --type trajectory --project my-project --output ds.csv
```
## Upload to LangSmith
```bash
# Generate and upload in one command
python generate_datasets.py --type trajectory \
--project my-project \
--root-run-name LangGraph \
--limit 50 \
--output /tmp/trajectory_ds.json \
--upload "Skills: Trajectory"
# Use --replace to overwrite existing dataset
python generate_datasets.py --type final_response \
--project my-project \
--output /tmp/final.json \
--upload "Skills: Final Response" \
--replace
```
**Naming Convention:** Use "Skills: <Type>" format for consistency:
- "Skills: Final Response"
- "Skills: Single Step (model)"
- "Skills: Single Step (sql_db_query)"
- "Skills: Trajectory (all depths)"
- "Skills: Trajectory (depth=2)"
## Query Datasets
```bash
# List all datasets
python query_datasets.py list-datasets
# Filter by name pattern
python query_datasets.py list-datasets | grep "Skills:"
# View dataset examples
python query_datasets.py show "Skills: Trajectory" --limit 5
# View local file
python query_datasets.py view-file /Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.