fanzy27/evolving-rl/add-reward-function
Claude Code and agent skill by fanzy27/evolving-rl
- community
Checking that the SKILL.md file is still in the repository.
Guide for adding a custom reward function in slime and wiring it through --custom-rm-path (and optional reward post-processing). Use when user wants new reward logic, remote/service reward integration, or task-specific reward shaping.
Install
npx vskill@latest install fanzy27/evolving-rl/add-reward-functionSKILL.md
The same SKILL.md was published earlier as xbqnrcm/shopsimrl/add-reward-function.
Add Reward Function
Implement custom reward logic and connect it to slime rollout/training safely.
When to Use
Use this skill when:
- User asks to add new reward computation logic
- User asks to integrate an external reward service
- User asks to customize reward normalization/post-processing
Step-by-Step Guide
Step 1: Choose Reward Mode
Pick one of these:
- Single-sample mode (
--group-rmdisabled): custom function gets oneSample - Group/batch mode (
--group-rmenabled): custom function getslist[Sample]
slime.rollout.rm_hub.__init__.py calls your function via --custom-rm-path.
Step 2: Create Reward Module
Create slime/rollout/rm_hub/<your_rm>.py.
Supported signatures:
If using group mode, return one reward per sample in input order.
Step 3: Keep Reward Type Consistent
- Return scalar numeric rewards unless your pipeline explicitly uses keyed rewards.
- If using reward dicts, ensure downstream
reward_key/eval_reward_keyis configured. - Keep exceptions explicit for invalid metadata instead of silently returning zeros.
Step 4: Optional Reward Post-Processing
To customize normalization/shaping before advantage computation, add:
Wire with:
This hook is consumed in slime/ray/rollout.py.
Step 5: Wire and Validate
Use:
Common Mistakes
- Returning wrong output shape in group mode
- Mixing scalar rewards and reward dicts without
reward_keyconfig - Doing blocking network calls without async handling
- Forgetting to validate reward behavior on truncated/failed samples
Reference Locations
- Reward dispatch:
slime/rollout/rm_hub/__init__.py - Reward post-process hook:
slime/ray/rollout.py - Customization docs:
docs/en/get_started/customization.md
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingslime/.claude/skills/add-reward-function/SKILL.md
Popularity
- Repository stars
- 21
- Repository forks
- 1
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/fanzy27/evolving-rl/add-reward-function)