Agent skill
tanstack-table
Build TanStack Table components using the meta field pattern for cell callbacks instead of closures. Use when creating data tables, implementing sorting, or adding inline editing.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/tanstack-table-casper-studios-casper-marketplace
Metadata
Additional technical details for this skill
- author
- BastiDood <[email protected]>
SKILL.md
Documentation
Use context7 for the latest documentation. Use deepwiki to ask questions about the library's implementation.
- GitHub Repository: https://github.com/TanStack/table
- DeepWiki Repository:
TanStack/table - Context7 Library ID:
/tanstack/table
TanStack Table Patterns
This skill covers TanStack Table library patterns with the meta field for passing behavior to cells.
Core Pattern: Hoisted Columns with Meta
// 1. Extend TableMeta for type safety
declare module '@tanstack/react-table' {
interface TableMeta<TData extends RowData> {
onEdit?: (id: string) => void;
onDelete?: (id: string) => void;
}
}
// 2. Hoist column definitions outside component
const columnHelper = createColumnHelper<Job>();
const columns = [
columnHelper.accessor('name', {
header: 'Name',
cell: info => info.getValue(),
}),
columnHelper.display({
id: 'actions',
cell: ({ row, table }) => (
<Button onClick={() => table.options.meta?.onEdit?.(row.original.id)}>Edit</Button>
),
}),
];
// 3. Pass callbacks via meta
function DataTable({ data, onEdit, onDelete }: Props) {
const table = useReactTable({
data,
columns,
getCoreRowModel: getCoreRowModel(),
meta: { onEdit, onDelete },
});
return <Table>...</Table>;
}
Why Meta Over Closures?
Closures in column definitions cause re-renders:
// Bad - new column array every render
const columns = useMemo(() => [
{
cell: ({ row }) => (
<Button onClick={() => onEdit(row.original.id)}>Edit</Button>
),
},
], [onEdit]); // Invalidates when onEdit changes
// Good - stable columns, dynamic meta
const columns = [...]; // Hoisted, never changes
const table = useReactTable({
meta: { onEdit }, // Only meta changes
});
References
- For column definition patterns, see column-definitions.md
- For meta field type safety, see meta-field.md
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?