Thank you for your interest in contributing to Claude Code Karma! This document provides guidelines and instructions for contributing to the project.
Please review our Code of Conduct and follow it in all interactions with the project community.
Before you begin, ensure you have:
- Python 3.9+
- Node.js 18+
- npm 7+
- Git
- Claude Code sessions (to test with real data)
Verify your setup:
python3 --version # 3.9 or higher
node --version # 18 or higher
npm --version # 7 or higher
git --version # any version- Clone the repository
git clone https://github.com/JayantDevkar/claude-code-karma.git
cd claude-code-karma- Set up the API
cd api
pip install -e ".[dev]"
pip install -r requirements.txt
uvicorn main:app --reload --port 8000The API will be available at http://localhost:8000.
- Set up the Frontend (in a new terminal)
cd frontend
npm install
npm run devThe frontend will be available at http://localhost:5173.
- Set up Captain Hook (if making changes)
cd captain-hook
pip install -e ".[dev]"
pytest tests/test_models.py -vIf you find a bug:
- Check if it's already reported — Search existing issues
- Create a new issue with:
- Clear title describing the bug
- Step-by-step reproduction steps
- Expected vs actual behavior
- Python version, Node version, OS
- Relevant logs or screenshots
To suggest a feature:
- Check if it's already requested — Search existing issues
- Create a new issue with:
- Clear title describing the feature
- Use case and motivation
- Proposed solution (if any)
- Additional context or examples
git checkout main
git pull origin main
git checkout -b feature/your-feature-nameUse descriptive branch names:
feature/add-export-buttonfix/session-timeline-crashdocs/update-api-guide
We use ruff for linting and formatting.
# Check for style issues
ruff check models/ routers/ tests/
# Auto-format code
ruff format models/ routers/ tests/
# Run linting in CI
ruff check --select E,F,W --line-length 120Guidelines:
- Follow PEP 8
- Use type hints for all functions
- Document public functions with docstrings
- Max line length: 120 characters
- Use
ConfigDict(frozen=True)for Pydantic models
We use prettier and eslint for formatting and linting.
# Check for style issues
npm run lint
# Auto-format code
npm run format
# Type check
npm run checkGuidelines:
- Use TypeScript for all components
- Use Svelte 5 runes (
$state(),$derived(),$effect()) - Follow component naming conventions (PascalCase)
- Document complex logic with comments
- Use
<script lang="ts">in Svelte files
cd api
# Run all tests
pytest
# Run specific test file
pytest tests/test_session.py -v
# Run with coverage
pytest --cov=models --cov=routers
# Run API endpoint tests
pytest tests/api/ -vcd frontend
# Run type checker
npm run check
# Run linter
npm run lint
# Run formatter check
npm run format -- --checkcd captain-hook
# Run tests
pytest tests/test_models.py -vGuidelines:
- Write tests for new features
- Ensure all tests pass before submitting a PR
- Aim for >70% code coverage on new code
- Include both happy path and error cases
- One feature/fix per PR — Keep PRs focused and reviewable
- Write clear commit messages — Use conventional commits style (see below)
- Update documentation — If you change behavior, update docs
- Add tests — Include tests for new features or bug fixes
- Keep commits atomic — Each commit should be a logical unit
Use Conventional Commits format:
type(scope): description
[optional body]
[optional footer]
Types:
feat— New featurefix— Bug fixdocs— Documentation changesstyle— Code style changes (formatting, semicolons, etc.)refactor— Code refactoring without feature changesperf— Performance improvementstest— Adding or updating testschore— Build system, dependencies, etc.
Scope: Component or area affected (optional but recommended)
Examples:
feat(session-timeline): add zoom control
fix(api): handle empty project directories
docs(readme): update installation instructions
refactor(frontend): extract chart component
test(models): add coverage for edge cases
- Push your branch
git push origin feature/your-feature-name-
Create a Pull Request with:
- Clear title describing the changes
- Description explaining the problem and solution
- Reference any related issues (#123)
- List of changes made
- Testing instructions (if not obvious)
-
Ensure all checks pass:
- Linting checks pass
- Tests pass
- Type checking passes
- No merge conflicts
-
Respond to reviews — Address feedback and push updates
-
Merge — Once approved, the maintainer will merge
For detailed information, see CLAUDE.md.
| Directory | Purpose |
|---|---|
api/ |
FastAPI backend with Pydantic models |
api/models/ |
Data models for Claude Code storage |
api/routers/ |
API endpoint definitions |
api/db/ |
Database utilities |
api/tests/ |
API tests |
frontend/src/routes/ |
SvelteKit pages |
frontend/src/lib/ |
Reusable components and utilities |
captain-hook/ |
Pydantic models for Claude Code hooks |
- Create a new router file in
api/routers/ - Define the endpoint with proper type hints and docstrings
- Add tests in
api/tests/api/ - Update README.md API table
- Run
ruff checkandpytest
- Create a route directory in
frontend/src/routes/ - Add
+page.sveltewith TypeScript - Add any components in
frontend/src/lib/components/ - Run
npm run checkandnpm run lint - Test in development server
- Update relevant
.mdfiles - Ensure code examples are accurate
- Check links are valid
- Run spelling and grammar checks
- Check SETUP.md for installation help
- See CLAUDE.md for development guidance
- Ask in GitHub Discussions (if available)
- Open an issue for questions
By contributing, you agree that your contributions will be licensed under the Apache License 2.0 (see LICENSE).
Thank you for contributing to Claude Code Karma!