# Contributing

## 🤝 Contributing

We welcome contributions! Here's how you can help:

### Development Setup

```bash
# Clone the repository
git clone https://github.com/algochad/prisma-core.git
cd prisma-core

# Install dependencies
npm install

# Run tests
npm test

# Run benchmarks
npm run benchmark

# Build the library
npm run build
```

### Contribution Guidelines

1. **🐛 Bug Reports**: Include minimal reproduction steps and environment details
2. **✨ Feature Requests**: Describe the use case and expected behavior
3. **💻 Code Contributions**: Follow TypeScript best practices and include tests
4. **📚 Documentation**: Help improve examples and guides
5. **⚡ Performance**: Submit benchmark results and optimization suggestions

### Running Tests

```bash
# Unit tests
npm run test

# Integration tests
npm run test:integration

# Performance tests
npm run test:performance

# All tests
npm run test:all
```

### Code Style

We use ESLint and Prettier for code formatting. Make sure your code passes linting:

```bash
# Check code style
npm run lint

# Fix code style issues
npm run lint:fix

# Format code
npm run format
```

### Submitting Pull Requests

1. Fork the repository
2. Create a feature branch: `git checkout -b feature/your-feature-name`
3. Make your changes and add tests
4. Ensure all tests pass: `npm test`
5. Commit your changes: `git commit -m "feat: add your feature"`
6. Push to your fork: `git push origin feature/your-feature-name`
7. Create a pull request

### Commit Message Convention

We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:

- `feat:` - New features
- `fix:` - Bug fixes
- `docs:` - Documentation changes
- `style:` - Code style changes (formatting, etc.)
- `refactor:` - Code refactoring
- `test:` - Adding or updating tests
- `perf:` - Performance improvements
- `chore:` - Maintenance tasks

### Development Guidelines

#### Adding New Features

1. Create an issue to discuss the feature
2. Write tests for the new functionality
3. Implement the feature following existing patterns
4. Update documentation and examples
5. Add benchmark tests if applicable

#### Bug Fixes

1. Create a test that reproduces the bug
2. Fix the issue
3. Ensure the test passes
4. Add regression tests if needed

#### Performance Improvements

1. Add benchmarks to measure current performance
2. Implement optimizations
3. Verify improvements with updated benchmarks
4. Document performance gains

### Project Structure

```
libs/prisma-core/
├── src/
│   ├── core/           # Core functionality
│   ├── collections/    # LINQ implementations
│   ├── benchmarks/     # Performance utilities
│   └── tests/          # Test files
├── docs/              # Documentation files
├── package.json
└── README.md
```

### Testing Strategy

#### Unit Tests

- Test individual functions and classes
- Mock external dependencies
- Focus on edge cases and error conditions

#### Integration Tests

- Test end-to-end functionality
- Use real database connections
- Test with both Prisma ORM and GraphQL

#### Performance Tests

- Benchmark critical operations
- Test with various data sizes
- Monitor memory usage

### Documentation

When contributing:

1. Update relevant documentation files
2. Add code examples for new features
3. Update the API reference if needed
4. Ensure examples are working and tested

### Getting Help

- Join our [GitHub Discussions](https://github.com/algochad/prisma-core/discussions)
- Check existing [GitHub Issues](https://github.com/algochad/prisma-core/issues)
- Read through the documentation files

### Release Process

Releases are managed by the maintainers:

1. Version bumps follow semantic versioning
2. Changelog is automatically generated
3. NPM packages are published automatically
4. GitHub releases include detailed notes

## Next Steps

- [Review the license](./LICENSE.md)
- [Check existing issues](https://github.com/algochad/prisma-core/issues)
- [Join discussions](https://github.com/algochad/prisma-core/discussions)
