MO

تطوير الموديلات (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.zip

Installs 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.
99 charsno explicit “when” trigger
Intermediate

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

You give it
Data entity
You get back
Data model

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.

SkillInstallsUpdatedSafetyDifficulty
تطوير الموديلات (Model Development) (this skill)02moNo flagsIntermediate
webf-native-plugin-dev27moReviewAdvanced
get-it-expert15moNo flagsIntermediate
cometchat-calls01moReviewIntermediate

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.

29

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.

18

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

00

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

00

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.

95185

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.

73206

Search skills

Search the agent skills registry