custom-features
Skill này làm gì
Skill này chỉ cách xây dựng một tính năng tái sử dụng, hay plugin, để thêm state hoặc hành vi mới cho TanStack Table. Skill dành cho lập trình viên nâng cao có nhu cầu mà các tính năng có sẵn chưa đáp ứng.
Khi nào nên dùng
- ✓Khi bạn cần state hoặc hành vi tái sử dụng được thêm vào các object của bảng.
- ✓Khi các tùy chọn có sẵn và meta có kiểu không xử lý được renderer hoặc thiết lập ứng dụng của bạn.
- ✓Khi bạn viết một plugin phải đăng ký đúng các hook vòng đời và phương thức của bảng.
Liên kết skill
https://github.com/TanStack/table/blob/main/packages/table-core/skills/custom-features/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Các tính năng TanStack Table có sẵn không đáp ứng được nhu cầu của tôi. Làm sao để tự viết plugin?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill đi qua các bước khai báo tính năng, giữ state do người dùng cung cấp, thêm phương thức cho bảng và object trong các hook vòng đời, rồi đăng ký plugin bằng một object tính năng ổn định.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Author a custom feature
Read core and feature architecture first. Use a plugin for reusable state or behavior that must augment Table objects. Built-in options and typed tableMeta/columnMeta are usually enough for renderer callbacks and application configuration.
Implementation workflow
- Identify the state, options, and object methods the behavior owns. If it only passes callbacks or renderer data, read scoped meta typing and use meta instead.
- Before declaring plugin types or writing lifecycle hooks, read the complete plugin example. It enumerates all 10 public FeatureMaps, the API assignment helpers, lifecycle ordering, and the advanced row-model maps.
- Declare the feature key in
Plugins. Merge only FeatureMaps with matching runtime implementations; declarations alone install no behavior. - Preserve user state after defaults in
getInitialState; connect state updaters in default options. Install table methods withassignTableAPIsand object methods withassignPrototypeAPIsinside the corresponding lifecycle hooks. - Keep the feature object and
tableFeatures({ customFeature })result stable. Register the plugin throughtableFeaturesso inference and composition include it. - Verify the advertised state, options, methods, and resets on a constructed table. Each declared API must exist at runtime; reset behavior must respect the state owner.
Lifecycle boundaries
Use initTableInstanceData for mutable data owned by one table and resetTableInstanceData for clearing its transient contents. All feature initialization finishes before any constructTableAPIs hook. Keep method installation separate from data allocation.
Prototype methods are shared across the table's rows, columns, cells, or headers. Read per-object values through the method's current instance, and use the supported instance-data hooks for mutable fields. Read the example's installation rules before adding memoized methods or advanced row-model/cache wiring.
Common failures
- Types without matching runtime hooks advertise APIs that do not exist.
- Ad hoc mutation of constructed instances bypasses feature registration and inferred composition.
- Treating the density example as the only extension pattern misses column definitions and the other public FeatureMaps. Choose the maps required by the behavior; advanced row-model declarations also require runtime pipeline/cache wiring.
Installed API discovery
Inspect node_modules/@tanstack/table-core/dist/types/TableFeatures.d.ts, the exported *_FeatureMap interfaces in dist/types/, and assignTableAPIs/assignPrototypeAPIs in dist/utils.d.ts. Follow declarations under dist/features/ for comparable stock lifecycle signatures.
Câu hỏi thường gặp
Khi nào tôi không nên viết tính năng tùy chỉnh?
Skill nói nếu hành vi chỉ truyền callback hoặc dữ liệu renderer thì nên dùng meta có kiểu.
Khai báo kiểu của tính năng có cài đặt hành vi không?
Không. Skill nói riêng khai báo không cài đặt gì cả, nên phần triển khai lúc chạy phải khớp với các kiểu đã khai báo.
Plugin nên đăng ký ở đâu?
Qua lệnh gọi tableFeatures, để việc suy luận kiểu và ghép tổ hợp đều bao gồm nó.
Chi tiết
Mô tả gốc của tác giả
Implement a Table v9 plugin when built-ins and typed meta are insufficient. Covers FeatureMaps, runtime lifecycle hooks, prototypes, and a complete checked example.
repo: TanStack/table
Độ phổ biến
- Sao GitHub
- 29k
- Vị trí xếp hạng
- #9835
- Giấy phép
- MIT
- Cập nhật
- 21/10/2026
Bình luận
- …
Thêm skill từ kho mã này
getting-started
29kHướng dẫn agent của bạn cách tạo và hiển thị bảng dữ liệu với TanStack Table trong Alpine.js, gồm thiết lập, dữ liệu phản ứng và hiển thị các hàng.
table-state
29kHướng dẫn agent của bạn cách đọc và điều khiển trạng thái bảng trong Alpine.js, như trang hiện tại, để màn hình cập nhật khi trạng thái đó thay đổi.
devtools
29kHướng dẫn agent của bạn cách đăng ký bảng Angular với bảng điều khiển TanStack Devtools, để lập trình viên có thể kiểm tra từng bảng trong khi xây dựng ứng dụng.
getting-started
29kHướng dẫn agent của bạn cách tạo và hiển thị bảng TanStack trong Angular, gồm thiết lập injectTable, hiển thị trong template và cập nhật dữ liệu hàng.
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.