Skip to content

Contributing

AGI Corp edited this page Mar 8, 2026 · 1 revision

Contributing to Web4AGI

Thank you for your interest in contributing to Web4AGI! This document outlines the process for contributing code, documentation, and ideas to the project.

🌟 Ways to Contribute

  1. Code - Implement features, fix bugs, improve performance
  2. Documentation - Improve Wiki pages, add examples, fix typos
  3. Testing - Write tests, report bugs, validate fixes
  4. Design - UI/UX improvements, architecture suggestions
  5. Research - Investigate new agent models, protocol integrations

🚀 Getting Started

1. Fork & Clone

# Fork via GitHub UI, then:
git clone https://github.com/YOUR_USERNAME/Web4AGI.git
cd Web4AGI
git remote add upstream https://github.com/AGI-Corporation/Web4AGI.git

2. Set Up Environment

See Development-Guide for complete environment setup.

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
npm install

3. Create Feature Branch

# Sync with upstream first
git fetch upstream
git checkout -b feature/your-feature-name upstream/main

📝 Pull Request Process

Branch Naming Convention

Type Pattern Example
Feature feature/description feature/add-agent-memory
Bug fix fix/description fix/wallet-balance-error
Documentation docs/description docs/update-api-ref
Testing test/description test/trading-integration
Refactor refactor/description refactor/optimize-mcp

Commit Message Format

Follow Conventional Commits:

<type>(<scope>): <short description>

[optional body]

[optional footer(s)]

Types: feat, fix, docs, test, refactor, chore, perf

Examples:

feat(agents): add memory persistence using Redis
fix(trading): resolve escrow deadlock on concurrent trades
docs(wiki): update MCP integration examples
test(contracts): add Hardhat tests for agreement signing

PR Checklist

Before opening a PR, ensure:

  • Code follows style guidelines (black, flake8, mypy)
  • All existing tests pass: pytest tests/ and npm test
  • New tests added for new functionality
  • Wiki documentation updated if needed
  • .env.example updated if new env vars added
  • No hardcoded secrets or API keys
  • PR description explains the change and links to relevant issue

💻 Code Style

Python

# Format
black src/ tests/

# Lint
flake8 src/ tests/ --max-line-length 100

# Type check
mypy src/ --ignore-missing-imports

# All at once
make lint

Key rules:

  • Use type hints everywhere
  • Write docstrings for all public functions/classes
  • Keep functions focused (< 50 lines)
  • Use async/await for all I/O operations
  • Prefer dataclasses for data structures

TypeScript/JavaScript

# Lint
npm run lint

# Format
npm run format

# Type check
npx tsc --noEmit

Key rules:

  • Use TypeScript strict mode
  • Prefer const over let
  • Use React hooks over class components
  • Add JSDoc for exported functions

Solidity

# Compile
npx hardhat compile

# Test
npx hardhat test

# Coverage
npx hardhat coverage

Key rules:

  • Follow Solidity style guide
  • Use OpenZeppelin contracts where possible
  • All state-changing functions must emit events
  • Add NatSpec comments for all public functions

🧪 Testing Requirements

New Features

Every new feature must include:

  • Unit tests covering the happy path
  • Unit tests covering error/edge cases
  • Integration test if the feature touches multiple systems

Bug Fixes

Every bug fix must include:

  • A regression test that reproduces the bug
  • The fix that makes the test pass

Test File Naming

tests/unit/test_<module_name>.py
tests/integration/test_<feature_name>.py
tests/e2e/test_<user_flow>.py

🐛 Reporting Bugs

When filing a bug report, include:

  1. Environment: OS, Python version, Node.js version
  2. Description: What happened vs what you expected
  3. Reproduction steps: Minimal steps to reproduce
  4. Logs: Relevant error messages or stack traces
  5. Configuration: Relevant .env variables (no secrets!)

Use the Bug Report template.

💡 Suggesting Features

Before submitting a feature request:

  1. Check existing Issues to avoid duplicates
  2. Consider if the feature fits the project scope
  3. Think through the implementation approach

Use the Feature Request template.

💬 Community

📄 License

By contributing, you agree that your contributions will be licensed under the MIT License.

See Home to return to the main page.

Clone this wiki locally