|
1 | 1 | #Coder Extension Development Guidelines |
2 | 2 |
|
| 3 | +##Working Style |
| 4 | + |
| 5 | +You're an experienced, pragmatic engineer. We're colleagues - push back on bad ideas and speak up when something doesn't make sense. Honesty over agreeableness. |
| 6 | + |
| 7 | +- Simple solutions over clever ones. Readability is a primary concern. |
| 8 | +- YAGNI - don't add features we don't need right now |
| 9 | +- Make the smallest reasonable changes to achieve the goal |
| 10 | +- Reduce code duplication, even if it takes extra effort |
| 11 | +- Match the style of surrounding code - consistency within a file matters |
| 12 | +- Fix bugs immediately when you find them |
| 13 | + |
| 14 | +##Naming and Comments |
| 15 | + |
| 16 | +Names should describe what code does, not how it's implemented: |
| 17 | + |
| 18 | +- Good:`Tool`,`RemoteTool`,`execute()` |
| 19 | +- Bad:`MCPToolWrapper`,`NewAPI`,`executeToolWithValidation()` |
| 20 | + |
| 21 | +Comments explain what code does or why it exists: |
| 22 | + |
| 23 | +- Never add comments about what used to be there or how things changed |
| 24 | +- Never use temporal terms like "new", "improved", "refactored", "legacy" |
| 25 | +- Code should be evergreen - describe it as it is |
| 26 | +- Do not add comments when you can instead use proper variable/function naming |
| 27 | + |
| 28 | +##Testing and Debugging |
| 29 | + |
| 30 | +- Tests must comprehensively cover functionality |
| 31 | +- Never mock behavior in end-to-end tests - use real data |
| 32 | +- Mock as little as possible in unit tests - try to use real data |
| 33 | +- Find root causes, not symptoms. Read error messages carefully before attempting fixes. |
| 34 | + |
| 35 | +##Version Control |
| 36 | + |
| 37 | +- Commit frequently throughout development |
| 38 | +- Never skip or disable pre-commit hooks |
| 39 | +- Check`git status` before using`git add` |
| 40 | + |
3 | 41 | ##Build and Test Commands |
4 | 42 |
|
5 | 43 | - Build:`yarn build` |
|
8 | 46 | - Lint:`yarn lint` |
9 | 47 | - Lint with auto-fix:`yarn lint:fix` |
10 | 48 | - Run all tests:`yarn test` |
11 | | -- Run specific test:`vitest ./src/filename.test.ts` |
12 | | -- CI test mode:`yarn test:ci` |
| 49 | +- Unit tests:`yarn test:ci` |
13 | 50 | - Integration tests:`yarn test:integration` |
| 51 | +- Run specific unit test:`yarn test:ci ./test/unit/filename.test.ts` |
| 52 | +- Run specific integration test:`yarn test:integration ./test/integration/filename.test.ts` |
14 | 53 |
|
15 | | -##Code Style Guidelines |
| 54 | +##Code Style |
16 | 55 |
|
17 | 56 | - TypeScript with strict typing |
18 | | --No semicolons (see`.prettierrc`) |
| 57 | +-Use semicolons |
19 | 58 | - Trailing commas for all multi-line lists |
20 | 59 | - 120 character line width |
21 | 60 | - Use ES6 features (arrow functions, destructuring, etc.) |
22 | 61 | - Use`const` by default;`let` only when necessary |
| 62 | +- Never use`any`, and use exact types when you can |
23 | 63 | - Prefix unused variables with underscore (e.g.,`_unused`) |
24 | | -- Sort imports alphabetically in groups: external → parent → sibling |
| 64 | +- Sort imports alphabetically in groups (see`import/order` in`.eslintrc.json`): external → parent → sibling |
25 | 65 | - Error handling: wrap and type errors appropriately |
26 | 66 | - Use async/await for promises, avoid explicit Promise construction where possible |
27 | | --Testfiles must be named`*.test.ts` and use Vitest |
| 67 | +-Unit testfiles must be named`*.test.ts` and use Vitest, they should be placed in`./test/unit/<path in src>` |