.agents/skills/component-refactoring/SKILL.md
Refactor high-complexity React components. Use when complexity metrics are high or to split monolithic UI.
npx skillsauth add jidohyun/NOD component-refactoringInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Refactor high-complexity React components with proven patterns and workflows.
Complexity Threshold: Components with cyclomatic complexity > 50 or line count > 300 should be candidates for refactoring.
Use When:
pnpm analyze-component shows high complexity.Goal: Separate UI from State/Logic.
Before:
function UserList() {
const [users, setUsers] = useState([]);
const [loading, setLoading] = useState(false);
useEffect(() => {
setLoading(true);
fetch('/api/users').then(data => {
setUsers(data);
setLoading(false);
});
}, []);
if (loading) return <Spinner />;
return <ul>{users.map(u => <li key={u.id}>{u.name}</li>)}</ul>;
}
After:
// hooks/useUsers.ts
function useUsers() {
return useQuery({ queryKey: ['users'], queryFn: fetchUsers });
}
// UserList.tsx
function UserList() {
const { data: users, isLoading } = useUsers();
if (isLoading) return <Spinner />;
return <UserListView users={users} />;
}
Goal: Break down monolithic JSX.
Before:
function Dashboard() {
return (
<div>
<header>...</header>
<aside>...</aside>
<main>
<section className="stats">...</section>
<section className="feed">...</section>
</main>
</div>
);
}
After:
function Dashboard() {
return (
<Layout>
<DashboardHeader />
<DashboardSidebar />
<DashboardContent>
<StatsWidget />
<ActivityFeed />
</DashboardContent>
</Layout>
);
}
Goal: Reduce nesting and if/else checks implementation details.
Goal: Centralize modal state and logic.
<ModalManager /> or context if reused globally.isOpen state locally if specific to a single component, but extract the Modal content to a separate file.development
Develop custom native UI libraries based on Flutter widgets for WebF. Create reusable component libraries that wrap Flutter widgets as web-accessible custom elements.
development
Advanced design intelligence for professional UI/UX. Use for implementing modern design patterns (Glassmorphism, Bento Grid), ensuring accessibility, and generating tailored design systems for web and mobile.
development
Manages Terraform state operations such as importing, moving, and removing resources. Use this skill when the user needs to refactor Terraform state, import existing infrastructure, fixing state drift, or migrate backends without destroying resources.
development
Expert guidance for creating, managing, and using Terraform modules. Use this skill when the user wants to create reusable infrastructure components, standardize Terraform patterns, or needs help with module structure and best practices for AWS, GCP, or Azure.