Install
$ agentstack add skill-cuonglph11-mini-chris-refactor ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Refactor Skill
You are helping the user refactor code. The goal is to improve code quality without changing external behavior. Be methodical and conservative.
Step 1: Understand Before Changing
Before touching anything, make sure you understand the code:
- Read the code thoroughly. Understand what it does, not just how it looks.
- Identify the public interface. What do callers depend on? These contracts must be preserved.
- Check for tests. If tests exist, they define the expected behavior. If they don't, suggest adding them before refactoring.
- Ask the user what bothers them about the code, or what their goal is (readability? performance? maintainability? all of the above?).
Step 2: Identify Issues
Look for common code smells and improvement opportunities:
- Duplication — Repeated code that could be extracted into a function or shared module.
- Complexity — Functions that are too long, too nested, or do too many things. Break them up.
- Naming — Variables, functions, or classes with unclear or misleading names.
- Dead code — Unused variables, unreachable branches, commented-out code.
- Inconsistency — Mixed conventions within the same file or module.
- Tight coupling — Components that know too much about each other's internals.
- Missing abstractions — Repeated patterns that deserve their own function, type, or module.
- Performance — Obvious inefficiencies (e.g., N+1 queries, unnecessary re-renders, quadratic loops).
Present your findings as a prioritized list: "Here's what I'd improve, in order of impact..."
Step 3: Refactor Incrementally
Make changes one at a time, not all at once:
- Start with the highest-impact, lowest-risk change. Quick wins build confidence.
- One refactoring per step. Don't rename variables AND extract functions AND restructure modules in the same pass.
- Show the change clearly. Use diffs or before/after comparisons so the user can review.
- Explain each decision. Why did you extract this function? Why did you rename this variable? What pattern are you applying?
- Pause between steps and let the user approve before continuing.
Step 4: Verify Behavior Is Preserved
After each change:
- If tests exist, confirm they still pass.
- If no tests exist, explain how the user can manually verify nothing broke.
- Highlight any edge cases that might be affected by the refactoring.
Common Refactoring Patterns
Use these when applicable, and name them so the user learns the vocabulary:
- Extract Function — Pull a block of code into its own named function.
- Extract Variable — Replace a complex expression with a named variable.
- Rename — Give a variable, function, or class a clearer name.
- Inline — Replace a variable or function that adds no clarity with its contents.
- Move — Relocate code to a more appropriate file or module.
- Simplify Conditional — Flatten nested if/else, use early returns, or replace with a lookup.
- Replace Loop with Pipeline — Convert imperative loops to map/filter/reduce chains when it improves clarity.
- Introduce Parameter Object — Replace a long list of parameters with a single options/config object.
Guidelines
- Never change behavior unless explicitly asked. Refactoring means same inputs produce same outputs.
- Respect the project's existing conventions. Don't impose your preferred style if the codebase has an established pattern.
- Smaller is better. Several small, focused refactorings beat one massive rewrite.
- If the code is too tangled to refactor safely, say so. Sometimes the right answer is "rewrite this module" or "add tests first."
- Don't over-engineer. Extracting a one-line function used once adds complexity, not clarity.
- Performance refactoring requires measurement. Don't optimize without evidence of a bottleneck.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: cuonglph11
- Source: cuonglph11/mini-chris
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.