shinka-convert
Convert an existing codebase in the current working directory into a ShinkaEvolve task directory by snapshotting the relevant code, adding evolve blocks, and…
Create ShinkaEvolve task scaffolds from a target directory and task description, producing `evaluate.py` and `initial.<ext>` (multi-language). Use when asked to set up new ShinkaEvolve tasks, evaluation harnesses, or baseline programs for ShinkaEvolve.
$ npx -y skills add sakanaai/shinkaevolve --skill shinka-setup --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/shinka-setupContext preview
The summary Claude sees to decide when to auto-load this skill.
Create ShinkaEvolve task scaffolds from a target directory and task description, producing `evaluate.py` and `initial.<ext>` (multi-language). Use when asked to set up new ShinkaEvolve tasks, evaluation harnesses, or baseline programs for ShinkaEvolve.
name: shinka-setup description: Create ShinkaEvolve task scaffolds from a target directory and task description, producing `evaluate.py` and `initial.<ext>` (multi-language). Use when asked to set up new ShinkaEvolve tasks, evaluation harnesses, or baseline programs for ShinkaEvolve.
Create a setup scaffold consisting of an evaluation script and initial solution for an optimization problem given a user's task description. Both ingredients will be used within ShinkaEvolve, a framework combining LLMs with evolutionary algorithms to drive code optimization.
Invoke this skill when the user:
1. Check if all user inputs are provided and ask the user follow-up questions if not inferrable. 2. Inspect working directory. Detect chosen language + extension. Avoid overwriting existing `evaluate.py` or `initial.<ext>` without consent. 3. Write `initial.<ext>` with a clear evolve region (`EVOLVE-BLOCK` markers or language-equivalent comments) and stable I/O contract. 4. Write `evaluate.py`:
5. Ensure candidate output schema matches evaluator expectations (tuple/dict for Python module eval, or file/CLI contract for non-Python). 6. Validate draft `evaluate.py` before handoff:
7. Ask the user if they want to run the evolution themself or whether to use the `shinka-run` skill:
A framework developed by SakanaAI that combines LLMs with evolutionary algorithms to propose program mutations, that are then evaluated and archived. The goal is to optimize for performance and discover novel scientific insights.
Repo and documentation: https://github.com/SakanaAI/ShinkaEvolve Paper: https://arxiv.org/abs/2212.04180
1. Select parent(s) from archive/population 2. LLM proposes patch (diff, full rewrite, or crossover) 3. Evaluate candidate → `combined_score` 4. If valid, insert into island archive (higher score = better) 5. Periodically migrate top solutions between islands 6. Repeat for N generations
| File | Purpose | |------|---------| | `initial.<ext>` | Starting solution in the chosen language with an evolve region that LLMs mutate | | `evaluate.py` | Scores candidates and emits metrics/correctness outputs that guide selection | | `run_evo.py` | (Optional) Launches the evolution loop | | `shinka.yaml` | (Optional) Config: generations, islands, LLM models, patch types, etc. |
Install once before creating/running tasks:
# Check if shinka is available in workspace environment python -c "import shinka" # If not; install from PyPI pip install shinka-evolve # Or with uv uv pip install shinka-evolve
Shinka supports multiple candidate-program languages. Choose one, then keep extension/config/evaluator aligned.
| `evo_config.language` | `initial.<ext>` | |---|---| | `python` | `initial.py` | | `julia` | `initial.jl` | | `fortran` | `initial.f90` | | `cpp` | `initial.cpp` | | `cuda` | `initial.cu` | | `rust` | `initial.rs` | | `swift` | `initial.swift` | | `json` / `json5` | `initial.json` |
Rules:
import random
# EVOLVE-BLOCK-START
def advanced_algo():
# Implement the evolving algorithm here.
return 0.0, ""
# EVOLVE-BLOCK-END
def solve_problem(params):
return advanced_algo()
def run_experiment(random_seed: int | None = None, **kwargs):
"""Main entrypoint called by evaluator."""
if random_seed is not None:
random.seed(random_seed)
score, text = solve_problem(kwargs)
return float(score), textFor non-Python `initial.<ext>`, keep the same idea: small evolve region + deterministic program interface consumed by `evaluate.py`.
import argparse
import numpy as np
from shinka.core import run_shinka_eval # required for results storage
def get_kwargs(run_idx: int) -> dict:
return {"random_seed": int(np.random.randint(0, 1_000_000_000))}
def aggregate_fn(results: list) -> dict:
scores = [r[0] for r in results]
texts = [r[1] forShinkaEvolve: Towards Open-Ended and Sample-Efficient Program Evolution 🧬
Convert an existing codebase in the current working directory into a ShinkaEvolve task directory by snapshotting the relevant code, adding evolve blocks, and…
Load top-performing Shinka programs into agent context using `shinka.utils.load_programs_to_df`, and emit a compact Markdown bundle for iteration planning.
Run existing ShinkaEvolve tasks with the `shinka_run` CLI from a task directory (`evaluate.py` + `initial.<ext>`). Use when an agent needs to launch async…