autoresearch-code-skill

A method for repeatedly improving code by making one small change, measuring it with a benchmark, and keeping or reverting it based on the result. It can use measures such as test coverage, bundle size, runtime, or error count; TDD means developing with tests as a guide.

In plain words
What is it for?
Iteratively increasing test coverage, reducing JavaScript bundle size or runtime, and lowering error counts. It is designed for code changes that can be measured and repeated toward a target.
Why use it?
It removes the need to decide by inspection whether an optimization helped. A program checks the result, while guard and consumer checks help catch broken downstream code before a change is kept.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/darellchua2/opencode-config-template/autoresearch-code-skill
Any agent
npx skills add darellchua2/opencode-config-template --skill autoresearch-code-skill
Clone the repo
git clone --depth 1 https://github.com/darellchua2/opencode-config-template

Made for: Claude Code, Codex.

Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,361 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00040 $0.01361
Opus 5 $0.00020 $0.00681
Sonnet 5 $0.00008 $0.00272
Haiku 4.5 $0.00004 $0.00136

Measured 3d ago against content hash 8839b708e664, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

autoresearch-code-skill scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (templates/guard.example.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- `autoresearch-core-skill/references/iteration-safety.md` — Verify/Guard separation; never modify `.env`, `node_modules/`, or run `rm -rf`.
opencode_app/.opencode/skills/autoresearch-code-skill/SKILL.md · 70 lines

How it starts

The opening of the file, as written. The whole thing — 70 lines — stays where its author put it; the contents beside it link to each section on GitHub.

What I do

I run an autonomous code-optimization loop. Each iteration: read the audit trail → hypothesize one atomic code change → apply → commit → run the benchmark evaluator → run the Guard command → run the Consumer Coverage check → keep the commit if {"pass":true,"score":N} shows improvement AND the guard stays green AND no downstream consumer is broken, else git reset --hard HEAD~1. I am Tier 1 (mechanical evaluator) — every keep/revert decision comes from a program, never from LLM self-judgment. I overlap with tdd-workflow-skill, but I am autonomous-loop-flavored (iterate to a target overnight) where TDD is single-cycle (write-one-test-then-implement).

Triggers

Load me (or route to autoresearch-code-subagent) when the user says any of:

  • "optimize code", "optimize until", "iteratively improve"
  • "test coverage", "increase coverage to N%"
  • "bundle size", "reduce bundle"
  • "performance", "reduce runtime", "speed up"
  • "fix errors", "reduce error count", "drive failures to zero"
  • "autoresearch code", "git-as-memory optimization"

Do not trigger for ML training (→ autoresearch-ml-skill) or literature review (→ autoresearch-research-skill).

Citations

  • autoresearch-core-skill/references/evaluator-contract.md — the {"pass":bool,"score":N} shape my benchmark evaluator emits.
  • autoresearch-core-skill/references/stuck-detection.md — 3-strike pivot (switch from micro-opt to algorithmic change; target a different hotspot).
  • autoresearch-core-skill/references/iteration-safety.md — Verify/Guard separation; never modify .env, node_modules/, or run rm -rf.
  • autoresearch-core-skill/references/audit-trail.md — the 8-column TSV I append to (<skill>-results.tsv).
  • autoresearch-core-skill/references/crash-recovery.md — syntax error → free fix; guard failure → revert.

Skill-specific overrides

  1. TDD mapping (the key override). When the metric is "test pass-count":
    • pass: true GREEN (all targeted tests pass)
    • pass: false RED (any targeted test fails)
    • score pass-count (number of tests passing)
    • This makes tdd-workflow-skill and this skill mechanically equivalent when the metric is test-pass; the difference is I iterate to a target autonomously rather than running one RED→GREEN cycle.
  2. Verify vs Guard vs Consumer Coverage. Verify emits {"pass":bool,"score":N} (e.g. pytest --cov → coverage %). Guard is a separate command that must stay green (e.g. npm test). Consumer Coverage is a third mandatory check that enumerates downstream callers of every changed symbol and forces revert on any broken reference. A failing Guard or a failing Consumer Coverage check forces revert regardless of Verify — you cannot trade test-green for a broken downstream consumer.
  3. Tier 1 (mechanical evaluator). No agent-as-evaluator fallback.
  4. Git-as-memory. Commit before Verify so revert is one command. Never edit the working tree without committing first — an uncommitted change cannot be cleanly reverted.
  5. Bounded-by-default. Iterations: 25 default. Lower for fast benchmarks (e.g. Iterations: 10 for npm run build cycles).
  6. Consumer Coverage sub-step (mandatory, between Guard and Keep/Revert). Guard is necessary but not sufficient — Guard validates a fixed suite (e.g. npm test), but it cannot detect downstream breakage in code paths the suite does not exercise. The Consumer Coverage sub-step traces the actual call graph of the symbols this iteration touched:
    • With .codegraph/: codegraph_callers on each changed symbol; revert if any caller is broken.
    • Without .codegraph/: grep -r/glob for importers and references of each changed symbol; revert if any grep hit references the old (now-renamed/removed) symbol.
    • Log discard with consumer-broken note in *-results.tsv when this gate forces a revert. Cross-references the agent's implementation in autoresearch-code-subagent.md §Consumer Coverage Gate.

Read the full file on GitHub · 70 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 70 lines · 40 tokens per session scan C 8839b708e664

Subscribe to this mod's changes

autoresearch-code-skill is a skill published in the GitHub repository darellchua2/opencode-config-template (6 stars, last pushed 3d ago), licensed Apache-2.0. It adds 40 tokens to every session and 1,361 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

create-notes

Write a note to {shareddir}/notes/ that future agents can actually act on. Use after every coral eval, when a heartbeat (reflect / consolidate / pivot) asks for a note, or when you discover a grader / build / runtime issue that future agents will hit. Covers 4 note variants (experiment / infra / focus / synthesis)…

Human-Agent-Society/CORAL · 217 tokens

autocontext

Iterative strategy generation and evaluation system. Use when the user wants to evaluate agent output quality, run improvement loops, queue tasks for background evaluation, check run status, inspect runtime artifacts and session branch lineage, or discover available scenarios. Provides LLM-based judging with…

greyhaven-ai/autocontext · 60 tokens

autocontext-consumer

Use when an agent needs to USE knowledge Autocontext already produced - find which scenarios have knowledge, read the playbook and lessons for one, understand the on-disk file and folder layout, and move knowledge between checkouts. Host-agnostic; requires only the autoctx CLI and the filesystem.

greyhaven-ai/autocontext · 67 tokens

arbor-research-agent

Public entrypoint for the Arbor skill suite. Use when a user wants to run an Arbor-style autonomous research or optimization workflow from a natural-language goal, including initial clarification of objective, target project, data, metric, evaluation, permissions, budget, run mode, and then automatic bootstrapping…

RUC-NLPIR/Arbor · 74 tokens

skill-creator

Autonomously create, test, and optimize skills by detecting reusable patterns in your own work. Use when you notice repeated tool sequences, recurring code patterns across attempts, or insights that should be captured as a packaged skill. Also use to benchmark and iterate on existing skills.

Human-Agent-Society/CORAL · 58 tokens

arbor-agent-executor

Executor-dispatch phase for Arbor. Use when implementing an Idea Tree node through RunExecutor or RunExecutorParallel semantics: isolated git worktree, executor prompt construction, eval metadata injection, RunTraining policy, smoke/full evaluation, report parsing, artifact persistence, tree update, and insight…

RUC-NLPIR/Arbor · 63 tokens