К основному содержанию
правило

react-formengine-ai-form-builder — правило для Cursor

Правило Cursor, по которому агент собирает React-формы из скриншота, PDF, HTML или описания и отдаёт схему FormEngine JSON плюс рабочий App.tsx.

Установить в Cursor · Вручную: положить файлы Все способы и платформы ↓
.cursor/rules/react-formengine-ai-form-builder-cursorrules-prompt-file.mdc
Открыть на GitHub

Что делает react-formengine-ai-form-builder-cursorrules-prompt-file

Правило задаёт агенту жёсткий контракт на выход: form.json со схемой FormEngine, проверенной по списку типов выбранной UI-библиотеки, и App.tsx, который импортирует схему и рендерит её через <FormViewer>. Плюс короткий отчёт о валидации и команда установки. Данные переносимые, а не одноразовый JSX.

Внутри — список инвариантов схемы. Корень всегда type: "Screen", у каждого узла есть key и type из выбранной библиотеки, значения свойств заворачиваются в объект вида { "value": "Email" }. Правила валидации живут в schema.validations на самом поле, а не на корне. Стилизация ограничена раскладкой: css и wrapperCss берут flex, grid, отступы и размеры, а цвет, шрифт и тени уходят в тему провайдера в App.tsx. Поле style запрещено, как и любой HTML-разметкой внутри строк.

По умолчанию правило нацелено на FormEngine Core под MIT через @react-form-builder/core и @react-form-builder/components-rsuite; Material UI и Mantine подключаются, когда пользователь их назвал. Компоненты из платной части, например Signature или DataGrid, агент не должен выдавать без прямой просьбы. Ключи валидации берутся только из набора Zod: minLength и maxLength там нет, вместо них min и max с args.limit.

Какие задачи решает

  • собрать форму из скриншота макета
  • получить схему FormEngine JSON вместо разрозненного JSX
  • перевести HTML-форму в компоненты RSuite
  • проверить ключи валидации по набору Zod
  • отрендерить схему в React через <FormViewer>

Примеры запросов агенту

  • Собери форму регистрации из скриншота signup.png на RSuite
  • Сделай form.json и App.tsx по описанию формы заказа с полями email и телефон
  • Переведи эту HTML-форму в схему FormEngine на Mantine

Как установить react-formengine-ai-form-builder-cursorrules-prompt-file

Вручную: положить файлы

.cursor/rules/react-formengine-ai-form-builder-cursorrules-prompt-file.mdc

Во frontmatter: description, globs, alwaysApply

По шагам, с командами для каждой платформы: Cursor rules: файлы .mdc, четыре режима и замена .cursorrules

Вопросы о react-formengine-ai-form-builder-cursorrules-prompt-file

Как установить react-formengine-ai-form-builder в Cursor?

Положите файл правила по пути .cursor/rules/react-formengine-ai-form-builder-cursorrules-prompt-file.mdc в проекте. После этого Cursor подхватит его для файлов по маске **/*.

Что делает это правило?

Оно заставляет агента выдавать схему FormEngine JSON и запускаемый App.tsx вместо произвольного JSX, а также короткий отчёт о проверке схемы.

Какие UI-библиотеки поддерживаются?

RSuite — вариант по умолчанию, с самым широким набором компонентов, включая RsWizard для многошаговых форм. Material UI и Mantine подключаются, если пользователь их упомянул или нужен компонент только из Mantine.

Исходный текст

react-formengine-ai-form-builder-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for generating React forms from screenshots, PDFs, HTML, or text descriptions with validated FormEngine JSON schema. Renders through RSuite, Material UI, or Mantine."
globs: **/*
alwaysApply: false
---
# FormEngine — AI Form Builder for React

Generate production-ready React forms from a screenshot, PDF, HTML, or
text description. The output is a validated FormEngine JSON schema plus
a runnable App.tsx — portable data, not throwaway JSX.

Default target: FormEngine Core (MIT, free) via `@react-form-builder/core`
+ `@react-form-builder/components-rsuite` (or Material UI / Mantine).

Source repo: https://github.com/lukinov/ai-form-builder

## What you produce — every time

1. `form.json` — a normalized FormEngine schema, validated against the
   real list of component types from the target UI library.
2. `App.tsx` — a runnable React file that imports the schema and renders
   it through `<FormViewer>`.
3. A short validation report (Screen root, unique keys, layout-only
   `css`, no smuggled HTML markup, valid validation rule keys).
4. Install command + a link to the free Online FormBuilder
   (https://formbuilder.formengine.io) so the user can tweak visually.

## Hard rules — never violate

### Schema invariants

- Root is `type: "Screen"` (NOT `"Form"`).
- Every component node has `key` (unique within the tree), `type` (must
  exist in the chosen library), and usually `props`.
- **Every prop value is wrapped:** `"label": { "value": "Email" }` —
  never `"label": "Email"`.
- Validations live under `schema.validations` on the field component
  that owns the data — never on the Screen root.
- Use the correct tooltip/error types:
  - RSuite: `RsTooltip` / `RsErrorMessage`
  - MUI: `MuiTooltip` / `MuiErrorWrapper`
  - Mantine: `MtTooltip` / `MtErrorWrapper`

### Layout vs. styling

- `css` and `wrapperCss` are **layout-only** — flex, grid, box-model,
  margin, padding, gap, width/height, alignment. **Never** color, font,
  background, border, shadow, radius, opacity, transform.
- Visual styling belongs in the UI library's theme provider in
  `App.tsx` (`<CustomProvider>` / `<ThemeProvider>` / `<MantineProvider>`).
- The legacy `style` field is **forbidden** — use `css` / `wrapperCss`.
- The shape is `{ "any": { "object": { "<layout-key>": "<value>" } } }`,
  never a plain CSS string.
- No companion `.css` file alongside `App.tsx`. No root `className`. No
  `<style>` blocks. No `styled-components`.

### Plain-text strings only

Every string inside any prop is plain text. **No HTML markup of any
kind**, anywhere — no `<h1>`, `<p>`, `<strong>`, `<small>`, `<br>`, no
`style="..."`, no `class="..."`, no `<style>` block. Express section
headings and structure with components (`RsCard` with `header` prop,
`RsHeader`, `RsDivider`) — not embedded HTML.

### Validation rule keys — Zod set only

Valid keys: `required`, `nonEmpty`, `min`, `max`, `length`, `email`,
`url`, `uuid`, `ip`, `datetime`, `regex`, `includes`, `startsWith`,
`endsWith`, `lessThan`, `moreThan`, `integer`, `multipleOf`, `truthy`,
`falsy`. There is **no `minLength` / `maxLength`** — use `min` / `max`
with `args.limit`.

## UI library defaults

- **Default to RSuite.** Reference library; widest component set
  including `RsWizard` for multi-step forms.
- **Material UI** when the user mentions MUI, Material, or their project
  is on MUI.
- **Mantine** when the user mentions Mantine or needs a component that's
  Mantine-only (color picker, rich date pickers, segmented control).

State the choice explicitly in the first sentence of the response.

## Common renames — always emit the right name

| Wrong | Right |
|---|---|
| `Form` | `Screen` |
| `RsForm` | `RsCard` or `RsContainer` |
| `RsSelectPicker` | `RsDropdown` |
| `RsRadio` | `RsRadioGroup` |
| `RsTextarea` | `RsTextArea` (capital A) |
| `RsInputNumber` | `RsNumberFormat` |
| `RsUpload` | `RsUploader` |
| `MtDatePickerSingle` | `MtDatePicker` |
| `MtTextField` | `MtTextInput` |

## Side-by-side fields

Use `RsContainer` with `display: flex` and children with
`wrapperCss.any.object.flex: "1"`. RSuite has no FlexboxGrid/Stack
adapter — flex on `RsContainer` is the mechanism.

## Section headings

Use `RsCard` with the `header` prop, or `RsHeader` — never `<h1>` /
`<h2>` embedded in `RsStaticContent` `content` strings.

## Conditional rendering

Use `renderWhen: { "jsCode": "data.X === Y" }` and pair with
`validateWhen` if validations should also be conditional.

## App.tsx — minimal starter

Import only the library's stylesheet. Theme via the library's provider.
No companion CSS. No root className. Layout-level inline styles
(`maxWidth`, `margin`, `padding`) on the wrapping `<div>` are fine.

```tsx
import "rsuite/dist/rsuite.min.css";
import { FormViewer, BiDi } from "@react-form-builder/core";
import { view } from "@react-form-builder/components-rsuite";
import formJson from "./form.json";

const getForm = () => JSON.stringify(formJson);

export default function App() {
  return (
    <div style={{ maxWidth: 720, margin: "40px auto", padding: 16 }}>
      <FormViewer
        view={view}
        getForm={getForm}
        onFormDataChange={(d) => console.log(d)}
        biDi={BiDi.LTR}
      />
    </div>
  );
}
```

## Free vs. commercial — stay on the MIT side

FormEngine **Core** is MIT and free. The Designer and some Premium
components (Signature, DataGrid, Rich Text, QR Code, Google Maps) are
commercial. Don't emit Premium component types unless the user
explicitly asks. Direct people to the free Online FormBuilder
(https://formbuilder.formengine.io) for visual editing.

## Response shape

Lead paragraph (library + field count) → `form.json` → `App.tsx` →
validation checklist → install command → "tweak visually in the Online
FormBuilder" link → 3 next-step doc links into FormEngine Core docs.

## Reference

- FormEngine Core docs: https://formengine.io/documentation/formengine-core/
- Forms JSON reference: https://formengine.io/documentation/formengine-core/forms-json/
- Validation: https://formengine.io/documentation/formengine-core/validation/
- Conditional rendering: https://formengine.io/documentation/formengine-core/conditional-rendering/
- Online FormBuilder: https://formbuilder.formengine.io
- llms-full.txt (full machine-readable docs): https://formengine.io/documentation/llms-full.txt
- Source repo for this rule: https://github.com/lukinov/ai-form-builder

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Похожие правила IDE

Все правила IDE по теме «Фронтенд и UI» →
winui3 официальный github Правило задаёт рекомендации для WinUI 3 и Windows App SDK: от XAML и потоков до окон и MVVM. Пригодится, чтобы Copilot учитывал особенности настольных приложений Windows. ★ 40 451звёзд репо vue официальный github Правило задаёт Copilot стандарты Vue 3: Composition API, <script setup>, реактивность, Pinia и Vue Router. Пригодится, когда агент пишет компоненты в вашем стиле. ★ 40 451звёзд репо tanstack-start-shadcn-tailwind официальный github Правило задаёт Copilot стек TanStack Start, Shadcn/ui и Tailwind CSS и требует валидировать внешние данные через Zod. ★ 40 451звёзд репо tailwind-v4-vite официальный github Правило помогает подключить Tailwind CSS v4 к проекту на Vite через официальный плагин. Пригодится и для новой установки, и при переходе с v3. ★ 40 451звёзд репо svelte официальный github Направляет GitHub Copilot на стандарты Svelte 5 и SvelteKit 2: руны вместо старых сторов, типизация компонентов и безопасная работа с SSR. ★ 40 451звёзд репо power-bi-custom-visuals-development официальный github Правило для GitHub Copilot, которое подсказывает агенту, как писать кастомные визуалы Power BI на React, D3.js и TypeScript. ★ 40 451звёзд репо

Из того же набора210

react-native-expo-router-typescript-windows-cursorrules-prompt-file Правило задаёт практики для React Native-проектов на Expo с TypeScript и Expo Router. Также оно содержит заметки о совместимости NativeWind с Tailwind CSS и работе в PowerShell. ★ 41 024звёзд репо react-native-expo-cursorrules-prompt-file Правило для Cursor, которое задаёт агенту стек и структуру проекта на React Native с Expo. Пригодится, когда нужно, чтобы код в проекте писался единообразно. ★ 41 024звёзд репо react-mobx-cursorrules-prompt-file Набор инструкций для Cursor по разработке на React с MobX. Задаёт архитектуру сторов, соглашения по хукам и строгий режим MobX при генерации кода. ★ 41 024звёзд репо react-graphql-apollo-client-cursorrules-prompt-file Правило задаёт Cursor подход к React-разработке с GraphQL и Apollo Client. Оно пригодится для единого устройства запросов, мутаций и компонентов. ★ 41 024звёзд репо react-components-creation-cursorrules-prompt-file Организует создание компонентов React в Cursor: ищет дубликаты в репозитории, готовит ссылку для генерации через v0.dev и адаптирует импорты shadcn/ui под структуру проекта. ★ 41 024звёзд репо react-chakra-ui-cursorrules-prompt-file Правило задаёт Cursor подход к React-проектам с Chakra UI: компоненты, тему, адаптивность, доступность и структуру каталогов. ★ 41 024звёзд репо rails-cursorrules-prompt-file Правило для Cursor, которое задаёт агенту стиль разработки на Rails 8: генераторы, bin/dev, Solid-стек, Minitest и Hotwire. ★ 41 024звёзд репо r-cursorrules-prompt-file-best-practices Задаёт стандарты разработки на R: структуру каталогов, стиль tidyverse, изоляцию окружения через renv и правила оформления пакетов. ★ 41 024звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой