🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
chore(claude-code): CC should prefer params objects when writing funcs (#11620)
Hassieb Pakzad7d328b404e0b
diff --git a/.claude/skills/backend-dev-guidelines/resources/services-and-repositories.md b/.claude/skills/backend-dev-guidelines/resources/services-and-repositories.mdindex 5a50e4a4c7..bad72587a6 100644--- a/.claude/skills/backend-dev-guidelines/resources/services-and-repositories.md+++ b/.claude/skills/backend-dev-guidelines/resources/services-and-repositories.md@@ -645,7 +645,42 @@ async doIt()async execute()```-### 3. Return Types+### 3. Use Params Objects for Multiple Arguments++When a function receives multiple arguments, use a single params object instead of positional arguments:++```typescript+// ❌ BAD - Positional arguments are unclear and can be swapped+async function createTrace(+ projectId: string,+ userId: string,+ sessionId: string,+ name: string,+) {}++// Call site - which string is which?+await createTrace(projectId, userId, sessionId, name);++// ✅ GOOD - Params object makes intent clear+async function createTrace(params: {+ projectId: string;+ userId: string;+ sessionId: string;+ name: string;+}) {}++// Call site - clear and prevents argument swapping bugs+await createTrace({ projectId, userId, sessionId, name });+```++**Benefits:**++- More readable at call sites+- Prevents bugs when positional arguments of the same type are accidentally swapped+- Easier to add optional parameters later+- Self-documenting code++### 4. Return TypesAlways use explicit return types:@@ -659,7 +694,7 @@ async deleteUser(id: string): Promise<void> {}async createUser(data) {} // No types!```-### 4. Error Handling+### 5. Error HandlingServices should throw meaningful errors:@@ -679,7 +714,7 @@ if (!user) {}```-### 5. Avoid God Services+### 6. Avoid God ServicesDon't create services that do everything:diff --git a/CLAUDE.md b/CLAUDE.mdindex a2b26b119b..6bab82f103 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -192,6 +192,21 @@ To get a project, use the `get_project` capability with the full project name as## TypeScript Best Practices- In TypeScript, if possible, don't use the `any` type+- **Use a single params object for functions with multiple arguments** - This makes code more readable at call sites and prevents bugs when arguments of the same type are accidentally swapped:++```typescript+// ❌ Bad - positional arguments are unclear and can be swapped without type errors+function sendMessage(userId: string, sessionId: string, projectId: string) {+ // ...+}+sendMessage(someString, someOtherString, anotherString); // Which is which?++// ✅ Good - params object makes intent clear and prevents argument swapping+function sendMessage(params: { userId: string; sessionId: string; projectId: string }) {+ // ...+}+sendMessage({ userId: someString, sessionId: someOtherString, projectId: anotherString });+```## General Coding Guidelines- For easier code reviews, prefer not to move functions etc around within a file unless necessary or instructed to do so