Skip to content

Commit d5866e3

Browse files
committed
Instruct the agents
1 parent cc43325 commit d5866e3

2 files changed

Lines changed: 52 additions & 4 deletions

File tree

AGENTS.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,58 @@
1111
- Keep notes in `notes/` as markdown files named `dd-mm-yy-topic.md`
1212

1313
## Coding Conventions
14+
15+
### Naming
16+
- Never shorten self-documentary names unless the short form is also self-documentary and well-known (e.g. `btn`, `el`, `i` are OK; `ct`, `coll`, `sub` are not)
17+
- Replace magic numbers with named constants
18+
- Use pronounceable, searchable names
19+
- Function names must accurately describe the operation, not the caller's intent
20+
- Prefer domain-specific terms over generic words (e.g. `node` over `item` when the domain calls them nodes)
21+
- Avoid encodings — don't append prefixes or type information
22+
23+
### Functions
24+
- Functions should do one thing
25+
- Prefer fewer arguments (ideally ≤ 3)
26+
- Functions should have no side effects — do what the name suggests and nothing else
27+
- Don't use flag arguments; split into separate functions
28+
29+
### Comments
30+
- Always try to explain yourself in code first; comment only when code can't be clear enough on its own
31+
- Don't add obvious/redundant comments
32+
- Don't comment out code — just remove it (version control exists)
33+
- Use comments for intent, clarification, or warning of consequences
34+
- Always use standard comment styles, no extra dashes or decorations
35+
- In multiline comments, add blank lines between logical points
36+
37+
### Structure
1438
- Respect existing indentation style in each file
1539
- Keep lines shorter than 80 columns (including comments), but don't break a line just to shave a few characters if it hurts readability
40+
- Don't break a logical unit of code across lines when it fits on one line
1641
- No trailing whitespace
17-
- In multiline comments, add blank lines between logical points
42+
- Separate concepts vertically with blank lines
43+
- Related code should appear vertically dense (close together)
44+
- Declare variables close to their usage
45+
- Dependent functions should be close to each other
46+
- Place called functions below their callers (downward direction)
47+
48+
### General
49+
- Be consistent — if you do something a certain way, do all similar things the same way
50+
- Avoid negative conditionals (prefer `isActive` over `isInactive`)
51+
- Encapsulate boundary conditions in one place
52+
- Don't repeat yourself (DRY), but don't abstract prematurely either
1853

1954
### JS
2055
- Avoid semicolons unless absolutely necessary
2156
- Always use curly braces {} for control structures (if, for, while, etc.), even for single statements
2257
- 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., `=> ({...})`)
2358
- Respect default JSHint rules
24-
- Break logical operator chains (&&, ||) across lines only when significantly long
59+
- Keep logical operator chains (&&, ||) on one line unless they exceed 80 columns
2560
- Keep short destructured imports on one line; break across lines only when exceeding 80 columns
2661
- Keep ternary `?` at end of line, not start of next
2762
- Always check for unused imports after finishing work on a module
2863

2964
### CSS
30-
- Order CSS properties from layout-affecting to cosmetic: positioning → display/layout → box model (padding, border) → typography → background/color → decoration (shadow, opacity) → animation → z-index
65+
- Order CSS properties from layout-affecting to cosmetic: positioning/z-index → display/layout → box model (padding, border) → typography → background/color → decoration (shadow, opacity) → animation
3166
- Never use arbitrarily high z-index values; use the lowest value that works
3267

3368
## Testing

src/cms/server/public/AGENTS.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,18 @@
99
- `app/components/` holds reusable components
1010
- Feature-specific modules live in their own folders under `app/components/` (e.g., `app/components/explorePanel/`)
1111

12+
## Coding Conventions
13+
14+
### HTML Templates
15+
- Extracted sub-template functions should own their
16+
wrapper element, not just return inner content
17+
- Extracted sub-template functions should co-locate
18+
their relevant `<style>` block
19+
20+
### CSS
21+
- Prefix all CSS classes within a component with the
22+
component name (e.g. `content-panel-divider`, not
23+
`content-divider`)
24+
1225
## Verification
13-
- After moving/renaming files or changing imports, check the browser console for errors (server runs on port 8080)
26+
- After moving/renaming files or changing imports, check the browser console for errors (server runs on port 8080)

0 commit comments

Comments
 (0)