aiclean

Refactor radare2 source code to reduce complexity and improve readability.

20|1|Updated Mar 20, 2026
One-click install
npx skills add https://github.com/radareorg/radare2-skills --skill aiclean
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: aiclean
Source: https://github.com/radareorg/radare2-skills/tree/main/dev/aiclean
Command: npx skills add https://github.com/radareorg/radare2-skills --skill aiclean

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps remove unnecessary complexity in radare2-related code, reducing line count and improving readability while maintaining behavior through safer, well-scoped changes.

Core Features & Use Cases

  • Behavior-preserving cleanup plans: Turns the provided context into a small refactoring plan that prioritizes LOC reduction, readability, and safer ownership/bounds handling.
  • Radare2-native style enforcement: Guides changes toward portable, radare2-native APIs for strings, arrays, vectors, and hash tables, avoiding non-portable libc patterns.
  • History-aware refactoring: Encourages inspecting cleanup-oriented history within the same subsystem to reuse prior fixes and deduplicate repeated logic.
  • Common cleanups that reduce bugs: Targets double dereferences, repeated traversal/formatting code, dead code elimination, and safer ownership/free/reset paths.

Quick Start

Use aiclean to review the specified radare2 subsystem code changes and produce a focused, LOC-reducing refactor patch that follows the skill’s portability, safety, and radare2-API guidelines.

Frequently Asked Questions about aiclean

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely refactor radare2 source code to reduce complexity?

To safely refactor radare2 source code, apply behavior-preserving changes that reduce line count and improve readability by validating loop invariants, using radare2-native helpers, and verifying changes with tests or builds.

How do I eliminate dead code and deduplicate repeated logic in radare2?

Eliminate dead code and deduplicate repeated logic in radare2 by inspecting cleanup-oriented history within the subsystem to reuse prior fixes, targeting double dereferences and repeated traversal or formatting code for safer ownership paths.

How do I enforce portable C and radare2-native APIs during code cleanup?

Enforce portable C and radare2-native APIs during code cleanup by avoiding non-portable libc patterns and preferring radare2-native helpers for strings, arrays, vectors, and hash tables to ensure portability and consistency.

Does code refactoring for radare2 require build validation to maintain behavior?

Code refactoring for radare2 does require build validation or tests when feasible to maintain behavior, ensuring that changes simplifying functions and improving bounds handling do not introduce regressions.

What is the best way to plan a behavior-preserving cleanup for radare2 subsystems?

The best way to plan a behavior-preserving cleanup for radare2 subsystems is to generate a focused refactoring plan that prioritizes LOC reduction, readability, and safer ownership or bounds handling.

Why should I avoid non-portable libc patterns when refactoring radare2 code?

You should avoid non-portable libc patterns when refactoring radare2 code to maintain strict portability requirements, relying instead on radare2-native APIs to handle strings, arrays, and vectors safely across platforms.