# Contributing to MySQL WAMP XAMPP Tutorial

First off, thank you for considering contributing to this project! It's people like you that make this tutorial a great learning resource for everyone.

## Table of Contents

- [Code of Conduct](#code-of-conduct)
- [How Can I Contribute?](#how-can-i-contribute)
- [Getting Started](#getting-started)
- [Contribution Guidelines](#contribution-guidelines)
- [Style Guide](#style-guide)
- [Commit Messages](#commit-messages)
- [Pull Request Process](#pull-request-process)

## Code of Conduct

This project and everyone participating in it is governed by our commitment to creating a welcoming and inclusive environment. By participating, you are expected to uphold this standard.

### Our Standards

- Be respectful and inclusive
- Accept constructive criticism gracefully
- Focus on what is best for the community
- Show empathy towards others

## How Can I Contribute?

### Reporting Bugs or Issues

If you find an error, typo, or issue:

1. **Check existing issues** to see if it's already reported
2. **Create a new issue** with:
   - Clear, descriptive title
   - Detailed description of the problem
   - Steps to reproduce (if applicable)
   - Screenshots (if helpful)
   - Your environment (OS, WAMP/XAMPP version, etc.)

### Suggesting Enhancements

Have an idea for improvement?

1. **Check existing issues** to avoid duplicates
2. **Create a new issue** describing:
   - The enhancement
   - Why it would be useful
   - How it should work
   - Examples or mockups (if applicable)

### Contributing Content

We welcome contributions in these areas:

1. **Fixing typos or errors**
2. **Improving documentation**
3. **Adding new tutorials**
4. **Creating sample code/databases**
5. **Adding troubleshooting guides**
6. **Translating content**

## Getting Started

### Fork and Clone

1. Fork the repository on GitHub
2. Clone your fork locally:
   ```bash
   git clone https://github.com/YOUR-USERNAME/MySQL-WAMP-XAMPP-Tutorial.git
   cd MySQL-WAMP-XAMPP-Tutorial
   ```

3. Add upstream remote:
   ```bash
   git remote add upstream https://github.com/Kubomu/MySQL-WAMP-XAMPP-Tutorial.git
   ```

### Create a Branch

Create a branch for your changes:

```bash
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fix
```

Branch naming conventions:
- `feature/` - New features or tutorials
- `fix/` - Bug fixes or corrections
- `docs/` - Documentation improvements
- `style/` - Formatting, style changes
- `refactor/` - Code restructuring

## Contribution Guidelines

### Documentation

- Use clear, concise language
- Include examples where appropriate
- Add code comments for complex sections
- Test all code examples before submitting
- Ensure proper formatting (Markdown)

### Code Examples

- **Test thoroughly**: All code must work
- **Comment well**: Explain what the code does
- **Follow conventions**: Use consistent naming and style
- **Be practical**: Focus on real-world use cases
- **Include output**: Show expected results

Example:
```sql
-- Good: Clear, commented, practical
-- Get users who registered in the last 7 days
SELECT user_id, username, email, created_at
FROM users
WHERE created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)
ORDER BY created_at DESC;

-- Expected output:
-- user_id | username | email              | created_at
-- --------|----------|-------------------|-------------------
-- 123     | john_doe | john@example.com  | 2024-11-10 14:30:00
```

### SQL Files

- Include header comments explaining purpose
- Organize queries logically
- Comment complex queries
- Use consistent formatting
- Test all queries before submitting

### Tutorials

When creating new tutorials:

1. **Structure**:
   - Introduction
   - Prerequisites
   - Step-by-step instructions
   - Code examples
   - Expected output
   - Troubleshooting
   - Summary
   - Additional resources

2. **Clarity**:
   - Write for beginners
   - Explain technical terms
   - Use simple language
   - Break down complex topics

3. **Completeness**:
   - Include all necessary steps
   - Don't skip "obvious" steps
   - Provide context
   - Link to related tutorials

## Style Guide

### Markdown

- Use `#` for headings (not underlines)
- Use \`\`\` for code blocks with language specifier
- Use `**bold**` for emphasis
- Use `- ` for unordered lists
- Use `1. ` for ordered lists
- Use `[link text](URL)` for links

### SQL

- **Keywords**: UPPERCASE
- **Identifiers**: lowercase_with_underscores
- **Indentation**: 4 spaces (or 2 spaces consistently)
- **Line length**: Max 80-100 characters
- **Comments**: `-- ` for single line, `/* */` for blocks

Example:
```sql
-- Create users table
CREATE TABLE users (
    user_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(50) NOT NULL UNIQUE,
    email VARCHAR(255) NOT NULL UNIQUE,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,

    INDEX idx_username (username),
    INDEX idx_email (email)
) ENGINE=InnoDB;
```

### File Organization

- Use descriptive file names: `database-design.md` not `db.md`
- Place files in appropriate directories
- Keep related files together
- Update README files when adding new content

## Commit Messages

### Format

```
<type>: <subject>

<body>

<footer>
```

### Types

- `feat`: New feature or tutorial
- `fix`: Bug fix or correction
- `docs`: Documentation changes
- `style`: Formatting, typos
- `refactor`: Code restructuring
- `test`: Adding tests
- `chore`: Maintenance tasks

### Examples

```
feat: Add advanced JOIN operations tutorial

- Added comprehensive JOIN guide
- Included multiple examples
- Added practice exercises

Closes #42
```

```
fix: Correct SQL syntax in SELECT queries

Fixed incorrect LIMIT clause syntax in basic SELECT
examples. Added proper semicolons.
```

```
docs: Update installation instructions for XAMPP

- Updated for XAMPP 8.2.4
- Added macOS-specific steps
- Fixed broken links
```

### Best Practices

- Use present tense: "Add feature" not "Added feature"
- Keep subject line under 50 characters
- Capitalize subject line
- Don't end subject line with period
- Wrap body at 72 characters
- Explain what and why, not how

## Pull Request Process

### Before Submitting

1. **Update your fork**:
   ```bash
   git fetch upstream
   git rebase upstream/main
   ```

2. **Test your changes**:
   - Verify all code examples work
   - Check for typos
   - Ensure proper formatting
   - Test on WAMP/XAMPP if applicable

3. **Commit your changes**:
   ```bash
   git add .
   git commit -m "feat: your feature description"
   ```

4. **Push to your fork**:
   ```bash
   git push origin feature/your-feature-name
   ```

### Creating Pull Request

1. Go to the original repository on GitHub
2. Click "New Pull Request"
3. Select your fork and branch
4. Fill in the PR template:
   - **Title**: Clear, descriptive (like commit message)
   - **Description**:
     - What changes were made
     - Why they were needed
     - Any relevant issue numbers
     - Screenshots (if UI changes)
     - Testing done

5. Submit the pull request

### PR Template

```markdown
## Description
Brief description of changes

## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Code refactoring

## Checklist
- [ ] Code tested and working
- [ ] Documentation updated
- [ ] Follows style guidelines
- [ ] No breaking changes

## Related Issues
Closes #issue_number
```

### Review Process

1. **Automated checks**: Ensure they pass
2. **Maintainer review**: Address feedback
3. **Revisions**: Make requested changes
4. **Approval**: PR will be merged

### After Merge

1. Delete your branch (optional):
   ```bash
   git branch -d feature/your-feature-name
   git push origin --delete feature/your-feature-name
   ```

2. Update your fork:
   ```bash
   git checkout main
   git pull upstream main
   git push origin main
   ```

## Recognition

Contributors will be:
- Listed in project credits
- Acknowledged in release notes
- Appreciated in the community!

## Questions?

- Open an issue for discussion
- Tag with "question" label
- Be patient waiting for response

## Additional Resources

- [GitHub Flow Guide](https://guides.github.com/introduction/flow/)
- [Markdown Guide](https://www.markdownguide.org/)
- [SQL Style Guide](https://www.sqlstyle.guide/)
- [Git Best Practices](https://git-scm.com/book/en/v2)

---

Thank you for contributing to MySQL-WAMP-XAMPP-Tutorial! Your efforts help countless developers learn and grow. 🎉
