بناء نموذج shadcn/ui بدون انجراف API
متى تستخدمه: تريد Form + react-hook-form + Zod، لكن Claude يستمر في استخدام استيرادات shadcn قديمة.
المتطلبات الأساسية
- تطبيق Next.js / Vite مع تهيئة shadcn/ui —
npx shadcn@latest init
الخطوات
-
الحصول على مصدر Form الحاليshadcn-ui MCP: get the current source for
form(React) plus its dependencies. Show me the install command.✓ تم النسخ→ أحدث مصدر مُعاد؛ قائمة التبعيات تشمل react-hook-form وzod -
بناء نموذجيNow build a SignupForm using these exact APIs. Email + password + terms checkbox; Zod schema with validation messages. No invented imports.✓ تم النسخ→ المكوِّن يتجمَّع مع إصدار shadcn الحالي
-
التحققRun
tsc --noEmitand report any unresolved imports.✓ تم النسخ→ فحص TypeScript نظيف
النتيجة: Form يعمل مع API shadcn/ui الحالي — بلا أخطاء import { ... } from '@/components/ui/old-name'.
المزالق
- المشروع على إصدار shadcn أقدم — قيِّد عبر
--registryأو قبِل الترقية وشغِّلshadcn upgrade