Build with
consistency.
Mandatory coding standards, workflows, and best practices every developer on the Helium team must follow. Non-compliance results in PR rejection.
Git & Branch Standards
All branches must follow a strict naming convention to ensure traceability and consistency across the codebase.
Branch Naming Format
Every branch name must follow this exact pattern — no exceptions:
/-
Allowed Prefixes
| Prefix | Use When |
|---|---|
feature/ | Adding new functionality |
bugfix/ | Fixing a bug |
hotfix/ | Urgent production fix |
release/ | Preparing a release |
chore/ | Maintenance, dependency updates |
docs/ | Documentation changes only |
refactor/ | Code restructuring without behavior change |
Examples
feature/HE2-142-add-team-invite-flow
bugfix/HE2-305-fix-thread-pagination
hotfix/HE2-410-patch-auth-redirect
chore/HE2-99-upgrade-nextjs
refactor/HE2-200-simplify-billing-service
myfix # No prefix, no ticket
Feature/add-stuff # Wrong case
feature/addTeamInviteFlow # camelCase not allowed
fix_something_quick # Underscores not allowed
john/testing # Names are not prefixes
Main Branch Rules
mainmain.Commit Message Standards
All commits must follow the Conventional Commits specification for automated changelogs and clear history.
Format
():
auth, billing, agent)Allowed Types
| Type | When to Use |
|---|---|
feat | New feature or functionality |
fix | Bug fix |
docs | Documentation only |
refactor | Code change that neither fixes a bug nor adds a feature |
test | Adding or updating tests |
chore | Build process, tooling, dependency updates |
ci | CI/CD pipeline changes |
perf | Performance improvement |
Examples
feat(agent): add retry logic for failed sandbox executions
fix(billing): prevent duplicate Stripe webhook processing
refactor(knowledge-base): extract chunking into dedicated service
test(auth): add integration tests for phone auth flow
chore(deps): upgrade @tanstack/react-query to v5
ci(deploy): add staging environment to GitHub Actions
perf(redis): batch cache invalidation for thread updates
fixed stuff # No type, vague
feat: Add New Feature. # Trailing period, wrong case
update # No type, no scope
WIP # Never commit WIP to shared branches
Co-Authored-By lines for Anthropic or Claude in commit messages.
Pull Request Standards
PRs are the primary quality gate. Every PR must be reviewable, well-described, and appropriately sized.
PR Size Limits
If your PR is growing large, split it into logical, independently reviewable chunks. Each chunk should be functional on its own.
PR Title
Follow the same Conventional Commits format as commit messages:
feat(agent): add retry logic for failed sandbox executions
Required PR Description
Every PR must include all of the following sections:
- Added retry logic for sandbox execution failures
- Implements exponential backoff with max 3 retries
- Addresses intermittent timeout issues reported in #142
Fixes #142
- [ ] New feature
- [ ] Bug fix
- [ ] Refactor
- [ ] Documentation
- [ ] CI/CD
- [ ] Other (describe)
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed (describe steps)
- [ ] Feature flag verified in staging
- [ ] Code follows project conventions
- [ ] No secrets, API keys, or tokens committed
- [ ] No console.log or debug statements left in
- [ ] No any types in TypeScript
- [ ] Feature flag wraps new functionality
- [ ] Database migrations are backward-compatible
- [ ] Error handling follows project patterns
- [ ] Accessibility checked (if UI change)
Review Rules
Feature Flags
Every new feature, UI change, or behavioral modification must be wrapped in a feature flag. No exceptions.
Implementation
// Use the feature flag hook
const { isEnabled } = useFeatureFlag('new-thread-ui');
if (isEnabled) {
return < />;
}
return < />;
from utils.feature_flags import is_feature_enabled
async def process_request(team_id: ):
if await is_feature_enabled("new-billing-logic", team_id):
return await new_billing_flow()
return await legacy_billing_flow()
Feature Flag Lifecycle
OFFNaming Convention
-
Examples:
agent-retry-logic
billing-new-checkout
thread-markdown-preview
Security & Secrets
Committing secrets is a zero-tolerance policy. In regulated environments, this is a terminable offense.
Banned from Source Code
.env or .env.local file contentsWhere Secrets Belong
| Environment | Method |
|---|---|
| Local development | .env / .env.local files (already in .gitignore) |
| CI/CD | GitHub Actions secrets or environment variables |
| Staging / Production | AWS Secrets Manager / environment variables |
Pre-Commit Checks
--no-verify to bypass it.Frontend-Specific Security
NEXT_PUBLIC_ prefixdangerouslySetInnerHTML without DOMPurify sanitizationHttpOnly, Secure, SameSite=StrictBackend-Specific Security
secrets module for OTP/token generation — never randomhmac.compare_digest for secret comparison — never ==Environment & Tooling
All developers must use the exact versions specified in mise.toml. Use mise to manage tool versions automatically.
Required Tool Versions
Running Commands in the Right Directory
npm install from the project root creates a rogue node_modules/ and package-lock.json in the root — this breaks the build and pollutes the repo.
| Command | Run From | Not From |
|---|---|---|
npm install | frontend/ | Never from project root |
npm run dev | frontend/ | Never from project root |
npm run build | frontend/ | Never from project root |
uv sync | backend/ | Never from project root |
uv run api.py | backend/ | Never from project root |
uv run pytest | backend/ | Never from project root |
docker compose up | Project root (he2-beta/) | Not from subdirectories |
python setup.py | Project root (he2-beta/) | Not from subdirectories |
Local Development Setup
# 1. Clone and enter the repo
git clone <repo-url> && cd he2-beta
# 2. Run the setup wizard
python setup.py
# 3. Install frontend dependencies
cd frontend && npm install
# 4. Install backend dependencies
cd ../backend && uv sync
# 5. Start Redis (required for backend)
docker compose up redis
# 6. Start backend (new terminal, from backend/)
cd backend && source .venv/bin/activate && uv run api.py
# 7. Start frontend (new terminal, from frontend/)
cd frontend && npm run dev
Environment Variables
=localhost # use 'redis' inside Docker
=... # LLM provider
=... # LLM provider
=... # Sandbox provider
=... # Web search
=http://localhost:8000/api
=development
Frontend Standards
TypeScript strict mode, shadcn/ui components, Tailwind CSS 4, and React Query. These are non-negotiable defaults.
TypeScript
tsconfig.json.any typesunknown if truly needed. any defeats the purpose of TypeScript.any.Components
components/ui/<button>, <input>, <select> directly.<i className="ri-icon-name-line">import from react-icons. Remix Icons is the only icon library.State Management
| What | Tool |
|---|---|
| Server state (API data) | React Query (@tanstack/react-query) |
| Global client state | Zustand stores (stores/) |
| Local component state | useState / useReducer |
| Form state | React Hook Form |
Styling
style={{}} attributesCode Quality
console.log in committed codenpm run lint before pushing.npm run format:check before pushing.Backend Standards
Python with full type annotations, async/await for all I/O, Pydantic models, and domain-driven structure.
Python Rules
async/await for all I/O operationsDomain-Driven Structure
domain/
└── <feature>/
├── api/ # Routes
├── service/ # Business logic
├── repository/ # Data access
└── models/ # Pydantic models
Database
backend/supabase/migrations/ as SQL filesError Handling
LLM Integration
infrastructure/llm/. Never call LLM providers directly.Testing Standards
70% minimum coverage threshold. PRs that drop coverage below this will be blocked by CI.
Backend — pytest Markers
| Marker | When to Use |
|---|---|
@pytest.mark.unit | No external dependencies needed |
@pytest.mark.integration | Requires DB, Redis, or external services |
@pytest.mark.property | Hypothesis property-based tests |
@pytest.mark.slow | Tests that take >5 seconds |
# Run unit tests before pushing
uv run pytest -m "not integration"
Frontend Testing
# Run tests before pushing
npm test
Code Review Checklist
Use this checklist when reviewing or self-reviewing a PR. Every item must be checked before requesting a merge.
Quick Reference Card
Everything you need at a glance. Bookmark this section.
feature/HE2-123-add-widgetfeat(widget): add interactive widget to dashboardfeat(widget): add interactive widget to dashboard< 400 lines.env only, never in codeRun from frontend/, NEVER from rootRun from backend/All new features behind flagsDeleted after mergeRequired · 70% coverage minimumNo any in TS · type all Python functionsSOC 2 Type 2 · GDPR