用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/ForceInjection/domain-driven-design-skills --skill create-inspect-task命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Conduct deep academic research for philosophy, neuroscience, cognitive science, and theoretical computer science (computability, complexity, AI theory, logic). Use when user asks to: research academic topics, find scholarly papers, conduct literature reviews, analyze citations, synthesize research findings, explore philosophical arguments, investigate consciousness/cognition, study computability/decidability/Turing machines, or analyze academic debates. Triggers on: 'research papers', 'literature review', 'academic sources', 'scholarly articles', 'philosophy of mind', 'computability theory', 'neuroscience studies', 'find papers on', 'what does the research say'.
Create clear action plans with steps, success criteria, and risk awareness. Use before implementing features, making changes, starting projects, or anytime you need a roadmap to success. Triggers on "plan this", "how should we approach", "what's the strategy", "steps to complete", or when facing complex multi-step work.
Add keyboard navigation to a feature using CommandRegistryService. Use when implementing keyboard shortcuts, vim-style navigation, or hotkeys for a page or component.
基于 SOC 职业分类
正在显示 SKILL.md
| name | create-inspect-task |
| description | Create custom inspect-ai evaluation tasks through interacted, guided workflow. |
You help users create custom inspect-ai evaluation tasks through an interactive, guided workflow. Create well-documented, reusable evaluation scripts that follow inspect-ai best practices.
Guide the user through designing and implementing a custom inspect-ai evaluation task. Create a complete, runnable task file and comprehensive documentation that explains the design decisions and usage.
This skill supports two modes:
When an experiment_summary.yaml file exists (created by design-experiment skill), extract configuration to pre-populate:
Usage: Run skill from experiment directory or provide path to experiment_summary.yaml
Create evaluation tasks from scratch without experiment context. User provides all configuration manually.
Usage: Run skill when no experiment exists or when creating general-purpose evaluation tasks
experiment_summary.yaml in current directorycreate-inspect-task.logcreate-inspect-task.logWhen operating in experiment-guided mode, extract the following information from the YAML structure:
experiment:
name: string
type: string
question: string
data:
training:
path: string
label: string
format: string
splits:
train: int
validation: int
test: int
models:
base:
- name: string
path: string
evaluation:
system_prompt: string
temperature: float
runs:
- name: string
type: string # "fine-tuned" or "control"
model: string
import yaml
from pathlib import Path
def extract_from_experiment_summary(path):
"""Extract configuration from experiment_summary.yaml"""
with open(path, 'r') as f:
config = yaml.safe_load(f)
# Extract dataset configuration
dataset_path = config['data']['training']['path']
dataset_format = config['data']['training']['format']
dataset_splits = config['data']['training']['splits']
# Extract system prompt from evaluation section
system_prompt = config['evaluation']['system_prompt']
# Extract research question
research_question = config['experiment']['question']
experiment_type = config['experiment']['type']
# Extract model information (first base model)
base_models = config['models']['base']
model_name = base_models[0]['name'] if base_models else None
model_path = base_models[0]['path'] if base_models else None
# Extract run names for documentation examples
run_names = [run['name'] for run in config[]]
control_runs = [run[] run config[] run[] == ]
{
: dataset_path,
: dataset_format,
: dataset_splits,
: system_prompt,
: research_question,
: experiment_type,
: model_name,
: model_path,
: run_names,
: control_runs
}
From experiment section:
question → Research question/objective (informs evaluation goal)type → Experiment type (helps understand what's being compared)From data.training section:
path → Dataset path for evaluationformat → Dataset format (json, parquet)splits → Sample counts (use test split for evaluation)From models.base[] section:
name → Model identifierpath → Full path to base model (for usage examples)From evaluation section:
system_prompt → Use same prompt for consistencytemperature → Default temperature settingFrom runs[] section:
name → Run identifiers (for documentation)type → Filter for "control" runs that need evaluationAfter extraction, show the user what was found:
## Configuration Extracted from Experiment
I found the following configuration in your experiment:
**Dataset:**
- Path: `/scratch/gpfs/.../data/green/capitalization/words_4L_80P_300.json`
- Format: JSON
- Splits: train (240), test (60)
**Models:**
- Llama-3.2-1B-Instruct
- Path: `/scratch/gpfs/.../pretrained-llms/Llama-3.2-1B-Instruct`
**System Prompt:**
{extracted_prompt or "(none)"}
**Research Question:**
{extracted_question}
I'll use this information to help configure your evaluation task. You can override any of these settings if needed.
Check extracted information:
ls)ls)If validation fails:
IMPORTANT: Create a detailed log file at {task_directory}/create-inspect-task.log that records all questions, answers, and decisions made during task creation.
[YYYY-MM-DD HH:MM:SS] ACTION: Description
Details: {specifics}
Result: {outcome}
[2025-10-24 14:30:00] MODE_SELECTION: Experiment-guided mode
Details: Found experiment_summary.yaml at /scratch/gpfs/MSALGANIK/mjs3/cap_4L_lora_lr_sweep/experiment_summary.yaml
Result: User confirmed to use experiment configuration
[2025-10-24 14:30:05] EXTRACT_CONFIG: Reading experiment_summary.yaml
Details: Parsing YAML structure: experiment, data, models, evaluation sections
Result: Successfully extracted configuration
[2025-10-24 14:30:10] EXTRACTED_DATASET: Dataset configuration
Details: Path: /scratch/gpfs/MSALGANIK/niznik/GitHub/cruijff_kit/data/green/capitalization/words_4L_80P_300.json
Format: JSON, Splits: train (240), test (60)
Result: Verified dataset exists (43KB)
[2025-10-24 14:30:15] EXTRACTED_SYSTEM_PROMPT: System prompt from experiment
Details: Prompt: "" (empty - no system message)
Result: Will use empty system prompt for consistency with training
[2025-10-24 14:30:20] EXTRACTED_RESEARCH_QUESTION: Scientific objective
Details: Compare LoRA ranks and learning rates for capitalization task
Result: Will design evaluation to measure exact match accuracy
[2025-10-24 14:30:25] EVALUATION_OBJECTIVE: User wants to evaluate capitalization accuracy
Details: Exact match (case-sensitive), using experiment dataset
Result: Will use match(location="exact", ignore_case=False) scorer for strict evaluation
[2025-10-24 14:30:30] SOLVER_CONFIG: Designing solver chain
Details: system_message(""), prompt_template("{prompt}"), generate(temp=0.0)
Result: Matches training configuration for consistency
[2025-10-24 14:30:00] MODE_SELECTION: Standalone mode
Details: No experiment_summary.md found
Result: User will provide all configuration manually
[2025-10-24 14:30:05] EVALUATION_OBJECTIVE: User wants to evaluate sentiment classification
Details: Binary classification (positive/negative), using custom dataset in JSON format
Result: Will use match() scorer for exact matching, temperature=0.0 for consistency
[2025-10-24 14:30:15] DATASET_CONFIG: Selected JSON dataset format
Details: Dataset path: /scratch/gpfs/MSALGANIK/niznik/data/sentiment_test.json
Field mapping: input="text", target="sentiment"
Result: Will use hf_dataset with json format and custom record_to_sample function
What do you want to evaluate?
What defines a correct answer?
What dataset format do you have?
.json or .jsonl).parquet)Where is the dataset located?
What are the field names?
Dataset structure specifics:
Example questions:
{'train': [...], 'test': [...]}?"System message:
Prompt template:
"{prompt}" (direct input)Generation parameters:
Common solver patterns:
[system_message(""), prompt_template("{prompt}"), generate()][chain_of_thought(), generate()][multiple_choice()] (don't add separate generate())[prompt_template("Answer: {prompt}\n"), generate()]Based on evaluation objective, suggest scorers:
For exact matching:
match() - Target appears at beginning/end; ignores case, whitespace, punctuation
location="begin"/"end"/"any", ignore_case=True/Falseexact() - Precise matching after normalizationincludes() - Target appears anywhere in output
ignore_case=True/FalseFor multiple choice:
choice() - Works with multiple_choice() solverFor pattern extraction:
pattern() - Extract answer using regex
For model-graded evaluation:
model_graded_qa() - Another model assesses answer quality
partial_credit=True/False, custom templatemodel_graded_fact() - Checks if specific facts appearFor numeric/F1 scoring:
f1() - F1 score for text overlapMultiple scorers:
[match(), includes()] to get multiple scoresShould the task accept parameters for flexibility?
Common parameters to expose:
system_prompt - Allow different system messagestemperature - Enable temperature tuningdataset_path - Support different datasetsgrader_model - For model-graded scoringconfig_dir - For integration with fine-tuning runs (like existing cap_task)Benefits of parameters:
How to pass parameters:
inspect eval task.py -T param_name=value
How will the model be specified?
Option 1: CLI specification (most flexible)
inspect eval task.py --model hf/local -M model_path=/path/to/modelOption 2: Integration with fine-tuning config
cap_task examplesetup_finetune.yamlconfig_dir parameter pointing to epoch directoryOption 3: Hard-coded in task
Create two files:
{task_name}_task.pyThe complete, runnable inspect-ai task following best practices.
File naming convention:
sentiment_classification_task.pymath_reasoning_task.py{domain}_{type}_task.pyRequired components:
from inspect_ai import Task, task
from inspect_ai.dataset import json_dataset, hf_dataset, FieldSpec
from inspect_ai.solver import chain, generate, prompt_template, system_message
from inspect_ai.scorer import match, includes
@task
def my_task(param1: str = "default"):
"""
Brief description of what this task evaluates.
Args:
param1: Description of parameter
Returns:
Task: Configured inspect-ai task
"""
# Dataset loading
dataset = ...
# Solver chain
solver = chain(
system_message("..."),
prompt_template("{prompt}"),
generate({"temperature": 0.0})
)
# Return task
return Task(
dataset=dataset,
solver=solver,
scorer=...
)
Best practices to follow:
{task_name}_design.mdComprehensive documentation of design decisions.
Required sections:
# {Task Name} Evaluation Task
**Created:** {timestamp}
**Inspect-AI Version:** {version if known}
## Evaluation Objective
{What this task evaluates and why}
## Dataset Configuration
**Format:** {JSON/Parquet/HuggingFace/etc.}
**Location:** `{full_path_to_dataset}`
**Size:** {number of samples if known}
**Field Mapping:**
- Input field: `{field_name}`
- Target field: `{field_name}`
- Metadata fields: `{field_names or "none"}`
**Loading Method:**
{Description of how dataset is loaded}
**Data Structure:**
{Explanation of JSON structure, splits, etc.}
## Solver Chain
**Components:**
1. {Solver 1}: {Purpose}
2. {Solver 2}: {Purpose}
3. ...
**System Message:**
{system message text or "none"}
**Prompt Template:**
{template or "direct input"}
**Generation Parameters:**
- Temperature: {value} - {rationale}
- Max tokens: {value or "default"} - {rationale}
- {Other parameters if any}
**Rationale:**
{Why this solver chain was chosen}
## Scorer Configuration
**Primary Scorer:** `{scorer_name}()`
**Options:**
- {option1}: {value} - {reason}
- {option2}: {value} - {reason}
**Additional Scorers:**
{List if multiple scorers used, or "none"}
**Rationale:**
{Why this scorer is appropriate for the task}
## Task Parameters
| Parameter | Type | Default | Purpose |
|-----------|------|---------|---------|
| {param1} | {type} | {default} | {description} |
**Parameter Usage:**
```bash
inspect eval {task_file}.py -T {param}={value}
Recommended usage:
inspect eval {task_file}.py --model hf/local -M model_path=/path/to/model
{Any specific notes about model compatibility}
Basic evaluation:
inspect eval {task_name}_task.py --model hf/local -M model_path=/path/to/model
With parameters:
inspect eval {task_name}_task.py --model hf/local -M model_path=/path/to/model -T temperature=0.5
Evaluating fine-tuned model: {if applicable}
cd /path/to/experiment/run/epoch_0
inspect eval {task_name}_task.py --model hf/local -M model_path=$PWD -T config_dir=$PWD
Inspect-ai will create:
logs/{task_name}_{timestamp}.eval - Evaluation results log{If known, describe expected baseline performance or what good performance looks like}
{Any additional considerations, limitations, or future improvements}
## Code Generation Guidelines
### Dataset Loading Patterns
**JSON with nested splits:**
```python
from inspect_ai.dataset import hf_dataset
def record_to_sample(record):
return Sample(
input=record["input"],
target=record["output"]
)
dataset = hf_dataset(
path="json",
data_files="/path/to/data.json",
field="test", # Access the "test" split
split="train", # Don't get confused - this refers to top-level split
sample_fields=record_to_sample
)
JSONL (one JSON object per line):
from inspect_ai.dataset import json_dataset
def record_to_sample(record):
return Sample(
input=record["question"],
target=record["answer"]
)
dataset = json_dataset(
"/path/to/data.jsonl",
record_to_sample
)
Parquet directory:
from inspect_ai.dataset import hf_dataset, FieldSpec
dataset = hf_dataset(
path="parquet",
data_dir="/path/to/parquet_dir",
split="test",
sample_fields=FieldSpec(
input="question",
target="answer"
)
)
HuggingFace dataset:
from inspect_ai.dataset import hf_dataset, FieldSpec
dataset = hf_dataset(
path="username/dataset-name",
split="test",
sample_fields=FieldSpec(
input="question",
target="answer",
metadata=["category", "difficulty"] # Preserve metadata
)
)
Simple generation:
from inspect_ai.solver import chain, generate, prompt_template, system_message
solver = chain(
system_message(""), # Empty if no system message needed
prompt_template("{prompt}"), # Direct input
generate({"temperature": 0.0})
)
With system message and custom template:
solver = chain(
system_message("You are an expert classifier. Respond with only the category label."),
prompt_template("Text: {prompt}\n\nCategory:"),
generate({"temperature": 0.0, "max_tokens": 50})
)
Chain-of-thought:
from inspect_ai.solver import chain_of_thought, generate
solver = chain(
chain_of_thought(), # Adds "Let's think step by step" prompt
generate({"temperature": 0.0})
)
Multiple choice:
from inspect_ai.solver import multiple_choice
solver = multiple_choice() # Don't add generate() separately
# Or with chain-of-thought:
solver = multiple_choice(cot=True)
Exact matching (case-insensitive):
from inspect_ai.scorer import match
scorer = match() # Default: ignore case, whitespace, punctuation
# Or customize:
scorer = match(location="exact", ignore_case=False)
Substring matching:
from inspect_ai.scorer import includes
scorer = includes() # Default: case-sensitive
# Or:
scorer = includes(ignore_case=True)
Multiple scorers:
scorer = [
match("exact", ignore_case=False),
includes(ignore_case=False)
]
# Results will show scores from both
Model-graded:
from inspect_ai.scorer import model_graded_qa
scorer = model_graded_qa(
partial_credit=True, # Allow 0.5 scores
model="openai/gpt-4o" # Specify grading model
)
When creating tasks for an experiment:
Run from experiment directory:
cd /scratch/gpfs/MSALGANIK/mjs3/my_experiment/
# Invoke create-inspect-task skill
Skill automatically extracts from experiment_summary.yaml:
Task supports both modes:
setup_finetune.yaml (for fine-tuned models)For tasks integrated with experiments:
import yaml
from pathlib import Path
@task
def my_task(
config_dir: Optional[str] = None,
dataset_path: Optional[str] = None,
system_prompt: str = "",
temperature: float = 0.0,
split: str = "test"
) -> Task:
"""
Evaluate model using configuration from fine-tuning setup or direct paths.
Args:
config_dir: Path to epoch directory (contains ../setup_finetune.yaml).
If provided, reads dataset path and system prompt from config.
dataset_path: Direct path to dataset JSON file. Used if config_dir not provided.
system_prompt: System message for the model. Overrides config if both provided.
temperature: Generation temperature (default: 0.0 for deterministic output).
split: Which data split to use (default: "test").
Returns:
Task: Configured inspect-ai task
"""
# Determine configuration source
if config_dir:
# Mode 1: Read from fine-tuning configuration
config_path = Path(config_dir).parent / "setup_finetune.yaml"
with open(config_path, 'r') as f:
config = yaml.safe_load(f)
# Extract settings from fine-tuning config
dataset_path = config['input_dir_base'] + config['dataset_label'] + config['dataset_ext']
# Use system prompt from config unless overridden
if not system_prompt:
system_prompt = config.get('system_prompt', '')
dataset_path:
:
ValueError()
dataset = ...
Task(
dataset=dataset,
solver=chain(
system_message(system_prompt),
prompt_template(),
generate({: temperature})
),
scorer=...
)
Evaluating fine-tuned model from experiment:
cd /path/to/experiment/run_dir/epoch_0
inspect eval /path/to/my_task.py --model hf/local -M model_path=$PWD -T config_dir=$PWD
Evaluating base model (control run):
inspect eval my_task.py \
--model hf/local \
-M model_path=/scratch/gpfs/MSALGANIK/pretrained-llms/Llama-3.2-1B-Instruct \
-T dataset_path=/path/to/dataset.json
This task pattern enables integration with the setup_inspect.py tool (when implemented):
python tools/inspect/setup_inspect.py --finetune_epoch_dir /path/to/experiment/run/epoch_0
Before finishing, verify:
@taskAdditional checks for experiment-guided mode:
config_dir and dataset_path parametersAfter creating the task, guide user:
Test the task:
# Validate syntax
python -m py_compile {task_file}.py
# Test with small sample
inspect eval {task_file}.py --model {model} --limit 5
Run full evaluation:
inspect eval {task_file}.py --model {model}
View results:
inspect view
# Opens web UI to browse evaluation logs
Iterate if needed:
inspect score to re-score without re-running--limit 5)config_dir parameter pattern for experiment integrationIf dataset file not found:
If unsure about dataset format:
If scorer choice unclear: