| Principle | Rule |
|---|---|
| SRP | Single Responsibility — each function/class does ONE thing |
| DRY | Don't Repeat Yourself — extract duplicates, single source of truth |
| KISS | Keep It Simple — simplest solution that works, optimize for readability |
| YAGNI | You Aren't Gonna Need It — don't build unused features |
| Boy Scout | Leave code cleaner than you found it |
| No commented-out code | Dead code must be removed. Version control keeps history. |
| Continuous refactoring | Clean as you go. Refactor before adding complexity. |
We follow Conventional Commits:
<type>(scope): <description>
| Type | Description |
|---|---|
feat |
New feature or significant change |
fix |
Bug fix |
refactor |
Code change that doesn't fix a bug or add a feature |
docs |
Documentation changes |
test |
Adding or modifying tests |
chore |
Maintenance, deps, tooling |
perf |
Performance improvement |
style |
Formatting, no logic change |
build |
Build system or external deps |
ci |
CI configuration |
revert |
Reverting a previous commit |
Do NOT extend this type list.
Examples:
feat(connections): unified ConnectionPicker modalfix(chat): preserve conversation history across turnsrefactor(settings): merge MCP tab with consoleStore
feature/*— new functionalityfix/*— bug fixhotfix/*— urgent production fix
Follows conventional commit: fix(chat): preserve conversation history
## Problem
[User/business impact, not technical detail]
## Solution
[Technical root cause + how the code changes fix it]- No
ascasts for data flow — use type guards or proper generics - No magic numbers — use named constants
- Max 20 lines per function (ideally 5-10)
- Max 3 arguments per function
- Guard clauses — early returns for edge cases
- Flat > nested — max 2 levels of nesting
- One component per file
- Props interfaces declared above the component
- No inline styles > 3 properties — extract to a
const stylesobject or CSS - Theme tokens via
useTheme()— never hardcode colors (except#FE5000accent)
- What imports this file? → They might break
- What does this file import? → Interface changes
- What tests cover this? → Tests might fail
- Is this shared? → Multiple places affected
Edit the file + all dependents in the SAME task.
- Unit tests for pure functions and stores
- Integration tests for API routes
- Smoke test before publish: open the app in a browser and test:
- Chat sends a message and gets a response
- Conversation history persists across turns
- Knowledge pipeline indexes a file
- MCP server connects
- Settings page loads without errors
- Export produces valid output
| Check | Command |
|---|---|
| TypeScript | npx tsc --noEmit |
| Tests | npx vitest run |
| Build | npm run build:all |
| Smoke | Open browser, test 6 flows above |
All 4 checks must pass before any publish.