xiaohongshu
xiaohongshu
config-generate
Generate configuration files for development tools
Full skill instructions
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:
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.
CRITICAL: Use pre-built configuration templates for all common tools
~/.claude/cache/config_templates.jsonImplementation:
// Cache structure: ~/.claude/cache/config_templates.json
{
"tsconfig": {
"base": { /* 137 lines of base TypeScript config */ },
"nextjs": { /* Next.js specific overrides */ },
"react": { /* React specific settings */ }
},
"eslint": {
"base": { /* 293 lines of ESLint config */ },
"react": { /* React plugin additions */ },
"vue": { /* Vue plugin additions */ }
},
"prettier": { /* 342 lines of Prettier config */ },
"jest": { /* 406 lines of Jest config */ },
"vitest": { /* 479 lines of Vitest config */ }
}
Before: Read similar configs from codebase (800-1,200 tokens) After: Write from cached template (100-200 tokens)
CRITICAL: Detect project type from package.json without full codebase scan
Before:
# Expensive: Scan codebase for framework indicators
find src -name "*.tsx" -o -name "*.vue" # 300-500 tokens
cat src/main.tsx src/App.tsx # 400-800 tokens
After:
# Efficient: Single package.json analysis
grep -E '"(react|vue|next|typescript|jest|vitest)"' package.json # 50-100 tokens
CRITICAL: Generate all configs in one pass
Before:
# Sequential: Generate each config separately
Write tsconfig.json # 200 tokens
Read back for verification # 150 tokens
Write .eslintrc.js # 200 tokens
Read back for verification # 150 tokens
# Total: 700+ tokens for 2 configs
After:
# Batch: Generate all configs together
Write tsconfig.json + .eslintrc.js + .prettierrc + .gitignore # 300 tokens
# No verification reads
# Total: 300 tokens for 4 configs
CRITICAL: Write configs directly without reading back
Before:
Write .eslintrc.js # 150 tokens
Read .eslintrc.js for verification # 200 tokens
Validate syntax # 100 tokens
# Total: 450 tokens
After:
Write .eslintrc.js # 150 tokens
# Total: 150 tokens (67% savings)
CRITICAL: Cache latest compatible versions and config formats
~/.claude/cache/tool_versions.jsonImplementation:
// ~/.claude/cache/tool_versions.json
{
"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": { /* cached rules */ }
}
}
Before: Search for latest compatible versions (400-600 tokens) After: Use cached versions (50-100 tokens)
# Detect React ecosystem (50 tokens)
grep -q '"react"' package.json && FRAMEWORK="react"
grep -q '"next"' package.json && FRAMEWORK="nextjs"
# Apply React-specific template (100 tokens)
# Write: tsconfig.json, .eslintrc.js (React plugins), .prettierrc
# Total: 150 tokens vs 800+ tokens baseline
# Detect Vue ecosystem (50 tokens)
grep -q '"vue"' package.json && FRAMEWORK="vue"
# Apply Vue-specific template (100 tokens)
# Total: 150 tokens
Cache Creation: Run once to populate templates
# Initial cache setup (one-time cost: 2,000 tokens)
mkdir -p ~/.claude/cache
# Store all config templates
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:
rm ~/.claude/cache/*.jsonBaseline (2,500-4,000 tokens):
Optimized (400-800 tokens):
Existing Configs:
.backup suffixCustom Requirements:
Upstream Dependencies:
/ci-setup - Generates configs as part of CI setup/scaffold - Includes config generation in project scaffolding/boilerplate - Adds framework-specific configsDownstream Usage:
/format - Uses generated Prettier config/review - Uses generated ESLint config/test - Uses generated Jest/Vitest config#!/bin/bash
# Detect project type and requirements
echo "=== Analyzing Project ==="
echo ""
# Detect package manager
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"
# Detect TypeScript
if [ -f "package.json" ]; then
if grep -q "\"typescript\"" package.json; then
HAS_TYPESCRIPT=true
echo "✓ TypeScript detected"
else
HAS_TYPESCRIPT=false
fi
# Detect frameworks
if grep -q "\"react\"" package.json; then
FRAMEWORK="react"
echo "✓ Framework: React"
elif grep -q "\"vue\"" package.json; then
FRAMEWORK="vue"
echo "✓ Framework: Vue"
elif grep -q "\"next\"" package.json; then
FRAMEWORK="nextjs"
echo "✓ Framework: Next.js"
fi
# Detect test framework
if grep -q "\"jest\"" package.json; then
TEST_FRAMEWORK="jest"
echo "✓ Test framework: Jest"
elif grep -q "\"vitest\"" package.json; then
TEST_FRAMEWORK="vitest"
echo "✓ Test framework: Vitest"
fi
fi
echo ""
{
"compilerOptions": {
/* Language and Environment */
"target": "ES2022",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"jsx": "react-jsx",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
/* Modules */
"module": "ESNext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"allowImportingTsExtensions": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@components/*": ["./src/components/*"],
"@utils/*": ["./src/utils/*"],
"@types/*": ["./src/types/*"]
},
/* Emit */
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "./dist",
"removeComments": true,
"noEmit": true,
/* Interop Constraints */
"isolatedModules": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
/* Type Checking */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUncheckedIndexedAccess": true,
/* Completeness */
"skipLibCheck": true
},
"include": [
"src/**/*",
"tests/**/*",
"*.ts",
"*.tsx"
],
"exclude": [
"node_modules",
"dist",
"build",
"coverage"
]
}
Framework-specific variations:
// Next.js tsconfig.json
{
"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": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
// .eslintrc.js - Comprehensive ESLint config
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', // Must be last
],
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: './tsconfig.json',
},
},
},
rules: {
// TypeScript specific rules
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' },
],
// React specific rules
'react/react-in-jsx-scope': 'off', // Not needed in React 17+
'react/prop-types': 'off', // TypeScript handles this
'react/jsx-uses-react': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
// Import rules
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
'newlines-between': 'always',
alphabetize: { order: 'asc', caseInsensitive: true },
},
],
'import/no-unresolved': 'error',
'import/no-cycle': 'error',
// General rules
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-debugger': 'warn',
'prefer-const': 'error',
'no-var': 'error',
},
overrides: [
{
// Test files
files: ['**/*.test.ts', '**/*.test.tsx', '**/*.spec.ts'],
env: {
jest: true,
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
],
};
# .eslintignore
node_modules/
dist/
build/
coverage/
.next/
out/
*.min.js
*.config.js
public/
// .prettierrc
{
"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",
"overrides": [
{
"files": "*.json",
"options": {
"printWidth": 120
}
},
{
"files": "*.md",
"options": {
"proseWrap": "always"
}
}
]
}
# .prettierignore
node_modules/
dist/
build/
coverage/
.next/
out/
pnpm-lock.yaml
package-lock.json
yarn.lock
*.min.js
*.min.css
// jest.config.js
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: 'react',
},
},
},
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/build/'],
watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/build/'],
};
// jest.setup.js
import '@testing-library/jest-dom';
// Mock window.matchMedia
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(),
})),
});
// Mock IntersectionObserver
global.IntersectionObserver = class IntersectionObserver {
constructor() {}
disconnect() {}
observe() {}
takeRecords() {
return [];
}
unobserve() {}
};
// vitest.config.ts
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, './src/components'),
'@utils': path.resolve(__dirname, './src/utils'),
},
},
});
# 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
// vite.config.ts
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'],
},
});
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:"
echo ""
if [ "$HAS_TYPESCRIPT" = true ]; then
echo "$PKG_MANAGER add -D typescript @types/node"
fi
echo "$PKG_MANAGER add -D eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin"
echo "$PKG_MANAGER add -D prettier eslint-config-prettier"
if [ "$FRAMEWORK" = "react" ]; then
echo "$PKG_MANAGER add -D eslint-plugin-react eslint-plugin-react-hooks"
echo "$PKG_MANAGER add -D eslint-plugin-jsx-a11y"
fi
echo "$PKG_MANAGER add -D eslint-plugin-import"
if [ "$TEST_FRAMEWORK" = "jest" ]; then
echo "$PKG_MANAGER add -D jest ts-jest @testing-library/react @testing-library/jest-dom"
elif [ "$TEST_FRAMEWORK" = "vitest" ]; then
echo "$PKG_MANAGER add -D vitest @vitest/ui @testing-library/react"
fi
echo ""
echo "🚀 Add scripts to package.json:"
echo ""
echo ' "scripts": {'
echo ' "lint": "eslint . --ext .ts,.tsx",'
echo ' "lint:fix": "eslint . --ext .ts,.tsx --fix",'
echo ' "format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",'
echo ' "format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",'
echo ' "type-check": "tsc --noEmit"'
echo ' }'
echo ""
echo "💡 Next steps:"
echo " 1. Install dependencies"
echo " 2. Run: $PKG_MANAGER run lint"
echo " 3. Run: $PKG_MANAGER run format"
echo " 4. Configure IDE to use these configs"
Configuration Quality:
Maintenance:
Integration Points:
/ci-setup - Add to CI pipeline/format - Use for code formatting/review - Check code qualityImportant: I will NEVER add AI attribution.
Credits: Configuration patterns based on TypeScript, ESLint, Prettier, Jest, and Vitest official documentation and community best practices.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience