huali
Joined 1 year ago
Joined 1 year ago
I've been experimenting with applying the Label Propagation Algorithm (LPA) to AST dependency graphs. By treating variables and functions as nodes, we can identify communities (clusters) within a single file.
I integrated this into a tool for Claude Code called VHO. It helps dismantle monolithic React/Vue hooks by grounded mathematical analysis rather than just LLM prediction.
Technical breakdown:
AST Parsing: To build the reference graph. LPA: To find the optimal boundaries for extraction. Agentic Execution: Using Claude Code to perform the actual file I/O and refactoring. Is graph-theory-assisted refactoring the future of AI coding? I'd love to discuss the methodology.
Now Integrated with Claude Code:I’ve implemented this as a Claude Code Skill. This allows the AI to not just "guess" how to refactor, but to follow a mathematically-backed community analysis to extract logic sustainably.
Stack:
- Core: Graph-based dependency analysis.
- Delivery: VS Code Ext, MCP Server, and Claude Code Skill.
- Supports: Vue 3 (Script Setup) and React.
I’m curious—do you trust AI to define your refactoring boundaries, or do you prefer a visualization tool to guide you?
Repo: https://github.com/zcf0508/vue-hook-optimizer
Playground: https://vue-hook-optimizer.vercel.app
Deploy the service on your cloud server or your local computer, then add the streamable MCP and skill to Claude Code.
To activate in a new conversation, simply reference the skill first: `@~/.claude/skills/mem/SKILL.md`.
If you like this project, please give it a star on GitHub!
Works with Vue 3 and React. Install via VS Code extension, playground, or MCP server. Includes refactoring skills to guide the actual extraction process.
Dependency graphs + community analysis = clearer path to clean architecture.