- Be mindful about your token usage, we often have errors about too much tokens used.
- Always ensure to use the latest version of package when creating or updating a project.
- Don't use emojis unless very necessary (e.g. to make a joke)
- when you need to name an error variable (e.g. in a catch), name it
err, instead ofe& avoid single-letter variable names as much as possible (other than for numerical code). - use yaml if a project needs a configuration file
- always ensure that tests pass when owrking on a feature.
- use cargo check before any build to make sure that the code compiles.
- Use
aws-lc-rsfor crypto operations. - Use
reqwestwhen you need an HTTP client andaxumwhen you need an HTTP server. - Use
sqlxwhen you need to interact with a database. Use thesqlx::query_asfunction for database queries when relevant, to deserialize directly into a struct. - When working, always build the projects in debug mode to go faster.
- use the
tracingcrate for logs. - never use unwrap. If it's a
Resulthandle it, if it's anOption, use safe patterns such as.ok_or,if let Some()...
- projects setup: when asked to create a web application, always create a single page app with vite and preact, starting from the preact-ts template. Use
@tailwindcss/viteto setup tailwindcss with vite. - Use only tailwindcss for design and mantine for components. NEVER use css-in-js libraries, don't use inline styles, don't use separate CSS files unless strictly necessary.
- Always use our own preact-router from this repo for routing.
- Always make sure that the webapp compiles.
- ALWAYS use preact signals for state management. NEVER use the
useStatehook for state management. Use theuseSignalhook for component-scoped signals. More info here: https://preactjs.com/guide/v10/signals - Always use the following "dev" script in package.json
"dev": "vite --strictPort --port 4000 --host" - Use native links (
<a>HTML tags) as much as possible instaod of special components linkAnchoror similar. - when creating a button to move to another page, wrap it into a link insteaod of using
onClick={router.push(...)} - prefer minimalist, simple and elegant design.
- when building user interfaces for APIs, always allow the dev to configure the API_BASE_URL via en environment variable. And use a proxy in the vitejs config for the
/apipath to this custom API_BASE_URL env var. - Always use native HTML tags for text and headings (
<p>,<span>,<h1>,<h2>...) instead of components likeText,Headingetc... - When working on user interfaces, always create responsive user interfaces, and take in account mobile touch devices (so no too small buttons etc...)