Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

tanstack-table坦斯塔克表

Agent Skill

tanstack-table 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,612

周安装

79

GitHub Stars

37

下载量

928
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:tanstack-table(坦斯塔克表)
来源仓库:https://github.com/ovachiever/droid-tings
仓库路径:skills/tanstack-table
安装命令:
npx skills add https://github.com/ovachiever/droid-tings --skill 'TanStack Table'
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/ovachiever/droid-tings --skill 'TanStack Table'

简介

tanstack-table 用于查找、检索和筛选相关信息,适合在 Codex、Claude 等宿主中处理技术表格相关问题。

  • 适用于研究检索场景,可协助分析 TanStack Table 的使用方法和最佳实践。
  • 通过 npx skills add 命令安装,需确认是否涉及代码修改或依赖变更。
  • 使用前建议核实仓库维护状态,避免引入不稳定因素。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

TanStack Table Skill

Build production-ready, headless data tables with TanStack Table v8, optimized for server-side patterns and Cloudflare Workers integration.


When to Use This Skill

Auto-triggers when you mention:

  • "data table" or "datagrid"
  • "server-side pagination" or "server-side filtering"
  • "TanStack Table" or "React Table"
  • "table with large dataset"
  • "paginate/filter/sort with API"
  • "Cloudflare D1 table integration"
  • "virtualize table" or "large list performance"

Use this skill when:

  • Building data tables with pagination, filtering, or sorting
  • Implementing server-side table features (API-driven)
  • Integrating tables with TanStack Query for data fetching
  • Working with large datasets (1000+ rows) needing virtualization
  • Connecting tables to Cloudflare D1 databases
  • Need headless table logic without opinionated UI
  • Migrating from other table libraries to TanStack Table v8

What This Skill Provides

1. Production Templates (6)

  • Basic client-side table - Simple table with local data
  • Server-paginated table - API-driven pagination with TanStack Query
  • D1 database integration - Cloudflare D1 + Workers API + Table
  • Column configuration patterns - Type-safe column definitions
  • Virtualized large dataset - Performance optimization with TanStack Virtual
  • shadcn/ui styled table - Integration with Tailwind v4 + shadcn

2. Server-Side Patterns

  • Pagination with API backends
  • Filtering with query parameters
  • Sorting with database queries
  • State management (page, filters, sorting)
  • URL synchronization
  • TanStack Query coordination

3. Cloudflare Integration

  • D1 database query patterns
  • Workers API endpoints for table data
  • Pagination + filtering + sorting in SQL
  • Bindings setup (wrangler.jsonc)
  • Client-side integration patterns

4. Performance Optimization

  • Virtualization with TanStack Virtual
  • Large dataset rendering (10k+ rows)
  • Memory-efficient patterns
  • useVirtualizer() integration

5. Error Prevention

Documents and prevents 6+ common issues:

  1. Server-side state management confusion
  2. TanStack Query integration errors (query key coordination)
  3. Column filtering with API backends
  4. Manual sorting setup mistakes
  5. URL state synchronization issues
  6. Large dataset performance problems

Quick Start

Installation

npm install @tanstack/react-table@latest
# For virtualization (optional):
npm install @tanstack/react-virtual@latest

Latest verified versions:

  • @tanstack/react-table: v8.21.3
  • @tanstack/react-virtual: v3.13.12

Basic Client-Side Table

import { useReactTable, getCoreRowModel, ColumnDef } from '@tanstack/react-table'
import { useMemo } from 'react'

interface User {
  id: string
  name: string
  email: string
}

const columns: ColumnDef<User>[] = [
  { accessorKey: 'id', header: 'ID' },
  { accessorKey: 'name', header: 'Name' },
  { accessorKey: 'email', header: 'Email' },
]

function UsersTable() {
  // CRITICAL: Memoize data and columns to prevent infinite re-renders
  const data = useMemo<User[]>(() => [
    { id: '1', name: 'Alice', email: 'alice@example.com' },
    { id: '2', name: 'Bob', email: 'bob@example.com' },
  ], [])

  const table = useReactTable({
    data,
    columns,
    getCoreRowModel: getCoreRowModel(), // Required
  })

  return (
    <table>
      <thead>
        {table.getHeaderGroups().map(headerGroup => (
          <tr key={headerGroup.id}>
            {headerGroup.headers.map(header => (
              <th key={header.id}>
                {header.isPlaceholder ? null : header.column.columnDef.header}
              </th>
            ))}
          </tr>
        ))}
      </thead>
      <tbody>
        {table.getRowModel().rows.map(row => (
          <tr key={row.id}>
            {row.getVisibleCells().map(cell => (
              <td key={cell.id}>
                {cell.renderValue()}
              </td>
            ))}
          </tr>
        ))}
      </tbody>
    </table>
  )
}

Server-Side Patterns (Recommended for Large Datasets)

Pattern 1: Server-Side Pagination with TanStack Query

Cloudflare Workers API Endpoint:

// src/routes/api/users.ts
import { Env } from '../../types'

export async function onRequestGet(context: { request: Request; env: Env }) {
  const url = new URL(context.request.url)
  const page = Number(url.searchParams.get('page')) || 0
  const pageSize = Number(url.searchParams.get('pageSize')) || 20

  const offset = page * pageSize

  // Query D1 database
  const { results, meta } = await context.env.DB.prepare(`
    SELECT id, name, email, created_at
    FROM users
    ORDER BY created_at DESC
    LIMIT ? OFFSET ?
  `).bind(pageSize, offset).all()

  // Get total count for pagination
  const countResult = await context.env.DB.prepare(`
    SELECT COUNT(*) as total FROM users
  `).first<{ total: number }>()

  return Response.json({
    data: results,
    pagination: {
      page,
      pageSize,
      total: countResult?.total || 0,
      pageCount: Math.ceil((countResult?.total || 0) / pageSize),
    },
  })
}

Client-Side Table with TanStack Query:

import { useReactTable, getCoreRowModel, PaginationState } from '@tanstack/react-table'
import { useQuery } from '@tanstack/react-query'
import { useState } from 'react'

function ServerPaginatedTable() {
  const [pagination, setPagination] = useState<PaginationState>({
    pageIndex: 0,
    pageSize: 20,
  })

  // TanStack Query fetches data
  const { data, isLoading } = useQuery({
    queryKey: ['users', pagination.pageIndex, pagination.pageSize],
    queryFn: async () => {
      const response = await fetch(
        `/api/users?page=${pagination.pageIndex}&pageSize=${pagination.pageSize}`
      )
      return response.json()
    },
  })

  // TanStack Table manages display
  const table = useReactTable({
    data: data?.data ?? [],
    columns,
    getCoreRowModel: getCoreRowModel(),
    // Server-side pagination config
    manualPagination: true, // CRITICAL: Tell table pagination is manual
    pageCount: data?.pagination.pageCount ?? 0,
    state: { pagination },
    onPaginationChange: setPagination,
  })

  if (isLoading) return <div>Loading...</div>

  return (
    <div>
      <table>{/* render table */}</table>

      {/* Pagination controls */}
      <div>
        <button
          onClick={() => table.previousPage()}
          disabled={!table.getCanPreviousPage()}
        >
          Previous
        </button>
        <span>
          Page {table.getState().pagination.pageIndex + 1} of{' '}
          {table.getPageCount()}
        </span>
        <button
          onClick={() => table.nextPage()}
          disabled={!table.getCanNextPage()}
        >
          Next
        </button>
      </div>
    </div>
  )
}

Pattern 2: Server-Side Filtering

API with Filter Support:

export async function onRequestGet(context: { request: Request; env: Env }) {
  const url = new URL(context.request.url)
  const search = url.searchParams.get('search') || ''

  const { results } = await context.env.DB.prepare(`
    SELECT * FROM users
    WHERE name LIKE ? OR email LIKE ?
    LIMIT 20
  `).bind(`%${search}%`, `%${search}%`).all()

  return Response.json({ data: results })
}

Client-Side:

const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([])

const { data } = useQuery({
  queryKey: ['users', columnFilters],
  queryFn: async () => {
    const search = columnFilters.find(f => f.id === 'search')?.value || ''
    return fetch(`/api/users?search=${search}`).then(r => r.json())
  },
})

const table = useReactTable({
  data: data?.data ?? [],
  columns,
  getCoreRowModel: getCoreRowModel(),
  manualFiltering: true, // CRITICAL: Server handles filtering
  state: { columnFilters },
  onColumnFiltersChange: setColumnFilters,
})

Virtualization for Large Datasets

For 1000+ rows, use TanStack Virtual to only render visible rows:

import { useVirtualizer } from '@tanstack/react-virtual'
import { useRef } from 'react'

function VirtualizedTable() {
  const tableContainerRef = useRef<HTMLDivElement>(null)

  const table = useReactTable({
    data: largeDataset, // 10k+ rows
    columns,
    getCoreRowModel: getCoreRowModel(),
  })

  const { rows } = table.getRowModel()

  // Virtualize rows
  const rowVirtualizer = useVirtualizer({
    count: rows.length,
    getScrollElement: () => tableContainerRef.current,
    estimateSize: () => 50, // Row height in px
    overscan: 10, // Render 10 extra rows for smooth scrolling
  })

  return (
    <div ref={tableContainerRef} style={{ height: '600px', overflow: 'auto' }}>
      <table style={{ height: `${rowVirtualizer.getTotalSize()}px` }}>
        <thead>{/* header */}</thead>
        <tbody>
          {rowVirtualizer.getVirtualItems().map(virtualRow => {
            const row = rows[virtualRow.index]
            return (
              <tr
                key={row.id}
                style={{
                  position: 'absolute',
                  transform: `translateY(${virtualRow.start}px)`,
                  width: '100%',
                }}
              >
                {row.getVisibleCells().map(cell => (
                  <td key={cell.id}>{cell.renderValue()}</td>
                ))}
              </tr>
            )
          })}
        </tbody>
      </table>
    </div>
  )
}

Common Errors & Solutions

Error 1: Infinite Re-Renders

Problem: Table re-renders infinitely, browser freezes.

Cause: data or columns references change on every render.

Solution: Always use useMemo or useState:

// ❌ BAD: New array reference every render
function Table() {
  const data = [{ id: 1 }] // Creates new array!
  const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() })
}

// ✅ GOOD: Stable reference
function Table() {
  const data = useMemo(() => [{ id: 1 }], []) // Stable
  const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() })
}

// ✅ ALSO GOOD: Define outside component
const data = [{ id: 1 }]
function Table() {
  const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() })
}

Error 2: TanStack Query + Table State Mismatch

Problem: Query refetches but pagination state not in sync, causing stale data.

Solution: Include ALL table state in query key:

// ❌ BAD: Missing pagination in query key
const { data } = useQuery({
  queryKey: ['users'], // Doesn't include page!
  queryFn: () => fetch(`/api/users?page=${pagination.pageIndex}`).then(r => r.json())
})

// ✅ GOOD: Complete query key
const { data } = useQuery({
  queryKey: ['users', pagination.pageIndex, pagination.pageSize, columnFilters, sorting],
  queryFn: () => {
    const params = new URLSearchParams({
      page: pagination.pageIndex.toString(),
      pageSize: pagination.pageSize.toString(),
      // ... filters, sorting
    })
    return fetch(`/api/users?${params}`).then(r => r.json())
  }
})

Error 3: Server-Side Features Not Working

Problem: Pagination/filtering/sorting doesn't trigger API calls.

Solution: Set manual* flags to true:

const table = useReactTable({
  data,
  columns,
  getCoreRowModel: getCoreRowModel(),
  // CRITICAL: Tell table these are server-side
  manualPagination: true,
  manualFiltering: true,
  manualSorting: true,
  pageCount: serverPageCount, // Must provide total page count
})

Error 4: TypeScript "Cannot Find Module" for Column Helper

Problem: Import errors for createColumnHelper.

Solution: Import from correct path:

// ❌ BAD: Wrong path
import { createColumnHelper } from '@tanstack/table-core'

// ✅ GOOD: Correct path
import { createColumnHelper } from '@tanstack/react-table'

// Usage for type-safe columns
const columnHelper = createColumnHelper<User>()
const columns = [
  columnHelper.accessor('name', {
    header: 'Name',
    cell: info => info.getValue(), // Fully typed!
  }),
]

Error 5: Sorting Not Working with Server-Side

Problem: Clicking sort headers doesn't update data.

Solution: Include sorting in query key and API call:

const [sorting, setSorting] = useState<SortingState>([])

const { data } = useQuery({
  queryKey: ['users', pagination, sorting], // Include sorting
  queryFn: async () => {
    const sortParam = sorting[0]
      ? `&sortBy=${sorting[0].id}&sortOrder=${sorting[0].desc ? 'desc' : 'asc'}`
      : ''
    return fetch(`/api/users?page=${pagination.pageIndex}${sortParam}`).then(r => r.json())
  }
})

const table = useReactTable({
  data: data?.data ?? [],
  columns,
  getCoreRowModel: getCoreRowModel(),
  manualSorting: true,
  state: { sorting },
  onSortingChange: setSorting,
})

Error 6: Poor Performance with Large Datasets

Problem: Table slow/laggy with 1000+ rows.

Solution: Use virtualization (see example above) or implement server-side pagination.


Integration with Existing Skills

With tanstack-query Skill

TanStack Table + TanStack Query is the recommended pattern:

// Query handles data fetching + caching
const { data, isLoading } = useQuery({
  queryKey: ['users', tableState],
  queryFn: fetchUsers,
})

// Table handles display + interactions
const table = useReactTable({
  data: data?.data ?? [],
  columns,
  getCoreRowModel: getCoreRowModel(),
})

With cloudflare-d1 Skill

// Cloudflare Workers API (from cloudflare-d1 skill patterns)
export async function onRequestGet({ env }: { env: Env }) {
  const { results } = await env.DB.prepare('SELECT * FROM users LIMIT 20').all()
  return Response.json({ data: results })
}

// Client-side table consumes D1 data
const { data } = useQuery({
  queryKey: ['users'],
  queryFn: () => fetch('/api/users').then(r => r.json())
})

With tailwind-v4-shadcn Skill

Use shadcn/ui Table components with TanStack Table logic:

import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell } from '@/components/ui/table'

function StyledTable() {
  const table = useReactTable({ /* config */ })

  return (
    <Table>
      <TableHeader>
        {table.getHeaderGroups().map(headerGroup => (
          <TableRow key={headerGroup.id}>
            {headerGroup.headers.map(header => (
              <TableHead key={header.id}>
                {header.column.columnDef.header}
              </TableHead>
            ))}
          </TableRow>
        ))}
      </TableHeader>
      <TableBody>
        {table.getRowModel().rows.map(row => (
          <TableRow key={row.id}>
            {row.getVisibleCells().map(cell => (
              <TableCell key={cell.id}>
                {cell.renderValue()}
              </TableCell>
            ))}
          </TableRow>
        ))}
      </TableBody>
    </Table>
  )
}

Best Practices

1. Always Memoize Data and Columns

const data = useMemo(() => [...], [dependencies])
const columns = useMemo(() => [...], [])

2. Use Server-Side for Large Datasets

  • Client-side: <1000 rows
  • Server-side: 1000+ rows or frequently changing data

3. Coordinate Query Keys with Table State

queryKey: ['resource', pagination, filters, sorting]

4. Provide Loading States

if (isLoading) return <TableSkeleton />
if (error) return <ErrorMessage error={error} />

5. Use Column Helper for Type Safety

const columnHelper = createColumnHelper<YourType>()
const columns = [
  columnHelper.accessor('field', { /* fully typed */ })
]

6. Virtualize Large Client-Side Tables

if (data.length > 1000) {
  // Use TanStack Virtual (see example above)
}

Templates Reference

All templates available in ~/.claude/skills/tanstack-table/templates/:

  1. package.json - Dependencies and versions
  2. basic-client-table.tsx - Simple client-side table
  3. server-paginated-table.tsx - Server-side pagination with Query
  4. d1-database-example.tsx - Cloudflare D1 integration
  5. column-configuration.tsx - Type-safe column patterns
  6. virtualized-large-dataset.tsx - Performance with Virtual
  7. shadcn-styled-table.tsx - Tailwind v4 + shadcn UI styling

Reference Docs

Deep-dive guides in ~/.claude/skills/tanstack-table/references/:

  1. server-side-patterns.md - Pagination, filtering, sorting with APIs
  2. query-integration.md - Coordinating with TanStack Query
  3. cloudflare-d1-examples.md - Workers + D1 complete examples
  4. performance-virtualization.md - TanStack Virtual guide
  5. common-errors.md - All 6+ documented issues with solutions

Token Efficiency

Without this skill:

  • ~8,000 tokens: Research v8 changes, server-side patterns, Query integration
  • 3-4 common errors encountered
  • 30-45 minutes total time

With this skill:

  • ~3,500 tokens: Direct templates, error prevention
  • 0 errors (all documented issues prevented)
  • 10-15 minutes total time

Savings: ~55-65% tokens, ~70% time


Production Validation

Tested with:

  • React 19.2
  • Vite 6.0
  • TypeScript 5.8
  • Cloudflare Workers (Wrangler 4.0)
  • TanStack Query v5.90.7 (tanstack-query skill)
  • Tailwind v4 + shadcn/ui (tailwind-v4-shadcn skill)

Stack compatibility:

  • ✅ Cloudflare Workers + Static Assets
  • ✅ Cloudflare D1 database
  • ✅ TanStack Query integration
  • ✅ React 19.2+ server components
  • ✅ TypeScript strict mode
  • ✅ Vite 6.0+ build optimization

Further Reading


Last Updated: 2025-11-07 Skill Version: 1.0.0 Library Version: @tanstack/react-table v8.21.3

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

31.74%
按下载量换算295

Antigravity

26.47%
按下载量换算246

Gemini CLI

16.6%
按下载量换算154

OpenCode

11.84%
按下载量换算110

Codex

8.11%
按下载量换算75

github-copilot

3.94%
按下载量换算37

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源字段存在多来源差异,先按来源优先级自动处理,无法消解时进入异常复核队列。

来源信息

继续浏览同类 Skills