Most of us review code in the wrong order. We spot a missing test or a style inconsistency before even asking whether the code is correct. We should think about it differently.
The first question should always be: Does this code do what it is supposed to do? If the answer is no, nothing else matters. Style, structure, tests - all secondary to correctness.
Once you are confident it is correct, ask if it is clear. Can someone else (or you, six months from now) understand what is happening and why? Clarity in code helps ensure it does not become a liability.
Then check whether it matches the style and conventions, because inconsistencies add cognitive load for everyone who reads the codebase afterward.
After that, look for duplication. Is this solving a problem that is already solved somewhere else? Could this be a shared utility?
Finally, ask whether it is well tested. Not just "are there tests" (non-sensical ones), but do the tests actually cover the meaningful cases?
Correctness. Clarity. Style. Deduplication. Tests. In that order, every time.
Hope this helps.
Like how it is easier to solve a maze backwards, try to think backwards when given a task or when you have a goal to achieve. Things become much simpler.
- planning - start from the launch date
- learning - ask what will help you grow
- building - start from the UX towards impl
- writing - decide the final key takeaways
- decisions - start with desired outcome
- career - start from the role you want and work backwards
Hope this helps.
Have a look at this video on how to spot and reduce hallucinations by the Anthropic team. Here's the summary:
• Be skeptical when asking for exact facts, statistics, or citations.
• Ask the AI to verify its own sources.
• Explicitly tell the AI it is "okay if you don't know" before starting your query.
• If you are unsure of an answer, ask the AI to assess its own confidence or suggest it re-check its work in a new chat.
• Always cross-reference critical information with trusted, external sources.
https://t.co/TZa4rXWTfp
A dependency version of one of our internal packages was raised without raising the package's version. The updated dependency has no bug, but we are still encountering that bug. Later, I found that the package's version hadn't been raised, so in the npm registry that version still has the older dependency.
So generally When we try to publish the npm package with the same version, it gets fails. What I learned is that Git isn't the source of truth, but the npm registry is in this case. 🥸
#discover #nodejs