Skip to content

Commit 410ac79

Browse files
committed
Improve agents.md structure
1 parent 6156d8f commit 410ac79

1 file changed

Lines changed: 43 additions & 39 deletions

File tree

AGENTS.md

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,47 @@
1+
## Meta
2+
- When the user states a strong preference or asserts that something should always/never be done a certain way, ask if they'd like it added to this file for future threads
3+
4+
## Project
5+
<!-- Fill in over time -->
6+
7+
## Architecture
8+
<!-- Fill in over time -->
9+
10+
## Preferences
11+
<!-- e.g., "No TypeScript", "No bundlers", "Vanilla JS only" -->
12+
113
## Coding Conventions
2-
- Avoid semicolons unless it's absolutely necessary
3-
- Always use block statements even if it could be a one-liner
4-
- Always use curly braces {} for control structures (if, for, while, etc.), even if the body is a single statement
14+
- Avoid semicolons unless absolutely necessary
15+
- Always use curly braces {} for control structures (if, for, while, etc.), even for single statements
516
- For multiline arrow functions without explicit parentheses, always use curly braces with return (e.g., `=> { return ... }`, not `=> expr` spanning lines). Implicit return with parentheses is OK (e.g., `=> ({...})`)
6-
- Keep lines shorter than 80 columns (including comments)
7-
- Don't break a line just because it slightly exceeds 80 columns; keep it on one line if adding a few extra characters is necessary for clarity or to avoid awkward continuation
8-
- For multiple expressions with logical operators (&&, ||), break lines after each operator only when the combined expression is significantly long
9-
- No trailing whitespace at the end of lines
10-
- In multiline comments, add blank lines between logical points for readability
11-
- Respect existing indentation style when editing files (maintain consistency with surrounding code)
12-
- Keep ternary operator `?` at the end of the line, not at the start of the next line (avoid JSHint misleading line break warning)
13-
- Respect default JSHint rules and do not change coding style in ways that cause JSHint to report warnings
14-
- Keep short destructured imports on a single line (e.g., `const { foo, bar } = require('./module')`)
15-
- Break destructured imports across multiple lines only when they exceed 80 columns or contain many items
16-
17-
## Test Assertions Formatting
18-
- Assertion function call on one line (e.g., `t.ok(`, `t.equal(`, `t.notOk(`)
17+
- Keep lines shorter than 80 columns (including comments), but don't break a line just to shave a few characters if it hurts readability
18+
- Break logical operator chains (&&, ||) across lines only when significantly long
19+
- No trailing whitespace
20+
- In multiline comments, add blank lines between logical points
21+
- Respect existing indentation style in each file
22+
- Keep ternary `?` at end of line, not start of next
23+
- Respect default JSHint rules
24+
- Keep short destructured imports on one line; break across lines only when exceeding 80 columns
25+
26+
## Testing
27+
### Conventions
28+
- File naming: `ModuleName.spec.js` (matching source file casing)
29+
- Glob pattern: `src/**/*.spec.js`
30+
- Use `Promise.all()` for independent async file ops in setup/teardown
31+
- Only use `t.plan()` for async or non-deterministic tests
32+
33+
### Assertion Formatting
34+
- Assertion call on one line (e.g., `t.ok(`)
1935
- Actual/expected value on separate line
2036
- Message on its own line
21-
- Add blank line between consecutive assertions
22-
- Only use `t.plan()` for async or non-deterministic tests where assertions might be skipped; omit for sync tests
23-
24-
## Test File Naming
25-
- Create test files with the same name and casing as the module being tested, with `.spec.js` appended
26-
- Example: `FileSystemParser.js``FileSystemParser.spec.js`
27-
- Test files use the glob pattern `src/**/*.spec.js`
28-
29-
## Test File Operations
30-
- Use `Promise.all()` to parallelize independent async file operations (mkdir, writeFile, etc.) instead of awaiting them serially
31-
32-
## Test Suite Design
33-
- Write lean tests that avoid redundancy while covering optimal paths and edge cases
34-
- Each test should demonstrate one distinct behavior or scenario, not repeat what other tests already cover
35-
- Focus on meaningful differences: testing the same logic with different data types (strings vs numbers) is redundant; test different behavior patterns instead
36-
- Include edge cases and boundary conditions (empty inputs, zero values, falsy values, etc.)
37-
- Remove tests that are functionally identical to existing ones, even if they test the same function in different scenarios
38-
- Prioritize tests that demonstrate unexpected or complex behaviors over tests that verify basic functionality with different data types
39-
40-
## DOM Element Assertions
41-
- Use `.length === 1` to assert an element is rendered exactly once (strict, single element expectation)
42-
- Use `.length !== 0` to assert elements exist but allow multiple (when multiple are expected)
43-
- Never use `.length > 0` as it's ambiguous about whether one or multiple elements are expected
37+
- Blank line between consecutive assertions
38+
39+
### DOM Assertions
40+
- `.length === 1` — element rendered exactly once
41+
- `.length !== 0` — elements exist, multiple allowed
42+
- Never `.length > 0` (ambiguous)
43+
44+
### Design Principles
45+
- One distinct behavior per test, no redundancy
46+
- Prioritize edge cases and unexpected behaviors over basic type variations
47+
- Remove functionally identical tests even across different scenarios

0 commit comments

Comments
 (0)