# Contributing

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

## Ways to Contribute

### Code

* Fix bugs
* Implement features
* Improve performance
* Write tests

### Documentation

* Fix typos and errors
* Add examples
* Improve clarity
* Translate to other languages

### Testing

* Run beta releases
* Report bugs
* Test edge cases
* Verify fixes

### Community

* Help users in chat
* Answer questions
* Share KayakNet
* Write tutorials

## Getting Started

### 1. Fork the Repository

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

### 2. Set Up Development Environment

```bash
# Install Go 1.21+
go version

# Download dependencies
go mod download

# Build
go build ./cmd/kayakd/
```

### 3. Create a Branch

```bash
git checkout -b feature/your-feature-name
```

## Code Style

### Go Code

Follow standard Go conventions:

* `gofmt` for formatting
* `golint` for style
* Clear variable names
* Comments for exported functions

```go
// Good
func ProcessMessage(msg *Message) error {
    if msg == nil {
        return errors.New("message is nil")
    }
    // Process...
    return nil
}

// Bad
func pm(m *Message) error {
    // ...
}
```

### Commit Messages

Use clear, descriptive commit messages:

```
feat: add support for Zcash escrow

- Implement Zcash wallet integration
- Add z-address generation
- Update escrow API for ZEC

Closes #123
```

Prefixes:

* `feat:` - New feature
* `fix:` - Bug fix
* `docs:` - Documentation
* `test:` - Tests
* `refactor:` - Code refactoring
* `perf:` - Performance improvement
* `chore:` - Maintenance

## Pull Request Process

### 1. Before Submitting

* [ ] Code compiles without errors
* [ ] Tests pass (`go test ./...`)
* [ ] Linter passes (`golangci-lint run`)
* [ ] Documentation updated if needed
* [ ] Commit messages are clear

### 2. Submit PR

1. Push your branch
2. Open PR on GitHub
3. Fill out the template
4. Wait for review

### 3. Review Process

* Maintainers will review
* Address feedback
* Make requested changes
* PR will be merged when approved

## Testing

### Running Tests

```bash
# All tests
go test ./...

# With coverage
go test -cover ./...

# Specific package
go test ./internal/chat/...

# Verbose
go test -v ./...
```

### Writing Tests

```go
func TestProcessMessage(t *testing.T) {
    tests := []struct {
        name    string
        input   *Message
        wantErr bool
    }{
        {"valid message", &Message{...}, false},
        {"nil message", nil, true},
    }
    
    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            err := ProcessMessage(tt.input)
            if (err != nil) != tt.wantErr {
                t.Errorf("got error %v, wantErr %v", err, tt.wantErr)
            }
        })
    }
}
```

## Security Contributions

### Responsible Disclosure

If you find a security vulnerability:

1. **DO NOT** open a public issue
2. Email: <security@kayaknet.io>
3. Include detailed reproduction steps
4. Wait for acknowledgment

### Security-Related PRs

* Mark PR as security-related
* Request private review
* Don't discuss details publicly until fixed

## Documentation

### Where to Document

| Type         | Location            |
| ------------ | ------------------- |
| API docs     | `api/*.md`          |
| Features     | `features/*.md`     |
| Architecture | `architecture/*.md` |
| Security     | `security/*.md`     |

### Documentation Style

* Clear and concise
* Include examples
* Use code blocks for commands
* Keep up to date with code

## Community Guidelines

### Be Respectful

* Treat everyone with respect
* No harassment or discrimination
* Constructive criticism only

### Be Collaborative

* Help others learn
* Share knowledge
* Welcome newcomers

### Be Professional

* Stay on topic
* No spam or self-promotion
* Respect privacy

## Questions?

* Join `#dev` on `chat.kyk`
* Open a GitHub discussion
* Check existing issues

Thank you for contributing to KayakNet!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kayaknet.io/development/contributing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
