跳到正文
Skillpedia
通用编程40k · #7070

autoresearch

它能做什么

这个工具可以帮你自动优化任何编程代码。你告诉它想要改进什么(比如速度或内存占用),以及如何衡量这个指标。然后工具会尝试修改代码,测试结果是否有所改善,只保留有效的改动。

适用场景

  • ✓当你想让某个程序运行得更快时。
  • ✓当你想让某个程序占用更少内存时。
  • ✓当你想针对特定任务优化代码,获得更好的效果时。

技能链接

https://github.com/github/awesome-copilot/blob/main/skills/autoresearch/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/github/awesome-copilot/blob/main/skills/autoresearch/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我想提升这个 Python 脚本的运行速度。衡量指标是用 'time python my_script.py' 测得的执行时间,时间越短越好。”

每周 5 个新技能,1 分钟读完。

工作原理

首先,你要定义优化目标,以及如何衡量它。然后,工具会复制一份你的代码,做一些小幅修改,测试是否有所提升,并决定保留还是放弃这次改动。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Autoresearch: Autonomous Iterative Experimentation

An autonomous experimentation loop for any programming task. You define the goal and how to measure it; the agent iterates autonomously -- modifying code, running experiments, measuring results, and keeping or discarding changes -- until interrupted.

This skill is inspired by Karpathy's autoresearch, generalized from ML training to any programming task with a measurable outcome.


Agent Behavior Rules

  1. DO guide the user through the Setup phase interactively before starting the loop.
  2. DO establish a baseline measurement before making any changes.
  3. DO commit every experiment attempt before running it (so it can be reverted cleanly).
  4. DO keep a results log (TSV) tracking every experiment.
  5. DO revert changes that do not improve the metric (git reset to last known good).
  6. DO run autonomously once the loop starts -- never pause to ask "should I continue?".
  7. DO NOT modify files the user marked as out-of-scope.
  8. DO NOT skip the measurement step -- every experiment must be measured.
  9. DO NOT keep changes that regress the metric unless the user explicitly allowed trade-offs.
  10. DO NOT install new dependencies or make environment changes unless the user approved it.

Phase 1: Setup (Interactive)

Before any experimentation begins, work with the user to establish these parameters. Ask the user directly for each item. Do not assume or skip any.

1.1 Define the Goal

Ask the user:

What are you trying to improve or optimize?

Examples: execution time, memory usage, binary size, test pass rate, code coverage, API response latency, throughput, error rate, benchmark score, build time, bundle size, lines of code, cyclomatic complexity, etc.

Record the user's answer as the goal.

1.2 Define the Metric

Ask the user:

How do we measure success? What exact command produces the metric?

I need:

  1. The command to run (e.g., dotnet test, npm run benchmark, time ./build.sh, pytest --tb=short)
  2. How to extract the metric from the output (e.g., a regex pattern, a specific line, a JSON field)
  3. Direction: Is lower better or higher better?

Example: "Run dotnet test --logger trx, count passing tests. Higher is better." Example: "Run hyperfine './my-program', extract mean time. Lower is better."

Record:

  • METRIC_COMMAND: the command to run
  • METRIC_EXTRACTION: how to extract the numeric metric from output
  • METRIC_DIRECTION: lower_is_better or higher_is_better

1.3 Define the Scope

Ask the user:

Which files or directories am I allowed to modify?

And which files are OFF LIMITS (read-only)?

Record:

  • IN_SCOPE_FILES: files/dirs the agent may edit
  • OUT_OF_SCOPE_FILES: files/dirs that must not be modified

1.4 Define Constraints

Ask the user:

Are there any constraints I should respect?

Examples:

  • Time budget per experiment (e.g., "each run should take < 2 minutes")
  • No new dependencies
  • Must keep all existing tests passing
  • Must not change the public API
  • Must maintain backward compatibility
  • VRAM/memory limit
  • Code complexity limits (prefer simpler solutions)

Record as CONSTRAINTS.

1.5 Define the Experiment Budget (Optional)

Ask the user:

How many experiments should I run, or should I just keep going until you stop me?

You can say a number (e.g., "try 20 experiments") or "unlimited" (I'll run until you interrupt).

Record as MAX_EXPERIMENTS (number or unlimited).

1.6 Simplicity Criterion

Inform the user of the default simplicity policy:

Simplicity policy (default): All else being equal, simpler is better. A small improvement that adds ugly complexity is not worth it. Removing code while maintaining or improving the metric is a great outcome. I'll weigh the complexity cost against the improvement magnitude. Does this policy work for you, or do you want to adjust it?

Record any adjustments as SIMPLICITY_POLICY.

1.7 Confirm Setup

Summarize all parameters back to the user in a clear table:

Parameter Value
Goal ...
Metric command ...
Metric extraction ...

…

常见问题

如果工具把代码改得更差了怎么办?

如果某次改动没有达到预期效果,工具会放弃这次改动,并恢复到之前能正常运行的版本。

我能告诉工具哪些代码不要动吗?

可以。你可以指定哪些文件或目录属于“范围之外”,工具就不会修改它们。

工具会安装新东西吗?

不会。未经你明确同意,工具不会安装新的库,也不会改动运行环境。

详情

作者的原始描述

Autonomous iterative experimentation loop for any programming task. Guides the user through defining goals, measurable metrics, and scope constraints, then runs an autonomous loop of code changes, testing, measuring, and keeping/discarding results. Inspired by Karpathy''s autoresearch. USE FOR: autonomous improvement, iterative optimization, experiment loop, auto research, performance tuning, auto

repo: github/awesome-copilot

热度

GitHub 星标
40k
排名
#7070
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能