@arkatom/ai-instructions
v0.6.0
Published
๐ค CLI tool to scaffold AI development instructions for ClaudeCode, Cursor, GitHub Copilot and more
Maintainers
Readme
ai-instructions
๐ค Professional CLI tool to scaffold AI development instructions for ClaudeCode, Cursor, GitHub Copilot and more
English | ๆฅๆฌ่ช
๐ Overview
ai-instructions streamlines the setup of AI-driven development environments by generating comprehensive instruction templates and configuration files. Perfect for teams and individual developers who want to standardize their AI assistant interactions across projects.
โจ Key Benefits
- ๐ Instant Setup: Generate instruction templates in seconds
- ๐ ๏ธ Multi-Tool Support: Claude Code, GitHub Copilot, Cursor AI IDE, and Cline AI support
- ๐ Development Templates: Essential development methodology guides (TDD, Git workflow, Scrum)
- ๐ Multilingual Core: Main instructions available in English, Japanese, and Chinese
- ๐ก๏ธ Advanced File Safety: 5 intelligent conflict resolution strategies with smart merging
- โ๏ธ Highly Configurable: Customizable project names and output directories
- ๐ Validated Input: Built-in validation for project names and paths
- ๐งช Battle-tested: Comprehensive test suite ensuring reliability
- ๐ฏ Agent Templates: 70+ specialized agent templates (CLI integration pending - see Issue #93)
๐ก๏ธ Advanced File Safety System (v0.5.0)
๐ NEW: Intelligent conflict resolution with 5 resolution strategies
๐ Safe Usage Patterns
# โ
RECOMMENDED: Interactive conflict resolution (default)
ai-instructions init --project-name "My Project"
# โ
SAFE: Automatic backup creation
ai-instructions init --conflict-resolution backup --project-name "My Project"
# โ
SMART: Merge existing + template content intelligently
ai-instructions init --conflict-resolution merge --project-name "My Project"
# โ
PREVIEW: See what files would be created/modified
ai-instructions init --preview
# โ ๏ธ SKIP: Skip conflicting files (non-destructive)
ai-instructions init --conflict-resolution skip --project-name "My Project"
# ๐จ DANGEROUS: Force overwrite (use with extreme caution)
ai-instructions init --force --conflict-resolution overwrite๐ก๏ธ Conflict Resolution Strategies
When existing files are detected, you can choose from 5 intelligent strategies:
| Strategy | Behavior | Use Case | Data Safety |
|----------|----------|----------|-------------|
| backup | Creates timestamped backup, writes new file | Default - Safest option | ๐ข High |
| merge | Intelligently merges existing + template content | Update existing instructions | ๐ข High |
| interactive | Prompts for choice per conflict | Full control over each file | ๐ข High |
| skip | Skips conflicting files, creates non-conflicting ones | Partial update scenarios | ๐ข High |
| overwrite | Overwrites without backup | Dangerous - Only with --force | ๐ด None |
๐ง Advanced CLI Options (v0.5.0)
# Conflict resolution strategy
ai-instructions init --conflict-resolution <backup|merge|interactive|skip|overwrite>
# Disable interactive prompts (batch mode)
ai-instructions init --no-interactive
# Disable automatic backups (use with caution)
ai-instructions init --no-backup
# Preview mode - see what would happen
ai-instructions init --preview๐ง Intelligent Content Merging
For markdown files, the merge strategy uses smart content analysis:
- Headers: Preserves unique sections from both files
- Content blocks: Avoids duplication
- Metadata: Maintains existing project-specific content
- Templates: Integrates new template content seamlessly
๐ Backup System
When using backup or merge strategies:
- Creates timestamped backups:
filename.backup.YYYYMMDD_HHMMSS.ext - Handles multiple backups automatically
- Never overwrites existing backups
๐ก Pro Tip: Use
--conflict-resolution mergeto update existing instruction files while preserving your customizations!
๐๏ธ Architecture & Dependency Management
System Architecture
graph TB
subgraph "CLI Layer"
CLI[cli.ts]
end
subgraph "Generator Layer"
Factory[GeneratorFactory]
Base[BaseGenerator]
Claude[ClaudeGenerator]
Cursor[CursorGenerator]
Copilot[CopilotGenerator]
Cline[ClineGenerator]
Windsurf[WindsurfGenerator]
end
subgraph "Core Services"
Config[ConfigurationManager]
SharedProc[SharedTemplateProcessor]
Parallel[ParallelGeneratorOperations]
Errors[Error Classes]
Types[Type Definitions]
end
subgraph "Converter Layer"
ConvFactory[ConverterFactory]
FormatConv[Format Converters]
end
subgraph "Utilities"
FileUtils[FileUtils]
ConflictHandler[FileConflictHandler]
MergeHandler[SmartMergeHandler]
end
CLI --> Factory
Factory --> Base
Base --> Claude
Base --> Cursor
Base --> Copilot
Base --> Cline
Base --> Windsurf
Base --> Config
Base --> SharedProc
Base --> Errors
SharedProc --> Config
SharedProc --> Parallel
SharedProc --> Types
Config --> Types
Config --> Errors
Parallel --> FileUtils
Claude --> ConvFactory
ConvFactory --> FormatConv
FileUtils --> ConflictHandler
ConflictHandler --> MergeHandlerDependency Flow
graph LR
subgraph "No Dependencies"
Types[types.ts]
Errors[errors.ts]
end
subgraph "Low-Level Dependencies"
FileUtils[file-utils.ts]
MergeHandler[smart-merge-handler.ts]
end
subgraph "Mid-Level Dependencies"
Config[config-manager.ts]
ConflictHandler[file-conflict-handler.ts]
Parallel[parallel-generator.ts]
end
subgraph "High-Level Dependencies"
SharedProc[shared-processor.ts]
Base[base.ts]
end
subgraph "Top-Level Components"
Generators[Specific Generators]
Converters[Format Converters]
CLI[cli.ts]
end
Types --> Config
Types --> SharedProc
Types --> Base
Errors --> Config
Errors --> SharedProc
Errors --> Base
Errors --> Parallel
FileUtils --> ConflictHandler
FileUtils --> Parallel
MergeHandler --> ConflictHandler
Config --> SharedProc
Config --> Base
ConflictHandler --> Base
Parallel --> SharedProc
SharedProc --> Base
Base --> Generators
Base --> Converters
Generators --> CLI
Converters --> CLIModule Responsibilities
| Module | Purpose | Dependencies | Dependents | |--------|---------|--------------|------------| | types.ts | Type definitions & guards | None | All modules | | errors.ts | Error class hierarchy | None | Core services | | config-manager.ts | Configuration loading & caching | types, errors | Generators, SharedProc | | parallel-generator.ts | Parallel file operations | errors, FileUtils | SharedProc | | shared-processor.ts | Template processing logic | types, config, parallel | Generators | | base.ts | Abstract generator base | All core services | Specific generators | | file-utils.ts | File operations | None | Multiple modules | | file-conflict-handler.ts | Conflict resolution | FileUtils, MergeHandler | Base generator |
Circular Dependency Prevention
This project uses ESLint with eslint-plugin-import to automatically detect and prevent circular dependencies:
// eslint.config.js
'import/no-cycle': ['error', {
maxDepth: Infinity,
ignoreExternal: true
}]Benefits:
- โ Build-time detection of circular imports
- โ Prevents runtime errors from dependency cycles
- โ Enforces clean architecture principles
- โ Integrated into CI/CD pipeline
Directory Structure
src/
โโโ generators/ # Generator implementations
โ โโโ base.ts # Abstract base class
โ โโโ claude.ts # Claude-specific generator
โ โโโ cursor.ts # Cursor-specific generator
โ โโโ cline.ts # Cline-specific generator
โ โโโ copilot.ts # GitHub Copilot generator
โ โโโ windsurf.ts # Windsurf generator
โ โโโ factory.ts # Generator factory
โ โโโ config-manager.ts # Configuration management
โ โโโ errors.ts # Error definitions
โ โโโ parallel-generator.ts # Parallel operations
โ โโโ shared-processor.ts # Shared processing
โ โโโ types.ts # Type definitions
โโโ converters/ # Format converters
โ โโโ index.ts # Converter exports
โ โโโ format-converter.ts # Base converter
โ โโโ cursor-converter.ts # Cursor format
โ โโโ copilot-converter.ts # Copilot format
โ โโโ windsurf-converter.ts # Windsurf format
โโโ utils/ # Utility functions
โ โโโ file-utils.ts # File operations
โ โโโ file-conflict-handler.ts # Conflict resolution
โ โโโ smart-merge-handler.ts # Content merging
โโโ cli.ts # CLI entry point๐ฆ Installation
Global Installation (Recommended)
npm install -g @arkatom/ai-instructionsLocal Project Installation
npm install --save-dev @arkatom/ai-instructionsUsage without Installation
npx @arkatom/ai-instructions init๐ Quick Start
Basic Usage
ai-instructions initThis creates a complete set of AI development instructions in your current directory.
Check Current Status
# Check AI instruction files in current directory
ai-instructions status
# Check specific directory
ai-instructions status --directory ./my-projectInteractive Help Guide
# Launch interactive setup guide with examples
ai-instructions help-interactiveCustom Project Setup
ai-instructions init --project-name "my-awesome-project" --output ./my-projectMulti-Tool Support
Generate instructions for different AI development tools:
# Generate Claude Code instructions (default)
ai-instructions init --tool claude
# Generate GitHub Copilot instructions
ai-instructions init --tool github-copilot --project-name "my-project"
# Generate Cursor AI IDE instructions
ai-instructions init --tool cursor --project-name "my-project"
# Generate Cline AI instructions
ai-instructions init --tool cline --project-name "my-project"Format Conversion (New in v0.3.0)
Generate Claude templates and convert to other formats:
# Convert to Cursor MDC format with short option
ai-instructions init -f cursor --project-name "my-project"
# Convert to GitHub Copilot 2024 standard
ai-instructions init --output-format copilot --project-name "my-project"
# Convert to Windsurf pair programming rules
ai-instructions init --output-format windsurf --project-name "my-project"
# Maintain original Claude format (default)
ai-instructions init --output-format claude --project-name "my-project"Language Options
The main instruction file is available in multiple languages:
# English (default)
ai-instructions init --lang en --project-name "my-project"
# Japanese (main instruction file)
ai-instructions init --lang ja --project-name "ใใญใธใงใฏใๅ"
# Chinese (main instruction file)
ai-instructions init --lang ch --project-name "้กน็ฎๅ็งฐ"
# Combined: Japanese main file with Cursor format
ai-instructions init -f cursor --lang ja --project-name "ใซใผใฝใซใใญใธใงใฏใ"Note: Currently, only the main instruction file (CLAUDE.md/core) supports multiple languages. Other templates are in English.
Safe Updates and Migrations (v0.5.0)
# Update existing project instructions with intelligent merging
ai-instructions init --conflict-resolution merge --project-name "existing-project"
# Backup existing files before updating
ai-instructions init --conflict-resolution backup --project-name "existing-project"
# Interactive updates - choose per file
ai-instructions init --conflict-resolution interactive --project-name "existing-project"
# Non-destructive partial update
ai-instructions init --conflict-resolution skip --project-name "existing-project"
# Batch mode without prompts (CI/CD safe)
ai-instructions init --no-interactive --conflict-resolution backupReal-world Examples
# Setup for a React project
ai-instructions init --project-name "react-dashboard" --output ./projects/dashboard
# Setup for a Japanese project
ai-instructions init --project-name "ใใญใธใงใฏใๅ" --output ./ๆฅๆฌ่ชใใญใธใงใฏใ
# Setup with spaces in name
ai-instructions init --project-name "My Enterprise App" --output ./enterprise๐ Generated File Structure
The file structure varies depending on the AI tool you select:
Claude Code (Default)
your-project/
โโโ CLAUDE.md # Main ClaudeCode instructions
โโโ instructions/ # Development methodology guides
โโโ base.md # Core development rules (MUST READ)
โโโ deep-think.md # Deep thinking methodology
โโโ KentBeck-tdd-rules.md # Test-Driven Development rules
โโโ commit-rules.md # Git commit conventions
โโโ pr-rules.md # Pull request guidelines
โโโ git.md # Git workflow instructions
โโโ develop.md # Development process guide
โโโ command.md # Shell command execution rules
โโโ memo/
โโโ index.md # Project memo templateGitHub Copilot (--tool github-copilot or --output-format copilot)
your-project/
โโโ .github/
โโโ copilot-instructions.md # GitHub Copilot 2024 standard formatCursor AI IDE (--tool cursor or --output-format cursor)
your-project/
โโโ .cursor/
โโโ rules/
โโโ main.mdc # Cursor AI rules with YAML front matterWindsurf AI (--output-format windsurf)
your-project/
โโโ .windsurfrules # Windsurf pair programming rulesCline AI (--tool cline)
your-project/
โโโ .clinerules/ # Cline AI rule directory
โ โโโ 01-coding.md # Core development rules
โ โโโ 02-documentation.md # Documentation standards
โโโ instructions/ # Comprehensive development guides
โโโ base.md # Core development rules (MUST READ)
โโโ deep-think.md # Deep thinking methodology
โโโ note.md # Work documentation guidelines
โโโ ... (additional methodology and workflow files)File Descriptions
| File | Purpose | Key Content |
|------|---------|-------------|
| CLAUDE.md | Main entry point for AI assistants | Project-specific instructions with {{projectName}} replaced |
| base.md | Core development principles | Fundamental rules that must be followed |
| deep-think.md | Thinking methodology | Quality-first approach and analytical thinking |
| KentBeck-tdd-rules.md | TDD methodology | Kent Beck's Test-Driven Development principles |
| commit-rules.md | Git commit standards | Semantic commit message format with domain tags |
| pr-rules.md | Pull request rules | PR creation guidelines and review process |
โ๏ธ Configuration Options
Available Commands
| Command | Description | Example |
|---------|-------------|---------|
| init | Initialize AI development instructions | ai-instructions init |
| status | Show current configuration status | ai-instructions status |
| help-interactive | Launch interactive help guide | ai-instructions help-interactive |
| help | Display help for a command | ai-instructions help init |
Command Line Options
| Option | Alias | Description | Default | Example |
|--------|-------|-------------|---------|---------|
| --lang | -l | Template language (en, ja, ch) | en | --lang ja |
| --output-format | -f | Output format (claude, cursor, copilot, windsurf) | claude | -f cursor |
| --output | -o | Output directory | Current directory | --output ./my-project |
| --project-name | -n | Project name for templates | my-project | --project-name "My App" |
| --tool | -t | AI tool type (legacy, use --output-format) | claude | --tool cursor |
| --conflict-resolution | | ๐ก๏ธ Conflict resolution strategy (backup, merge, interactive, skip, overwrite) | backup | --conflict-resolution merge |
| --no-interactive | | ๐ค Disable interactive conflict resolution | false | --no-interactive |
| --no-backup | | ๐จ Disable automatic backups (use with caution) | false | --no-backup |
| --force | | โ ๏ธ Force overwrite existing files (DANGEROUS) | false | --force |
| --preview | | ๐ Preview files that would be created/modified | false | --preview |
| --version | | Show version number | | |
| --help | | Display help information | | |
Project Name Validation
The CLI validates project names to ensure filesystem compatibility:
- โ Allowed: Letters, numbers, spaces, hyphens, underscores, Unicode characters
- โ Forbidden:
<,>,|characters - โ Invalid: Empty strings or whitespace-only names
Examples of Valid Project Names
ai-instructions init --project-name "My Project" # โ
Spaces
ai-instructions init --project-name "my-awesome_project-v2" # โ
Hyphens & underscores
ai-instructions init --project-name "ใใญใธใงใฏใๅ" # โ
Unicode/Japanese
ai-instructions init --project-name "Project123" # โ
NumbersOutput Format Validation
The CLI validates output formats to ensure compatibility:
- โ
Supported Formats:
claude,cursor,copilot,windsurf - โ Case Sensitive: Format names must be lowercase
- โ Invalid:
CLAUDE,Cursor,GitHub-Copilot
Language Code Validation
- โ
Supported Languages:
en(English),ja(Japanese),ch(Chinese) - โ Case Sensitive: Language codes must be lowercase
- โ Invalid:
EN,JA,fr,es
๐ Format Conversion Benefits
Why Use Format Conversion?
- ๐ Single Source of Truth: Maintain comprehensive Claude templates
- ๐ง Tool-Specific Optimization: Each format optimized for its AI tool
- ๐ Multi-Tool Workflows: Switch between AI tools seamlessly
- ๐ Consistent Standards: Apply same development practices across tools
Format-Specific Features
| Format | File Extension | Key Features |
|--------|----------------|---------------|
| claude | .md | Full instruction hierarchy, TDD rules, comprehensive guides |
| cursor | .mdc | YAML front matter, MDC format, Cursor-optimized prompts |
| copilot | .md | GitHub 2024 standard, repository-focused instructions |
| windsurf | .windsurfrules | Pair programming focus, collaborative development rules |
| cline | .md | Multiple specialized files in .clinerules directory |
๐ ๏ธ Development
Prerequisites
- Node.js 16+
- npm 7+
- TypeScript 5.0+
Setup Development Environment
# Clone the repository
git clone https://github.com/arkatom/ai-instructions.git
cd ai-instructions
# Install dependencies
npm install
# Run tests
npm test
# Build the project
npm run build
# Test CLI locally
npm run cli init --helpRunning Tests
# Run all tests (8 test suites, 110 tests)
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverageTest Coverage
Our comprehensive test suite includes:
- Basic CLI functionality (version, help, commands) - 41 tests
- Format conversion system (Claude โ Cursor/Copilot/Windsurf) - 16 tests
- Multi-language support (English, Japanese, Chinese templates) - 21 tests
- Multi-tool generators (Claude, GitHub Copilot, Cursor) - 17 tests
- Error handling (invalid inputs, filesystem errors, validation) - 8 tests
- Edge cases (Unicode names, very long names, empty strings) - 7 tests
Key Test Categories:
- CLI Output Format Support: 12 comprehensive tests for --output-format/-f option
- Multi-Language Templates: Tests for en/ja/ch language generation
- GitHub Copilot 2024 Standard: Tests for new .github/copilot-instructions.md path
- Content verification: Generated file structure and content validation
- Integration testing: End-to-end CLI workflows with format conversion
Build and Distribution
# Build TypeScript to JavaScript
npm run build
# Create distribution package
npm pack
# Publish to npm (maintainers only)
npm publish๐ Versioning
This project adheres to Semantic Versioning (SemVer). Version numbers follow the format MAJOR.MINOR.PATCH:
- MAJOR: Incompatible API changes or breaking changes
- MINOR: New functionality in a backwards compatible manner
- PATCH: Backwards compatible bug fixes
For example:
0.3.0โ0.3.1: Bug fixes or minor improvements0.3.1โ0.4.0: New features or enhancements0.4.0โ1.0.0: Breaking changes or major redesign
๐ค Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Development Workflow
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Follow TDD principles - write tests first
- Implement your changes with proper TypeScript types
- Test thoroughly (
npm test) - Commit using our commit conventions
- Submit a pull request
Code Quality Standards
- TDD Required: All new features must have tests
- TypeScript: Strict type checking enabled
- ESLint: Code style enforcement
- 100% Test Coverage: For new features
- Documentation: Update README for new features
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Support
- Issues: GitHub Issues
- Documentation: This README and generated instruction files
- Examples: See the examples directory
๐ Acknowledgments
- Kent Beck for the foundational Test-Driven Development methodology
- "Test-Driven Development: By Example" (2003) - The seminal work that defined TDD
- "Tidy First?" (2023) - Modern approach to structural vs behavioral changes
- The three rules of TDD that guide our development process
- Martin Fowler for documenting and evangelizing TDD practices
- ClaudeCode team for inspiration on AI-assisted development workflows
- Open source community for the excellent tools and libraries that make this possible
Made with โค๏ธ for AI-assisted development workflows
