bengous/agents-skills/refactorlib-cc
Claude Code and agent skill by bengous/agents-skills
- community
Checking that the SKILL.md file is still in the repository.
Audit a codebase for handcrafted code that duplicates functionality already available in the project's dependencies. Reads package.json, launches parallel exploration agents, verifies replacement feasibility, and produces a structured refactor plan. Audit only -- does not execute changes.
Install
npx vskill@latest install bengous/agents-skills/refactorlib-ccSKILL.md
The same SKILL.md was published earlier as bengous/agents-skills/refactorlib-cc.
refactorlib
Audit a codebase for handcrafted code that could be replaced by existing dependencies.
Projects accumulate utility code over time. Some predates a dependency that now covers the same ground; some was written before the team discovered a library API. Removing these duplications shrinks maintenance surface and leverages battle-tested implementations with better edge-case handling and security patches.
Project context
- deps: !
bun -e "const p=JSON.parse(await Bun.file('package.json').text()); console.log(JSON.stringify({...p.dependencies,...p.devDependencies}))" 2>/dev/null - runtime: !
bun --version 2>/dev/null || node --version 2>/dev/null - has_effect: !
bun -e "const p=JSON.parse(await Bun.file('package.json').text()); console.log(p.dependencies?.effect || p.devDependencies?.effect ? 'yes' : 'no')" 2>/dev/null - has_bun: !
bun -e "const p=JSON.parse(await Bun.file('package.json').text()); console.log(p.devDependencies?.['@types/bun'] ? 'yes' : 'no')" 2>/dev/null - src_dirs: !
ls src/ 2>/dev/null | head -20
Workflow
Phase 1 -- Route on context
The project context above was resolved at skill load time. Use it to decide which pattern catalogs each agent should read:
- If has_effect == "yes": include
references/patterns/effect-infra.mdin the infra
agent's pattern list
- Always: include
references/patterns/runtime-infra.mdfor infra agent,
references/patterns/general-utility.md and references/patterns/runtime-utility.md for utility agent
The subagents have effect-usage and bun skills preloaded — no need to load companion skills in the orchestrator.
Phase 2 -- Parallel exploration
Spawn two custom subagents in parallel. Each receives a short task prompt with:
- Project dependencies (from
depsabove) - Source directories (from
src_dirsabove) - Pattern catalog file paths to read (from Phase 1 routing)
- Guardrails:
~/.claude/skills/refactorlib-cc/references/guardrails.md - Report format:
~/.claude/skills/refactorlib-cc/references/report-format.md - The user's request (or "Full audit -- no scope restriction")
The agents' system prompts (from their markdown definitions) provide the methodology. Their preloaded skills (effect-usage, bun) provide deep API knowledge with progressive disclosure.
Phase 3 -- Triage and deep-dive
Synthesize agent findings. For each candidate, classify:
| Verdict | Meaning | |
|---|---|---|
| REPLACE | Clear duplication. Library equivalent exists, is proven compatible, and is installed. | |
| INVESTIGATE | Likely replaceable but needs API verification or output comparison. | |
| KEEP | Intentionally custom. See references/guardrails.md. |
For REPLACE and INVESTIGATE candidates, perform these verification steps:
- Read the source -- understand the full implementation, not just the grep match
- Count callers --
grep -rfor imports to gauge blast radius - Verify the API exists -- grep type declarations in
node_modules/*/dist/dts/for the
replacement API. An API that looks right in docs might not exist in the installed version.
- Test output compatibility (for INVESTIGATE) -- run both implementations with identical
input via bun -e and compare output. This catches subtle differences in encoding, formatting, or edge-case behavior.
Only promote INVESTIGATE to REPLACE after step 4 confirms identical behavior.
Phase 4 -- Structured output
Produce the final report using this template:
False-positive guardrails
See references/guardrails.md. Agents are directed to read this file during exploration.
Reference navigation
| Question | Load | |
|---|---|---|
| Effect infrastructure patterns? | references/patterns/effect-infra.md | |
| Bun/Node infrastructure APIs? | references/patterns/runtime-infra.md | |
| Bun/Node utility APIs? | references/patterns/runtime-utility.md | |
| General utility patterns? | references/patterns/general-utility.md | |
| False-positive guardrails? | references/guardrails.md | |
| Infra subagent? | dot_claude/agents/refactorlib-infra.md | |
| Utility subagent? | dot_claude/agents/refactorlib-utility.md | |
| Agent report format? | references/report-format.md |
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingrefactorlib-cc/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/bengous/agents-skills/refactorlib-cc)