jpskill.com
📦 その他 コミュニティ

tanstack-integration

Webアプリケーション開発において、まずは基本機能を実装した後、TanStackライブラリ(Query、Tableなど)を活用してコードの改善点を見つけ、より効率的で保守性の高いシステムを構築するSkill。

📜 元の英語説明(参考)

Find opportunities to improve web application code using TanStack libraries (Query, Table, Form, Router, etc.). Avoid man-with-hammer syndrome by applying TanStack after vanilla implementation works.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Webアプリケーション開発において、まずは基本機能を実装した後、TanStackライブラリ(Query、Tableなど)を活用してコードの改善点を見つけ、より効率的で保守性の高いシステムを構築するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o tanstack-integration.zip https://jpskill.com/download/18659.zip && unzip -o tanstack-integration.zip && rm tanstack-integration.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/18659.zip -OutFile "$d\tanstack-integration.zip"; Expand-Archive "$d\tanstack-integration.zip" -DestinationPath $d -Force; ri "$d\tanstack-integration.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して tanstack-integration.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → tanstack-integration フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

TanStack Integration — 戦略的なライブラリの採用

理念: 「ハンマーを持つ男症候群」(すべてが釘に見える)を避ける。まずはバニラで始め、TanStack が明確な利点をもたらす場合にのみ、戦略的に採用する。

タイミング: Next.js/React/Tailwind でアプリがすでにかなりうまく動作している状態になってから、これを使用する。


TanStack とは?

TanStack は、Web アプリケーション向けの高品質なライブラリのセットです。

ライブラリ 目的
TanStack Query サーバーの状態管理、キャッシュ、同期
TanStack Table ヘッドレスなテーブル/グリッドロジック
TanStack Form フォームの状態管理とバリデーション
TanStack Router 型安全なルーティング
TanStack Virtual 大規模リストの仮想化
TanStack Ranger レンジ/スライダーコンポーネント

アンチパターン: 早すぎる採用

やってはいけないこと:

  1. 新しいプロジェクトを開始する
  2. すぐにすべての TanStack ライブラリをインストールする
  3. すべてを TanStack パターンで強制する
  4. 結果として、過剰に設計されたコードになる

なぜ悪いのか:

  • すべての機能が TanStack を必要とするわけではない
  • 単純な解決策で済む場所に複雑さを加える
  • メリットがないのにコードの理解を難しくする
  • 「ハンマーを持つ男」はすべての問題を釘とみなす

正しいパターン: 戦略的な採用

代わりに、これを行う:

  1. バニラの Next.js 16、React 19、Tailwind で構築する
  2. アプリをうまく動作させる
  3. TanStack 分析プロンプトを実行する
  4. 明らかに改善される場合にのみ TanStack を採用する
  5. 複数のラウンドを繰り返す

正確なプロンプト — TanStack 分析

Ok, I want you to look through the ENTIRE project and look for areas where, if we leveraged one of the many TanStack libraries (e.g., query, table, forms, etc), we could make part of the code much better, simpler, more performant, more maintainable, elegant, shorter, more reliable, etc. Use ultrathink

各 TanStack ライブラリを使用するタイミング

TanStack Query

良い候補:

  • キャッシュが必要な API 呼び出し
  • 頻繁にフェッチされるデータ
  • 楽観的アップデート
  • バックグラウンドでの再フェッチ
  • キャッシュ付きのページネーション
  • 無限スクロール

スキップする場合:

  • 単純な 1 回限りのフェッチ
  • 静的データ
  • 同期が必要ないデータ

TanStack Table

良い候補:

  • ソート/フィルタリングを備えた複雑なデータテーブル
  • ページネーション付きのテーブル
  • 列のリサイズ/並べ替え
  • 行の選択
  • 展開可能な行
  • サーバーサイドのデータテーブル

スキップする場合:

  • 単純な静的テーブル
  • 20 行未満のテーブル
  • インタラクティブ性が不要

TanStack Form

良い候補:

  • 複雑な複数ステップのフォーム
  • 複雑なバリデーションを持つフォーム
  • 動的なフィールドを持つフォーム
  • 非同期バリデーションを持つフォーム
  • ウィザード形式のワークフロー

スキップする場合:

  • 単純な問い合わせフォーム
  • 3〜4 個のフィールドを持つフォーム
  • 基本的なバリデーションニーズ

TanStack Router

良い候補:

  • 型安全なルーティングを必要とする大規模なアプリ
  • 複雑なネストされたルート
  • ルートベースのコード分割
  • 検索パラメータの管理

スキップする場合:

  • Next.js App Router を使用している場合 (すでに優れている)
  • 単純なナビゲーションニーズ
  • ルートが少ない

TanStack Virtual

良い候補:

  • 1000 以上のアイテムを持つリスト
  • 無限スクロールビュー
  • 大規模なデータグリッド
  • チャットメッセージリスト

スキップする場合:

  • 100 未満のアイテムを持つリスト
  • すでに他の場所でウィンドウイングを使用している
  • それなしでもパフォーマンスが問題ない

統合ワークフロー

ステップ 1: アプリを動作させる

最初にバニラパターンでアプリを構築する:

  • API 呼び出しには fetch または axios
  • ネイティブなフォーム処理
  • 単純な HTML テーブル
  • Next.js ルーティング

ステップ 2: 分析を実行する

Claude Code + Opus 4.5 または Codex + GPT 5.2 (高度な推論能力) で TanStack 分析プロンプトを使用する。

ステップ 3: 提案を評価する

モデルは機会を特定します。それぞれについて:

  • 複雑さはメリットに見合うか?
  • 現在の解決策は実際に問題があるか?
  • これにより保守性が向上するか?

ステップ 4: 選択的な採用

明確なメリットがある場合にのみ採用する。次のことは問題ありません。

  • TanStack Query は使用するが、Table は使用しない
  • 1 つの複雑なテーブルに Table を使用し、すべてのテーブルには使用しない
  • バニラと TanStack のアプローチを組み合わせる

ステップ 5: 繰り返す

変更後にもう一度分析を実行する。新しい機会が現れる可能性があります。


このタスクに最適なモデル

モデル 構成
Claude Code + Opus 4.5 ultrathink を使用
Codex + GPT 5.2 高または非常に高い推論能力

改善例

以前: 手動でのデータフェッチ

// Vanilla approach
const [data, setData] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);

useEffect(() => {
  fetch('/api/users')
    .then(res => res.json())
    .then(setData)
    .catch(setError)
    .finally(() => setLoading(false));
}, []);

以降: TanStack Query

// TanStack Query approach
const { data, isLoading, error } = useQuery({
  queryKey: ['users'],
  queryFn: () => fetch('/api/users').then(res => res.json()),
});

メリット:

  • 組み込みのキャッシュ
  • 自動再フェッチ
  • リクエストの重複排除
  • DevTools のサポート

以前: 複雑なテーブルロジック

// Vanilla approach with manual sorting, filtering, pagination
// ... 200+ lines of state management

以降: TanStack Table

// TanStack Table handles sorting, filtering, pagination
const table = useReactTable({
  data,
  columns,
  getCoreRowModel: getCoreRowModel(),
  getSortedRowModel: getSortedRowModel(),
  getFilteredRowModel: getFilteredRowModel(),
  getPaginationRowModel: getPaginationRowModel(),
});

メリット:

  • ヘッドレス (UI を制御できる)
  • すべてのテーブルロジックが処理される
  • 一貫した動作
  • コードが大幅に削減される

TanStack 作業用の Beads の作成

bd create "Evaluate TanStack Query opportunities" -t enhancement -p 3
bd create "Migrate user data fetching to TanStack Query" -t enhancement -p 2
bd create "Implement data table with TanStack Table" -t feature -p 2
bd create "Add TanStack Virtual to chat message list" -t performance -p 2

完全なプロンプトのリファレンス

TanStack 分析

Ok, I want you to 

(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

TanStack Integration — Strategic Library Adoption

Philosophy: Avoid "man with a hammer syndrome" (to whom everything appears as a nail). Start vanilla, then strategically adopt TanStack where it provides clear benefits.

Timing: Use this AFTER your app is already working pretty well in vanilla Next.js/React/Tailwind.


What is TanStack?

TanStack is a set of high-quality libraries for web applications:

Library Purpose
TanStack Query Server state management, caching, synchronization
TanStack Table Headless table/grid logic
TanStack Form Form state management and validation
TanStack Router Type-safe routing
TanStack Virtual Virtualization for large lists
TanStack Ranger Range/slider components

The Anti-Pattern: Premature Adoption

Don't do this:

  1. Start new project
  2. Immediately install all TanStack libraries
  3. Force everything through TanStack patterns
  4. End up with over-engineered code

Why it's bad:

  • Not every feature needs TanStack
  • Adds complexity where simple solutions work
  • Makes code harder to understand for no benefit
  • "Man with a hammer" sees every problem as a nail

The Correct Pattern: Strategic Adoption

Do this instead:

  1. Build with vanilla Next.js 16, React 19, Tailwind
  2. Get the app working well
  3. Run the TanStack analysis prompt
  4. Adopt TanStack only where it clearly improves things
  5. Repeat several rounds

THE EXACT PROMPT — TanStack Analysis

Ok, I want you to look through the ENTIRE project and look for areas where, if we leveraged one of the many TanStack libraries (e.g., query, table, forms, etc), we could make part of the code much better, simpler, more performant, more maintainable, elegant, shorter, more reliable, etc. Use ultrathink

When to Use Each TanStack Library

TanStack Query

Good candidates:

  • API calls that need caching
  • Data that's fetched frequently
  • Optimistic updates
  • Background refetching
  • Pagination with caching
  • Infinite scroll

Skip if:

  • Simple one-time fetches
  • Static data
  • Data that doesn't need synchronization

TanStack Table

Good candidates:

  • Complex data tables with sorting/filtering
  • Tables with pagination
  • Column resizing/reordering
  • Row selection
  • Expandable rows
  • Server-side data tables

Skip if:

  • Simple static tables
  • Tables with < 20 rows
  • No interactivity needed

TanStack Form

Good candidates:

  • Complex multi-step forms
  • Forms with complex validation
  • Forms with dynamic fields
  • Forms with async validation
  • Wizard-style workflows

Skip if:

  • Simple contact forms
  • Forms with 3-4 fields
  • Basic validation needs

TanStack Router

Good candidates:

  • Large apps needing type-safe routing
  • Complex nested routes
  • Route-based code splitting
  • Search params management

Skip if:

  • Using Next.js App Router (already good)
  • Simple navigation needs
  • Few routes

TanStack Virtual

Good candidates:

  • Lists with 1000+ items
  • Infinite scroll views
  • Large data grids
  • Chat message lists

Skip if:

  • Lists with < 100 items
  • Already using windowing elsewhere
  • Performance is fine without it

Integration Workflow

Step 1: Get App Working

Build your app with vanilla patterns first:

  • fetch or axios for API calls
  • Native form handling
  • Simple HTML tables
  • Next.js routing

Step 2: Run Analysis

Use the TanStack analysis prompt with Claude Code + Opus 4.5 or Codex + GPT 5.2 (High reasoning effort).

Step 3: Evaluate Suggestions

The model will identify opportunities. For each:

  • Does the complexity justify the benefit?
  • Is the current solution actually problematic?
  • Will this improve maintainability?

Step 4: Selective Adoption

Only adopt where there's clear benefit. It's fine to:

  • Use TanStack Query but not Table
  • Use Table for one complex table, not all tables
  • Mix vanilla and TanStack approaches

Step 5: Repeat

Run the analysis again after changes. New opportunities may emerge.


Best Models for This Task

Model Configuration
Claude Code + Opus 4.5 Use ultrathink
Codex + GPT 5.2 High or Extra-High reasoning effort

Example Improvements

Before: Manual Data Fetching

// Vanilla approach
const [data, setData] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);

useEffect(() => {
  fetch('/api/users')
    .then(res => res.json())
    .then(setData)
    .catch(setError)
    .finally(() => setLoading(false));
}, []);

After: TanStack Query

// TanStack Query approach
const { data, isLoading, error } = useQuery({
  queryKey: ['users'],
  queryFn: () => fetch('/api/users').then(res => res.json()),
});

Benefits:

  • Built-in caching
  • Automatic refetching
  • Request deduplication
  • DevTools support

Before: Complex Table Logic

// Vanilla approach with manual sorting, filtering, pagination
// ... 200+ lines of state management

After: TanStack Table

// TanStack Table handles sorting, filtering, pagination
const table = useReactTable({
  data,
  columns,
  getCoreRowModel: getCoreRowModel(),
  getSortedRowModel: getSortedRowModel(),
  getFilteredRowModel: getFilteredRowModel(),
  getPaginationRowModel: getPaginationRowModel(),
});

Benefits:

  • Headless (you control the UI)
  • All table logic handled
  • Consistent behavior
  • Much less code

Creating Beads for TanStack Work

bd create "Evaluate TanStack Query opportunities" -t enhancement -p 3
bd create "Migrate user data fetching to TanStack Query" -t enhancement -p 2
bd create "Implement data table with TanStack Table" -t feature -p 2
bd create "Add TanStack Virtual to chat message list" -t performance -p 2

Complete Prompt Reference

TanStack Analysis

Ok, I want you to look through the ENTIRE project and look for areas where, if we leveraged one of the many TanStack libraries (e.g., query, table, forms, etc), we could make part of the code much better, simpler, more performant, more maintainable, elegant, shorter, more reliable, etc. Use ultrathink

Focused Query Analysis

Look through the project for data fetching patterns that would benefit from TanStack Query. Consider caching needs, refetching patterns, and optimistic updates. Identify the top 3 opportunities. Use ultrathink.

Focused Table Analysis

Look through the project for table/grid components that would benefit from TanStack Table. Consider sorting, filtering, pagination, and column management needs. Identify candidates. Use ultrathink.

Tips

  1. Don't over-adopt — Some vanilla patterns are fine
  2. Measure the benefit — Does it actually improve the code?
  3. Consider team familiarity — TanStack has a learning curve
  4. Check bundle size — Only import what you need
  5. Read the docs — TanStack documentation is excellent