agentsclimarketplace

Data

Skill launch52-ai/flutter-template/.claude/skills/data

Generate data layer code (Freezed DTOs, repository implementations, data sources) from feature specifications or API references. Creates the bridge between domain entities and external data sources. Use after /domain to implement the data layer.From its SKILL.md

Install
npx -y skills add launch52-ai/flutter-template --skill data

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
  • runs commandsInstructs the agent to run 2 commands, including `dart run build_runner build --delete-conflicting-outputs` and 1 more.

SKILL.md

6.8 KB, ~1.5k tokens by cl100k_base, as published. Nobody here has run it

Data - Data Layer Generator

Generate data layer components that implement domain interfaces and handle external data sources.

Philosophy

The data layer is the only place for:

  • Freezed models with JSON serialization
  • API field mapping (@JsonKey)
  • Repository implementations
  • Data source abstractions (remote, local, cache)

This keeps the domain pure while handling all serialization and external communication here.

When to Use This Skill

  • After /domain has created entities and repository interfaces
  • When implementing API integration
  • When adding local storage/caching
  • When you have backend code or OpenAPI specs as reference
  • User asks to "implement repository", "create DTOs", or "wire up API"

Note: This skill replaces the former /api skill. All API integration functionality is now here.

What This Skill Creates

lib/features/{feature}/data/
├── models/
│   ├── {entity}_model.dart       # Freezed DTO with JSON
│   └── {entity}_model.g.dart     # Generated JSON code
├── repositories/
│   └── {feature}_repository_impl.dart  # Implements domain interface
└── data_sources/
    ├── {feature}_remote_data_source.dart   # API calls
    └── {feature}_local_data_source.dart    # Local storage (optional)

Input Sources

SourceWhat Claude Extracts
Feature spec (.spec.md)Endpoints, DTOs, storage needs
Backend code (NestJS, Express)Controllers, DTOs, types
OpenAPI/Swagger specPaths, schemas, request/response shapes
Endpoint descriptionsGET /users → User[]

Workflow

Step 1: Locate Requirements

Check for:

lib/features/{feature}/.spec.md           # Feature specification
lib/features/{feature}/domain/            # Domain entities/repository interface

If domain layer doesn't exist, ask user to run /domain {feature} first.

Step 2: Analyze Data Sources

From spec:

  • API Endpoints - Section 3.1 (URLs, methods, request/response shapes)
  • Local Storage - Section 3.2 (what to persist, cache strategy)
  • Field Mappings - API field names vs domain field names

From backend code (if provided):

  • Extract endpoint paths from controllers/routes
  • Extract request/response shapes from DTOs
  • Map snake_case API fields to camelCase Dart fields

Step 3: Generate Code

Use reference files in reference/ directory as templates:

ComponentReference File
Simple DTOreference/models/simple_model.dart
Nested DTOreference/models/nested_model.dart
Custom convertersreference/models/custom_converter_model.dart
Request DTOsreference/models/request_models.dart
Paginationreference/models/paginated_response.dart
Basic repositoryreference/repositories/basic_repository_impl.dart
Cached repositoryreference/repositories/cached_repository_impl.dart
Mock repositoryreference/repositories/mock_repository.dart
Remote data sourcereference/data_sources/remote_data_source.dart
Local (prefs)reference/data_sources/local_data_source_prefs.dart
Local (secure)reference/data_sources/local_data_source_secure.dart
Failuresreference/failures/failures.dart
Error mappingreference/failures/dio_error_handler.dart
i18n mappingreference/failures/failure_mapper.dart
Provider registrationreference/providers/repository_provider.dart

Step 4: Run Code Generation

dart run build_runner build --delete-conflicting-outputs

Step 5: Verify

dart run .claude/skills/data/scripts/check.dart {feature}

Commands

# Generate data layer from spec
/data {feature}

# Generate only DTOs
/data {feature} --only=models

# Generate only repository implementation
/data {feature} --only=repository

# Add new endpoint to existing data layer
/data {feature} --add-endpoint={methodName}

Checklist

Before finishing data layer generation:

  • All DTOs match API response shapes
  • @JsonKey mappings handle snake_case → camelCase
  • toEntity() and fromEntity() methods implemented
  • Repository implements all domain interface methods
  • Data source handles all API endpoints
  • Error handling uses typed Failures (no hardcoded strings)
  • Nullable fields handled correctly
  • Run build_runner to generate code
  • No lint errors after generation

Naming Conventions

ElementConventionExample
DTO class{Entity}ModelMemoryModel
DTO file{entity}_model.dartmemory_model.dart
Repository impl{Feature}RepositoryImplMemoriesRepositoryImpl
Remote data source{Feature}RemoteDataSourceMemoriesRemoteDataSource
Local data source{Feature}LocalDataSourceMemoriesLocalDataSource

Data Layer Rules

  1. Freezed for all DTOs - Immutability + JSON + equality
  2. Always map to domain - toEntity() and fromEntity() required
  3. Handle API field names - Use @JsonKey for snake_case
  4. Repository is the boundary - Only repository returns domain entities
  5. Data sources return DTOs - Never return domain entities from data sources
  6. Typed failures - No hardcoded error strings, use Failure types

What Goes Where

ConcernLayerExample
Entity fields & business logicDomainMemory.isSynced
JSON serializationData@JsonKey(name: 'is_synced')
API endpointsData_dio.get('/memories')
Field mappingDatatoEntity(), fromEntity()
Error typesDataNetworkFailure.noConnection()
Error messagesPresentationt.errors.noConnection (i18n)

Guides

GuideUse For
patterns-guide.mdBasic pattern descriptions and when to use
advanced-patterns.mdPagination, retry, caching, uploads, auth interceptor
examples.mdComplete before/after examples by input source
reference/Actual code templates

Related Skills

  • /domain - Run first to create entities and repository interfaces
  • /feature-init - Initialize feature scaffold (run before /domain and /data)
  • /plan - Plan data sources before implementation
  • /presentation - Implement UI layer after data layer is complete
  • /testing - Create tests for repositories and data sources
  • /i18n - Localize error messages (via failure mapper)

What ships with it: 47 files

130.6 KB alongside SKILL.md

reference/

7 more files not listed here. See all 47 in the repository.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.