Skip to content

Latest commit

 

History

History
400 lines (299 loc) · 9.71 KB

File metadata and controls

400 lines (299 loc) · 9.71 KB

Contributing to Claude Code Extended Framework

Thank you for your interest in contributing! This document provides guidelines for contributing to this project.

Table of Contents

Code of Conduct

This project adheres to a Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.

Getting Started

Prerequisites

  • Claude Code CLI installed
  • Git configured with your name and email
  • Bash shell environment (Linux, macOS, or WSL on Windows)
  • Basic understanding of shell scripting

Development Setup

  1. Fork and clone the repository:
git fork https://github.com/kvnloo/evolve.git
git clone https://github.com/kvnloo/evolve.git
cd evolve
  1. Create a feature branch:
git checkout -b feature/your-feature-name
  1. Set up MCP servers (recommended):
claude mcp add claude-flow npx claude-flow@alpha mcp start
claude mcp add ruv-swarm npx ruv-swarm mcp start  # Optional
  1. Review the project structure:
cat CLAUDE.md  # Main configuration
ls -la .claude/  # Configuration directory
cat docs/github-setup-plan.md  # Development roadmap

Development Workflow

SPARC Methodology

This project follows the SPARC methodology for systematic development:

  1. Specification: Define requirements clearly

    • Write PRD if adding major feature
    • Create GitHub issue with detailed description
    • Identify success criteria
  2. Pseudocode: Design before implementation

    • Outline algorithm/logic in comments
    • Plan function signatures and data structures
    • Review with maintainers if complex
  3. Architecture: Document system design

    • Update architecture diagrams if needed
    • Document integration points
    • Explain design decisions
  4. Refinement: Test-Driven Development

    • Write tests BEFORE implementation
    • Ensure tests fail initially
    • Implement until tests pass
    • Refactor while keeping tests green
  5. Completion: Validate integration

    • Run full test suite
    • Update documentation
    • Verify no regressions

Feature Branch Workflow

# Always work on feature branches, never on main
git checkout -b feature/descriptive-name

# Make incremental commits
git add .
git commit -m "feat: add user authentication helper"

# Keep branch updated with main
git fetch origin
git rebase origin/main

# Push when ready
git push origin feature/descriptive-name

Code Style Guidelines

Shell Scripts

Follow these conventions for all .sh files:

#!/usr/bin/env bash
set -euo pipefail  # Exit on error, undefined vars, pipe failures

# Use descriptive variable names
readonly PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
readonly CONFIG_DIR="${PROJECT_ROOT}/.claude"

# Add comments for complex logic
# Validates that the repository is not the CCPM template
validate_repository() {
  local remote_url
  remote_url=$(git remote get-url origin 2>/dev/null || echo "")

  if [[ "$remote_url" == *"automazeio/ccpm"* ]]; then
    echo "❌ ERROR: Cannot sync with template repository" >&2
    return 1
  fi
}

# Use functions for reusability
main() {
  validate_repository || exit 1
  # Implementation...
}

main "$@"

Style Requirements:

  • Use #!/usr/bin/env bash shebang
  • Set strict mode: set -euo pipefail
  • Use readonly for constants
  • Quote all variables: "${variable}"
  • Use local for function variables
  • Add descriptive comments
  • Use meaningful function names
  • Return early on errors
  • Use >&2 for error messages

Configuration Files

For .md files in .claude/commands/:

---
name: command-name
description: Brief description of what this command does
category: category-name
---

# Command Implementation

Detailed documentation and implementation...

For rule files in .claude/rules/:

# Rule Title

Clear, actionable rules with examples.

## Section

✅ Correct examples
❌ Incorrect examples

File Organization

Critical Rule: NEVER save working files to the root folder

Use these directories:

.claude/
├── commands/        # Slash command definitions
├── rules/           # Coordination and operation rules
├── helpers/         # Reusable shell scripts
├── prds/            # Product requirement documents
├── context/         # Project context files
└── statusline/      # Status line configuration

docs/                # Documentation and analysis
scripts/             # Utility scripts
.github/             # GitHub workflows and templates

Path Standards

Follow .claude/rules/path-standards.md:

  • Use relative paths for project files: internal/auth/server.go
  • No absolute paths with usernames: ❌ /Users/username/project/...
  • Cross-project references: ../project-name/file.go

Testing Requirements

Shell Script Testing

# Run shellcheck on all scripts
shellcheck scripts/*.sh .claude/helpers/*.sh

# Test scripts in isolated environment
bash -n script.sh  # Syntax check
bash -x script.sh  # Debug mode

Integration Testing

Before submitting PR:

# Test slash command execution
# (requires Claude Code CLI)

# Test helper scripts
./scripts/checkpoint.sh
./scripts/migrate-agents.sh --dry-run

# Verify GitHub workflows syntax
# (use GitHub Actions workflow validator)

Pull Request Process

Before Submitting

  • Follow SPARC methodology (all 5 phases)
  • Tests written and passing
  • Shell scripts pass shellcheck
  • Documentation updated
  • Commit messages follow convention (see below)
  • No hardcoded paths or secrets
  • Files organized in correct directories

Commit Message Convention

<type>(<scope>): <subject>

<body>

<footer>

Types:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation only
  • style: Code style changes (formatting)
  • refactor: Code refactoring
  • test: Adding/updating tests
  • chore: Maintenance tasks

Examples:

git commit -m "feat(commands): add /sc:benchmark command for performance testing"
git commit -m "fix(helpers): resolve path resolution in checkpoint.sh"
git commit -m "docs(contributing): add shell script style guidelines"

PR Template Checklist

When you open a PR, complete the template checklist:

## SPARC Methodology Checklist
- [ ] Specification: Requirements clearly defined
- [ ] Pseudocode: Algorithm/logic designed before implementation
- [ ] Architecture: System design documented
- [ ] Refinement: TDD approach - tests written first
- [ ] Completion: Integration validated

## Code Quality
- [ ] Shell scripts pass shellcheck
- [ ] No new warnings introduced
- [ ] Files under 500 lines (per style guide)
- [ ] Code follows project style guide

## Security
- [ ] No hardcoded secrets or credentials
- [ ] No absolute paths with usernames
- [ ] Input validation implemented

Agent Coordination

Multi-Agent Development

If using git worktrees for parallel development:

Follow .claude/rules/agent-coordination.md:

  • Only modify files in your assigned work stream
  • Make atomic commits (single purpose)
  • Update progress files regularly
  • Never force push
  • Communicate through commit messages

Example workflow:

# Create worktree for epic
git worktree add ../epic-auth-system epic/auth-system

# Check work assignment
cat .claude/epics/epic-name/issue-123-analysis.md

# Update progress
echo "✅ Completed database schema" >> stream-A.md
git add stream-A.md
git commit -m "Progress: Stream A - schema complete"

Adding New Features

Adding a Slash Command

  1. Create command file in .claude/commands/:
# .claude/commands/sc/my-command.md
---
name: my-command
description: Brief description
category: utilities
---

# Implementation
Your command logic here...
  1. Document usage in README or docs/
  2. Add tests if applicable
  3. Submit PR with example usage

Adding a Helper Script

  1. Create script in .claude/helpers/:
#!/usr/bin/env bash
set -euo pipefail

# .claude/helpers/my-helper.sh
# Description: What this helper does

main() {
  # Implementation
}

main "$@"
  1. Make executable: chmod +x .claude/helpers/my-helper.sh
  2. Run shellcheck: shellcheck .claude/helpers/my-helper.sh
  3. Document in README or docs/
  4. Add usage examples

Adding Documentation

  1. Add files to docs/ directory:

    • Guides: docs/guide-name.md
    • Analysis: docs/analysis-name.md
    • Reference: docs/reference-name.md
  2. Link from README.md if appropriate

  3. Use relative paths for links

  4. Include table of contents for long docs

Modifying GitHub Workflows

  1. Test syntax with GitHub Actions validator
  2. Test in fork before submitting PR
  3. Document any new environment variables needed
  4. Explain workflow purpose in PR description

Questions?

Recognition

Contributors are recognized in:

  • Git commit history
  • Release notes
  • Project documentation

Thank you for contributing to make this project better! 🎉