Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion docs/tone_of_voice.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,17 @@ Data over description - Show metrics, not marketing.
Write complete, runnable examples with error handling, expected outputs, and realistic values (use environment variables, not placeholders).

```javascript
const apiKey = process.env.API_KEY;
function calculateTotal(numbers) {
if (!Array.isArray(numbers)) {
throw new Error('Input must be an array');
}
if (!numbers.every((num) => typeof num === 'number' && !Number.isNaN(num) && isFinite(num))) {
throw new Error('Input must contain only finite numbers');
}
return numbers.reduce((sum, num) => sum + num, 0);
}

const apiKey = process.env.API_KEY; // Use only if needed for API calls

try {
const result = calculateTotal([10, 20, 30]);
Expand Down