# Contributing

Thank you for your interest in contributing to AIDP! This guide will help you get started.

***

## 🌟 Ways to Contribute

### 1. Code Contributions

* Fix bugs
* Add new features
* Improve performance
* Write tests

### 2. Documentation

* Fix typos and errors
* Improve clarity
* Add examples
* Translate documentation

### 3. Community Support

* Answer questions in GitHub Discussions
* Help troubleshoot issues
* Share your expertise
* Write tutorials

### 4. Bug Reports

* Report issues you encounter
* Provide detailed reproduction steps
* Suggest fixes

### 5. Feature Requests

* Propose new features
* Discuss improvements
* Vote on existing requests

***

## 🚀 Getting Started

### 1. Fork the Repository

```bash
# Fork on GitHub, then clone your fork
git clone https://github.com/YOUR_USERNAME/aidp.git
cd aidp
```

### 2. Set Up Development Environment

```bash
# Install dependencies
npm install

# Copy environment variables
cp .env.example .env.local

# Set up database
npm run db:setup

# Start development server
npm run dev
```

### 3. Create a Branch

```bash
# Create a feature branch
git checkout -b feature/your-feature-name

# Or a bugfix branch
git checkout -b fix/bug-description
```

***

## 📝 Development Guidelines

### Code Style

We use ESLint and Prettier for code formatting:

```bash
# Format code
npm run format

# Lint code
npm run lint

# Fix linting issues
npm run lint:fix
```

### TypeScript

* Use TypeScript for all new code
* Define proper types (no `any`)
* Document complex types

### Testing

* Write tests for new features
* Ensure existing tests pass
* Aim for >80% code coverage

```bash
# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Check coverage
npm run test:coverage
```

### Commit Messages

Follow conventional commits format:

```
type(scope): subject

body (optional)

footer (optional)
```

**Types**:

* `feat`: New feature
* `fix`: Bug fix
* `docs`: Documentation changes
* `style`: Code style changes (formatting)
* `refactor`: Code refactoring
* `test`: Adding or updating tests
* `chore`: Maintenance tasks

**Examples**:

```
feat(api): add business search endpoint

fix(auth): resolve token expiration issue

docs(readme): update installation instructions
```

***

## 🔄 Pull Request Process

### 1. Before Submitting

* ✅ Code follows style guidelines
* ✅ Tests pass
* ✅ Documentation updated
* ✅ Commit messages follow convention
* ✅ Branch is up to date with main

### 2. Submit Pull Request

**Title**: Clear, descriptive title **Description**: Include:

* What changes were made
* Why the changes were needed
* How to test the changes
* Screenshots (if UI changes)
* Related issues

**Template**:

```markdown
## Description

Brief description of changes

## Type of Change

- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update

## Testing

How to test these changes

## Checklist

- [ ] Tests pass
- [ ] Documentation updated
- [ ] Follows code style
- [ ] No breaking changes (or documented)
```

### 3. Code Review

* Address reviewer feedback
* Keep discussion professional
* Be open to suggestions
* Update PR as needed

### 4. Merge

Once approved:

* Squash commits if needed
* Ensure CI passes
* Maintainer will merge

***

## 🐛 Reporting Bugs

### Before Reporting

1. Search existing issues
2. Check if it's already fixed
3. Verify it's reproducible

### Bug Report Template

```markdown
**Description**
Clear description of the bug

**Steps to Reproduce**

1. Go to '...'
2. Click on '...'
3. See error

**Expected Behavior**
What should happen

**Actual Behavior**
What actually happens

**Screenshots**
If applicable

**Environment**

- OS: [e.g., macOS 14.1]
- Browser: [e.g., Chrome 120]
- AIDP Version: [e.g., 1.0.0]

**Additional Context**
Any other relevant information
```

***

## 💡 Feature Requests

### Before Requesting

1. Search existing requests
2. Discuss in GitHub Discussions

### Feature Request Template

```markdown
**Problem**
What problem does this solve?

**Proposed Solution**
How should it work?

**Alternatives**
Other solutions considered

**Use Case**
How would you use this?

**Additional Context**
Mockups, examples, etc.
```

***

## 📚 Documentation Contributions

### Documentation Structure

```
docs/
├── gitbook/          # GitBook documentation
├── api/              # API documentation
└── guides/           # Tutorials and guides
```

### Writing Guidelines

* Use clear, concise language
* Include code examples
* Add screenshots where helpful
* Link to related documentation
* Test all code examples

***

## 🤝 Code of Conduct

### Our Standards

**Positive Behavior**:

* Be respectful and inclusive
* Welcome newcomers
* Give constructive feedback
* Focus on what's best for the community

**Unacceptable Behavior**:

* Harassment or discrimination
* Trolling or insulting comments
* Personal or political attacks
* Publishing others' private information

### Enforcement

Violations may result in:

1. Warning
2. Temporary ban
3. Permanent ban

**Report**: <conduct@aidp.dev>

***

## 📞 Questions?

**GitHub Discussions**: [github.com/aidp/platform/discussions](https://github.com/aidp/platform/discussions) - `#contributors` channel **Email**: <contributors@aidp.dev> **GitHub Discussions**: [github.com/aidp/platform/discussions](https://github.com/aidp/platform/discussions)

***

**Thank you for contributing to AIDP!** 🎉
