- 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
- An SSG with a built-in CMS studio — not a headless CMS or bolt-on editor
- Keep notes in
notes/as markdown files nameddd-mm-yy-topic.md - After generating an image file, reveal it in Finder (
open -R <path>)
- Never shorten self-documentary names unless the short form is also self-documentary and well-known (e.g.
btn,el,iare OK;ct,coll,subare not) - Replace magic numbers with named constants
- Use pronounceable, searchable names
- Function names must accurately describe the operation, not the caller's intent
- Prefer domain-specific terms over generic words (e.g.
nodeoveritemwhen the domain calls them nodes) - Avoid encodings — don't append prefixes or type information
- Functions should do one thing
- Prefer fewer arguments (ideally ≤ 3)
- Functions should have no side effects — do what the name suggests and nothing else
- Don't use flag arguments; split into separate functions
- Always try to explain yourself in code first; comment only when code can't be clear enough on its own
- Don't add obvious/redundant comments
- Don't comment out code — just remove it (version control exists)
- Use comments for intent, clarification, or warning of consequences
- Always use standard comment styles, no extra dashes or decorations
- In multiline comments, add blank lines between logical points
- Respect existing indentation style in each file
- Keep lines shorter than 80 columns (including comments), but don't break a line just to shave a few characters if it hurts readability
- Don't break a logical unit of code across lines when it fits on one line
- No trailing whitespace
- Separate concepts vertically with blank lines
- Related code should appear vertically dense (close together)
- Declare variables close to their usage
- Dependent functions should be close to each other
- Place called functions below their callers (downward direction)
- Be consistent — if you do something a certain way, do all similar things the same way
- Avoid negative conditionals (prefer
isActiveoverisInactive) - Encapsulate boundary conditions in one place
- Don't repeat yourself (DRY), but don't abstract prematurely either
- Avoid semicolons unless absolutely necessary
- Always use curly braces {} for control structures (if, for, while, etc.), even for single statements
- For multiline arrow functions without explicit parentheses, always use curly braces with return (e.g.,
=> { return ... }, not=> exprspanning lines). Implicit return with parentheses is OK (e.g.,=> ({...})) - Respect default JSHint rules
- Keep logical operator chains (&&, ||) on one line unless they exceed 80 columns
- Keep short destructured imports on one line; break across lines only when exceeding 80 columns
- Keep ternary
?at end of line, not start of next - Always spread function arguments across multiple lines when the call exceeds 80 columns
- Always check for unused imports after finishing work on a module
- Order CSS properties from layout-affecting to cosmetic: positioning/z-index → display/layout → box model (padding, border) → typography → background/color → decoration (shadow, opacity) → animation
- Never use arbitrarily high z-index values; use the lowest value that works
- File naming:
ModuleName.spec.js(matching source file casing) - Glob pattern:
src/**/*.spec.js - Use
Promise.all()for independent async file ops in setup/teardown - Only use
t.plan()for async or non-deterministic tests
- When arguments are short enough (1–2 words each), keep the entire assertion on one line
- Otherwise: assertion call on one line (e.g.,
t.ok(), actual/expected value on separate line, message on its own line - Blank line between consecutive assertions
.length === 1— element rendered exactly once.length !== 0— elements exist, multiple allowed- Never
.length > 0(ambiguous)
- One distinct behavior per test, no redundancy
- Prioritize edge cases and unexpected behaviors over basic type variations
- Remove functionally identical tests even across different scenarios