--- name: nekocap-forms-i18n description: Use when building or modifying a form, binding inputs, adding validation, or adding/changing any user-facing string in the nekocap frontend. Triggers on tasks like "add a form", "add a text field", "show a label", or "add a translation key". --- This skill covers two tightly coupled concerns: form handling (react-hook-form + antd via `Controller`) and i18n (next-i18next, English-string-as-key). ## Forms — react-hook-form + antd **Never bind a raw `` to a form.** Every input is an antd component wrapped in react-hook-form's `Controller`: ```ts import { Controller, useForm } from "react-hook-form"; import { Input, Select } from "antd"; type FormShape = { displayName: string; language: string }; export const ProfileForm = () => { const { control, handleSubmit } = useForm(); const onSubmit = (data: FormShape) => { /* ... */ }; return (
} /> ` | ## Anti-patterns - **Don't** bind a raw `` to a form. **Do** use `Controller` wrapping an antd `Input` / `Select`. - **Don't** write inline strings in JSX. **Do** wrap them in `t("...")`. - **Don't** concatenate translated fragments. **Do** use `{{name}}` interpolation. - **Don't** add translations to non-English locales by hand. Leave them missing. - **Don't** add UI strings to `extension-statics/_locales/`. That's for the manifest only. - **Don't** put validation rules in antd's `Form.Item`. They go in `Controller.rules`.