Skip to main content

form-refactorer

Refactor legacy forms to use modern Redpanda UI Registry Field components with react-hook-form and Zod validation. Use when user requests: (1) Form refactoring or modernization, (2) Updating forms to use Field components, (3) Migrating from legacy form patterns, (4) Implementing forms with react-hook-form and Zod validation.

소스 정보

저장소
redpanda-data/console
최근 소스 활동
2026년 9월 16일 14:00
감지된 SKILL.md 언어
영어
스타
4,336
포크
429

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

파일 탐색기
2 개 파일

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
form-refactorer
description
Refactor legacy forms to use modern Redpanda UI Registry Field components with react-hook-form and Zod validation. Use when user requests: (1) Form refactoring or modernization, (2) Updating forms to use Field components, (3) Migrating from legacy form patterns, (4) Implementing forms with react-hook-form and Zod validation.
# Form Refactorer Refactor legacy forms to modern Redpanda UI Registry Field components with react-hook-form and Zod validation. ## Core Requirements ### MUST USE (Modern Pattern) - Field component family from `components/redpanda-ui/components/field` - react-hook-form for form state management - Zod for validation schemas via `zodResolver` ### FORBIDDEN (Legacy Patterns) See [no-legacy](../code-standards/rules/no-legacy.md) for prohibited patterns. Also never import `Form` from `components/redpanda-ui/components/form`. ## Component Hierarchy ``` FieldSet - Semantic fieldset container for related fields ├─ FieldLegend - Title for the fieldset ├─ FieldDescription - Description for entire fieldset └─ FieldGroup - Layout wrapper that stacks fields ├─ Field - Individual field wrapper │ ├─ FieldLabel - Label for input (use htmlFor) │ ├─ Input/Select/... - Form control │ ├─ FieldDescription - Helper text │ └─ FieldError - Error message ├─ FieldSeparator - Visual divider between fields └─ Field - Another field ``` ## Key Patterns **Vertical field:** ```tsx <Field data-invalid={!!errors.fieldName}> <FieldLabel htmlFor="fieldName">Label</FieldLabel> <Input id="fieldName" {...register("fieldName")} aria-invalid={!!errors.fieldName} /> {errors.fieldName && <FieldError>{errors.fieldName.message}</FieldError>} </Field> ``` **Horizontal field (switch/checkbox):** ```tsx <Field orientation="horizontal"> <Switch id="toggle" {...register("toggle")} /> <FieldContent> <FieldLabel htmlFor="toggle">Enable Feature</FieldLabel> <FieldDescription>Description</FieldDescription> </FieldContent> </Field> ``` ## Checklist Before completing refactoring, verify: - [ ] All legacy form imports removed (the legacy `Form` component) - [ ] Field components used for all fields - [ ] FieldLabel has `htmlFor` matching Input `id` - [ ] Errors show `data-invalid` on Field and `aria-invalid` on Input - [ ] Yup replaced with Zod + zodResolver - [ ] FieldSet + FieldLegend used for semantic grouping - [ ] FieldError conditionally rendered: `{errors.field && <FieldError>...` - [ ] Form submission handled via react-hook-form `handleSubmit` ## References - [Common Patterns](references/common-patterns.md) — Dynamic fields, field arrays, multi-section forms, pitfalls, Zod patterns - [Field Component Docs](https://redpanda-ui-registry.netlify.app/docs/field)
GitHub에서 보기