
Tanstack Cli
- 77 installs
- 14 repo stars
- Updated March 2, 2026
- oakoss/agent-skills
Helps with ai & agent building tasks during AI-assisted development.
About
tanstack-cli is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- tanstack-cli
- AI & Agent Building
- AI-coding skill
Tanstack Cli by the numbers
- 77 all-time installs (skills.sh)
- +1 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #5,358 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/oakoss/agent-skills --skill tanstack-cliAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 77 |
|---|---|
| repo stars | ★ 14 |
| Last updated | March 2, 2026 |
| Repository | oakoss/agent-skills ↗ |
What it does
Helps with ai & agent building tasks during AI-assisted development.
Files
TanStack Config
Overview
TanStack Config provides opinionated tooling to build, version, and publish JavaScript/TypeScript packages with minimal configuration and consistent results. It uses Vite for library builds with automatic dual ESM/CJS output and type generation, plus automated publishing with conventional-commit-based versioning.
When to use: Building TanStack libraries or packages that follow TanStack conventions, contributing to TanStack open-source projects, setting up dual ESM/CJS library builds with Vite, automating package publishing with conventional commits.
When NOT to use: Application builds (use framework-specific tooling), non-library projects, projects not using pnpm, projects that need non-Vite build pipelines.
Quick Reference
| Pattern | API / Package | Key Points |
|---|---|---|
| Vite build config | tanstackViteConfig() from @tanstack/vite-config | Merge with defineConfig via mergeConfig |
| Entry point | entry: './src/index.ts' | Single file or array of entry files |
| Source directory | srcDir: './src' | Used for declaration file generation |
| CJS output | cjs: true (default) | Generates .cjs and .d.cts alongside ESM |
| External deps | externalDeps: [/^@internal\//] | Auto-detected from package.json, extend with patterns |
| Bundled deps | bundledDeps: ['tiny-invariant'] | Bundle instead of externalize |
| Exclude from types | exclude: ['./src/**/*.test.ts'] | Patterns to skip during type generation |
| Custom tsconfig | tsconfigPath: './tsconfig.build.json' | Override default tsconfig for builds |
| Declaration hook | beforeWriteDeclarationFile(path, content) | Transform .d.ts content before write |
| Publish automation | publish() from @tanstack/publish-config | Conventional commits drive versioning |
| Branch configs | branchConfigs: { main, beta, alpha } | Control prerelease and stable channels |
| Package list | packages: [{ name, packageDir }] | Monorepo package definitions |
| Build script | vite build && publint --strict | Standard build with strict linting |
Common Mistakes
| Mistake | Correct Pattern |
|---|---|
Missing "type": "module" in package.json | Set "type": "module" for ESM-first builds |
Using defineConfig alone without mergeConfig | Use mergeConfig(defineConfig({...}), tanstackViteConfig({...})) |
Forgetting entry or srcDir options | Both are required for tanstackViteConfig to work |
Missing exports field in package.json | Define import and require conditions with types |
Not awaiting publish() promise | Handle with .then() and .catch() for error reporting |
| Using npm or yarn instead of pnpm | pnpm is the only supported package manager |
Omitting publint --strict from build script | Add publint --strict after vite build to catch packaging issues |
Setting tag without v prefix | Manual version tags must start with v (e.g., v1.0.0) |
| Wrong commit type for release level | fix/refactor/perf = patch, feat = minor, BREAKING CHANGE = major |
Requirements
- Node.js v18.17+
- pnpm v8+
- Git CLI
- GitHub CLI (pre-installed on GitHub Actions)
- Vite (peer dependency for build config)
- publint (recommended for build validation)
Delegation
- Build configuration review: Use
Taskagent to verify Vite config andpackage.jsonexports - Publishing workflow setup: Use
Exploreagent to check CI/CD integration patterns - Package validation: Run
publint --strictafter builds to catch packaging issues
References
- Configuration and Vite plugin setup
- Publishing and version management
Configuration
Installation
pnpm add -D @tanstack/vite-config vite publintBasic Vite Configuration
The tanstackViteConfig function provides an opinionated Vite build setup for dual ESM/CJS publishing. Merge it with your own Vite config using mergeConfig:
import { defineConfig, mergeConfig } from 'vite';
import { tanstackViteConfig } from '@tanstack/vite-config';
const config = defineConfig({
// Framework plugins, vitest config, etc.
});
export default mergeConfig(
config,
tanstackViteConfig({
entry: './src/index.ts',
srcDir: './src',
}),
);Configuration Options
The tanstackViteConfig function accepts an options object with these properties:
import { type Options } from '@tanstack/vite-config';
const options: Options = {
// Required: entry file or array of entry files
entry: './src/index.ts',
// Or multiple entries:
// entry: ['./src/index.ts', './src/utils.ts'],
// Required: source directory for declaration file generation
srcDir: './src',
// Output directory (default: 'dist')
outDir: './dist',
// Generate CJS output alongside ESM (default: true)
cjs: true,
// Patterns to exclude from type generation
exclude: ['./src/**/*.test.ts', './src/__mocks__'],
// Path to custom tsconfig
tsconfigPath: './tsconfig.build.json',
// Additional dependencies to externalize (auto-detected from package.json)
externalDeps: [/^@internal\//],
// Dependencies to bundle instead of externalize
bundledDeps: ['tiny-invariant'],
// Hook to transform declaration file content before writing
beforeWriteDeclarationFile: (filePath, content) => {
return `// Generated by TanStack Config\n${content}`;
},
};Package.json Exports Configuration
The build output requires a properly configured exports field in package.json:
{
"name": "my-library",
"type": "module",
"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"
}
},
"./package.json": "./package.json"
},
"scripts": {
"build": "vite build && publint --strict"
}
}Key requirements for package.json:
"type": "module"must be set for ESM-first output- The
exportsfield defines bothimport(ESM) andrequire(CJS) conditions - Each condition includes
typesfirst, thendefaultfor proper TypeScript resolution - Export
./package.jsonfor tools that need to read package metadata
Multiple Entry Points
For libraries with multiple entry points, use an array for the entry option and add corresponding exports:
export default mergeConfig(
config,
tanstackViteConfig({
entry: ['./src/index.ts', './src/utils.ts'],
srcDir: './src',
}),
);{
"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"
}
},
"./utils": {
"import": {
"types": "./dist/esm/utils.d.ts",
"default": "./dist/esm/utils.js"
},
"require": {
"types": "./dist/cjs/utils.d.cts",
"default": "./dist/cjs/utils.cjs"
}
},
"./package.json": "./package.json"
}
}ESM-Only Output
To skip CJS generation, set cjs: false:
export default mergeConfig(
config,
tanstackViteConfig({
entry: './src/index.ts',
srcDir: './src',
cjs: false,
}),
);When distributing ESM-only, simplify the exports field:
{
"type": "module",
"exports": {
".": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"./package.json": "./package.json"
}
}Dependency Handling
Dependencies listed in package.json (dependencies, peerDependencies) are automatically externalized. Use externalDeps to add patterns beyond what is auto-detected:
tanstackViteConfig({
entry: './src/index.ts',
srcDir: './src',
externalDeps: [/^@internal\//, 'shared-utils'],
});To force-bundle a dependency instead of externalizing it:
tanstackViteConfig({
entry: './src/index.ts',
srcDir: './src',
bundledDeps: ['tiny-invariant', 'ts-invariant'],
});Build Validation
Run publint --strict after the build to validate the package output:
pnpm build
# Runs: vite build && publint --strictpublint checks that the exports field matches actual build output, verifies file extensions are correct for ESM/CJS, and catches common packaging mistakes.
Publishing
Installation
pnpm add -D @tanstack/publish-configBasic Publish Script
Create a publish script that uses the publish function from @tanstack/publish-config:
// scripts/publish.ts
import { publish } from '@tanstack/publish-config';
publish({
branchConfigs: {
main: {
prerelease: false,
},
beta: {
prerelease: true,
},
alpha: {
prerelease: true,
},
},
packages: [
{
name: '@tanstack/my-core',
packageDir: 'packages/core',
},
{
name: '@tanstack/my-react',
packageDir: 'packages/react',
},
],
rootDir: process.cwd(),
branch: process.env.BRANCH,
tag: process.env.TAG,
ghToken: process.env.GH_TOKEN,
})
.then(() => {
console.log('Successfully published packages!');
})
.catch((error) => {
console.error('Publishing failed:', error);
process.exit(1);
});The publish function is only available as an ESM import. Ensure your project has "type": "module" in package.json.
Publish Options
| Option | Type | Description |
|---|---|---|
branchConfigs | Record<string, BranchConfig> | Maps branch names to release configurations |
packages | Array<{ name, packageDir }> | List of packages to publish |
rootDir | string | Root directory of the monorepo |
branch | string (optional) | Override current branch detection |
tag | string (optional) | Manual version tag, must start with v |
ghToken | string (optional) | GitHub token for user lookups and releases |
Branch Configurations
Branch configs control how each branch publishes to npm:
const branchConfigs = {
// Stable releases, tagged as 'latest' on npm
main: {
prerelease: false,
},
// Beta prereleases, tagged as 'beta' on npm
beta: {
prerelease: true,
},
// Alpha prereleases, tagged as 'alpha' on npm
alpha: {
prerelease: true,
},
// Previous major version, tagged as 'previous' on npm
v4: {
prerelease: false,
previousVersion: true,
},
};Each branch maps to an npm dist-tag:
mainwithprerelease: falsepublishes aslatestbetawithprerelease: truepublishes asbetaalphawithprerelease: truepublishes asalpha- Branches with
previousVersion: truepublish asprevious
Conventional Commit Versioning
The publish system determines version bumps from conventional commit messages:
| Commit Type | Release Level | Example |
|---|---|---|
fix | Patch (0.0.x) | fix: resolve race condition |
refactor | Patch (0.0.x) | refactor: simplify internal logic |
perf | Patch (0.0.x) | perf: optimize query deduplication |
feat | Minor (0.x.0) | feat: add new query option |
BREAKING CHANGE | Major (x.0.0) | Requires manual TAG=vX.0.0 |
Breaking changes indicated by BREAKING CHANGE in the commit body or feat!: prefix require a manual tag for major version bumps.
Manual Version Tags
For major version bumps or specific version overrides, pass a tag via environment variable:
TAG=v2.0.0 BRANCH=main npx tsx scripts/publish.tsThe tag must start with v followed by a valid semver version.
Monorepo Package Configuration
Define each publishable package with its name and directory:
const packages = [
{
name: '@tanstack/config',
packageDir: 'packages/config',
},
{
name: '@tanstack/vite-config',
packageDir: 'packages/vite-config',
},
{
name: '@tanstack/publish-config',
packageDir: 'packages/publish-config',
},
{
name: '@tanstack/eslint-config',
packageDir: 'packages/eslint-config',
},
];GitHub Actions Integration
A typical CI workflow for publishing:
name: Publish
on:
push:
branches: [main, beta, alpha]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- run: pnpm install
- run: pnpm build
- run: npx tsx scripts/publish.ts
env:
BRANCH: ${{ github.ref_name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}Requirements
The following tools must be available in the publishing environment:
- Node.js v18.17+
- pnpm v8+ (only supported package manager)
- Git CLI (for commit history analysis)
- GitHub CLI (pre-installed on GitHub Actions)