Thank you for your interest in contributing to Loopi! This document provides guidelines for development and contribution.
- Node.js 20 or higher
- npm or yarn
- Git
- Anthropic API key
-
Fork the repository
-
Clone your fork:
git clone https://github.com/YOUR_USERNAME/loopi.git cd loopi -
Add upstream remote:
git remote add upstream https://github.com/nicholaspsmith/loopi.git
-
Install dependencies:
npm install
-
Copy environment variables:
cp .env.example .env.local
-
Configure your
.env.localwith your API keys -
Initialize the database:
npm run db:init
main- Production-ready code- Feature branches -
[issue-number]-feature-description
-
Create a new branch:
git checkout -b 123-add-new-feature
-
Make your changes following our code style
-
Write or update tests for your changes
-
Run tests locally:
npm test npm run test:integration -
Run linting and type checking:
npm run lint npm run type-check
-
Commit your changes following commit conventions (see below)
-
Push to your fork:
git push origin 123-add-new-feature
-
Create a Pull Request
- Use TypeScript for all new code
- Enable strict mode
- Avoid
anytypes - use proper typing - Use interfaces for object shapes
- Use type aliases for unions and primitives
- Use functional components with hooks
- Prefer Server Components (default in Next.js 15)
- Mark Client Components explicitly with
'use client' - Keep components focused and single-responsibility
- Extract reusable logic into custom hooks
- Components in
components/[feature]/ComponentName.tsx - API routes in
app/api/[endpoint]/route.ts - Types in
types/index.tsor feature-specific type files - Utilities in
lib/[category]/utility.ts
- Components: PascalCase (e.g.,
MessageList.tsx) - Files: camelCase for utilities, PascalCase for components
- Variables: camelCase
- Constants: SCREAMING_SNAKE_CASE
- Types/Interfaces: PascalCase
Subject line (72 characters max)
Co-Authored-By: Your Name <your.email@example.com>
- Subject line: 72 characters maximum
- One responsibility per commit: Each commit should do one thing
- Imperative mood: "Add feature" not "Added feature"
- No AI attribution: Don't mention AI tools in commits
- Body format: Only include Co-Authored-By line if applicable
Good:
Add ARIA labels to quiz interface
Co-Authored-By: Claude <noreply@anthropic.com>
Bad:
Added ARIA labels, fixed keyboard navigation, and updated docs
This commit makes several changes to improve accessibility across
the application including ARIA labels and keyboard support.
- All new features must include tests
- Maintain minimum 70% code coverage
- Test critical user paths end-to-end
-
Unit Tests (Vitest)
- Test individual functions and components
- Location:
tests/unit/ - Run:
npm test
-
Component Tests (React Testing Library)
- Test React component behavior
- Location:
tests/component/ - Run:
npm run test:component
-
Integration Tests (Playwright)
- Test complete user journeys
- Location:
tests/integration/ - Run:
npm run test:integration
// Unit test example
import { describe, it, expect } from 'vitest'
import { calculateNextReview } from '@/lib/fsrs/scheduler'
describe('FSRS Scheduler', () => {
it('should calculate next review date correctly', () => {
const result = calculateNextReview(/* params */)
expect(result).toBeDefined()
})
})- Tests pass locally
- Code is properly typed (no TypeScript errors)
- Linting passes (
npm run lint) - Changes are documented (JSDoc comments, README updates)
- Commit messages follow conventions
Include:
- What: Brief description of changes
- Why: Reason for the changes
- How: Technical approach
- Testing: How to test the changes
- Screenshots: For UI changes
- At least one maintainer must approve
- All CI checks must pass
- No merge conflicts with main
- Branch must be up to date with main
- Be respectful and constructive
- Focus on code quality, not personal preferences
- Explain why changes are needed
- Approve when satisfied, request changes if needed
- Address all review comments
- Ask for clarification if needed
- Update PR description if scope changes
- Be responsive to feedback
loopi/
├── app/ # Next.js App Router
│ ├── (auth)/ # Auth pages (login, signup)
│ ├── (protected)/ # Protected routes (goals, quiz)
│ └── api/ # API routes
├── components/ # React components
├── lib/ # Shared utilities
├── types/ # TypeScript types
├── tests/ # Test files
├── public/ # Static assets
└── specs/ # Feature specifications
This project includes AI-assisted development tools organized into three categories.
Model Context Protocol servers run as background processes and provide tools to AI agents (Claude Code).
Semantic code search using vector embeddings:
| Tool | Purpose |
|---|---|
index_codebase |
Build/rebuild the vector index of code files |
search_code |
Natural language search (e.g., "authentication logic") |
get_index_status |
Check if index exists and file counts |
clear_index |
Delete the index to start fresh |
Symbolic code navigation for precise, structure-aware operations:
| Tool | Purpose |
|---|---|
find_symbol |
Find functions/classes/methods by name path |
get_symbols_overview |
List all symbols in a file |
find_referencing_symbols |
Find where a symbol is used |
replace_symbol_body |
Edit a specific function/method |
insert_before/after_symbol |
Add code at specific positions |
Invoke by typing /command in Claude Code:
| Command | Purpose |
|---|---|
/speckit.specify |
Create feature specifications |
/speckit.clarify |
Resolve spec ambiguities |
/speckit.plan |
Generate implementation plans |
/speckit.tasks |
Generate task breakdowns |
/speckit.analyze |
Cross-artifact consistency check |
/speckit.implement |
Execute implementation tasks |
Numbered aliases exist (/2.specify, /3.plan, /4.1.analyze) for faster autocomplete.
Defined in .claude/agents/ - spawned by Claude Code for focused tasks:
| Agent | When to Use |
|---|---|
review-agent |
Code review before pushes (gates all pushes) |
test-agent |
Writing/fixing tests (Vitest, Playwright) |
ui-agent |
React components, styling |
db-agent |
Schema, migrations, Drizzle queries |
git-agent |
Commits, PRs, rebases |
deploy-agent |
Docker, CI/CD, production |
spec-agent |
Feature planning |
| Tool Type | Primary User |
|---|---|
| MCP tools (lance-context, serena) | Agents - Claude Code uses these to navigate/search code efficiently |
Slash commands (/speckit.*) |
Humans - You invoke these to drive workflows |
| Subagents | Agents - Claude Code spawns these for specialized tasks |
- Add JSDoc comments to all exported functions
- Document complex logic with inline comments
- Keep comments up to date with code changes
- Update README.md for user-facing changes
- Update specs/ for new features
- Add API documentation for new endpoints
- Questions: Open a GitHub Discussion
- Bugs: Open a GitHub Issue
- Security: Email security@loopi.com (do not open public issues)
By contributing, you agree that your contributions will be licensed under the MIT License.
Contributors will be recognized in:
- GitHub contributors list
- Release notes (for significant contributions)
- Project documentation (for major features)
Thank you for contributing to Loopi!