ワンクリックで
json-to-freezed-model
Parse JSON and create freezed object classes following project conventions.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Parse JSON and create freezed object classes following project conventions.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Pull Request (PR) Review skill for reviewing code changes following Flutter/Dart best practices, Clean Architecture, and Security standards.
Merges workspace keybindings into IDE user profile configurations (e.g., ~/antigravity-profile-2/User/keybindings.json).
Merges workspace keybindings (.vscode/keybindings.json) into the user's global IDE configuration (VS Code, Cursor, Windsurf, Antigravity, etc.).
Automate the end-to-end process of handling a new API request, from model generation to Data Source integration.
Enforces a checklist to verify that all required secure configuration files (google-services.json, GoogleService-Info.plist, environment-configs.json) are present for all environments (dev, stg, prd).
Copies secure configuration files (google-services.json, GoogleService-Info.plist) from the secureFiles directory to Android and iOS project paths.
| name | json_to_freezed_model |
| description | Parse JSON and create freezed object classes following project conventions. |
| conversation_mode | Fast |
Parse JSON and generate freezed object classes in the data layer.
[!IMPORTANT] Execute Immediately: When this skill is requested, skip the
PLANNINGphase andimplementation_plan.mdcreation. Proceed directly toEXECUTION.
[!IMPORTANT] Import Convention: Always use full package paths (e.g.,
import 'package:bloc_digital_wallet/core/network/app_uri.dart';) instead of relative imports (e.g.,import '../../core/network/app_uri.dart';).
[!IMPORTANT] Always use
abstract classfor Freezed models
[!IMPORTANT] Always include private constructor:
const ClassName._();
string → String?, number → int?/double?, boolean → bool?, object → nested object@JsonKey mappingObject suffix to nested object class names (e.g., user → UserObject). Do not add prefix for nested json object.[!CRITICAL] ONE OBJECT, ONE FILE RULE
Each class (Root or Nested) MUST have its own dedicated
.dartfile.
- ❌ NEVER define multiple classes in a single file
- ❌ NEVER put nested objects in the same file as the parent
- ✅ ALWAYS create a separate file for each object, even if it's small
Example: If JSON has
userandaddressobjects, create:
user_object.dart(contains onlyUserObject)address_object.dart(contains onlyAddressObject)
For each object in the JSON hierarchy, create a separated file in the target data layer:
lib/features/{module}/data/models/
├── {root_object}.dart
├── {nested_object_1}.dart
└── {nested_object_2}.dart
// Copyright (c) 2026, one of DanhDue ExOICTIF projects. All rights reserved.
// coverage:ignore-file
// ignore_for_file: invalid_annotation_target
import 'package:flutter/foundation.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
// Import nested models if any
import 'package:bloc_digital_wallet/features/{module}/data/models/nested_object.dart';
part '{model_name}.freezed.dart';
part '{model_name}.g.dart';
@freezed
abstract class {ModelName} with _${ModelName} {
const {ModelName}._();
@JsonSerializable(includeIfNull: false)
const factory {ModelName}({
@JsonKey(name: 'field_name') String? fieldName,
@JsonKey(name: 'count') int? count,
@JsonKey(name: 'snake_case_field') String? camelCaseField,
@JsonKey(name: 'nested') NestedObject? nested,
}) = _{ModelName};
factory {ModelName}.fromJson(Map<String, Object?> json) =>
_${ModelName}FromJson(json);
}
| JSON | Dart | Notes |
|---|---|---|
snake_case key | camelCase property | Use @JsonKey(name: 'snake_case') |
| Same name | Same name | Always use @JsonKey(name: 'field_name') |
| Nested object | {Name}Object class | Auto-add Object suffix. No prefix. |
| All fields | Nullable (?) | Use int?, String?, etc. |
| Class | abstract class | Always use abstract class for Freezed models |
includeIfNull | false | Always use @JsonSerializable(includeIfNull: false) |
| Constructor | const Class._(); | Always include private constructor |
| Imports | foundation.dart + freezed_annotation | Both required for debugFillProperties support |
Important: Always add
@JsonKeyannotation for every field, even when the JSON key matches the Dart property name exactly.
Input JSON:
{
"refresh": "token123",
"access": "token456",
"user": {
"id": 1,
"username": "john"
}
}
Output:
user_object.dart:
@freezed
abstract class UserObject with _$UserObject {
const UserObject._();
const factory UserObject({
@JsonKey(name: 'id') int? id,
@JsonKey(name: 'username') String? username,
}) = _UserObject;
factory UserObject.fromJson(Map<String, Object?> json) =>
_$UserObjectFromJson(json);
}
sign_in_object.dart:
@freezed
abstract class SignInObject with _$SignInObject {
const SignInObject._();
const factory SignInObject({
@JsonKey(name: 'refresh') String? refresh,
@JsonKey(name: 'access') String? access,
@JsonKey(name: 'user') UserObject? user,
}) = _SignInObject;
factory SignInObject.fromJson(Map<String, Object?> json) =>
_$SignInObjectFromJson(json);
}
# Generate code
melos genAlls
# Verify
fvm flutter analyze --no-fatal-infos