| name | config-generate |
| description | Generate configuration files for development tools |
| disable-model-invocation | true |
Configuration File Generator
I'll generate configuration files for common development tools: TypeScript, ESLint, Prettier, Jest, Vitest, and more.
Arguments: $ARGUMENTS - config type (tsconfig, eslint, prettier, jest, etc.)
Supported Configs:
- TypeScript: tsconfig.json
- Linting: .eslintrc.js, .eslintignore
- Formatting: .prettierrc, .prettierignore
- Testing: jest.config.js, vitest.config.ts
- Bundling: vite.config.ts, webpack.config.js
- Git: .gitignore, .gitattributes
Token Optimization
Optimization Status: ✅ Fully Optimized (Phase 2 Batch 4B, 2026-01-27)
Baseline: 2,500-4,000 tokens → Optimized: 400-800 tokens (~80% reduction)
This skill achieves exceptional optimization through template-based generation. As a pure configuration generation skill, it leverages pre-built templates and framework detection to eliminate expensive codebase scanning.
Core Optimization Strategies
1. Template-Based Generation (85% savings)
CRITICAL: Use pre-built configuration templates for all common tools
- Cache complete configs for ESLint, Prettier, TypeScript, Jest, Vitest, etc.
- Maintain templates in
~/.claude/cache/config_templates.json
- Apply framework-specific variations from cached presets
- Never read existing configs unless explicitly modifying them
Implementation:
{
"tsconfig": {
"base": { },
"nextjs": { },
"react": { }
},
"eslint": {
"base": { },
"react": { },
"vue": { }
},
"prettier": { },
"jest": { },
"vitest": { }
}
Before: Read similar configs from codebase (800-1,200 tokens)
After: Write from cached template (100-200 tokens)
2. Framework Detection via package.json (80% savings)
CRITICAL: Detect project type from package.json without full codebase scan
- Read ONLY package.json for framework/tool detection
- Use Grep on package.json for presence checks
- Never scan directories or read multiple files
Before:
find src -name "*.tsx" -o -name "*.vue"
cat src/main.tsx src/App.tsx
After:
grep -E '"(react|vue|next|typescript|jest|vitest)"' package.json
3. Batch Generation (80% savings)
CRITICAL: Generate all configs in one pass
- Create multiple config files in single operation
- Write all files together without individual verification
- Use multi-file Write operations
Before:
Write tsconfig.json
Read back for verification
Write .eslintrc.js
Read back for verification
After:
Write tsconfig.json + .eslintrc.js + .prettierrc + .gitignore
4. No Verification Reads (90% savings)
CRITICAL: Write configs directly without reading back
- Trust template-based generation
- Skip verification unless user explicitly requests validation
- Assume Write operations succeed
Before:
Write .eslintrc.js
Read .eslintrc.js for verification
Validate syntax
After:
Write .eslintrc.js
5. Cached Tool Versions (75% savings)
CRITICAL: Cache latest compatible versions and config formats
- Store current config standards in
~/.claude/cache/tool_versions.json
- Update cache quarterly for breaking changes
- Never search documentation or check latest versions
Implementation:
{
"eslint": {
"version": "^9.0.0",
"parser": "@typescript-eslint/parser@^8.0.0",
"plugins": ["@typescript-eslint@^8.0.0", "eslint-plugin-react@^7.37.0"]
},
"prettier": {
"version": "^3.2.0",
"config_format": "json",
"recommended_rules": { }
}
}
Before: Search for latest compatible versions (400-600 tokens)
After: Use cached versions (50-100 tokens)
Framework-Specific Optimizations
React/Next.js Projects
grep -q '"react"' package.json && FRAMEWORK="react"
grep -q '"next"' package.json && FRAMEWORK="nextjs"
Vue/Nuxt Projects
grep -q '"vue"' package.json && FRAMEWORK="vue"
Cache Management
Cache Creation: Run once to populate templates
mkdir -p ~/.claude/cache
cat > ~/.claude/cache/config_templates.json << 'EOF'
{ /* all templates */ }
EOF
Cache Structure:
~/.claude/cache/
├── config_templates.json # 2MB of config templates
├── framework_defaults.json # Framework-specific presets
└── tool_versions.json # Latest compatible versions
Cache Invalidation:
- Update quarterly for breaking changes in ESLint, Prettier, TypeScript
- Automatic update on major version bumps in package.json
- Manual invalidation:
rm ~/.claude/cache/*.json
Token Usage Breakdown
Baseline (2,500-4,000 tokens):
- Framework detection via file scanning: 500-800 tokens
- Read existing configs for reference: 800-1,200 tokens
- Generate new configs: 400-600 tokens
- Verify generated configs: 400-600 tokens
- Dependency version lookup: 400-600 tokens
Optimized (400-800 tokens):
- Framework detection via package.json: 50-100 tokens
- Template selection from cache: 50-100 tokens
- Batch write all configs: 200-400 tokens
- Dependency info from cache: 100-200 tokens
Special Cases
Existing Configs:
- Only read if explicitly modifying existing config
- Otherwise, write new config from template
- Backup existing config with
.backup suffix
Custom Requirements:
- Apply customizations on top of base template
- Merge user preferences with cached template
- Document custom rules in config comments
Integration with Other Skills
Upstream Dependencies:
/ci-setup - Generates configs as part of CI setup
/scaffold - Includes config generation in project scaffolding
/boilerplate - Adds framework-specific configs
Downstream Usage:
/format - Uses generated Prettier config
/review - Uses generated ESLint config
/test - Uses generated Jest/Vitest config
Success Metrics
- 80-85% token reduction on typical usage
- 200-300 tokens for basic config set (tsconfig + eslint + prettier)
- 400-800 tokens for comprehensive setup (all configs + framework-specific)
- <50 tokens for single config generation
- Zero verification reads in standard workflow
Optimization Checklist
Phase 1: Detect Project Requirements
#!/bin/bash
echo "=== Analyzing Project ==="
echo ""
detect_package_manager() {
if [ -f "pnpm-lock.yaml" ]; then
echo "pnpm"
elif [ -f "yarn.lock" ]; then
echo "yarn"
elif [ -f "package-lock.json" ]; then
echo "npm"
elif [ -f "bun.lockb" ]; then
echo "bun"
else
echo "npm"
fi
}
PKG_MANAGER=$(detect_package_manager)
echo "✓ Package manager: $PKG_MANAGER"
if [ -f "package.json" ]; then
if grep -q "\"typescript\"" package.json; then
HAS_TYPESCRIPT=true
echo "✓ TypeScript detected"
else
HAS_TYPESCRIPT=false
fi
if grep -q package.json;
FRAMEWORK=
grep -q package.json;
FRAMEWORK=
grep -q package.json;
FRAMEWORK=
grep -q package.json;
TEST_FRAMEWORK=
grep -q package.json;
TEST_FRAMEWORK=
Phase 2: Generate tsconfig.json
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"jsx": "react-jsx",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"module": "ESNext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"allowImportingTsExtensions": true,
"baseUrl": ".",
"paths":
Framework-specific variations:
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules":
Phase 3: Generate ESLint Configuration
module.exports = {
root: true,
env: {
browser: true,
es2022: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
project: './tsconfig.json',
},
plugins: [
'@typescript-eslint',
'react',
'react-hooks',
'jsx-a11y',
'import',
],
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: ,
},
},
},
: {
: [
,
{ : , : },
],
: ,
: ,
: ,
: ,
: [
,
{ : },
],
: ,
: ,
: ,
: ,
: ,
: [
,
{
: [
,
,
,
,
,
,
],
: ,
: { : , : },
},
],
: ,
: ,
: [, { : [, ] }],
: ,
: ,
: ,
},
: [
{
: [, , ],
: {
: ,
},
: {
: ,
},
},
],
};
# .eslintignore
node_modules/
dist/
build/
coverage/
.next/
out/
*.min.js
*.config.js
public/
Phase 4: Generate Prettier Configuration
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"arrowParens": "always",
"endOfLine": "lf",
"bracketSpacing": true,
"jsxSingleQuote": false,
"jsxBracketSameLine": false,
"proseWrap": "preserve",
"quoteProps": "as-needed",
# .prettierignore
node_modules/
dist/
build/
coverage/
.next/
out/
pnpm-lock.yaml
package-lock.json
yarn.lock
*.min.js
*.min.css
Phase 5: Generate Jest Configuration
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
roots: ['<rootDir>/src', '<rootDir>/tests'],
testMatch: [
'**/__tests__/**/*.+(ts|tsx|js)',
'**/?(*.)+(spec|test).+(ts|tsx|js)',
],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/*.stories.tsx',
'!src/index.tsx',
],
coverageThreshold: {
global: {
branches: 70,
functions: 70,
lines: 70,
statements: 70,
},
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'^@components/(.*)$': '<rootDir>/src/components/$1',
'^@utils/(.*)$': '<rootDir>/src/utils/$1',
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
'\\.(jpg|jpeg|png|gif|svg)$': '<rootDir>/__mocks__/fileMock.js',
},
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
globals: {
'ts-jest': {
tsconfig: {
jsx: ,
},
},
},
: [, , ],
: [, , ],
};
import '@testing-library/jest-dom';
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: jest.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(),
removeListener: jest.fn(),
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
})),
});
global.IntersectionObserver = class IntersectionObserver {
constructor() {}
disconnect() {}
observe() {}
takeRecords() {
return [];
}
unobserve() {}
};
Phase 6: Generate Vitest Configuration
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import path from 'path';
export default defineConfig({
plugins: [react()],
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./vitest.setup.ts'],
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: [
'node_modules/',
'dist/',
'**/*.d.ts',
'**/*.config.*',
'**/mockData/',
],
thresholds: {
lines: 70,
functions: 70,
branches: 70,
statements: 70,
},
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@components': path.resolve(__dirname, ),
: path.(__dirname, ),
},
},
});
Phase 7: Generate .gitignore
# Dependencies
node_modules/
.pnp
.pnp.js
# Testing
coverage/
.nyc_output
# Production
build/
dist/
out/
.next/
# Misc
.DS_Store
*.pem
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# Local env files
.env
.env*.local
.env.development.local
.env.test.local
.env.production.local
# Vercel
.vercel
# TypeScript
*.tsbuildinfo
next-env.d.ts
# IDE
.vscode/
.idea/
*.swp
*.swo
*~
# OS
.DS_Store
Thumbs.db
Phase 8: Generate Vite Configuration
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@components': path.resolve(__dirname, './src/components'),
'@utils': path.resolve(__dirname, './src/utils'),
},
},
server: {
port: 3000,
open: true,
cors: true,
},
build: {
outDir: 'dist',
sourcemap: true,
rollupOptions: {
output: {
manualChunks: {
vendor: ['react', 'react-dom'],
},
},
},
},
optimizeDeps: {
include: ['react', 'react-dom'],
},
});
Summary
echo ""
echo "=== ✓ Configuration Generation Complete ==="
echo ""
echo "📁 Generated configuration files:"
if [ "$HAS_TYPESCRIPT" = true ]; then
echo " ✓ tsconfig.json # TypeScript configuration"
fi
echo " ✓ .eslintrc.js # ESLint rules"
echo " ✓ .eslintignore # ESLint ignore patterns"
echo " ✓ .prettierrc # Prettier formatting"
echo " ✓ .prettierignore # Prettier ignore patterns"
if [ "$TEST_FRAMEWORK" = "jest" ]; then
echo " ✓ jest.config.js # Jest test configuration"
echo " ✓ jest.setup.js # Jest setup file"
elif [ "$TEST_FRAMEWORK" = "vitest" ]; then
echo " ✓ vitest.config.ts # Vitest configuration"
echo " ✓ vitest.setup.ts # Vitest setup file"
fi
echo " ✓ .gitignore # Git ignore patterns"
echo ""
echo "📦 Install required dependencies:"
[ = ];
[ = ];
[ = ];
[ = ];
Best Practices
Configuration Quality:
- Start with strict settings
- Relax rules only when needed
- Use framework-specific presets
- Keep configs in sync
Maintenance:
- Update dependencies regularly
- Review deprecated rules
- Test config changes
- Document custom rules
Integration Points:
/ci-setup - Add to CI pipeline
/format - Use for code formatting
/review - Check code quality
What I'll Actually Do
- Detect project - Framework and tools
- Generate configs - Optimized for project
- Add best practices - Strict but practical
- Framework-specific - Tailored settings
- Complete setup - All necessary files
Important: I will NEVER add AI attribution.
Credits: Configuration patterns based on TypeScript, ESLint, Prettier, Jest, and Vitest official documentation and community best practices.