Contributing to BookWorm
April 23, 2026 ยท View on GitHub
๐ Thank you for your interest in contributing to BookWorm!
BookWorm is a cloud-native microservices application showcasing .NET Aspire, Domain-Driven Design, and AI integration. We welcome contributions of all kinds: bug fixes, features, documentation improvements, and more.
Whether you're a first-time contributor or an experienced developer, this guide will help you get started. Please follow these guidelines to ensure a smooth contribution process and maintain code quality across the project.
Table of Contents
- Contributing to BookWorm
Getting Started
-
Fork the Repository: Start by forking the main BookWorm repository.
-
Clone Your Fork:
git clone https://github.com/YOUR-USERNAME/BookWorm.git cd BookWorm -
Add Upstream Remote:
git remote add upstream https://github.com/foxminchan/BookWorm.git -
Configure Line Endings: Ensure consistent line endings across different operating systems:
git config --global core.autocrlf input -
Review Project Guide: See AGENTS.md for detailed setup instructions, prerequisites, and project architecture overview.
Development Workflow
- Create a Branch:
git checkout -b feature/your-feature-name - Make Changes: Follow the coding conventions described below
- Commit Changes: Use descriptive commit messages following Conventional Commits:
feat:for new featuresfix:for bug fixesdocs:for documentation changesrefactor:for code refactoringtest:for test additions or modificationschore:for maintenance tasks
- Push to Your Fork:
git push origin feature/your-feature-name - Create a Pull Request: Submit your changes for review. Use a Conventional Commits-style title (e.g.,
feat: add book search endpoint) and fill out the PR template completely
For the branching strategy, please refer to the Git Flow model.
Agent Workflow
BookWorm includes AI agents to assist with development tasks. These agents work collaboratively through a structured handoff system:
Available Agents
-
.NET Expert โ Implements, refactors, and optimizes C#/.NET code following project conventions, SOLID principles, and modern C# 14 patterns.
-
Next.js Expert โ Implements, debugs, and optimizes Next.js 16 App Router code with TypeScript, Server/Client Components, Cache Components, and Turbopack.
-
Debug โ Systematically identifies, analyzes, and resolves bugs through structured investigation and verification.
-
Planner โ Generates implementation plans for new features or refactoring existing code.
-
Code Reviewer โ Reviews code changes for quality, security, and best practices compliance.
-
GitHub Actions Expert โ Builds secure CI/CD workflows with action pinning, OIDC authentication, and supply-chain security.
Agent Collaboration Workflow
The agents collaborate through handoffs to provide comprehensive development support:
graph TD
P[Planner] -->|Implement .NET| NE[.NET Expert]
P -->|Implement Frontend| NX[Next.js Expert]
P -->|Review Plan| CR[Code Reviewer]
NE -->|Request Review| CR
NE -->|Debug Issues| D[Debug]
NE -->|Plan Complex Changes| P
NX -->|Request Review| CR
NX -->|Debug Issues| D
NX -->|Plan Complex Changes| P
D -->|Get Expert Help| NE
D -->|Review Fix| CR
D -->|Plan Refactoring| P
CR -->|Fix .NET Issues| NE
CR -->|Fix Frontend Issues| NX
CR -->|Debug a Problem| D
CR -->|Create Refactoring Plan| P
GA[GitHub Actions Expert] -->|Review Workflows| CR
GA -->|Plan Complex CI/CD| P
style P fill:#1f4e79,color:#ffffff
style NE fill:#7a4f01,color:#ffffff
style NX fill:#5a2d82,color:#ffffff
style D fill:#7a1f1f,color:#ffffff
style CR fill:#1f6f3e,color:#ffffff
style GA fill:#7a3e00,color:#ffffff
Typical Workflows
Backend Feature Development:
- Start with Planner to create implementation plan
- Hand off to .NET Expert for implementation
- Use Code Reviewer to validate changes
- Use Debug if issues arise
Frontend Feature Development:
- Start with Planner to create implementation plan
- Hand off to Next.js Expert for implementation
- Use Code Reviewer to validate changes
- Use Debug for hydration mismatches or runtime bugs
Bug Fixing:
- Start with Debug to identify and fix bugs
- Hand off to .NET Expert or Next.js Expert for complex solutions
- Use Code Reviewer to review the fix
- Use Planner if architectural changes needed
Code Review:
- Start with Code Reviewer for systematic review
- Hand off to .NET Expert or Next.js Expert to address issues
- Use Planner for major refactoring recommendations
CI/CD Changes:
- Start with GitHub Actions Expert for workflow changes
- Hand off to Code Reviewer for review
- Use Planner for complex pipeline restructuring
Using Agents in Your Workflow
- Agents are available in the
.github/agents/directory - Each agent has specific expertise and tools
- Agents can hand off work to other agents based on task requirements
- Follow agent recommendations for maintaining code quality and consistency
Tip
When working on complex features, start with the Planner agent to create a comprehensive implementation plan before coding.
Coding Standards
- Follow DDD (Domain-Driven Design) principles
- Use the latest C# features and idioms
- Implement unit tests for all business logic
- Maintain service boundaries - avoid direct cross-service dependencies
- Follow
.editorconfigsettings for code formatting - Prefer explicit type declarations when type isn't obvious
- Use primary constructors for classes with immutable properties
- Use expression-bodied members when appropriate
Example:
public sealed class Book : IAggregateRoot
{
public string Title { get; private set; }
public string Author { get; private set; }
public Book(string title, string author)
{
Title = !string.IsNullOrWhiteSpace(title)
? title
: throw new CatalogDomainException("Title cannot be empty.");
Author = !string.IsNullOrWhiteSpace(author)
? author
: throw new CatalogDomainException("Author cannot be empty.");
}
}
public sealed class BookService
{
public Book GetBook(string title, string author) => new Book(title, author);
}
Integration Events Standards
When working with integration events for cross-service communication:
- Always use the
BookWorm.Contractsnamespace when declaring integration events - Follow the naming convention
[Action][Entity]IntegrationEvent(e.g.,BookCreatedIntegrationEvent) - Include only necessary data in integration events to minimize payload size
- Implement proper serialization attributes for all event properties
Caution
Do not modify namespaces for Integration Events as it will disrupt the messaging system. The event bus relies on consistent namespace conventions for proper routing.
namespace BookWorm.Contracts;
public sealed record UserCheckedOutIntegrationEvent(
Guid OrderId,
Guid BasketId,
string? Email,
decimal TotalMoney
) : IntegrationEvent;
Protocol Buffers (Proto) Schema Standards
When modifying Protocol Buffers schema files (.proto files), you must run the following Buf commands to ensure schema validity and compatibility:
-
Lint the schema: Validates that your proto files follow best practices and conventions
buf lint -
Check for breaking changes: Ensures backward compatibility with the locked schema
buf breaking --against lock.binpb -
Update the lock file: After validation, rebuild and update the schema lock file
buf build -o lock.binpb
Important
All three commands must pass successfully before submitting a PR with proto schema changes. Breaking changes require careful coordination and migration planning.
Workflow for Proto Changes:
- Modify your
.protofiles - Run
buf lintto check for style and best practice violations - Run
buf breaking --against lock.binpbto verify backward compatibility - If checks pass, run
buf build -o lock.binpbto update the lock file - Commit both the
.protochanges and the updatedlock.binpbfile
Design Patterns
- Use CQRS with Mediator when applicable
- Repository pattern for data access
- Domain Events for cross-service communication
- Avoid circular dependencies between services
- Keep services independently deployable
- Use Value Objects for immutable types
- Use Domain Events for side effects
- Use Domain Services for complex business logic
- Use Factories or Builders for object creation
- Use Specification pattern for complex queries
Testing Guidelines
Core Testing Principles
- 100% Business Logic Coverage: Write unit tests for all domain and business logic components
- Descriptive Test Names: Use the
GivenCondition_WhenAction_ThenExpectedResultpattern for test naming (e.g.,GivenValidBook_WhenAddingToLibrary_ThenSuccessReturned) - Isolation: Mock all external dependencies including repositories, services, and infrastructure components
- Comprehensive Scenarios: Test both happy paths and edge cases, including validation failures and exception handling
Test Organization
- Group tests by feature or domain entity
- Create separate test fixtures for different testing scenarios
- Use appropriate test attributes for categorization
Test Quality
- Aim for high code coverage in domain logic (minimum 80%)
- Follow TUnit conventions for test methods and classes
- Avoid testing implementation details; focus on behaviors
- Write deterministic tests that don't depend on environment or timing
- Keep tests fast, independent, and repeatable
- Use descriptive test names that clearly indicate what is being tested
- Ensure tests are isolated and don't share state
Tools and Resources
- Testing Framework: Use TUnit (not xUnit/NUnit/MSTest)
- Mocking: Utilize Moq for mocking dependencies
- Assertions: Use Shouldly for fluent assertions
- Snapshot Testing: Use Verify.TUnit for snapshot tests
- Architecture Tests: Use ArchUnitNET.TUnit in
tests/BookWorm.ArchTests/ - Coverage: Microsoft.Testing.Extensions.CodeCoverage for test coverage reports
- Integration Tests: Use Aspire.Hosting.Testing for service integration tests
- For automated test generation, refer to our GitHub Copilot test prompts
Pull Request Process
-
PR Title:
- Use Conventional Commits format:
<type>: <description>(e.g.,feat: add book search endpoint) - Valid types:
feat,fix,docs,refactor,test,chore - Keep the description clear and concise
- Use Conventional Commits format:
-
PR Description:
- Fill out the PR template completely
- Summarize proposed changes and their purpose
- Select the appropriate type of change
- Complete all checklist items (check off or explain why not applicable)
- Link related issues using keywords (e.g.,
Fixes #123)
-
Code Quality:
- Follow BookWorm's coding standards and conventions
- Include comprehensive unit tests for new features and changes
- Ensure all existing and new tests pass locally before submitting
-
Documentation:
- Update relevant documentation when changing functionality
- Add code comments for complex logic where necessary
- Include clear examples for API changes
-
CI/CD:
- Ensure your PR passes all CI/CD pipeline checks, SonarQube analysis, and Snyk security scans
-
Review Process:
- Request reviews from project maintainers
- Address reviewer feedback promptly
- Be prepared to make additional changes if requested
-
Merge Criteria:
- PRs require approval from at least one maintainer
- All automated checks must pass
- No merge conflicts with the target branch
Here is flowchart of the PR process:
flowchart TD
A[Create Pull Request] --> B{PR Title & Description}
B -->|Valid| C{Code Quality Checks}
C -->|Pass| D{Documentation Updated?}
D -->|Pass| E{CI/CD Checks}
E -->|Pass| F{Code Review}
F -->|Approved| G{Merge Criteria}
G -->|Pass| H[Merge PR]
B -->|Invalid| I[Fix Issues]
C -->|Fail| I
D -->|Fail| I
E -->|Fail| I
F -->|Changes Requested| I
I --> B
Need Help?
Getting Support
We're here to help! If you have questions or need assistance:
- ๐ Documentation: Start with AGENTS.md and the project README
- ๐ Bug Reports: Create a bug report
- ๐ก Feature Requests: Submit a feature request
- ๏ฟฝ Security Vulnerabilities: Do not open a public issue โ follow the process in SECURITY.md
- ๏ฟฝ๐ฅ Maintainers: Reach out via GitHub issues
Response Times
This is an open-source project maintained by volunteers. Please be patient:
- Bug reports: We aim to respond within 48-72 hours
- Feature requests: May take longer to evaluate and implement
- Pull requests: We'll review as soon as possible, usually within a week
Community Guidelines
When seeking help or contributing:
- โ Be respectful and constructive
- โ Provide detailed information about your issue
- โ Search for existing solutions before asking
- โ Follow up if you find a solution
- โ Don't demand immediate responses
- โ Don't post duplicate issues
Thank you for contributing to BookWorm! ๐