一键导入
api-integration-skill
Use when: integrating or modifying backend APIs, endpoint contracts, request/response mapping, and business error-code handling in Beacon.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when: integrating or modifying backend APIs, endpoint contracts, request/response mapping, and business error-code handling in Beacon.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when: any task involves Flutter UI, UX, animation, motion, redesign, image-to-code, or mobile visual implementation quality.
Use when: planning or implementing Flutter local database, cache, offline-read, local datasources, repository cache orchestration, stale data handling, and deterministic tests.
Use when: adding or extending Flutter integration/E2E tests for Beacon with fake backend, ProviderScope overrides, and reusable test robots.
Use when: selecting Flutter test levels, planning unit/widget/integration coverage, and creating verification checklists for risky or cross-layer changes.
Use when: starting a task and loading Beacon source-of-truth context before writing code.
Use when: documenting architecture decisions, tradeoffs, impacts, and rollback guidance after important changes.
| name | api-integration-skill |
| description | Use when: integrating or modifying backend APIs, endpoint contracts, request/response mapping, and business error-code handling in Beacon. |
Triển khai hoặc chỉnh sửa API theo đúng Clean Architecture của dự án Beacon, giữ contract rõ ràng từ data đến UI, đồng thời đảm bảo luồng xử lý lỗi nhất quán.
Tài liệu này lấy auth login làm chuẩn tham chiếu để áp dụng cho các feature khác.
code lỗi nghiệp vụ.Page/Widget
-> Notifier
-> UseCase
-> Repository (domain contract)
-> RemoteDatasource
-> DioClient
-> ApiHandler
-> Exception -> Failure
-> Notifier fold
-> UI state + AppMessage
lib/core/network/api_endpoints.dart.login, register, refreshToken.features/<feature>/data/models.*_remote_datasource.dart.*_remote_datasource_impl.dart bằng DioClient.ApiHandler.handle<T>().Mẫu:
final response = await _dioClient.post(
ApiEndpoints.login,
data: {'username': username, 'password': password},
);
final result = ApiHandler.handle<AuthResponseModel>(
response,
fromJsonT: (json) => AuthResponseModel.fromJson(json as Map<String, dynamic>),
);
return result.data!;
Nếu backend có code lỗi nghiệp vụ:
data/mappers, ví dụ auth_error_code_mapper.dart.ApiHandler.handle qua codeMessageMapper.ApiHandler.rethrowDioException(...) để vẫn map theo code.Thứ tự ưu tiên message:
code (nếu có và match).message từ API response.statusCode.Ví dụ login codes:
VALIDATION_ERRORINVALID_CREDENTIALSACCOUNT_INACTIVEFuture<Either<Failure, T>>.NetworkInfo nếu use case yêu cầu.try/catch và map exception bằng toFailure().DioException hoặc Response rò rỉ lên domain/presentation.Mẫu:
try {
final data = await _remoteDatasource.login(...);
return Right(mappedResult);
} on Exception catch (e) {
return Left(e.toFailure());
}
ValidationFailure khi dữ liệu không hợp lệ.fold để tách success/failure.appMessageProvider.notifier.ref.watch để render state hiện tại.ref.listen để xử lý side effect như navigation sau thành công.lib/core/providers/providers.dart.Either<Failure, T>.DioException trực tiếp lên presentation.NetworkInfo trong nghiệp vụ cần check mạng.providers.dart.flutter analyze.flutter test khi cần).code nếu có.