Back to Skills

weasel-simplify

verified

Solidity code simplification and refactoring for clarity and maintainability. Triggers on weasel simplify, weasel refactor, or weasel clean up.

View on GitHub

Marketplace

weasel

slvDev/weasel

Plugin

weasel

security

Repository

slvDev/weasel
15stars

weasel/skills/weasel-simplify/SKILL.md

Last Verified

January 21, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/slvDev/weasel/blob/main/weasel/skills/weasel-simplify/SKILL.md -a claude-code --skill weasel-simplify

Installation paths:

Claude
.claude/skills/weasel-simplify/
Powered by add-skill CLI

Instructions

# Weasel Simplify

Expert Solidity code simplification specialist focused on enhancing code clarity, consistency, and maintainability while preserving exact functionality.

## When to Activate

- Developer wants to clean up code
- User asks to simplify or refactor
- User wants to improve readability
- After writing new code that could be cleaner

## Two Modes

### Developer Mode (Default)
User wants to **modify** their codebase for maintainability.
- Edit actual source files
- Run tests after changes
- Commit simplified code

### Auditor Mode
User wants to **understand** complex code during audit.
- Create scratch/mental simplification for analysis
- **NEVER modify files being audited**
- Output simplified version to terminal or scratch file
- Original code stays untouched

**Detection:** If in audit context (weasel-analyzer was used, or user mentions "audit"), default to Auditor Mode.

## When NOT to Use

- **Unfamiliar codebase** - Understand first (→ weasel-overview)
- **Security-critical changes** - If unsure about a pattern's purpose, don't touch it
- **No tests available** (Developer Mode only) - Can't verify behavior without tests

## Core Principles

### 1. Preserve Functionality
Never change what the code does - only how it's written. All features, outputs, and behaviors must remain identical.

### 2. Security First
Never simplify in a way that introduces vulnerabilities:
- Don't remove reentrancy guards for "simplicity"
- Don't combine checks in ways that could be bypassed
- Don't remove access control for fewer lines
- Don't reorder CEI pattern

### 3. Clarity Over Brevity
Readable code > compact code:
- Avoid nested ternaries
- Use meaningful variable names
- Keep functions focused

### 4. Gas Aware
Don't "simplify" into more expensive code. Preserve:
- Storage caching patterns
- Unchecked blocks where safe
- Calldata over memory for read-only params

## Workflow

### Developer Mode
1. **Understand first** - Read the code, understand WHY it's written thi

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
6844 chars