Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Refactors high-complexity Dify React components by extracting hooks and splitting code, using pnpm analyze-component metrics.
50% 95%+45 ptsof test cases passed
Passed 21 of 22 test cases with the skill, and 11 of 22 without it.
From which working directory in the repository root should component analysis and refactoring CLI scripts be run?
specifies executing component commands from the web/ directory
3 of 3 safety checks passed
Refactor high-complexity React components in the Dify frontend codebase with the patterns and workflow below.
Complexity Threshold: Components with complexity > 50 (measured by
pnpm analyze-component) should be refactored before testing.
web/)Use paths relative to web/ (e.g., app/components/...).
Use refactor-component for refactoring prompts and analyze-component for testing prompts and metrics.
cd web
# Generate refactoring prompt
pnpm refactor-component <path>
# Output refactoring analysis as JSON
pnpm refactor-component <path> --json
# Generate testing prompt (after refactoring)
pnpm analyze-component <path>
# Output testing analysis as JSON
pnpm analyze-component <path> --json
# Analyze component complexity
pnpm analyze-component <path> --json
# Key metrics to check:
# - complexity: normalized score 0-100 (target < 50)
# - maxComplexity: highest single function complexity
# - lineCount: total lines (target < 300)
Published skills whose descriptions closely match this one, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.