Expand toolkit to 135 agents, 120 plugins, 796 total files
- Add 60 new agents across all 10 categories (75 -> 135) - Add 95 new plugins with command files (25 -> 120) - Update all agents to use model: opus - Update README with complete plugin/agent tables - Update marketplace.json with all 120 plugins
This commit is contained in:
6
plugins/refactor-engine/.claude-plugin/plugin.json
Normal file
6
plugins/refactor-engine/.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "refactor-engine",
|
||||
"version": "1.0.0",
|
||||
"description": "Extract functions, simplify complex code, and reduce cognitive complexity",
|
||||
"commands": ["commands/extract-fn.md", "commands/simplify.md"]
|
||||
}
|
||||
40
plugins/refactor-engine/commands/extract-fn.md
Normal file
40
plugins/refactor-engine/commands/extract-fn.md
Normal file
@@ -0,0 +1,40 @@
|
||||
Extract a block of code into a well-named, reusable function with proper typing.
|
||||
|
||||
## Steps
|
||||
|
||||
1. Identify the code block to extract:
|
||||
- Accept file path with line range, or a description of the logic.
|
||||
- If no range given, detect the longest or most complex function and suggest extraction.
|
||||
2. Analyze the code block:
|
||||
- Variables read from outer scope become function parameters.
|
||||
- Variables written and used later become return values.
|
||||
- Side effects (I/O, mutations) are documented in the function's contract.
|
||||
3. Determine the function signature:
|
||||
- Name: verb + noun describing the action (e.g., `calculateTotalPrice`).
|
||||
- Parameters: typed, ordered by importance, grouped in object if more than 3.
|
||||
- Return type: explicit annotation.
|
||||
4. Extract the function:
|
||||
- Move the code block to the new function.
|
||||
- Add type annotations for parameters and return value.
|
||||
- Replace the original code with a function call.
|
||||
5. If the function is reusable across modules, move it to a shared utilities file.
|
||||
6. Run tests to verify behavior is preserved.
|
||||
|
||||
## Format
|
||||
|
||||
```
|
||||
Extracted: <functionName>
|
||||
From: <file>:<startLine>-<endLine>
|
||||
To: <destination file>
|
||||
Params: (<paramList>)
|
||||
Returns: <returnType>
|
||||
Tests: passing
|
||||
```
|
||||
|
||||
## Rules
|
||||
|
||||
- The extraction must preserve identical behavior; run tests before and after.
|
||||
- Name functions based on purpose, not implementation.
|
||||
- Keep parameter count under 4; use an options object for more.
|
||||
- Add a doc comment explaining what the extracted function does.
|
||||
- Do not extract trivially short code (under 3 lines) unless it clarifies intent.
|
||||
46
plugins/refactor-engine/commands/simplify.md
Normal file
46
plugins/refactor-engine/commands/simplify.md
Normal file
@@ -0,0 +1,46 @@
|
||||
Simplify complex code by reducing nesting, eliminating duplication, and improving clarity.
|
||||
|
||||
## Steps
|
||||
|
||||
1. Measure the current complexity:
|
||||
- Count nesting depth (target: max 3 levels).
|
||||
- Count lines per function (target: max 30 lines).
|
||||
- Identify duplicated patterns (3+ occurrences).
|
||||
- Check cyclomatic complexity if tooling available.
|
||||
2. Apply simplification techniques:
|
||||
- **Early returns**: Replace nested if/else with guard clauses.
|
||||
- **Extract variables**: Name complex expressions for readability.
|
||||
- **Decompose conditionals**: Move complex conditions into named functions.
|
||||
- **Replace loops**: Use map/filter/reduce where clearer.
|
||||
- **Eliminate duplication**: Extract repeated patterns into shared functions.
|
||||
- **Simplify state**: Reduce the number of mutable variables.
|
||||
3. For each simplification:
|
||||
- Show the before and after code.
|
||||
- Explain why the change improves the code.
|
||||
- Verify behavior is preserved.
|
||||
4. Run tests after all simplifications.
|
||||
5. Measure the new complexity and compare to the original.
|
||||
|
||||
## Format
|
||||
|
||||
```
|
||||
Simplification Report: <file>
|
||||
|
||||
Before: <complexity metrics>
|
||||
After: <complexity metrics>
|
||||
|
||||
Changes:
|
||||
1. <description>: reduced nesting from 5 to 2 levels
|
||||
2. <description>: extracted 3 duplicated blocks into shared function
|
||||
3. <description>: replaced nested ternary with lookup table
|
||||
|
||||
Tests: all passing
|
||||
```
|
||||
|
||||
## Rules
|
||||
|
||||
- Never change behavior while simplifying; this is purely structural.
|
||||
- Simplify the most complex functions first for maximum impact.
|
||||
- Preserve meaningful variable names; do not over-abbreviate.
|
||||
- Run tests after each simplification to catch regressions early.
|
||||
- Do not simplify code that is intentionally optimized for performance.
|
||||
Reference in New Issue
Block a user