LogoAwesome Skills
  • Search
  • Category
  • Tag
  • Blog
LogoAwesome Skills
LogoAwesome Skills

Discover Open-Source Agent Skills for AI Coding Assistants

Product

  • Search
  • Category
  • Tag
  • Blog

Resources

  • Claude Skill Docs
  • Antigravity Skills Docs

Tools

  • Claude Code
  • OpenCode
  • Cursor
  • Codex
  • Antigravity

Company

  • Privacy Policy
  • Terms of Service
  • Sitemap

©2026 Awesome Skills. All rights reserved.

Privacy PolicyTerms
Back to Skills

component-refactoring

Refactor high-complexity React components in Dify frontend. Use when `pnpm analyze-component --json` shows complexity > 50 or lineCount > 300, when the user asks for code splitting, hook extraction, or complexity reduction, or when `pnpm analyze-component` warns to refactor before testing; avoid for simple/well-structured components, third-party wrappers, or when the user explicitly wants testing without refactoring.

140,667stars22,076forksUpdated 5/9/2026
Web DevelopmentTesting & QA#code-refactoring#react#custom-hooks#component-architecture#testing#javascript

Security Assessment

Safe(100/100)
Security Score100/100

About component-refactoring

Target users include frontend developers working on the Dify platform who need to optimize complex React components before testing or deployment. It is particularly useful when automated complexity metrics indicate potential refactoring needs or when a developer requests code splitting, hook extraction, or general complexity reduction. The skill is not intended for simple, well-structured components, third-party wrappers, or situations where testing without refactoring is explicitly desired. By following the prescribed patterns, developers can achieve more maintainable codebases, reduce technical debt, and ensure higher quality in component design.

FAQ

When should I use the component-refactoring skill?

Use this skill when `pnpm analyze-component --json` shows a complexity score above 50, a line count over 300, or when refactoring is suggested before testing. It is also appropriate when users request code splitting or hook extraction.

Can I use this skill on all React components?

No, it is intended for high-complexity components. Avoid using it on simple, well-structured components or third-party wrapper components.

Where should custom hooks be placed according to Dify conventions?

Custom hooks should be placed in a `hooks/` subdirectory within the component or alongside the component file, typically named `use-<feature>.ts`.

Does this skill modify components automatically?

The skill generates refactoring prompts and provides guidance, but developers must implement the changes manually according to the suggested patterns.

What metrics does the skill rely on for refactoring decisions?

It relies on `complexity`, `maxComplexity`, and `lineCount` from `pnpm analyze-component --json`. Target values are complexity below 50 and line count below 300.

All Files

4 files
references/complexity-patterns.md11.6 KB
View
references/hook-extraction.md7.7 KB
View
references/component-splitting.md11.1 KB
View
SKILL.md13.0 KB
View

Install component-refactoring

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

langgenius/dify

Related Skills

research

448

secops-detection-engineering

21,346

qdrant-monitoring

259

project-architecture

3