- NEVER RUN GIT REVERT OR GIT RESTORE WITHOUT ASKING. NO DESTRUCTIVE GIT COMMANDS EVER WITHOUT EXPLICIT PERMISSION
- Use the simplest, flattest HTML structure that communicates the content — don't add wrapper elements or semantic tags unless they provide real value.
- keep html semantic, minimal and modern
- less ui is always better than too much
- no unessary labels or boxes within boxes
- don't add gradients to design unless it's specified as part of a project's design spec
- Don't give the user "refresh" buttons, data should always be fresh
- Don't give the user "save" buttons, forms should auto save on data change (never via a setInterval)
- Don't add text to explain the ui, ie don't put text explaining to the user what to do, the correct path should be obvious by the ui itself.
- Never leave TODOs, placeholder implementations, or no-op stubs. If something needs to work, wire it now. If you can't wire it yet, the task isn't done — don't close it.
- Follow the existing style in each touched file (some files differ).
- Avoid reformatting unrelated lines.
- Group imports as:
- Node built-ins (
node:*), - external packages,
- internal relative modules.
- Node built-ins (
- Keep type imports explicit with
import type. - Avoid wildcard imports.
- Never re-export code or types; always import directly from the source module.
- Preserve
stricttyping (tsconfig.jsonhasstrict: true). - Forbid
any; preferunknownat trust boundaries. - Narrow
unknownbefore property access. - Use literal unions for finite statuses/events.
- Use
typefor unions/aliases; useinterfacefor object contracts when useful. - Add explicit return types for exported functions/APIs.
PascalCase: classes, interfaces, Svelte components.camelCase: variables, functions, methods.SCREAMING_SNAKE_CASE: top-level constants.- Boolean names should be intentful (
is*,has*,should*). - Prefer descriptive cross-process naming over abbreviations.
- Do not add pass-through wrapper helpers that only call another function with the same arguments.
- If logic is generic/pure and not component-state specific, place it in the correct utility layer instead of defining it inside a component.
- Utility location is strict and must not drift:
- All shared/pure utilities go in
src/lib/utils/* - Do not create new utility folders. One pool:
src/lib/utils/. - Before adding a new helper, check
src/lib/utils/first and extend existing helpers when appropriate. - Never write a utility function in a context of where it's used. Always put it in the appropriate utils folder and import it.
- All shared/pure utilities go in
- Prefer inline expressions for trivial one-off formatting; only extract helpers when there is meaningful reuse or domain logic.
- When extracting a helper, use a name that communicates domain meaning. Avoid aliases that add indirection without behavior.
- Keep feature-specific stores, types, components, and tests together in the same feature folder under
src/lib/components/<feature>/. - Do not place feature-specific files in global buckets like
src/lib/stores/*orsrc/lib/types/*when they only serve one feature. - Reserve shared/global locations for truly cross-feature modules only (for example app-wide stores like status/projects/tasks).
- Fail fast for bad input (
TypeError/Errorwith clear messages). - For best-effort persistence, catch and continue intentionally.
- Log with context (
console.error("message", error)). - Do not silently swallow errors unless clearly intentional.
- Prefer
async/awaitover long promise chains. - If a promise is intentionally not awaited, handle rejection with
.catch.
- Do not use $effect unless you absolutely have to, most things don't need side effects.
- Prefer nested SvelteKit layouts for shared route-level UI composition; do not introduce wrapper components when a layout hierarchy solves it.
- When using Svelte don't fallback to react practices. If a global manager/store is the source of truth, read it directly where it is used.
- Components own their own data. If data is in a global store or available from the route (
page.params,page.route), read it directly where it's used. Do not compute it in a parent and pass it down as props unless the parent truly owns that data or behavior. - Use props at real generic boundaries. Use manager imports at feature/state boundaries.
- Do not create thin wrapper components or prop-forwarding layers that only relay manager state, manager methods, or route-derived values.
- In Svelte runes/state logic, keep derived values deterministic and side-effect free.
- Do not create rename-only
$derivedor$derived.byaliases for existing manager/store values. Only use local$derivedwhen it computes something new. - Bad:
when those values are only being forwarded or lightly renamed.
const state = $derived(epicRunManager.current); const currentTask = $derived(epicRunManager.currentTask);
- Good:
{#if epicRunManager.currentTask} {epicRunManager.currentTask.taskName} {/if} - Good:
const completedCount = $derived.by(() => { const current = epicRunManager.current; return current ? current.queue.filter((t) => t.status === "completed").length : 0; });
- NEVER use $derived or $derived.by for running side effects. $derived and $derived.by are strictly for deriving state.
- Always program to avoid side effects or mysterious behavior.
- Always prefer small components and refactor when they are getting too large.
- Do not write
onclick={() => { void handleSavePreWork(); }}. Preferonclick={handleSavePreWork}or, if the handler name matches, shorthand like{onclick}.
- Unit tests live near code (
*.test.ts/*.spec.ts). - Svelte component tests should use
@testing-library/svelte. - Prefer role/text-based assertions over brittle selectors.
- Keep tests deterministic and independent.
- During iteration, run one file or one test title first.
- Do not introduce new frameworks/tooling unless requested.
- Avoid incidental refactors.
- Do not change build/packaging config without a clear task need.
- Keep preload and renderer typing changes in sync.
- CSS should be systemic avoiding one off styles in routes unless absolutely needed.
- Always prefer existing CSS vars, tokens and systems before creating new ones.
- CSS customization should be done at a global level via an imported css file OR scoped to a component.
- Never add a "button" class to a
<button>element.