تطوير الموديلات (Model Development)
Defines rigorous standards for defining Data models in Clean Architecture, ensuring type safety and efficient serialization.
Install
mkdir -p .claude/skills/model-development && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/9863" && unzip -o skill.zip -d .claude/skills/model-development && rm skill.zipInstalls to .claude/skills/model-development
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
القواعد الصارمة والمعايير الهندسية لبناء الموديلات (Models) في طبقة الـ Data بـ Clean Architecture.Key capabilities
- →Data layer model creation
- →fromMap/toMap transformation
- →Clean architecture compliance
- →Centralized table registry usage
How it works
It enforces strict rules for data models, including final classes and centralized table keys for transformations.
Inputs & outputs
When to use تطوير الموديلات (Model Development)
- →Creating data layer models
- →Implementing fromMap/toMap
- →Applying clean architecture rules
- →Standardizing data transformations
About this skill
مهارة تطوير الموديلات (Model Development)
تُهتم الموديلات بتمثيل البيانات التقني (المحلي والبعيد). يجب أن تكون مرتبطة بـ Entity الخاص بها وتتعامل مع قواعد البيانات (مثل fromMap و toMap) بذكاء.
📂 الموقع والتسمية
- المسار:
lib/features/[feature_name]/data/models/. - اسم الملف:
snake_caseينتهي بـ_model.dart(مثال:product_model.dart). - اسم الكلاس:
PascalCaseينتهي بـModel(مثال:ProductModel).
🏗️ القواعد البرمجية الصارمة
1. الوراثة والتعريف
- يجب أن يكون الكلاس
final classدائمًا. - يجب أن يرث من الـ Entity المقابل له.
- مثال:
final class ProductModel extends ProductEntity.
- مثال:
2. الباني (Constructor)
- يجب استخدام باني
constواستدعاء باني الأب (super(...)).
3. تحويل البيانات (Data Transformations)
fromMap: دالة Factory لتحويل البيانات من الـ Database أو الـ API.- ⚠️ قاعدة صارمة: يمنع منعاً باتاً استخدام النصوص المباشرة للمفاتيح. يجب استخدام كلاسات الجداول المركزية من
lib/core/tables/. - التحويل الفطري: النوع
String,int,double,boolالقادمة من الـ Map لا تحتاج لـas(تستخدم بشكل مباشر أو مع??للقيم الافتراضية). - التحويل القسري: يستخدم
asفقط مع الـListأو الكائنات المركبة. - المصفوفات: استخدم
List<T>.of(map[t.fieldName] as List<dynamic>? ?? [])لضمان صحة الأنواع.
- ⚠️ قاعدة صارمة: يمنع منعاً باتاً استخدام النصوص المباشرة للمفاتيح. يجب استخدام كلاسات الجداول المركزية من
4. الـ override والإلزاميات
toMap(): يجب عملoverrideلها واستخدام مفاتيح الجداول المركزية.copyWith(): يجب تنفيذ الدالة لترجع نوع الـModel(مع استخدامcastللقوائم أو الحقول التي تم تغيير نوعها من Entity إلى Model).fromMap(): يجب تنفيذ الدالة كـ factory واستخدام مفاتيح الجداول المركزية.
📝 النموذج التطبيقي (Template)
import 'package:furnigo_mgmt/core/tables/example_table.dart';
import 'package:furnigo_mgmt/features/[feature_name]/domain/entities/example_entity.dart';
final class ExampleModel extends ExampleEntity {
const ExampleModel({
required super.id,
required super.name,
required super.price,
super.tags,
});
factory ExampleModel.fromMap(Map<String, dynamic> map) {
final t = ExampleTable(); // استخدام كلاس الجدول
return ExampleModel(
id: map[t.id],
name: map[t.name] ?? '',
price: (map[t.price] ?? 0.0).toDouble(),
tags: (map[t.tags] as List<dynamic>?)?.map((e) => e.toString()).toList(),
);
}
@override
Map<String, dynamic> toMap() {
final t = ExampleTable();
return {
t.id: id,
t.name: name,
t.price: price,
t.tags: tags,
};
}
@override
ExampleModel copyWith({
int? id,
String? name,
double? price,
List<String>? tags,
}) {
return ExampleModel(
id: id ?? this.id,
name: name ?? this.name,
price: price ?? this.price,
tags: tags ?? this.tags,
);
}
}
⚠️ محظورات (Strict Prohibitions)
- يمنع: استخدام نصوص مثل
'id'أو'name'داخلfromMapأوtoMap. الالتزام بكلاسات الجداول إلزامي. - يمنع: إضافة أي منطق اختيار أو شرطي معقد داخل دالة التحويل.
[!IMPORTANT] استقلالية الـ Model عن الـ Entity تكمن في قدرته على التعامل مع "تمثيل البيانات" (Data Representation) بينما الـ Entity يهتم بـ "نموذج البيانات" (Data Model).
When not to use it
- →Non-Clean Architecture projects
- →Using hardcoded keys in transformations
Limitations
- →Strict adherence to architectural rules
How it compares
It mandates a specific architectural pattern for data models rather than flexible implementation.
Compared to similar skills
تطوير الموديلات (Model Development) side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| تطوير الموديلات (Model Development) (this skill) | 0 | 2mo | No flags | Intermediate |
| webf-native-plugin-dev | 2 | 7mo | Review | Advanced |
| get-it-expert | 1 | 5mo | No flags | Intermediate |
| cometchat-calls | 0 | 1mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
webf-native-plugin-dev
openwebf
Develop custom WebF native plugins based on Flutter packages. Create reusable plugins that wrap Flutter/platform capabilities as JavaScript APIs. Use when building plugins for native features like camera, payments, sensors, file access, or wrapping existing Flutter packages.
get-it-expert
flutter-it
Expert guidance on get_it service locator and dependency injection for Flutter/Dart. Covers registration (singleton, factory, lazy, async), scopes with shadowing, async initialization with init() pattern, retrieval, testing with scope-based mocking, and production patterns. Use when working with get_it, dependency injection, service registration, scopes, or async initialization.
cometchat-calls
cometchat
Entry-point for adding CometChat Voice & Video Calling to any React, React Native, Angular, native Android, native iOS, or Flutter project. Detects the framework, picks standalone (calls-only) vs additive (calls on top of existing chat) mode, and routes to the per-family calls skill. Invoked by the
firebase
lapc506
| Atributo | Valor | |----------|-------| | **ID** | `flutter-firebase` | | **Nivel** | 🟡 Intermedio | | **Versión** | 2.0.0 | | **Keywords** | `firebase`, `firestore`, `auth`, `cloud-messaging`, `analytics`, `storage`, `remote-config`, `crashlytics`, `provider` | | **Referencia
supabase-developer
daffy0208
Build full-stack applications with Supabase (PostgreSQL, Auth, Storage, Real-time, Edge Functions). Use when implementing authentication, database design with RLS, file storage, real-time features, or serverless functions.
payload
payloadcms
Use when working with Payload CMS projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, security issues, relationship queries, transactions, or hook behavior.