Skip to content

Commit 01367e7

Browse files
duyetduyetbot
andcommitted
feat(simplify): add code cleanup plugin
Add the simplify Claude command and matching Codex skill for changed-code review across reuse, quality, and efficiency. Register the plugin in Claude and Codex marketplace metadata. Co-Authored-By: duyetbot <duyetbot@users.noreply.github.com>
1 parent a4e7bdc commit 01367e7

8 files changed

Lines changed: 196 additions & 1 deletion

File tree

.agents/plugins/marketplace.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,18 @@
124124
},
125125
"category": "Productivity"
126126
},
127+
{
128+
"name": "simplify",
129+
"source": {
130+
"source": "local",
131+
"path": "./simplify"
132+
},
133+
"policy": {
134+
"installation": "AVAILABLE",
135+
"authentication": "ON_INSTALL"
136+
},
137+
"category": "Productivity"
138+
},
127139
{
128140
"name": "clickhouse",
129141
"source": {

.claude-plugin/marketplace.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@
5454
"source": "./fix",
5555
"description": "Fix issues, tests, and CI failures with intelligent problem detection and resolution. Supports Python, Node/TS, Rust, and Go projects."
5656
},
57+
{
58+
"name": "simplify",
59+
"source": "./simplify",
60+
"description": "Review changed code for reuse, quality, and efficiency, then simplify issues found."
61+
},
5762
{
5863
"name": "prompt-engineering",
5964
"source": "./prompt-engineering",

marketplace.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@
9191
"type": "command",
9292
"category": "productivity"
9393
},
94+
{
95+
"name": "simplify",
96+
"id": "simplify@duyet-claude-plugins",
97+
"description": "Review changed code for reuse, quality, and efficiency, then simplify issues found",
98+
"version": "1.0.0",
99+
"type": "command",
100+
"category": "productivity"
101+
},
94102
{
95103
"name": "clickhouse",
96104
"id": "clickhouse@duyet-claude-plugins",
@@ -126,7 +134,7 @@
126134
],
127135
"metadata": {
128136
"lastUpdated": "2026-03-05",
129-
"totalPlugins": 14,
137+
"totalPlugins": 15,
130138
"categories": ["agents", "git", "design", "productivity", "ui", "docs", "database", "monitoring", "ml"]
131139
}
132140
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "simplify",
3+
"description": "Review changed code for reuse, quality, and efficiency, then simplify issues found",
4+
"version": "1.0.0",
5+
"author": {
6+
"name": "duyet"
7+
}
8+
}

simplify/.codex-plugin/plugin.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "simplify",
3+
"version": "1.0.0",
4+
"description": "Review changed code for reuse, quality, and efficiency, then simplify issues found",
5+
"author": {
6+
"name": "duyet"
7+
},
8+
"skills": "./skills/",
9+
"interface": {
10+
"displayName": "Simplify",
11+
"shortDescription": "Review changed code for reuse, quality, and efficiency, then simplify issues found",
12+
"developerName": "duyet",
13+
"category": "Productivity",
14+
"capabilities": [
15+
"Skill",
16+
"Command"
17+
]
18+
}
19+
}

simplify/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Simplify Plugin
2+
3+
Review changed code for reuse, quality, and efficiency, then simplify issues found.
4+
5+
## Installation
6+
7+
```bash
8+
/plugin install simplify@duyet-claude-plugins
9+
```
10+
11+
## Usage
12+
13+
```bash
14+
/simplify:simplify
15+
```
16+
17+
The command inspects the current diff, reviews it from three angles, fixes actionable issues, and summarizes what changed.
18+
19+
## Structure
20+
21+
```
22+
simplify/
23+
├── .claude-plugin/
24+
│ └── plugin.json
25+
├── .codex-plugin/
26+
│ └── plugin.json
27+
├── commands/
28+
│ └── simplify.md
29+
├── skills/
30+
│ └── simplify/
31+
│ └── SKILL.md
32+
└── README.md
33+
```

simplify/commands/simplify.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
allowed-tools: [Read, Bash, Glob, Grep, TodoWrite, Edit, MultiEdit, Write, Task]
3+
description: "Review changed code for reuse, quality, and efficiency, then simplify issues found"
4+
---
5+
6+
# /simplify:simplify - Code Review and Cleanup
7+
8+
Review all changed files for reuse, quality, and efficiency. Fix any issues found.
9+
10+
## Phase 1: Identify Changes
11+
12+
Run `git diff` or `git diff HEAD` if there are staged changes to see what changed. If there are no git changes, review the most recently modified files that the user mentioned or that you edited earlier in this conversation.
13+
14+
## Phase 2: Launch Three Review Agents in Parallel
15+
16+
Use the Task tool to launch all three agents concurrently in a single message. Pass each agent the full diff so it has the complete context.
17+
18+
### Agent 1: Code Reuse Review
19+
20+
For each change:
21+
22+
1. Search for existing utilities and helpers that could replace newly written code. Look for similar patterns elsewhere in the codebase. Common locations are utility directories, shared modules, and files adjacent to the changed ones.
23+
2. Flag any new function that duplicates existing functionality. Suggest the existing function to use instead.
24+
3. Flag any inline logic that could use an existing utility, such as hand-rolled string manipulation, manual path handling, custom environment checks, ad-hoc type guards, and similar patterns.
25+
26+
### Agent 2: Code Quality Review
27+
28+
Review the same changes for hacky patterns:
29+
30+
1. Redundant state: state that duplicates existing state, cached values that could be derived, observers/effects that could be direct calls
31+
2. Parameter sprawl: adding new parameters to a function instead of generalizing or restructuring existing ones
32+
3. Copy-paste with slight variation: near-duplicate code blocks that should be unified with a shared abstraction
33+
4. Leaky abstractions: exposing internal details that should be encapsulated, or breaking existing abstraction boundaries
34+
5. Stringly-typed code: using raw strings where constants, enums, string unions, or branded types already exist in the codebase
35+
6. Unnecessary JSX nesting: wrapper Boxes/elements that add no layout value. Check if inner component props such as `flexShrink` or `alignItems` already provide the needed behavior.
36+
7. Nested conditionals: ternary chains, nested if/else, or nested switch blocks 3+ levels deep. Flatten with early returns, guard clauses, a lookup table, or an if/else-if cascade.
37+
8. Unnecessary comments: comments explaining what the code does, narrating the change, or referencing the task/caller. Delete those. Keep only non-obvious why comments for hidden constraints, subtle invariants, or workarounds.
38+
39+
### Agent 3: Efficiency Review
40+
41+
Review the same changes for efficiency:
42+
43+
1. Unnecessary work: redundant computations, repeated file reads, duplicate network/API calls, N+1 patterns
44+
2. Missed concurrency: independent operations run sequentially when they could run in parallel
45+
3. Hot-path bloat: new blocking work added to startup or per-request/per-render hot paths
46+
4. Recurring no-op updates: state/store updates inside polling loops, intervals, or event handlers that fire unconditionally. Add a change-detection guard so downstream consumers are not notified when nothing changed. If a wrapper function takes an updater/reducer callback, verify it honors same-reference returns or the local no-change signal.
47+
5. Unnecessary existence checks: pre-checking file/resource existence before operating. Operate directly and handle the error.
48+
6. Memory: unbounded data structures, missing cleanup, event listener leaks
49+
7. Overly broad operations: reading entire files when only a portion is needed, loading all items when filtering for one
50+
51+
## Phase 3: Fix Issues
52+
53+
Wait for all three agents to complete. Aggregate their findings and fix each issue directly. If a finding is a false positive or not worth addressing, note it and move on.
54+
55+
When done, briefly summarize what was fixed, or confirm the code was already clean.

simplify/skills/simplify/SKILL.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
name: simplify
3+
description: Use when reviewing changed code for reuse, quality, and efficiency, then directly simplifying or cleaning up issues found.
4+
---
5+
6+
# Simplify: Code Review and Cleanup
7+
8+
Review all changed files for reuse, quality, and efficiency. Fix any issues found.
9+
10+
## Phase 1: Identify Changes
11+
12+
Run `git diff`, or `git diff HEAD` if there are staged changes. If there are no git changes, review the most recently modified files that the user mentioned or that were edited earlier in the conversation.
13+
14+
## Phase 2: Review in Three Passes
15+
16+
If the active Codex instructions allow subagents, launch three review agents in parallel and pass each one the full diff. If subagents are unavailable or not allowed, perform the same three passes locally.
17+
18+
### Pass 1: Code Reuse Review
19+
20+
For each change:
21+
22+
1. Search for existing utilities and helpers that could replace newly written code. Look for similar patterns elsewhere in the codebase. Common locations are utility directories, shared modules, and files adjacent to the changed ones.
23+
2. Flag any new function that duplicates existing functionality. Suggest the existing function to use instead.
24+
3. Flag any inline logic that could use an existing utility, such as hand-rolled string manipulation, manual path handling, custom environment checks, ad-hoc type guards, and similar patterns.
25+
26+
### Pass 2: Code Quality Review
27+
28+
Review the same changes for hacky patterns:
29+
30+
1. Redundant state: state that duplicates existing state, cached values that could be derived, observers/effects that could be direct calls
31+
2. Parameter sprawl: adding new parameters to a function instead of generalizing or restructuring existing ones
32+
3. Copy-paste with slight variation: near-duplicate code blocks that should be unified with a shared abstraction
33+
4. Leaky abstractions: exposing internal details that should be encapsulated, or breaking existing abstraction boundaries
34+
5. Stringly-typed code: using raw strings where constants, enums, string unions, or branded types already exist in the codebase
35+
6. Unnecessary JSX nesting: wrapper Boxes/elements that add no layout value. Check if inner component props such as `flexShrink` or `alignItems` already provide the needed behavior.
36+
7. Nested conditionals: ternary chains, nested if/else, or nested switch blocks 3+ levels deep. Flatten with early returns, guard clauses, a lookup table, or an if/else-if cascade.
37+
8. Unnecessary comments: comments explaining what the code does, narrating the change, or referencing the task/caller. Delete those. Keep only non-obvious why comments for hidden constraints, subtle invariants, or workarounds.
38+
39+
### Pass 3: Efficiency Review
40+
41+
Review the same changes for efficiency:
42+
43+
1. Unnecessary work: redundant computations, repeated file reads, duplicate network/API calls, N+1 patterns
44+
2. Missed concurrency: independent operations run sequentially when they could run in parallel
45+
3. Hot-path bloat: new blocking work added to startup or per-request/per-render hot paths
46+
4. Recurring no-op updates: state/store updates inside polling loops, intervals, or event handlers that fire unconditionally. Add a change-detection guard so downstream consumers are not notified when nothing changed. If a wrapper function takes an updater/reducer callback, verify it honors same-reference returns or the local no-change signal.
47+
5. Unnecessary existence checks: pre-checking file/resource existence before operating. Operate directly and handle the error.
48+
6. Memory: unbounded data structures, missing cleanup, event listener leaks
49+
7. Overly broad operations: reading entire files when only a portion is needed, loading all items when filtering for one
50+
51+
## Phase 3: Fix Issues
52+
53+
Aggregate findings and fix each actionable issue directly. If a finding is a false positive or not worth addressing, note it and move on.
54+
55+
When done, briefly summarize what was fixed, or confirm the code was already clean.

0 commit comments

Comments
 (0)