Skip to main content
skill CX Codex

tanstack-config — Claude Code skill: what it does, how to install

Guides agent setup for building, versioning, and publishing TypeScript packages using the @tanstack/config toolkit. Useful when setting up pnpm and Nx monorepos.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add tanstack-skills/tanstack-skills --skill tanstack-config -a claude-code
Open on GitHub

What tanstack-config does

The skill provides workflow rules for @tanstack/config. It teaches coding agents how to build dual ESM and CJS packages with .d.ts declaration files using Vite, apply tanstackEslintConfig, and structure package.json exports to pass publint checks.

It includes templates for pnpm workspaces and Nx task caching. GitHub Actions workflows run on Node 20. Version bumping and changelogs rely on Changesets.

Omitting moduleResolution: "bundler" in tsconfig.json or skipping test exclusions in the Vite config will break builds for downstream consumers.

What it helps with

  • configure dual ESM and CJS builds in Vite with generated .d.ts files
  • define publint-compliant exports maps inside package.json
  • automate package publishing and changelog creation using Changesets
  • configure a pnpm monorepo workspace with Nx task caching

Example prompts for the agent

  • Configure vite.config.ts with multiple entry points using tanstack-config
  • Set up publint-compatible exports in package.json for my TypeScript library
  • Create a GitHub Actions publish workflow with Changesets and pnpm

How to install tanstack-config

1Skills CLI (Vercel)

npx skills add tanstack-skills/tanstack-skills --skill tanstack-config -a claude-code

2Manually: put the files in place

~/.claude/skills/tanstack-config/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/tanstack-config/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about tanstack-config

How to install tanstack-config in Claude Code?

Run npx skills add tanstack-skills/tanstack-skills --skill tanstack-config -a claude-code.

What does the tanstack-config skill do?

It provides presets and guidelines for packaging TypeScript projects, covering Vite builds, ESLint configurations, monorepo tooling with pnpm and Nx, and release automation.

Which build formats does the Vite configuration produce?

It outputs both ESM and CJS bundles, builds TypeScript declaration files, and handles tree-shaking while excluding specified test files.

Source text

SKILL.md · MIT
---
name: tanstack-config
description: Opinionated toolkit for building, versioning, and publishing high-quality JavaScript/TypeScript packages.
---


## Overview

TanStack Config provides an opinionated, minimal-configuration toolkit for JavaScript/TypeScript package development. It includes Vite-powered build configuration, ESLint presets, publish automation with semantic versioning, and integrations with TypeScript, Prettier, Changesets, and GitHub Actions. Designed for monorepo workflows with pnpm and Nx.

**Package:** `@tanstack/config`
**Status:** Stable

## Installation

```bash
npm install @tanstack/config --save-dev
# or
pnpm add @tanstack/config -D
```

## Vite Build Configuration

### Basic Setup

```typescript
// vite.config.ts
import { defineConfig, mergeConfig } from 'vitest/config'
import { tanstackViteConfig } from '@tanstack/config/vite'

const config = defineConfig({
  // Your custom Vite config
})

export default mergeConfig(
  config,
  tanstackViteConfig({
    entry: './src/index.ts',
    srcDir: './src',
    exclude: ['./src/__tests__'],
  })
)
```

### Multiple Entry Points

```typescript
import { tanstackViteConfig } from '@tanstack/config/vite'

export default tanstackViteConfig({
  entry: [
    './src/index.ts',
    './src/adapters.ts',
    './src/utils.ts',
  ],
  srcDir: './src',
})
```

### Build Options

```typescript
tanstackViteConfig({
  entry: './src/index.ts',
  srcDir: './src',
  exclude: ['./src/__tests__', './src/**/*.test.ts'],
  // Generates ESM and CJS outputs
  // Generates .d.ts declaration files
  // Handles tree-shaking configuration
})
```

## ESLint Configuration

### Basic Setup

```javascript
// eslint.config.js
import { tanstackEslintConfig } from '@tanstack/config/eslint'

export default tanstackEslintConfig
```

### Extending the Config

```javascript
// eslint.config.js
import { tanstackEslintConfig } from '@tanstack/config/eslint'

export default [
  ...tanstackEslintConfig,
  {
    rules: {
      // Custom overrides
      '@typescript-eslint/no-explicit-any': 'warn',
    },
  },
]
```

## Publishing

### Publish Configuration

```typescript
// publish.config.ts or used via CLI
import { tanstackPublishConfig } from '@tanstack/config/publish'

export default tanstackPublishConfig({
  // Publint-compliant defaults
  // Semantic versioning automation
  // Changelog generation
})
```

### Package.json Setup

```json
{
  "name": "@myorg/my-package",
  "version": "0.0.0",
  "type": "module",
  "main": "dist/cjs/index.cjs",
  "module": "dist/esm/index.js",
  "types": "dist/esm/index.d.ts",
  "exports": {
    ".": {
      "import": {
        "types": "./dist/esm/index.d.ts",
        "default": "./dist/esm/index.js"
      },
      "require": {
        "types": "./dist/cjs/index.d.cts",
        "default": "./dist/cjs/index.cjs"
      }
    }
  },
  "files": ["dist", "src"],
  "scripts": {
    "build": "vite build",
    "lint": "eslint .",
    "test": "vitest"
  }
}
```

## TypeScript Configuration

### tsconfig.json

```json
{
  "compilerOptions": {
    "strict": true,
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "declaration": true,
    "declarationMap": true,
    "sourceMap": true,
    "outDir": "./dist",
    "rootDir": "./src",
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": ["src"],
  "exclude": ["node_modules", "dist"]
}
```

## Changesets Integration

### Setup

```bash
npx changeset init
```

### Creating a Changeset

```bash
npx changeset
# Interactive prompt: select packages, bump type, summary
```

### Changeset Config

```json
// .changeset/config.json
{
  "$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
  "changelog": "@changesets/cli/changelog",
  "commit": false,
  "fixed": [],
  "linked": [],
  "access": "public",
  "baseBranch": "main",
  "updateInternalDependencies": "patch"
}
```

## GitHub Actions Workflow

### CI/CD Pipeline

```yaml
# .github/workflows/ci.yml
name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v2
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: 'pnpm'
      - run: pnpm install
      - run: pnpm build
      - run: pnpm lint
      - run: pnpm test
```

### Publish Workflow

```yaml
# .github/workflows/publish.yml
name: Publish

on:
  push:
    branches: [main]

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v2
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          registry-url: 'https://registry.npmjs.org'
      - run: pnpm install
      - run: pnpm build
      - name: Create Release Pull Request or Publish
        uses: changesets/action@v1
        with:
          publish: pnpm publish -r
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```

## Monorepo Setup (pnpm + Nx)

### Workspace Configuration

```yaml
# pnpm-workspace.yaml
packages:
  - 'packages/*'
  - 'examples/*'
```

### Nx Configuration

```json
// nx.json
{
  "tasksRunnerOptions": {
    "default": {
      "runner": "nx/tasks-runners/default",
      "options": {
        "cacheableOperations": ["build", "lint", "test"]
      }
    }
  },
  "targetDefaults": {
    "build": {
      "dependsOn": ["^build"]
    }
  }
}
```

## Prettier Configuration

```json
// .prettierrc
{
  "semi": false,
  "singleQuote": true,
  "trailingComma": "all",
  "printWidth": 80
}
```

## EditorConfig

```ini
# .editorconfig
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
```

## Best Practices

1. **Use the Vite config for builds** - handles ESM/CJS dual output and declarations
2. **Use publint-compliant exports** in package.json for compatibility
3. **Use Changesets** for version management in monorepos
4. **Set `"type": "module"`** in package.json for ESM-first packages
5. **Include both `src` and `dist`** in `files` for source map debugging
6. **Use Nx caching** for faster builds in monorepos
7. **Always generate declaration files** (`.d.ts`) for TypeScript consumers
8. **Use the ESLint config** as a consistent baseline across packages
9. **Automate publishing** with GitHub Actions and Changesets

## Common Pitfalls

- Missing `exports` field in package.json (breaks modern bundlers)
- Not setting `"type": "module"` (causes ESM import issues)
- Forgetting declaration files in build output
- Not excluding test files from the build
- Publishing without running publint validation first
- Not configuring `moduleResolution: "bundler"` in tsconfig
- Inconsistent versioning across monorepo packages (use Changesets `linked`)

© tanstack-skills · MIT · tanstack-skills/tanstack-skills

Similar skills

All skills for Programming languages →

From the same set13

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor