/d3nexus:json_to_freezed_modelfrom d3nexus
Parse JSON and create freezed object classes following project conventions.
Ships in d3nexus. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
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
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub danhdue/ai-agent-tools --plugin d3nexus72 skills in this plugin
/android-api-integrationGenerates a standardized Network Module, API Interface, Remote Data Source, Repository, UseCase, Models, and ViewModel updates for Android using the Hybrid Network Architecture and MVI Pattern./android-quality-checkRead-only Android quality assurance provider implementing the common quality contract. Executes project-configured Gradle, Spotless, Detekt, and Konsist capabilities from .agents/quality/android-quality.json, enforces BCV and architecture policies, and outputs structured results bound to repository SHA./android-ui-auditAudits Jetpack Compose and Android UI code for recomposition stability, state hoisting, Material3 design system adherence, and modifier best practices.Other plugins' skills for the same job