---
name: claude-init-conventions
description: Development conventions and patterns for claude-init. Node.js CLI project with conventional commits.
---

## Overview
A Node.js CLI tool for generating project-specific `.claude/` configurations for Claude Code using the Claude API.

## Tech Stack
- Language: JavaScript (Node.js)
- Framework: Native Node.js CLI
- Package Manager: npm
- Test Framework: None (no tests currently)

## When to Use This Skill
- When working on claude-init for the first time
- When implementing new CLI features
- When reviewing code changes

## Commit Conventions
### Commit Style
Conventional Commits

### Prefixes Used
feat, fix, docs, style, refactor, test, chore

### Message Guidelines
- Use imperative mood
- Keep under 72 characters
- Reference issue numbers when applicable

## Architecture
### Project Structure
```
claude-init/
├── .claude/          # Claude Code configuration
│   ├── commands/     # Slash commands for development
│   └── rules/        # Code style and workflow rules
├── bin/              # CLI executable entry point
│   └── claude-init.js # Main CLI script with shebang
├── src/              # Core application modules
├── package.json      # npm configuration and metadata
└── README.md         # Usage documentation
```

### Configuration Files
- `package.json` - npm configuration, dependencies, bin field
- `.claude/settings.json` - Claude Code permissions and preferences
- `README.md` - Installation and usage instructions

### Guidelines
- Keep zero runtime dependencies for easy installation
- Support cross-platform usage (Windows, macOS, Linux)
- Use native Node.js APIs instead of external packages

## Code Style
### Language
JavaScript with Node.js runtime

### Naming Conventions
- Files: kebab-case (claude-init.js, config-generator.js)
- Variables: camelCase
- Constants: UPPER_SNAKE_CASE

### Import/Export Style
CommonJS (require/module.exports)

## Testing
### Test Framework
None currently configured

### File Pattern
None

### Test Types
CLI testing would involve manual verification and integration tests

## Error Handling
- Use try/catch blocks for all async operations
- Exit with status code 1 for errors, 0 for success
- Provide user-friendly error messages
- Handle missing API keys gracefully

## Common Workflows
### 1. Add New CLI Option
- **Description**: Add a new command line flag or option
- **Steps**: Parse argument, add validation, implement feature, update help
- **Files**: bin/claude-init.js, README.md
- **Commands**: `node bin/claude-init.js --help`

### 2. Improve Configuration Generation
- **Description**: Enhance the Claude configuration output
- **Steps**: Update generation logic, test with sample projects, validate JSON
- **Files**: src/*.js, test projects
- **Commands**: `node bin/claude-init.js /path/to/test/project`

### 3. Add New Project Type Support
- **Description**: Support detection and generation for new language/framework
- **Steps**: Add detection logic, create templates, test with examples
- **Files**: src/*.js
- **Commands**: Test with projects of new type

### 4. Fix Cross-Platform Issue
- **Description**: Resolve Windows/macOS/Linux compatibility problem
- **Steps**: Identify platform differences, use path module, test on all platforms
- **Files**: Any files with path operations
- **Commands**: Test on different operating systems

### 5. Update API Integration
- **Description**: Modify Claude API calls or response handling
- **Steps**: Update request format, handle new response structure, add error handling
- **Files**: src/*.js (API-related modules)
- **Commands**: Test with various project types

### 6. Documentation Update
- **Description**: Improve README or add examples
- **Steps**: Update markdown, add code examples, verify instructions
- **Files**: README.md
- **Commands**: Follow documented installation/usage steps

### 7. Release Preparation
- **Description**: Prepare for npm package release
- **Steps**: Update version, test installation, prepare changelog
- **Files**: package.json, README.md
- **Commands**: `npm pack`, `npm publish --dry-run`

## Best Practices
### Do
- Keep the tool lightweight with zero dependencies
- Validate all user inputs and API responses
- Use proper error handling for file and network operations
- Test CLI functionality after changes
- Follow conventional commit format
- Use cross-platform file path operations

### Don't
- Add external dependencies unless absolutely necessary
- Log or expose API keys in any form
- Execute user-provided commands directly
- Overwrite existing configurations without confirmation
- Use platform-specific file operations
- Ignore error conditions or fail silently