Logo Naming Conventions

Naming Conventions

Cộng đồng
zakariaf
naming-conventions

Áp dụng quy tắc viết hoa của Effective-Dart (kiểu UpperCamelCase, thành viên/hằng số lowerCamelCase, tệp lowercase_with_underscores), cùng hậu tố thể hiện vai trò kiến trúc để tên hoặc kết quả grep cho biết lớp tương ứng — Screen/Notifier/Repository/Dao/Service/Gateway/Failure, tên tệp trùng với khai báo chính, đưa đơn vị và ý nghĩa vào tên định danh, biểu thị giá trị boolean dưới dạng khẳng định is/has/can/should, không dùng tiền tố get, không dùng Hungarian, không dùng SCREAMING_CAPS, sắp xếp import theo nhóm. Hãy dùng khi tạo tệp; đặt tên class/enum/mixin/extension/typedef/biến/hàm/getter/hằng số/tham số; sắp xếp import; chọn hậu tố vai trò; hoặc rà soát diff về cách đặt tên và thứ tự chỉ thị.

Add to TypingMind

Tổng quan

Nhà phát hànhzakariaf
Kho mãFlutter-Skills
Tên kỹ năngnaming-conventions
Sao
64
Bản fork
15
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được zakariaf công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Naming Conventions trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/zakariaf/Flutter-Skills/tree/main/skills/naming-conventions
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/zakariaf/Flutter-Skills.git /tmp/Flutter-Skills
mkdir -p .claude/skills
cp -r /tmp/Flutter-Skills/skills/naming-conventions .claude/skills/naming-conventions
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Naming Conventions trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Naming Conventions ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Naming Conventions với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Naming Conventions

Consistent, role-carrying names make code searchable and self-explaining, and the suffix on a type declares which layer it lives in — so a reviewer, a grep, and a banned-import gate can all read the layer off the name alone. This skill is the how; the normative what is Effective Dart. Never invent a house style that contradicts the language's own.

Non-negotiable rules

  1. Types are UpperCamelCase. Classes, enums, mixins, extensions, typedefs, type parameters: TaskScreen, OrderStatus, Predicate<T>. Consistent shape makes types visually distinct from values.
  2. Members, variables, functions, and parameters are lowerCamelCase. dueDate, loadTasks(), itemCount. It is the language default; deviating costs readers a double-take.
  3. Constants are lowerCamelCase, never SCREAMING_CAPS. const maxItemsPerPage = 50; — not const MAX_ITEMS = 50. Dart dropped the C convention; the analyzer expects constant_identifier_names.
  4. Files, folders, libraries, and import prefixes are lowercase_with_underscores. task_detail_screen.dart, features/task_detail/, import 'package:app_core/app_core.dart';. Cross-platform filesystems and pub demand it.
  5. File name = its primary declaration, snake_cased, one primary public type per file. TaskNotifier lives in task_notifier.dart. No utils.dart/helpers.dart/models.dart grab-bags and no utils//common//helpers//misc/ junk-drawer folders — a reader who greps a symbol must land in the file that owns it. core/ is the sanctioned pure-foundation layer (value objects, Result/Failure, the Clock seam, pure calculators), not a junk-drawer — see project-structure-and-packages, which owns the layout.
  6. Acronyms longer than two letters are cased like a word. Json, Http, Url, Api → JsonOrder, HttpClient, fromJson, imageUrl — not JSONOrder, HTTPClient. Two-letter caps-in-English acronyms may stay caps as types (ID, UI). Mixed-case acronyms are unsearchable and inconsistent.
  7. A leading underscore means library-private — use it only when you mean private. Never prefix a public symbol with _ to "namespace" it; that makes it unusable from another file. Public (no _) is a documented contract — see dartdoc-conventions.
  8. No Hungarian / type-encoding in names. Not strName, iCount, lstItems, userMap, nameString, itemsList. The type system already knows the type; write name, usersById, items.
  9. Full dictionary words; units and semantics live in the name. maxItemsPerPage, retryDelaySeconds, orderTotalMinorUnits — never bare max, delay, total. Abbreviations (opt, qty, amt) are confined to the inside of one short pure function with a comment mapping them. A name that omits its unit invites a unit bug.
  10. Booleans read as assertions. isLoading, hasError, canSubmit, shouldRetry — not loading, error, retry. Boolean getters and methods start is/has/can/should so a condition reads like prose.
  11. No get-prefixed accessors. Expose dueTasks, not getDueTasks(). Dart has real getters. Functions are verb phrases (loadTasks(), scheduleReminder()); non-boolean getters are noun phrases (itemCount, nextDueDate).
  12. Imports grouped and sorted: dart: first, then package:, then relative — each group alphabetized, exports in their own section after imports. Let dart format plus the directives_ordering lint enforce it; never hand-fight the formatter.

The suffix declares the layer

A role suffix turns a name into a layer contract: a grep or a path-scoped import gate can tell a repository from a view from a platform boundary without opening the file. Use neutral domain nouns (Task, Order, Account, Item) for the entity token.

RoleSuffix / patternLayerFile → symbol
Screen / route target[Feature]ScreenUI (View)task_list_screen.dart → TaskListScreen
Reusable widget[Thing] (+ Widget only if ambiguous)UItask_card.dart → TaskCard
ViewModel (Riverpod, default)[Feature]NotifierUI (ViewModel)task_list_notifier.dart → TaskListNotifier
ViewModel (Provider appendix only)[Feature]ViewModelUI (ViewModel)task_list_view_model.dart → TaskListViewModel
Repository (interface)[Entity]Repositorydatatask_repository.dart → TaskRepository
Repository (impl)Drift[Entity]Repository / Remote[Entity]Repositorydatadrift_task_repository.dart
Drift DAO[Entity]Daodatatasks_dao.dart → TasksDao
Capability interface you define[Concern]Serviceboundaryshare_service.dart → ShareService
Service impl (per flavor)[Provider][Concern]Serviceapp adapterfirebase_analytics_service.dart → FirebaseAnalyticsService
Wrapper over a specific plugin/SDK/native channel[Concern]Gatewayboundarynotification_gateway.dart → NotificationGateway
Gateway impl[Plugin][Concern]Gateway / Live[Concern]Gatewayapp adapterfln_notification_gateway.dart → FlnNotificationGateway
Pure-Dart domain logic[Domain] + verb suffix (Calculator/Validator/Formatter)domainprice_calculator.dart → PriceCalculator
Immutable modeldomain noun, no suffixanytask.dart → Task
Failure type[Domain]Failure (sealed)anyorder_failure.dart → OrderFailure
  • Notifier is the ViewModel role — never ViewModel or ChangeNotifier in the type name. On Riverpod 3.x the ViewModel is a Notifier/AsyncNotifier/StreamNotifier, one per Screen, 1:1, named [Feature]Notifier in [feature]_notifier.dart (file = primary declaration). [Feature]ViewModel in [feature]_view_model.dart is sanctioned ONLY in the Provider/ChangeNotifier appendix — never on the Riverpod path, and never [Feature]Controller. See state-management-riverpod.
  • Service vs Gateway — both name provider-free boundary ports, distinguished by who owns the contract. A [Concern]Service is a capability interface YOU define (ShareService, AnalyticsService); a [Concern]Gateway is the thin wrapper over a SPECIFIC external plugin/SDK or native MethodChannel (NotificationGateway over flutter_local_notifications, SecureStorageGateway over flutter_secure_storage). Domain and UI code names the interface; the concrete impl (FirebaseAnalyticsService, FlnNotificationGateway) lives only in the composition root. A concrete impl name leaking into shared code is a grep-catchable smell. See service-boundary-and-native.
  • Pure-Dart types carry a Calculator/Validator/Formatter/Parser verb suffix and touch no Flutter. The suffix advertises that the type is framework-free and unit-testable without a widget.
  • Match the domain's ubiquitous language and keep it consistent everywhere — one word per concept across models, repositories, and UI, so search finds every reference.

Value vs. instant, and other name-carried distinctions

Encode a semantic distinction the type system can't in the name. A raw instant (DateTime.now()) used where a stable calendar value is expected is a common correctness bug; naming makes the boundary visible.

dart
// A real wall-clock instant is legal only at the Clock boundary and named as one.
final DateTime capturedAt = clock.now();      // instant, from package:clock's Clock (never DateTime.now())

// A stored quantity carries its canonical unit in the name.
final int priceMinorUnits;                    // not `price` — unit is explicit
final int distanceMeters;                     // SI base unit, integer

// Unused callback params are `_` (and `__` for a second).
onChanged: (_) => notifier.refresh(),

See value-objects-money-and-units for canonical storage and service-boundary-and-native for the Clock (from package:clock) injected via clockProvider — never a bespoke ClockService.

Worked example

dart
// task_list_notifier.dart — file name == primary declaration, snake_cased
import 'dart:async'; // dart: group, alphabetized

import 'package:flutter_riverpod/flutter_riverpod.dart'; // package: group, alphabetized

import 'task.dart'; // relative group, alphabetized

/// Frozen paging bound — unit lives in the name (rule 9).
const int maxItemsPerPage = 50; // lowerCamelCase const, not SCREAMING_CAPS

/// ViewModel for [TaskListScreen]. One Notifier per Screen, 1:1 (role suffix).
class TaskListNotifier extends AsyncNotifier<List<Task>> {
  @override
  Future<List<Task>> build() => ref.watch(taskRepositoryProvider).loadTasks();

  /// Verb-phrase command; routes through the repository's single write path.
  Future<void> archive(String taskId) async {
    await ref.read(taskRepositoryProvider).archive(taskId);
    ref.invalidateSelf();
  }

  bool get hasTasks => state.valueOrNull?.isNotEmpty ?? false; // boolean assertion
  int get taskCount => state.valueOrNull?.length ?? 0;          // noun getter, no get- prefix
}

Anti-patterns

  • SCREAMING_CAPS constants in new Dart (const MAX_ITEMS = 50) — use lowerCamelCase; the analyzer flags it.
  • Class name ≠ file name (TaskScreen living in home.dart), or a grab-bag utils.dart/models.dart holding unrelated things — breaks grep-to-file.
  • Naming a Flutter-touching type …Calculator/…Validator (a pure-Dart suffix), or a Riverpod ViewModel …ViewModel/…VM/…Controller — the suffix then lies about the layer (…Notifier on the Riverpod path; …ViewModel only in the Provider appendix).
  • A concrete impl name (FlnNotificationGateway, FirebaseAnalyticsService) referenced from shared/domain code — name the Gateway/Service interface; the impl belongs in the composition root.
  • DateTime.now() captured into a field meant to be stable, or an unnamed instant crossing into domain logic — inject a Clock and name the instant (capturedAt).
  • getDueTasks() / get/set prefixes — Dart has real getters.
  • Type baked into a name: userMap, nameString, itemsList, strName, iCount.
  • Booleans without is/has/can/should (loading, valid); unit-silent quantities (total, delay).
  • Leading _ to "namespace" a public symbol (it makes it private and unreachable); l/O/I single letters or data/temp/foo in committed code.
  • Abbreviations (opt, qty, msg) outside a single short function with a mapping comment.
  • Hand-sorted or mixed import groups — run dart format; obey directives_ordering.

Definition of done

  • Types UpperCamelCase; members/vars/constants lowerCamelCase; files/folders/prefixes lower_snake_case.
  • File name matches its primary declaration; one primary public type per file; no junk-drawer file or folder.
  • Architectural suffix applied and correct for the layer (Screen/Notifier/Repository/Dao/Service/Gateway/Failure).
  • Riverpod ViewModels are …Notifier (not …Controller/…ViewModel/…VM); pure-Dart types carry a Calculator/Validator/Formatter suffix and no Flutter import; Service/Gateway interfaces are provider-free with impls confined to the composition root.
  • Acronyms >2 letters word-cased; full dictionary words; units + semantics in the name; instants named at the Clock boundary.
  • Booleans read as assertions; functions are verb phrases; getters are noun phrases with no get prefix.
  • Imports grouped dart:/package:/relative and alphabetized; dart format + dart analyze --fatal-infos clean.

Related skills

  • dart3-idioms-and-coding-standards — which construct (sealed/record/enum) each declaration earns, and complexity limits.
  • state-management-riverpod — why the ViewModel is a Notifier, and the single write path.
  • service-boundary-and-native — provider-free Service interfaces and their composition-root impls.
  • value-objects-money-and-units — canonical-unit storage behind the unit-in-name rule.
  • naming neighbors: dartdoc-conventions for the /// contract on public symbols, lint-and-style-config for the directives_ordering/constant_identifier_names enforcement, and flutter-architecture for the layer DAG the suffixes map to.

References

Câu hỏi thường gặp

Kỹ năng AI Naming Conventions làm được gì?

Áp dụng quy tắc viết hoa của Effective-Dart (kiểu UpperCamelCase, thành viên/hằng số lowerCamelCase, tệp lowercase_with_underscores), cùng hậu tố thể hiện vai trò kiến trúc để tên hoặc kết quả grep cho biết lớp tương ứng — Screen/Notifier/Repository/Dao/Service/Gateway/Failure, tên tệp trùng với khai báo chính, đưa đơn vị và ý nghĩa vào tên định danh, biểu thị giá trị boolean dưới dạng khẳng định is/has/can/should, không dùng tiền tố get, không dùng Hungarian, không dùng SCREAMING_CAPS, sắp xếp import theo nhóm. Hãy dùng khi tạo tệp; đặt tên class/enum/mixin/extension/typedef/biến/hàm/gette...

Vì sao nên dùng Naming Conventions trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Naming Conventions là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Naming Conventions trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/zakariaf/Flutter-Skills/tree/main/skills/naming-conventions. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Naming Conventions?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Naming Conventions với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Naming Conventions với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Naming Conventions có miễn phí không?

Có. Kỹ năng này được zakariaf phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇