autoresearch-skill
This skill should be used when the user asks to "improve a skill", "create an autoresearch loop", "iteratively improve", "optimize a skill", "run an improvement loop on skill X", "autoresearch skill", "autonomously improve", "evaluate and improve a skill", "benchmark a skill", or wants to set up an autonomous agent loop that iteratively experiments with and improves a Claude Code skill against user-defined criteria.
What this skill does
# Autoresearch Skill Improvement Loop Generate a self-contained shell script that autonomously improves a Claude Code skill through iterative cycles. Each iteration: improve the skill, actually execute it against test prompts, evaluate the execution output, keep or discard. Deterministic steps (git, scoring, cleanup) run as plain bash. Subjective steps (improving, executing, evaluating) run via `claude -p` calls with generated prompts. ## Workflow ### Step 1: Analyze the Target Skill Read all files in the target skill directory. Build two things: **File inventory** -- what files exist and can be modified: ``` Skill: mermaid-svg Files: - SKILL.md (2,100 words) - references/layout-patterns.md (3,200 words) - references/style-guide.md (1,800 words) ``` **Execution profile** -- how the skill behaves when used: - **Purpose**: What the skill does when triggered (e.g., "converts Mermaid diagram syntax into hand-crafted SVG markup") - **Required tools**: What tools a `claude -p` call needs to execute the skill (e.g., `Read,Write,Glob` for a skill that reads input and writes files; `Read,Edit,Write,Glob,Bash` for a skill that runs scripts; `Read,WebSearch, WebFetch` for a research skill) - **Artifacts**: What files or output the skill produces when executed (e.g., `*.svg` files, `*.ts` files, text-only output to stdout) - **Cleanup commands**: Bash commands to remove artifacts between executions (e.g., `rm -f *.svg`, `rm -rf output/`). Empty if the skill produces only text output. ### Step 2: Gather Criteria If the user has not provided optimization criteria, ask for them. Criteria are specific, measurable aspects of the skill to improve. Examples: - "SVG output should use logical coordinate-based layout, not magic numbers" - "Research responses should include source quality evaluation" - "TypeScript guidance should cover monorepo project patterns" Also ask whether the user wants to provide test prompts -- concrete user queries that exercise the skill. If not provided, generate 3-5 from the criteria. Test prompts should be realistic requests a user would make that trigger the skill. ### Step 3: Build the Evaluation Rubric Convert each criterion into a 1-5 scoring rubric with observable level descriptions. See `references/prompt-templates.md` for rubric construction guidance. Each level describes concrete, observable qualities of the execution output (not the skill files themselves). ### Step 4: Compose the Prompts Build three system prompts embedded in the script: 1. **Improver prompt** -- Instructs `claude -p` to read the skill files, analyze past results, propose and apply ONE improvement. Includes: the rubric, improvement strategies (from `references/improvement-strategies.md`), file constraints, and required `HYPOTHESIS:` output line. 2. **Executor prompt** -- Instructs `claude -p` to act as Claude with the skill loaded. The skill content is injected dynamically at runtime (the script reads the current SKILL.md + references each iteration). The executor receives a test prompt and responds as Claude would, following the skill's guidance. 3. **Evaluator prompt** -- Instructs `claude -p` to judge the execution outputs against the rubric. Receives: the collected execution outputs from all test prompts, the rubric, and outputs a structured score with `AGGREGATE:` line. See `references/prompt-templates.md` for the full templates. ### Step 5: Generate the Script Generate a bash script following `references/script-structure.md`. Sections: 1. **Configuration** -- skill dir, branch, TSV path, test prompts array, cleanup commands, all system prompts as heredocs 2. **Helper functions** -- `read_skill` (reads current skill content at runtime), `execute_skill` (runs all test prompts, collects outputs), `cleanup_artifacts` (removes execution artifacts), `summary` (exit trap) 3. **Setup** -- create branch, initialize TSV 4. **Baseline** -- execute skill as-is against test prompts, evaluate outputs, record baseline score 5. **Main loop** -- improve, commit, execute, evaluate, decide, cleanup, log 6. **Summary** -- print results table on exit Key design rules: - The executor `claude -p` call receives the **current** skill content (read at runtime via `read_skill`), not a fixed heredoc -- the skill changes each iteration - The executor gets tools from the execution profile (Step 1) - After each execution+evaluation cycle, `cleanup_artifacts` removes any files the skill created, so the next iteration starts clean - The evaluator judges **execution output quality**, not skill file content - Score extraction: `grep -oP 'AGGREGATE:\s*\K[0-9.]+'` - Keep/discard: `score > best_score` via `bc -l` - Plateau: 3 consecutive discards triggers exit - Trap EXIT for summary on Ctrl+C ### Step 6: Write and Confirm Write the script to `improve-<skill-name>.sh` in the repo root. Make it executable. Show the user: - The execution profile (tools, artifacts, cleanup) - The generated rubric - The test prompts - How to run: `bash improve-<skill-name>.sh` - How to stop: Ctrl+C (prints summary) - How to review: `cat improvements.tsv` and `git log skill-improve/<tag>` ## Constraints - The generated script must be self-contained -- prompts baked in as heredocs, no external dependencies beyond `claude`, `git`, `bc`, `grep` - The executor must load the **current** skill content each iteration (not a stale copy from generation time) - Cleanup must remove all execution artifacts between iterations - The evaluator prompt and test prompts are fixed for the run - `improvements.tsv` stays untracked by git ## Additional Resources ### Reference Files - **`references/prompt-templates.md`** -- System prompt templates for all three `claude -p` calls (improve, execute, evaluate), rubric guide - **`references/script-structure.md`** -- Complete bash script structure with execute step, cleanup, and dynamic skill loading - **`references/improvement-strategies.md`** -- Catalog of skill improvement strategies, embedded in the improver system prompt
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.