<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Balraj Singh</title>
    <description>The latest articles on DEV Community by Balraj Singh (@balrajola).</description>
    <link>https://dev.to/balrajola</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1014157%2Fd959fcd4-1f8f-4a73-8c6c-58a956a18ca5.jpg</url>
      <title>DEV Community: Balraj Singh</title>
      <link>https://dev.to/balrajola</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/balrajola"/>
    <language>en</language>
    <item>
      <title>Your Context Window Is Not a Knowledge Base</title>
      <dc:creator>Balraj Singh</dc:creator>
      <pubDate>Sat, 27 Jun 2026 21:46:47 +0000</pubDate>
      <link>https://dev.to/balrajola/your-context-window-is-not-a-knowledge-base-3a4h</link>
      <guid>https://dev.to/balrajola/your-context-window-is-not-a-knowledge-base-3a4h</guid>
      <description>&lt;p&gt;&lt;strong&gt;Part 2 of Practical AI Engineering: Beyond the Demo&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Bigger context windows create a tempting idea:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Put everything in. Let the model work it out.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is not context engineering. It is moving the junk drawer closer to the model.&lt;/p&gt;

&lt;p&gt;An AI system can receive a huge amount of text and still miss the one fact that matters. The problem is not only how much context fits. It is whether the right information reaches the model at the right moment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Context is an attention budget
&lt;/h2&gt;

&lt;p&gt;A context window is the information available to the model for the current call. It may contain:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;system instructions,&lt;/li&gt;
&lt;li&gt;the user’s task,&lt;/li&gt;
&lt;li&gt;examples,&lt;/li&gt;
&lt;li&gt;retrieved documents,&lt;/li&gt;
&lt;li&gt;tool descriptions,&lt;/li&gt;
&lt;li&gt;tool results,&lt;/li&gt;
&lt;li&gt;conversation history,&lt;/li&gt;
&lt;li&gt;project notes,&lt;/li&gt;
&lt;li&gt;intermediate plans.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All of these compete for attention.&lt;/p&gt;

&lt;p&gt;More context can help when it adds missing evidence. It can hurt when it adds stale, repeated, conflicting, or irrelevant material.&lt;/p&gt;

&lt;p&gt;The useful question is not:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How much context can this model hold?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What is the smallest high-signal context that makes the next decision easier?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The seven layers of useful context
&lt;/h2&gt;

&lt;p&gt;I use this mental model when deciding where information belongs.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. System instructions: stable behaviour
&lt;/h3&gt;

&lt;p&gt;Put durable rules here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;safety boundaries,&lt;/li&gt;
&lt;li&gt;output conventions,&lt;/li&gt;
&lt;li&gt;non-negotiable policies,&lt;/li&gt;
&lt;li&gt;the broad responsibility of the assistant.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do not turn the system prompt into a company wiki. Stable behaviour and changing knowledge have different lifecycles.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Task contract: the current job
&lt;/h3&gt;

&lt;p&gt;The task should contain:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the goal,&lt;/li&gt;
&lt;li&gt;relevant local context,&lt;/li&gt;
&lt;li&gt;constraints,&lt;/li&gt;
&lt;li&gt;expected output,&lt;/li&gt;
&lt;li&gt;acceptance checks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This layer should answer: &lt;strong&gt;What are we trying to accomplish now?&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Examples: the quality bar
&lt;/h3&gt;

&lt;p&gt;Examples are useful when the desired behaviour is easier to show than describe.&lt;/p&gt;

&lt;p&gt;One good code-review finding can teach evidence, severity, and scope better than several vague adjectives.&lt;/p&gt;

&lt;p&gt;Examples should be representative. A misleading example can anchor the model in the wrong direction.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Retrieval: changing evidence
&lt;/h3&gt;

&lt;p&gt;Use retrieval when the answer depends on information that is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;too large to keep in every prompt,&lt;/li&gt;
&lt;li&gt;frequently updated,&lt;/li&gt;
&lt;li&gt;specific to the current question,&lt;/li&gt;
&lt;li&gt;expected to be cited or verified.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Retrieval is not memory. It is a search step that selects evidence for this task.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Working memory: state that must survive
&lt;/h3&gt;

&lt;p&gt;Long-running work creates facts that are not part of the original documents:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;decisions already made,&lt;/li&gt;
&lt;li&gt;files changed,&lt;/li&gt;
&lt;li&gt;tests that failed,&lt;/li&gt;
&lt;li&gt;unresolved questions,&lt;/li&gt;
&lt;li&gt;the next planned step.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Store these outside the context window, then bring back the relevant parts.&lt;/p&gt;

&lt;p&gt;A simple &lt;code&gt;NOTES.md&lt;/code&gt; can be more useful than replaying an entire conversation.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Tools: possible actions
&lt;/h3&gt;

&lt;p&gt;A tool description is also context. It tells the model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;what action exists,&lt;/li&gt;
&lt;li&gt;when to use it,&lt;/li&gt;
&lt;li&gt;what arguments are valid,&lt;/li&gt;
&lt;li&gt;what result to expect,&lt;/li&gt;
&lt;li&gt;what side effects it may cause.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Poor tool descriptions create poor tool use. Ten overlapping tools with vague names can be worse than three clear ones.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Recent history: local continuity
&lt;/h3&gt;

&lt;p&gt;Recent messages can preserve the flow of a task. Old raw history often becomes noise.&lt;/p&gt;

&lt;p&gt;Keep decisions and unresolved items. Compress repeated explanations, large tool outputs, and dead ends.&lt;/p&gt;

&lt;h2&gt;
  
  
  A simple context compiler
&lt;/h2&gt;

&lt;p&gt;Instead of building one permanent mega-prompt, assemble context for each step.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;AgentTask&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;goal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;projectId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;buildContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;AgentTask&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;loadStablePolicy&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;projectState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;loadRelevantProjectNotes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;projectId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;evidence&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;retrieveEvidence&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;recentDecisions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;summarizeRecentDecisions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;projectId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;policy&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;task&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;projectState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;evidence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;recentDecisions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important idea is not this exact code. It is that context should be &lt;strong&gt;selected&lt;/strong&gt;, not dumped.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five common context failures
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Context omission
&lt;/h3&gt;

&lt;p&gt;The model never receives the fact needed to make the right choice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; confident but generic answers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; trace the answer back to the evidence available at that step.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Context pollution
&lt;/h3&gt;

&lt;p&gt;The prompt contains too much low-value material.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; the model follows an old detail and ignores the current goal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; remove repeated history, raw logs, and unrelated documents.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Context conflict
&lt;/h3&gt;

&lt;p&gt;Two instructions or sources disagree.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; inconsistent behaviour across similar runs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; define precedence. Prefer current, authoritative sources and expose the conflict when it cannot be resolved.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Context staleness
&lt;/h3&gt;

&lt;p&gt;The retrieved or remembered information is no longer true.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; a well-written answer based on an old policy or obsolete API.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; attach source dates, versions, and expiry rules. Retrieval needs freshness, not only similarity.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Context leakage
&lt;/h3&gt;

&lt;p&gt;Sensitive information reaches a model, tool, or sub-agent that does not need it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; excessive data exposure and a larger security boundary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; apply least privilege to context. Redact, scope, and route sensitive tasks deliberately.&lt;/p&gt;

&lt;h2&gt;
  
  
  Long tasks need context management, not just a larger window
&lt;/h2&gt;

&lt;p&gt;For work that spans many steps, three patterns are especially useful.&lt;/p&gt;

&lt;h3&gt;
  
  
  Compaction
&lt;/h3&gt;

&lt;p&gt;Summarise the important state and discard bulky history.&lt;/p&gt;

&lt;p&gt;Keep:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;architectural decisions,&lt;/li&gt;
&lt;li&gt;current failures,&lt;/li&gt;
&lt;li&gt;requirements,&lt;/li&gt;
&lt;li&gt;next actions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Drop:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;repeated tool output,&lt;/li&gt;
&lt;li&gt;abandoned paths,&lt;/li&gt;
&lt;li&gt;conversational filler.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Structured notes
&lt;/h3&gt;

&lt;p&gt;Let the agent write durable state outside the context window.&lt;/p&gt;

&lt;p&gt;For a coding task, that might be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Goal:
Migrate the retry path without changing the public API.

Decisions:
- Reuse the original idempotency key.
- Keep the existing timeout value.

Open issues:
- Integration test fails only on Windows.

Next:
- Inspect path handling in test fixtures.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Context isolation
&lt;/h3&gt;

&lt;p&gt;Use a focused sub-agent for a bounded investigation, then return a short result to the main agent.&lt;/p&gt;

&lt;p&gt;The main agent does not need every search query and failed attempt. It needs the conclusion, evidence, and uncertainty.&lt;/p&gt;

&lt;h2&gt;
  
  
  The four-C filter
&lt;/h2&gt;

&lt;p&gt;Before adding any context, ask whether it is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Correct:&lt;/strong&gt; Is it trustworthy?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Current:&lt;/strong&gt; Is it still valid?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compact:&lt;/strong&gt; Can it be made smaller without losing meaning?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connected:&lt;/strong&gt; Will it change the next decision?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If it fails the fourth test, it probably does not belong in the current context.&lt;/p&gt;

&lt;h2&gt;
  
  
  Context engineering in one sentence
&lt;/h2&gt;

&lt;p&gt;Prompt engineering focuses on what we say to the model.&lt;/p&gt;

&lt;p&gt;Context engineering focuses on what the system lets the model know at each step.&lt;/p&gt;

&lt;p&gt;That includes retrieval, memory, tools, history, and the rules that decide what gets included.&lt;/p&gt;

&lt;p&gt;A large context window is useful capacity. It is not an information architecture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where is your current AI workflow using “paste everything” as a substitute for context selection?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents" rel="noopener noreferrer"&gt;Effective context engineering for AI agents: Anthropic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/engineering/building-effective-agents" rel="noopener noreferrer"&gt;Building effective agents: Anthropic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2512.05470" rel="noopener noreferrer"&gt;Everything is Context: Agentic File System Abstraction for Context Engineering&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>llm</category>
      <category>rag</category>
    </item>
    <item>
      <title>Stop Writing Bigger Prompts. Start Writing Better Task Contracts</title>
      <dc:creator>Balraj Singh</dc:creator>
      <pubDate>Thu, 25 Jun 2026 20:02:47 +0000</pubDate>
      <link>https://dev.to/balrajola/stop-writing-bigger-prompts-start-writing-better-task-contracts-164d</link>
      <guid>https://dev.to/balrajola/stop-writing-bigger-prompts-start-writing-better-task-contracts-164d</guid>
      <description>&lt;p&gt;&lt;strong&gt;Part 1 of Practical AI Engineering: Beyond the Demo&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most developers think better prompting means finding better words.&lt;/p&gt;

&lt;p&gt;Add a role. Add more detail. Ask the model to “think step by step.” Keep extending the prompt until it becomes a small novel.&lt;/p&gt;

&lt;p&gt;That can improve an answer. It does not make the workflow reliable.&lt;/p&gt;

&lt;p&gt;After years of working on large software systems, I trust explicit contracts more than clever wording.&lt;/p&gt;

&lt;p&gt;For serious work, a prompt should look less like a clever question and more like a good engineering task. It should tell the model what success means, what evidence it can use, and where it must stop.&lt;/p&gt;

&lt;p&gt;I call this a &lt;strong&gt;task contract&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  A prompt asks. A task contract defines success.
&lt;/h2&gt;

&lt;p&gt;Compare these two requests.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prompt A
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Review this pull request and find any issues.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model must guess:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What kind of issues matter?&lt;/li&gt;
&lt;li&gt;Which files are in scope?&lt;/li&gt;
&lt;li&gt;Is it allowed to suggest a redesign?&lt;/li&gt;
&lt;li&gt;How should it report uncertainty?&lt;/li&gt;
&lt;li&gt;What does a useful answer look like?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now consider this version.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prompt B
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Goal:
Review this pull request for correctness and regression risk.

Context:
- This is a TypeScript service that processes subscription renewals.
- The diff changes retry handling after a payment timeout.
- Duplicate charges are the highest-risk failure.

Scope:
- Review the changed code and directly connected call paths.
- Do not comment on formatting or unrelated refactors.

Deliverable:
Return a table with:
1. severity,
2. file and line,
3. failure scenario,
4. evidence from the code,
5. smallest safe fix,
6. test that would catch it.

Acceptance checks:
- Do not report an issue without code evidence.
- Separate confirmed defects from possible risks.
- Say "not enough evidence" when the diff cannot support a conclusion.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second version is not better because it sounds smarter. It is better because it reduces hidden decisions.&lt;/p&gt;

&lt;p&gt;That is the real job of a useful prompt.&lt;/p&gt;

&lt;h2&gt;
  
  
  The five parts of a task contract
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Goal
&lt;/h3&gt;

&lt;p&gt;State the outcome, not merely the activity.&lt;/p&gt;

&lt;p&gt;Weak:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Look at this API.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Better:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Find behaviours that could cause an existing mobile client to break after this API change.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;“Look at” describes effort. “Find breaking behaviours” describes value.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Context
&lt;/h3&gt;

&lt;p&gt;Give the model the facts that change the answer.&lt;/p&gt;

&lt;p&gt;Useful context can include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the user or system affected,&lt;/li&gt;
&lt;li&gt;the current architecture,&lt;/li&gt;
&lt;li&gt;known constraints,&lt;/li&gt;
&lt;li&gt;the highest-risk failure,&lt;/li&gt;
&lt;li&gt;decisions already made.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do not paste everything you know. Add only information that should alter the model’s judgement.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Constraints
&lt;/h3&gt;

&lt;p&gt;Constraints define the edges of the problem.&lt;/p&gt;

&lt;p&gt;Examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Do not change the public API.
Use only libraries already in package.json.
Keep the migration reversible.
Do not include personal data in logs.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without constraints, an AI can produce a technically valid answer that is useless in your environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Deliverable
&lt;/h3&gt;

&lt;p&gt;Specify the shape of the result.&lt;/p&gt;

&lt;p&gt;You might ask for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a patch,&lt;/li&gt;
&lt;li&gt;a decision table,&lt;/li&gt;
&lt;li&gt;three options with trade-offs,&lt;/li&gt;
&lt;li&gt;a test plan,&lt;/li&gt;
&lt;li&gt;a JSON object matching a schema,&lt;/li&gt;
&lt;li&gt;a short recommendation followed by evidence.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A clear output format makes the response easier to review and easier to feed into the next step.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Acceptance checks
&lt;/h3&gt;

&lt;p&gt;This is the part most prompts miss.&lt;/p&gt;

&lt;p&gt;Acceptance checks let the model inspect its own work before returning it.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Before answering, verify that:
- every recommendation maps to a stated requirement,
- every factual claim has a source,
- the code compiles conceptually with the types shown,
- unresolved assumptions are listed,
- no out-of-scope files are changed.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These checks are not a guarantee. They are a lightweight test suite for the response.&lt;/p&gt;

&lt;h2&gt;
  
  
  One good example can beat another paragraph of instructions
&lt;/h2&gt;

&lt;p&gt;Developers often use vague role prompts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Act as a world-class senior software architect.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model still has to guess what “world-class” means.&lt;/p&gt;

&lt;p&gt;A short example is often more useful:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Good finding:
HIGH: retryPayment.ts:84
A timeout after the provider accepts payment can trigger a second charge.
Evidence: the retry path creates a new idempotency key.
Fix: reuse the original key until the operation reaches a terminal state.
Test: simulate provider success followed by a client-side timeout.

Bad finding:
"Improve error handling."
This is too broad and has no failure scenario or code evidence.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The example teaches the model your standard, not merely your aspiration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do not solve every AI problem inside the prompt
&lt;/h2&gt;

&lt;p&gt;A prompt becomes bloated when it absorbs responsibilities that belong elsewhere.&lt;/p&gt;

&lt;p&gt;Use this simple placement guide:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Information&lt;/th&gt;
&lt;th&gt;Better home&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Stable rules that apply to every request&lt;/td&gt;
&lt;td&gt;System instructions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The current goal and constraints&lt;/td&gt;
&lt;td&gt;User prompt or task contract&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A reusable procedure&lt;/td&gt;
&lt;td&gt;Skill, template, or workflow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Changing facts from documents&lt;/td&gt;
&lt;td&gt;Retrieval&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Previous decisions and project state&lt;/td&gt;
&lt;td&gt;Memory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;An action such as searching or running tests&lt;/td&gt;
&lt;td&gt;Tool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Proof that the result is acceptable&lt;/td&gt;
&lt;td&gt;Evaluator or deterministic check&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This matters because each layer changes at a different speed.&lt;/p&gt;

&lt;p&gt;Your security rules may stay stable for months. The current task may last ten minutes. A product document may change tomorrow. Mixing all three into one giant prompt makes the system harder to update and debug.&lt;/p&gt;

&lt;h2&gt;
  
  
  Treat prompts like code
&lt;/h2&gt;

&lt;p&gt;A production prompt deserves the same habits as production software.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keep representative cases
&lt;/h3&gt;

&lt;p&gt;Collect a small set of real tasks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a normal case,&lt;/li&gt;
&lt;li&gt;an ambiguous case,&lt;/li&gt;
&lt;li&gt;a missing-information case,&lt;/li&gt;
&lt;li&gt;an adversarial case,&lt;/li&gt;
&lt;li&gt;a high-risk case.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Define what good looks like
&lt;/h3&gt;

&lt;p&gt;Do not use “the answer feels better” as your only measure.&lt;/p&gt;

&lt;p&gt;Check things such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Did it follow the requested format?&lt;/li&gt;
&lt;li&gt;Did it use evidence?&lt;/li&gt;
&lt;li&gt;Did it respect scope?&lt;/li&gt;
&lt;li&gt;Did it expose uncertainty?&lt;/li&gt;
&lt;li&gt;Did it avoid a known failure?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Change one thing at a time
&lt;/h3&gt;

&lt;p&gt;When you change the prompt, model, retrieval, and tool set together, you do not know what caused the result.&lt;/p&gt;

&lt;p&gt;Prompt work becomes engineering when changes are testable.&lt;/p&gt;

&lt;h2&gt;
  
  
  A reusable template
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GOAL
What outcome should be produced?

CONTEXT
Which facts materially affect the answer?

CONSTRAINTS
What must the model do, avoid, or preserve?

DELIVERABLE
What exact form should the output take?

ACCEPTANCE CHECKS
How should the result be tested before it is returned?

UNCERTAINTY
What should the model do when evidence is missing?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You do not need every heading for every request. The point is to remove the decisions that matter most.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changes
&lt;/h2&gt;

&lt;p&gt;The future of prompting is not memorising magic phrases.&lt;/p&gt;

&lt;p&gt;It is making intent, constraints, and quality visible.&lt;/p&gt;

&lt;p&gt;A strong model can fill small gaps. It should not have to invent the definition of success.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is one prompt you keep making longer when the real problem is a missing acceptance check?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/engineering/building-effective-agents" rel="noopener noreferrer"&gt;Building effective agents: Anthropic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents" rel="noopener noreferrer"&gt;Effective context engineering for AI agents: Anthropic&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>productivity</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>5 Underrated NPM Packages You’re Not Using (But Should Be)</title>
      <dc:creator>Balraj Singh</dc:creator>
      <pubDate>Tue, 04 Mar 2025 09:58:50 +0000</pubDate>
      <link>https://dev.to/balrajola/5-underrated-npm-packages-youre-not-using-but-should-be-dn4</link>
      <guid>https://dev.to/balrajola/5-underrated-npm-packages-youre-not-using-but-should-be-dn4</guid>
      <description>&lt;p&gt;The world of NPM is massive. Over 2 million packages, and yet, most developers end up using the same 20-30 over and over again.&lt;/p&gt;

&lt;p&gt;React, Lodash, Express. The usual suspects.&lt;/p&gt;

&lt;p&gt;But what about the hidden gems? The ones that could make your workflow easier, cleaner, and smarter?&lt;/p&gt;

&lt;p&gt;Here are five underrated NPM packages that deserve more attention.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;code&gt;date-fns-tz&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Time zones are annoying. This makes them less so.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’ve ever scheduled an event across time zones, you know how quickly things get messy. Moment.js? Bloated. Manually handling offsets? A disaster waiting to happen.&lt;/p&gt;

&lt;p&gt;Enter &lt;code&gt;date-fns-tz&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it deserves more love:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built on &lt;code&gt;date-fns&lt;/code&gt;, so it’s modular and tree-shakable.&lt;/li&gt;
&lt;li&gt;Does one thing well: time zone management.&lt;/li&gt;
&lt;li&gt;No unnecessary overhead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Where it helps:&lt;/strong&gt;&lt;br&gt;
When you’re building apps that handle scheduling for users in different time zones.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;formatInTimeZone&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;date-fns-tz&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;timeZone&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;America/New_York&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;formattedDate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;formatInTimeZone&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yyyy-MM-dd HH:mm:ssXXX&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;formattedDate&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 2024-11-25 10:00:00-05:00&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. &lt;code&gt;clsx&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Writing messy className logic? Stop. Use this.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’ve written dynamic &lt;code&gt;className&lt;/code&gt; logic in React, you’ve probably seen something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;buttonClass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`btn &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;isActive&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;btn-active&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;isDisabled&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;btn-disabled&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It works. But it’s ugly.&lt;/p&gt;

&lt;p&gt;Enter &lt;code&gt;clsx&lt;/code&gt;. A tiny utility that makes class name logic elegant.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why you need this:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Handles conditional logic, arrays, and objects effortlessly.&lt;/li&gt;
&lt;li&gt;Automatically ignores falsy values.&lt;/li&gt;
&lt;li&gt;Makes your UI code cleaner and more readable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;clsx&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;clsx&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;isActive&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;isDisabled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;buttonClass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;clsx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;btn&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;btn-active&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;isActive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;btn-disabled&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;isDisabled&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;buttonClass&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// "btn btn-active"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. &lt;code&gt;ow&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Validation that doesn’t make you want to quit coding.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’ve written input validation manually, you know it gets repetitive fast.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ow&lt;/code&gt;, by Sindre Sorhus, makes it simple and declarative.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it’s underrated:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TypeScript-friendly with strong error messages.&lt;/li&gt;
&lt;li&gt;Expressive syntax that reads like English.&lt;/li&gt;
&lt;li&gt;Handles complex validations in a single line.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Where it helps:&lt;/strong&gt;&lt;br&gt;
Validating API responses, CLI inputs, or function arguments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ow&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ow&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;validateUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;ow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exactShape&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;minLength&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;integer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;positive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}));&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nf"&gt;validateUser&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;example@example.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt; &lt;span class="c1"&gt;// Passes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. &lt;code&gt;npm-check&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Your node_modules is a mess. This fixes it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Have you ever wondered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which dependencies are outdated?&lt;/li&gt;
&lt;li&gt;Which ones are unused?&lt;/li&gt;
&lt;li&gt;Which ones you accidentally forgot to install?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npm-check&lt;/code&gt; gives you an interactive way to clean things up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it’s useful:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finds outdated, unused, or missing dependencies.&lt;/li&gt;
&lt;li&gt;Works interactively, so you can update/uninstall with a keystroke.&lt;/li&gt;
&lt;li&gt;Works with both local and global packages.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx npm-check
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run that command, and you’ll get a nice interactive list of dependencies with options to update or remove them.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. &lt;code&gt;log-symbols&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Make your CLI logs actually readable.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ever built a CLI tool and thought, &lt;em&gt;this looks so plain&lt;/em&gt;?&lt;/p&gt;

&lt;p&gt;&lt;code&gt;log-symbols&lt;/code&gt; adds intuitive icons (✅ ❌ ⚠️) to your logs, making them clearer at a glance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why you should use it:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gives instant visual feedback in the terminal.&lt;/li&gt;
&lt;li&gt;Works across macOS, Linux, and Windows.&lt;/li&gt;
&lt;li&gt;Small but powerful.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;logSymbols&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;log-symbols&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;logSymbols&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;success&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Build completed successfully!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;logSymbols&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Failed to connect to the database.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;logSymbols&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;warning&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Using default configuration.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don’t just use what’s popular. Use what makes your life easier.&lt;/p&gt;

&lt;p&gt;The next time you find yourself repeating code or struggling with a common problem, take a detour into the lesser-known corners of NPM.&lt;/p&gt;

&lt;p&gt;What’s your favorite underrated NPM package?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>npm</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Modern JavaScript Patterns You’ll Want to Use in 2025.</title>
      <dc:creator>Balraj Singh</dc:creator>
      <pubDate>Tue, 25 Feb 2025 09:54:12 +0000</pubDate>
      <link>https://dev.to/balrajola/modern-javascript-patterns-youll-want-to-use-in-2025-3m4k</link>
      <guid>https://dev.to/balrajola/modern-javascript-patterns-youll-want-to-use-in-2025-3m4k</guid>
      <description>&lt;p&gt;JavaScript is always changing. Some patterns stick around, some fade, and some evolve into something we never saw coming.  &lt;/p&gt;

&lt;p&gt;Here’s a &lt;strong&gt;breakdown&lt;/strong&gt; of the JavaScript patterns.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Pattern Matching (Early Proposal Stage, But Promising)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Think of &lt;code&gt;switch&lt;/code&gt; statements—but better. Pattern matching, inspired by languages like Haskell and Scala, makes handling complex branching logic &lt;strong&gt;way cleaner&lt;/strong&gt;.  &lt;/p&gt;

&lt;p&gt;❗ &lt;strong&gt;Where it stands&lt;/strong&gt;: Still in &lt;strong&gt;Stage 1&lt;/strong&gt; of the &lt;a href="https://github.com/tc39/proposal-pattern-matching" rel="noopener noreferrer"&gt;TC39 Pattern Matching Proposal&lt;/a&gt;, meaning it’s experimental and far from being implemented in JavaScript yet.  &lt;/p&gt;

&lt;p&gt;📌 &lt;strong&gt;Why it matters&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
✔️ Reduces boilerplate&lt;br&gt;&lt;br&gt;
✔️ Makes conditions more readable&lt;br&gt;&lt;br&gt;
✔️ Handles nested destructuring elegantly  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; If this gets approved in the future, it’ll make &lt;code&gt;switch&lt;/code&gt; feel like a relic.  &lt;/p&gt;
&lt;h3&gt;
  
  
  2. &lt;strong&gt;Decorators (Closer to Standardization)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Decorators allow you to &lt;strong&gt;wrap functions &amp;amp; classes with extra functionality&lt;/strong&gt;.  &lt;/p&gt;

&lt;p&gt;📌 &lt;strong&gt;Where it stands&lt;/strong&gt;: Now in &lt;strong&gt;Stage 3&lt;/strong&gt;, meaning it’s closer to being finalized. &lt;a href="https://github.com/tc39/proposal-decorators" rel="noopener noreferrer"&gt;TC39 Proposal&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;📌 &lt;strong&gt;Why it matters&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
✔️ Cleaner than traditional wrappers&lt;br&gt;&lt;br&gt;
✔️ Perfect for logging, permissions, &amp;amp; class enhancements  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; If you use &lt;strong&gt;TypeScript&lt;/strong&gt;, start experimenting now.  &lt;/p&gt;
&lt;h3&gt;
  
  
  3. &lt;strong&gt;Module Federation (Micro-Frontend Hype)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Micro-frontends are here, and &lt;strong&gt;Webpack 5’s Module Federation&lt;/strong&gt; is making it easier than ever.  &lt;/p&gt;

&lt;p&gt;📌 &lt;strong&gt;Why it matters&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
✔️ Teams can deploy different parts of an app &lt;strong&gt;independently&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
✔️ Works well for &lt;strong&gt;large-scale applications&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;How it works&lt;/strong&gt;: &lt;a href="https://webpack.js.org/concepts/module-federation/" rel="noopener noreferrer"&gt;Webpack Docs&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; If you're working on a &lt;strong&gt;multi-team project&lt;/strong&gt;, this is a must-know.  &lt;/p&gt;
&lt;h3&gt;
  
  
  4. &lt;strong&gt;Proxy-Based Observables (Reactivity Without a Framework)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Vue.js made reactive programming cool, but &lt;strong&gt;JavaScript itself doesn’t provide built-in observable support yet&lt;/strong&gt;. Instead, developers are using &lt;strong&gt;Proxy-based reactivity&lt;/strong&gt; for lightweight state tracking.  &lt;/p&gt;

&lt;p&gt;📌 &lt;strong&gt;Why it matters&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
✔️ Lets you &lt;strong&gt;watch&lt;/strong&gt; changes dynamically&lt;br&gt;&lt;br&gt;
✔️ Eliminates &lt;strong&gt;heavy state management libraries&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;prop&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;prop&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; changed to &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;prop&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Proxy&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bob&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Logs: "name changed to Bob"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; Expect to see &lt;strong&gt;lightweight reactivity without frameworks&lt;/strong&gt;.  &lt;/p&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Immutable Data Patterns&lt;/strong&gt; (Avoiding Side Effects)
&lt;/h3&gt;

&lt;p&gt;More teams are &lt;strong&gt;moving away from mutation&lt;/strong&gt; and towards &lt;strong&gt;immutable state management&lt;/strong&gt;, but JavaScript does not &lt;strong&gt;natively enforce immutability&lt;/strong&gt;. Instead, libraries like &lt;strong&gt;Immutable.js&lt;/strong&gt; and &lt;strong&gt;Immer&lt;/strong&gt; help achieve this.  &lt;/p&gt;

&lt;p&gt;📌 &lt;strong&gt;Why it matters&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
✔️ Helps prevent unpredictable side effects&lt;br&gt;&lt;br&gt;
✔️ Makes debugging easier  &lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;Deep dive&lt;/strong&gt;: &lt;a href="https://immutable-js.github.io/immutable-js/" rel="noopener noreferrer"&gt;Immutable.js&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; Functional programming principles are &lt;strong&gt;not just hype&lt;/strong&gt;—they actually help.  &lt;/p&gt;

&lt;p&gt;Which of these patterns do you already use? Let me know in the comments.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>learning</category>
    </item>
    <item>
      <title>10 Hidden Gems in GitHub Actions for Automating Your Workflow</title>
      <dc:creator>Balraj Singh</dc:creator>
      <pubDate>Wed, 19 Feb 2025 10:40:05 +0000</pubDate>
      <link>https://dev.to/balrajola/10-hidden-gems-in-github-actions-for-automating-your-workflow-4gam</link>
      <guid>https://dev.to/balrajola/10-hidden-gems-in-github-actions-for-automating-your-workflow-4gam</guid>
      <description>&lt;p&gt;GitHub Actions has changed the game for automation. CI/CD, testing, and deployments? Sure, those are the basics. &lt;/p&gt;

&lt;p&gt;But what if I told you there’s a whole world of underrated Actions that can make your workflow smoother, faster, and—dare I say—effortless?&lt;/p&gt;

&lt;p&gt;Here are 10 lesser-known but insanely useful GitHub Actions you should be using.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. YAML Validator
&lt;/h3&gt;

&lt;p&gt;YAML is everywhere in automation, but one indentation mistake and boom—your pipeline is broken. This Action catches errors before you commit them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it’s a game-changer:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Saves you from debugging nightmare-inducing YAML misconfigurations.&lt;/li&gt;
&lt;li&gt;Essential for Kubernetes, GitHub workflows, and CI/CD.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Validate YAML&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ibiqlik/action-yaml-lint@v3&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;config_file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.yamllint'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Markdown Link Checker
&lt;/h3&gt;

&lt;p&gt;Ever had a README full of broken links? This Action scans your Markdown files and flags dead links before they embarrass you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Perfect for:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keeping documentation flawless.&lt;/li&gt;
&lt;li&gt;Avoiding those awkward “this link is broken” messages from users.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Check Markdown Links&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gaurav-nelson/github-action-markdown-link-check@v1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Auto Assign PRs
&lt;/h3&gt;

&lt;p&gt;Stop manually assigning PRs. This Action does it for you based on predefined rules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why you need it:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Saves time, especially for teams handling multiple PRs daily.&lt;/li&gt;
&lt;li&gt;Ensures code reviews don’t get lost in the shuffle.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Auto Assign PR&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kentaro-m/auto-assign-action@v1&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;assignees&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;team-lead'&lt;/span&gt;
    &lt;span class="na"&gt;reviewers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;senior-dev'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Commitlint
&lt;/h3&gt;

&lt;p&gt;Messy commit messages make tracking changes painful. This Action enforces consistency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Teams following Conventional Commits.&lt;/li&gt;
&lt;li&gt;Keeping changelogs neat and versioning structured.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Commitlint&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;wagoid/commitlint-github-action@v5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Cache Dependencies
&lt;/h3&gt;

&lt;p&gt;Dependency installation slowing down your builds? This Action caches them, making CI runs significantly faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where it shines:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Large Node.js/Python/Ruby projects.&lt;/li&gt;
&lt;li&gt;Reducing build times in active development environments.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Cache Node Modules&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/cache@v3&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;~/.npm&lt;/span&gt;
    &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}&lt;/span&gt;
    &lt;span class="na"&gt;restore-keys&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
      &lt;span class="s"&gt;${{ runner.os }}-node-&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6. Notify Slack
&lt;/h3&gt;

&lt;p&gt;Stop refreshing GitHub to check workflow statuses. This Action sends real-time Slack notifications for builds, tests, and deployments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Great for:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keeping teams updated instantly.&lt;/li&gt;
&lt;li&gt;Catching failed deployments before they cause chaos.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Notify Slack&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rtCamp/action-slack-notify@v2&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;webhook-url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.SLACK_WEBHOOK }}&lt;/span&gt;
    &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Deployment&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Status:&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;job.status&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  7. License Compliance Checker
&lt;/h3&gt;

&lt;p&gt;If your project depends on external libraries, you need to ensure all licenses are compliant. This Action does the checking for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ideal for:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open-source projects.&lt;/li&gt;
&lt;li&gt;Enterprise teams with strict licensing policies.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;License Check&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;anchorfree/license-check-action@v2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  8. Pull Request Size Labeler
&lt;/h3&gt;

&lt;p&gt;Helps reviewers by labeling PRs based on size—small, medium, large.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it’s useful:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lets teams prioritize quick PRs.&lt;/li&gt;
&lt;li&gt;Prevents massive, unmanageable PRs from slipping through.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PR Size Labeler&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kentaro-m/size-label-action@v3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  9. Security Scan with Trivy
&lt;/h3&gt;

&lt;p&gt;Security is a non-negotiable. Trivy scans your container images and dependencies for vulnerabilities before they become a problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use it for:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keeping your Docker images secure.&lt;/li&gt;
&lt;li&gt;Identifying vulnerable dependencies before deployment.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Security Scan&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;aquasecurity/trivy-action@v0.3.0&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image-ref&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;myapp:latest&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  10. GitHub Actions for JIRA Integration
&lt;/h3&gt;

&lt;p&gt;If your team uses JIRA, this Action automatically updates tickets based on GitHub commits and PRs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keeps your development and project management teams aligned.&lt;/li&gt;
&lt;li&gt;Reduces manual updates and keeps issues moving.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Update Jira Issue&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;atlassian/gajira-create@v3&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;project&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ENG"&lt;/span&gt;
    &lt;span class="na"&gt;issuetype&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Task"&lt;/span&gt;
    &lt;span class="na"&gt;summary&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Automated&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;issue&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;update&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;from&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;GitHub&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Action"&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Linked&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;PR:&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;github.event.pull_request.html_url&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which one are you adding to your workflow?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>github</category>
      <category>productivity</category>
      <category>githubactions</category>
    </item>
    <item>
      <title>10 Git Commands You’ll Wish You Knew Earlier</title>
      <dc:creator>Balraj Singh</dc:creator>
      <pubDate>Mon, 17 Feb 2025 09:20:23 +0000</pubDate>
      <link>https://dev.to/balrajola/10-git-commands-youll-wish-you-knew-earlier-2efg</link>
      <guid>https://dev.to/balrajola/10-git-commands-youll-wish-you-knew-earlier-2efg</guid>
      <description>&lt;p&gt;Git can be intimidating when you’re just starting out. Most developers stick to &lt;code&gt;git add&lt;/code&gt;, &lt;code&gt;git commit&lt;/code&gt;, and &lt;code&gt;git push&lt;/code&gt;, and for the most part, that’s enough—until you run into a problem you don’t know how to fix.&lt;/p&gt;

&lt;p&gt;That’s when these 10 Git commands can save you time and frustration.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;code&gt;git reflog&lt;/code&gt; – Recover Lost Commits
&lt;/h3&gt;

&lt;p&gt;Sometimes, you accidentally delete a branch or reset to the wrong commit. &lt;code&gt;git reflog&lt;/code&gt; lets you go back in time and recover lost work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it does:&lt;/strong&gt; Tracks every change made in the repository, even those you thought were gone.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You accidentally deleted a branch.&lt;/li&gt;
&lt;li&gt;You need to recover a commit after a bad reset.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git reflog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. &lt;code&gt;git cherry-pick&lt;/code&gt; – Apply Specific Commits
&lt;/h3&gt;

&lt;p&gt;You need a commit from another branch but don’t want to merge everything. &lt;code&gt;git cherry-pick&lt;/code&gt; brings in only the commit you need.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it does:&lt;/strong&gt; Lets you apply a specific commit from one branch to another.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need a bug fix from a different branch without merging unnecessary changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git cherry-pick &amp;lt;commit-hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. &lt;code&gt;git bisect&lt;/code&gt; – Find the Problematic Commit
&lt;/h3&gt;

&lt;p&gt;When a bug appears but you don’t know which commit introduced it, &lt;code&gt;git bisect&lt;/code&gt; helps you track it down efficiently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it does:&lt;/strong&gt; Uses binary search to identify the commit that caused an issue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to find which commit introduced a bug.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git bisect start
git bisect bad  &lt;span class="c"&gt;# Mark the current commit as bad&lt;/span&gt;
git bisect good &amp;lt;commit-hash&amp;gt;  &lt;span class="c"&gt;# Mark a known good commit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Git will guide you through commits until the problem is found.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;code&gt;git stash pop&lt;/code&gt; – Switch Tasks Without Losing Work
&lt;/h3&gt;

&lt;p&gt;You’re in the middle of coding, and suddenly, you need to switch branches. &lt;code&gt;git stash pop&lt;/code&gt; lets you do that without losing progress.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it does:&lt;/strong&gt; Saves your uncommitted changes so you can apply them later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why &lt;code&gt;pop&lt;/code&gt; instead of &lt;code&gt;stash&lt;/code&gt;?&lt;/strong&gt; It applies the saved changes and removes them from the stash list automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git stash pop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. &lt;code&gt;git reset --soft&lt;/code&gt; – Undo a Commit Without Losing Changes
&lt;/h3&gt;

&lt;p&gt;You committed too early, and now you need to modify the commit. &lt;code&gt;git reset --soft&lt;/code&gt; moves the commit back to the staging area.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it does:&lt;/strong&gt; Allows you to edit a commit without losing your changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to modify the last commit before pushing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git reset &lt;span class="nt"&gt;--soft&lt;/span&gt; HEAD~1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6. &lt;code&gt;git blame&lt;/code&gt; – Track Changes to a File
&lt;/h3&gt;

&lt;p&gt;If you’re trying to understand why a certain change was made, &lt;code&gt;git blame&lt;/code&gt; shows you the last modification for each line in a file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it does:&lt;/strong&gt; Displays commit history for each line of a file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You want to know who changed a specific line of code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git blame &amp;lt;file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  7. &lt;code&gt;git log --oneline --graph&lt;/code&gt; – A Clearer History View
&lt;/h3&gt;

&lt;p&gt;Repositories with multiple branches can get messy. This command gives a simplified visual overview of the commit history.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it does:&lt;/strong&gt; Shows commits in a structured, easy-to-read format.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to understand how branches diverged and merged.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log &lt;span class="nt"&gt;--oneline&lt;/span&gt; &lt;span class="nt"&gt;--graph&lt;/span&gt; &lt;span class="nt"&gt;--all&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  8. &lt;code&gt;git clean -f&lt;/code&gt; – Remove Untracked Files
&lt;/h3&gt;

&lt;p&gt;If your working directory is cluttered with untracked files, &lt;code&gt;git clean -f&lt;/code&gt; helps clean it up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it does:&lt;/strong&gt; Deletes untracked files from your working directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have untracked files interfering with your work.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clean &lt;span class="nt"&gt;-f&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  9. &lt;code&gt;git rebase -i&lt;/code&gt; – Edit Your Commit History
&lt;/h3&gt;

&lt;p&gt;When you need to clean up your commits before merging, &lt;code&gt;git rebase -i&lt;/code&gt; lets you squash, edit, or delete commits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it does:&lt;/strong&gt; Allows you to modify commit history interactively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Before merging, to make your commit history look structured and clear.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git rebase &lt;span class="nt"&gt;-i&lt;/span&gt; HEAD~&amp;lt;number-of-commits&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Avoid using this on public branches—it rewrites history and can cause conflicts.&lt;/p&gt;

&lt;h3&gt;
  
  
  10. &lt;code&gt;git diff --staged&lt;/code&gt; – Review Staged Changes
&lt;/h3&gt;

&lt;p&gt;Before committing, you may want to double-check what you’re about to push. &lt;code&gt;git diff --staged&lt;/code&gt; shows exactly that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it does:&lt;/strong&gt; Displays changes between the staging area and the last commit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You want to verify staged changes before committing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git diff &lt;span class="nt"&gt;--staged&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hope this helps!&lt;/p&gt;

&lt;p&gt;Do you have a go-to Git command that isn’t on this list? Let’s discuss in the comments!&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>learning</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to Write Clean Code: Refactoring and Best Practices</title>
      <dc:creator>Balraj Singh</dc:creator>
      <pubDate>Thu, 13 Feb 2025 10:05:18 +0000</pubDate>
      <link>https://dev.to/balrajola/how-to-write-clean-code-refactoring-and-best-practices-315h</link>
      <guid>https://dev.to/balrajola/how-to-write-clean-code-refactoring-and-best-practices-315h</guid>
      <description>&lt;p&gt;Let’s be honest, every developer (yes, even the ones with years of experience) has shipped messy code at some point.&lt;/p&gt;

&lt;p&gt;Writing clean code isn’t some elite skill. It’s a habit you can build. And refactoring? That’s just your chance to make your code actually make sense—both to you and whoever gets stuck maintaining it later.&lt;/p&gt;

&lt;p&gt;Let’s break it down. No fluff. No abstract theory. Just practical, real-world tips to help you write clean, maintainable code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Name Things Like You Mean It&lt;/strong&gt;&lt;br&gt;
Your variables and functions need to tell a story.&lt;/p&gt;

&lt;p&gt;Not &lt;code&gt;x&lt;/code&gt;, not &lt;code&gt;temp&lt;/code&gt;, not &lt;code&gt;data&lt;/code&gt;. Those are just placeholders for confusion.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Good:&lt;/strong&gt; &lt;code&gt;getUserProfile()&lt;/code&gt;&lt;br&gt;&lt;br&gt;
❌ &lt;strong&gt;Bad:&lt;/strong&gt; &lt;code&gt;getData()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Good:&lt;/strong&gt; &lt;code&gt;maxLoginAttempts&lt;/code&gt;&lt;br&gt;&lt;br&gt;
❌ &lt;strong&gt;Bad:&lt;/strong&gt; &lt;code&gt;m&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When you name things well, your code explains itself—no detective work required.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Less Is More: The Power of Function Size&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’re scrolling through a function like it’s an essay, something’s wrong.&lt;/p&gt;

&lt;p&gt;Long functions are &lt;strong&gt;hard to read, hard to debug, and hard to maintain&lt;/strong&gt;. Instead, break them down into smaller, single-purpose functions.&lt;/p&gt;

&lt;p&gt;Think of it like this: each function should answer &lt;strong&gt;one&lt;/strong&gt; question. If it’s answering five, break it apart.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Instead of this&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;processUserData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;validateUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;saveToDatabase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;sendEmail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Do this&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;validateAndSaveUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;validateUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;saveToDatabase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;notifyUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;sendEmail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes your code easier to read and reuse. Future-you will thank you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Consistency Is Key&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ever worked on a project where &lt;code&gt;userList&lt;/code&gt; was called &lt;code&gt;users&lt;/code&gt; in one place and &lt;code&gt;activeUsersArray&lt;/code&gt; in another? Chaos.&lt;/p&gt;

&lt;p&gt;Keep naming conventions, indentation, and formatting &lt;strong&gt;consistent&lt;/strong&gt;. When your code follows a predictable pattern, it’s easier to read—and easier to debug.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Good:&lt;/strong&gt; &lt;code&gt;userList, orderList, productList&lt;/code&gt;&lt;br&gt;
❌ &lt;strong&gt;Bad:&lt;/strong&gt; &lt;code&gt;users, ordersList, listOfProducts&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Pick a convention and stick to it. No surprises.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Comment With Purpose, Not Out of Habit&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Comments should &lt;strong&gt;explain why, not what&lt;/strong&gt;. If your code needs a comment to explain what it does, rewrite the code instead.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ❌ Bad Comment&lt;/span&gt;
&lt;span class="c1"&gt;// Increase count by 1&lt;/span&gt;
&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ Good Comment&lt;/span&gt;
&lt;span class="c1"&gt;// Edge case: Prevents counter from going negative&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Write comments that &lt;strong&gt;add value&lt;/strong&gt;, not ones that state the obvious.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Magic Numbers and Hardcoded Values – Get Rid of Them&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ever seen a function with random numbers thrown in? Yeah, it’s a maintenance nightmare.&lt;/p&gt;

&lt;p&gt;Instead, use &lt;strong&gt;constants&lt;/strong&gt; that make these values meaningful.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ❌ Bad&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;loginAttempts&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;lockAccount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ Good&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MAX_LOGIN_ATTEMPTS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;loginAttempts&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;MAX_LOGIN_ATTEMPTS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;lockAccount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Much better.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. DRY: Don’t Repeat Yourself&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Repetitive code is just &lt;strong&gt;waiting to break&lt;/strong&gt;. If you find yourself copy-pasting, stop. Create reusable functions or modules instead.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ❌ Bad: Duplicated logic&lt;/span&gt;
&lt;span class="nf"&gt;sendEmail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Welcome!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;sendEmail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;New user registered!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ Good: Reusable function&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;sendNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;sendEmail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;sendNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Welcome!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;sendNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;New user registered!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way, when changes are needed, you only have &lt;strong&gt;one place&lt;/strong&gt; to update.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Keep Your Code SOLID&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you haven’t heard of &lt;strong&gt;SOLID principles&lt;/strong&gt;, now’s a good time to start. These are five simple rules that make your code cleaner and easier to maintain.&lt;/p&gt;

&lt;p&gt;If nothing else, start with this: &lt;strong&gt;The Single Responsibility Principle&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;➡ &lt;strong&gt;Each function/class should do ONE thing and do it well.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If your class is handling &lt;strong&gt;both&lt;/strong&gt; user authentication and database storage, it’s time for a refactor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Refactor Ruthlessly&lt;/strong&gt;&lt;br&gt;
Writing clean code isn’t a one-and-done thing. It’s a &lt;strong&gt;habit&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Every time you review your code, look for ways to make it better:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can you rename variables for clarity?&lt;/li&gt;
&lt;li&gt;Can you break down a huge function?&lt;/li&gt;
&lt;li&gt;Can you remove unnecessary comments?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Don’t wait for a major rewrite—&lt;strong&gt;refactor as you go.&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ❌ First draft&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fetchUserData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://api.example.com/user/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ Refactored&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fetchUserData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://api.example.com/user/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Refactoring doesn’t mean your first attempt was bad—it means you’re making it &lt;strong&gt;better.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you can:&lt;br&gt;
✅ Name things clearly&lt;br&gt;&lt;br&gt;
✅ Keep functions small&lt;br&gt;&lt;br&gt;
✅ Stay consistent&lt;br&gt;&lt;br&gt;
✅ Avoid hardcoded values&lt;br&gt;&lt;br&gt;
✅ Refactor often  &lt;/p&gt;

&lt;p&gt;…you’re already way ahead of the game.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>10 DeepSeek R1 Prompts for Coding That Actually Save You Time.</title>
      <dc:creator>Balraj Singh</dc:creator>
      <pubDate>Mon, 10 Feb 2025 18:25:33 +0000</pubDate>
      <link>https://dev.to/balrajola/10-deepseek-r1-prompts-for-coding-that-actually-save-you-time-55jp</link>
      <guid>https://dev.to/balrajola/10-deepseek-r1-prompts-for-coding-that-actually-save-you-time-55jp</guid>
      <description>&lt;p&gt;Most people don’t know how to prompt AI properly.&lt;/p&gt;

&lt;p&gt;They type something vague like “Optimize this JavaScript function” and expect groundbreaking results. Then, when they get a slightly cleaner version of what they already wrote, they think, AI isn’t that great.&lt;/p&gt;

&lt;p&gt;AI is only as good as your prompts.&lt;/p&gt;

&lt;p&gt;DeepSeek R1 is powerful. It understands code well, but if you’re not framing your questions correctly, you’re leaving value on the table. &lt;/p&gt;

&lt;p&gt;These 10 prompts will help you get the best possible output—cleaner, faster, and actually useful.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. “Refactor this function for better performance. Explain each change.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A vague "optimize this" won’t cut it. You want clear improvements with reasoning so you actually understand what’s being changed.&lt;/p&gt;

&lt;p&gt;🟢 Better prompt:&lt;/p&gt;

&lt;p&gt;"Refactor this function to improve performance and maintainability. Explain each change in detail, focusing on execution time, readability, and memory efficiency."&lt;/p&gt;

&lt;p&gt;This forces DeepSeek R1 to not just rewrite code but also justify every modification.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. “Identify potential memory leaks in this JavaScript code.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Memory leaks slow down applications and are hard to spot. Let DeepSeek R1 do the heavy lifting.&lt;/p&gt;

&lt;p&gt;🟢 Better prompt:&lt;/p&gt;

&lt;p&gt;"Analyze this JavaScript function for potential memory leaks. Point out what’s causing them and suggest fixes."&lt;/p&gt;

&lt;p&gt;You’ll get targeted optimizations instead of a generic best-practices list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. “Rewrite this SQL query for better performance. Explain the changes.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Databases get sluggish when queries are inefficient. Asking for a rewrite without explanation means you’ll end up copy-pasting without learning.&lt;/p&gt;

&lt;p&gt;🟢 Better prompt:&lt;/p&gt;

&lt;p&gt;"Optimize this SQL query for speed. Prioritize reducing execution time and improving index usage. Explain each improvement step by step."&lt;/p&gt;

&lt;p&gt;This gets you performance gains you can actually apply elsewhere.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. “Write unit tests for this function covering all edge cases.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you just ask AI to write tests, it’ll generate happy path scenarios and call it a day. You need to force it to dig deeper.&lt;/p&gt;

&lt;p&gt;🟢 Better prompt:&lt;/p&gt;

&lt;p&gt;"Write comprehensive unit tests for this function in Jest, ensuring all edge cases (invalid inputs, boundary conditions, unexpected data types) are covered."&lt;/p&gt;

&lt;p&gt;Your tests will go from basic to robust.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. “Debug this error and explain what’s causing it.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Copy-pasting errors into Google works, but DeepSeek R1 can debug faster if you give it the right context.&lt;/p&gt;

&lt;p&gt;🟢 Better prompt:&lt;/p&gt;

&lt;p&gt;"I’m getting this error in my Next.js app: [Insert error]. Analyze the issue and explain what’s going wrong in simple terms."&lt;/p&gt;

&lt;p&gt;Instead of random StackOverflow answers, you’ll get a direct fix with an explanation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. “Convert this JavaScript function to TypeScript with proper types.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most AI-generated TypeScript code is lazy. It just slaps an any type on everything. That’s not useful.&lt;/p&gt;

&lt;p&gt;🟢 Better prompt:&lt;/p&gt;

&lt;p&gt;"Convert this JavaScript function into TypeScript, ensuring strict type safety. Avoid using 'any' and infer types where possible."&lt;/p&gt;

&lt;p&gt;This forces DeepSeek R1 to do actual type inference instead of taking shortcuts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. “Rewrite this function using functional programming principles.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you just ask AI to refactor code, it’ll slightly clean it up but won’t shift paradigms. To enforce a different approach, you need to be specific.&lt;/p&gt;

&lt;p&gt;🟢 Better prompt:&lt;/p&gt;

&lt;p&gt;"Refactor this function to follow functional programming principles. Use pure functions, immutability, and avoid side effects."&lt;/p&gt;

&lt;p&gt;This gives you a structural shift, not just minor tweaks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. “Optimize this React component to minimize unnecessary re-renders.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React re-renders kill performance. AI won’t prevent them unless you specifically ask it to.&lt;/p&gt;

&lt;p&gt;🟢 Better prompt:&lt;/p&gt;

&lt;p&gt;"Identify why this React component is re-rendering unnecessarily and optimize it using memoization, useCallback, or other best practices."&lt;/p&gt;

&lt;p&gt;You’ll get targeted solutions instead of basic ‘useMemo’ suggestions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. “Explain this complex code to me like I’m a junior developer.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ever come across code that looks like an alien language? AI can break it down for you—if you ask the right way.&lt;/p&gt;

&lt;p&gt;🟢 Better prompt:&lt;/p&gt;

&lt;p&gt;"Here’s a function that does X. Explain its logic in a simple, step-by-step way, as if you’re teaching a beginner."&lt;/p&gt;

&lt;p&gt;This makes AI act like a mentor, not just a code generator.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. “Rewrite this Python script in Node.js while maintaining efficiency.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AI translates code line by line unless you tell it otherwise. That often leads to inefficient conversions.&lt;/p&gt;

&lt;p&gt;🟢 Better prompt:&lt;/p&gt;

&lt;p&gt;"Convert this Python script into an optimized Node.js implementation, ensuring equivalent functionality while following best practices for event-driven programming."&lt;/p&gt;

&lt;p&gt;Instead of blind translation, you get a version that actually makes sense in Node.js.&lt;/p&gt;

&lt;p&gt;If you feed it weak prompts, you’ll get weak results. The way you phrase your request determines whether you get something useful or something generic.&lt;/p&gt;

&lt;p&gt;Try these prompts the next time you use DeepSeek R1. You’ll see the difference instantly.&lt;/p&gt;

</description>
      <category>deepseek</category>
      <category>opensource</category>
      <category>ai</category>
      <category>productivity</category>
    </item>
    <item>
      <title>10 Underrated Swift Features You Probably Aren’t Using (But Should)</title>
      <dc:creator>Balraj Singh</dc:creator>
      <pubDate>Wed, 05 Feb 2025 10:44:12 +0000</pubDate>
      <link>https://dev.to/balrajola/10-underrated-swift-features-you-probably-arent-using-but-should-56o9</link>
      <guid>https://dev.to/balrajola/10-underrated-swift-features-you-probably-arent-using-but-should-56o9</guid>
      <description>&lt;p&gt;Swift is packed with cool tricks that often go unnoticed. While everyone obsesses over &lt;code&gt;async/await&lt;/code&gt; and SwiftUI, there are plenty of low-key features that can make your life easier if only more people knew about them. So, let’s talk about those. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. &lt;code&gt;some&lt;/code&gt; Keyword for Type Opaqueness&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You’ve probably used &lt;code&gt;Any&lt;/code&gt; to deal with unknown types. But have you used &lt;code&gt;some&lt;/code&gt;? It lets you return an opaque type without exposing unnecessary details. Less clutter, more clarity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;makeButton&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kd"&gt;some&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Tap Me"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Button tapped!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This matters because without &lt;code&gt;some&lt;/code&gt;, generics can turn into a tangled mess really fast.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. &lt;code&gt;@autoclosure&lt;/code&gt; for Cleaner Lazy Evaluations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of wrapping expressions inside &lt;code&gt;{}&lt;/code&gt; for no reason, let &lt;code&gt;@autoclosure&lt;/code&gt; handle it for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;logIfNeeded&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="nv"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;@autoclosure&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cp"&gt;#if DEBUG&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;message&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="cp"&gt;#endif&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way, you can just pass &lt;code&gt;"Some log message"&lt;/code&gt; without worrying about closures.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. &lt;code&gt;@discardableResult&lt;/code&gt; to Avoid Unused Result Warnings&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sometimes, you call a function for its side effects and don’t care about the return value. But Swift does.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;@discardableResult&lt;/span&gt;
&lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;performTask&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;Bool&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you won’t see warnings for ignoring the return value. Simple fix.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. &lt;code&gt;@inline(__always)&lt;/code&gt; for Performance Boost&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you care about performance, this forces inlining, even when the compiler doesn’t think it’s necessary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;@inline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__always&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;fastFunction&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"This will always be inlined!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It’s a small optimization, but for high-performance apps, small tweaks add up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Conditional Conformance for Generics&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Swift allows types to conform to protocols only when certain conditions are met.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;extension&lt;/span&gt; &lt;span class="kt"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Equatable&lt;/span&gt; &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="kt"&gt;Element&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Equatable&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, arrays of &lt;code&gt;Equatable&lt;/code&gt; elements can be compared directly. Before this, you had to manually implement &lt;code&gt;Equatable&lt;/code&gt;. Not fun.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. &lt;code&gt;withoutActuallyEscaping(_:)&lt;/code&gt; for Non-Escaping Closures&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Got a non-escaping closure but need to pass it somewhere that expects an escaping one? Swift has a trick for that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="n"&gt;execute&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="nv"&gt;closure&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;Void&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;with&lt;/span&gt; &lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;withoutActuallyEscaping&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;closure&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;escapable&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
        &lt;span class="nf"&gt;escapable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This keeps things type-safe without the usual &lt;code&gt;@escaping&lt;/code&gt; gymnastics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. &lt;code&gt;defer&lt;/code&gt; for Guaranteed Cleanup&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You’ve probably seen &lt;code&gt;finally&lt;/code&gt; in other languages. Swift’s &lt;code&gt;defer&lt;/code&gt; is even better—it &lt;strong&gt;always&lt;/strong&gt; runs, no matter how the function exits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;fetchData&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Cleanup executed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Fetching data..."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No matter what happens, cleanup is handled. No surprises.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. &lt;code&gt;ExpressibleBy*Literal&lt;/code&gt; for Custom Types&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ever wanted to assign literals to your custom structs? You can.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;struct&lt;/span&gt; &lt;span class="kt"&gt;Temperature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;ExpressibleByFloatLiteral&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Double&lt;/span&gt;
    &lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;floatLiteral&lt;/span&gt; &lt;span class="nv"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Double&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;temp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Temperature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;36.6&lt;/span&gt;  &lt;span class="c1"&gt;// Works because of ExpressibleByFloatLiteral&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you don’t have to write &lt;code&gt;Temperature(value: 36.6)&lt;/code&gt;. Just use &lt;code&gt;36.6&lt;/code&gt;. Neat, right?&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;9. &lt;code&gt;mutating func&lt;/code&gt; in Structs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Structs are immutable by default. But what if you &lt;strong&gt;need&lt;/strong&gt; to modify them? &lt;code&gt;mutating&lt;/code&gt; lets you do it safely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;struct&lt;/span&gt; &lt;span class="kt"&gt;Counter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="k"&gt;mutating&lt;/span&gt; &lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Still keeps your code clean and predictable while allowing changes where necessary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. &lt;code&gt;lazy&lt;/code&gt; Properties for Efficient Initialization&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Why initialize a heavy object if you might not even use it? &lt;code&gt;lazy&lt;/code&gt; postpones initialization until it’s actually needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="kt"&gt;ExpensiveObject&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Expensive Object Created"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="kt"&gt;MyClass&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;lazy&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;expensiveInstance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;ExpensiveObject&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;MyClass&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  &lt;span class="c1"&gt;// Nothing happens yet&lt;/span&gt;
&lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;expensiveInstance&lt;/span&gt;  &lt;span class="c1"&gt;// Now the instance is created&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This avoids unnecessary resource allocation. Especially useful in UI-heavy apps.&lt;/p&gt;

&lt;p&gt;The best part is that most of them require just &lt;strong&gt;one extra keyword&lt;/strong&gt; to start using.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>swift</category>
      <category>100daysofcode</category>
      <category>programming</category>
    </item>
    <item>
      <title>7 Swift Hacks You Wish You Knew Sooner</title>
      <dc:creator>Balraj Singh</dc:creator>
      <pubDate>Mon, 03 Feb 2025 10:02:35 +0000</pubDate>
      <link>https://dev.to/balrajola/7-swift-hacks-you-wish-you-knew-sooner-25ho</link>
      <guid>https://dev.to/balrajola/7-swift-hacks-you-wish-you-knew-sooner-25ho</guid>
      <description>&lt;p&gt;You know that feeling when you write a code, only to realize later, there was a one-liner that could’ve done the same job? Yeah, me too. &lt;/p&gt;

&lt;p&gt;Swift is full of underrated gems.&lt;/p&gt;

&lt;p&gt;So here are &lt;strong&gt;7 Swift hacks&lt;/strong&gt; you’ll wish you knew sooner. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Format Numbers Without the Extra Work&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Manually formatting numbers? Nope. Swift has a built-in way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;formatted&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;NumberFormatter&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;localizedString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1234567&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;number&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decimal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;formatted&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// "1,234,567"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Works for currency, percentages, and scientific notation too.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The 'One-Liner' &lt;code&gt;if let&lt;/code&gt; Trick&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Before:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;username&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Now:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why? Cleaner, more functional, and no unnecessary nesting. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Force a SwiftUI View to Refresh Instantly&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;SwiftUI sometimes just… doesn’t refresh when you expect it to. Instead of overcomplicating state management, do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="n"&gt;someStateVariable&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// Forces view to re-render&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No extra logic, no unnecessary bindings. Just works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Auto-Resizing Text Fields Without Extra Code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Tired of writing logic for resizing text fields? Here’s the fix:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kt"&gt;TextField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Enter text"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;$text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;minHeight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;background&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Color&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gray&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cornerRadius&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What happens?&lt;/strong&gt; The field grows/shrinks dynamically. No extra logic needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Turn a Dictionary into a URL Query String Instantly&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No need to manually construct query strings. This one-liner handles it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"search"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"Swift Hacks"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"limit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"10"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="nv"&gt;$0&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="s"&gt;=&lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="nv"&gt;$0&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;joined&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;separator&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"&amp;amp;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// "search=Swift Hacks&amp;amp;limit=10"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Time saved. Code cleaner.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Ditch the Long &lt;code&gt;if&lt;/code&gt; Statements with &lt;code&gt;switch&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of multiple conditions, simplify it like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Low"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Medium"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"High"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Unknown"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Easier to read. Faster to debug.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Lazy-Load Expensive Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of executing an expensive function right away, delay it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;fetchData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="nv"&gt;loader&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;@autoclosure&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Fetching Data: &lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="nf"&gt;loader&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;fetchData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;expensiveFunctionCall&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="c1"&gt;// Runs only when needed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Performance boost, especially in bigger apps.&lt;/p&gt;

&lt;p&gt;That’s it—7 Swift hacks to simplify your code and speed up your workflow. &lt;/p&gt;

&lt;p&gt;Hope this helps!&lt;/p&gt;

</description>
      <category>swift</category>
      <category>ios</category>
      <category>productivity</category>
      <category>programming</category>
    </item>
    <item>
      <title>Top 10 Python Libraries That Will Save You Hours of Work.</title>
      <dc:creator>Balraj Singh</dc:creator>
      <pubDate>Fri, 31 Jan 2025 10:50:45 +0000</pubDate>
      <link>https://dev.to/balrajola/top-10-python-libraries-that-will-save-you-hours-of-work-1nm6</link>
      <guid>https://dev.to/balrajola/top-10-python-libraries-that-will-save-you-hours-of-work-1nm6</guid>
      <description>&lt;p&gt;If you write Python code regularly, you know that some tasks can be painfully repetitive. &lt;/p&gt;

&lt;p&gt;Python has some incredibly powerful libraries that can save you hours (or even days) of work. The problem? Most people keep using the same mainstream ones—NumPy, Pandas, and Requests—without realizing there are hidden gems that can automate, optimize, and simplify a lot of tasks.&lt;/p&gt;

&lt;p&gt;So here’s a list of &lt;strong&gt;10 Python libraries&lt;/strong&gt; that can help you get things done faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Rich – Stop Using Boring Print Statements&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rich&lt;/strong&gt; is a game-changer for &lt;strong&gt;beautifully formatted console logs.&lt;/strong&gt; It lets you print tables, syntax-highlighted code, markdown, and even progress bars. Perfect for debugging or making CLI tools visually appealing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time saved:&lt;/strong&gt; No more ugly print debugging or manually formatting tables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;rich.console&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Console&lt;/span&gt;
&lt;span class="n"&gt;console&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello, [bold magenta]Rich![/bold magenta]&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Typer – Writing CLIs the Easy Way&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’ve ever struggled with &lt;strong&gt;argparse&lt;/strong&gt;, you’re going to love &lt;strong&gt;Typer&lt;/strong&gt;. It’s based on FastAPI’s structure and makes it ridiculously easy to build command-line interfaces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time saved:&lt;/strong&gt; No more manually parsing command-line arguments. Just type hint your functions and Typer does the rest.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;typer&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;typer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Typer&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nd"&gt;@app.command&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;app&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Polars – A Faster Alternative to Pandas&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If your Pandas operations feel slow, &lt;strong&gt;Polars&lt;/strong&gt; is the upgrade you need. It’s a &lt;strong&gt;blazingly fast DataFrame library&lt;/strong&gt; that can handle large datasets more efficiently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time saved:&lt;/strong&gt; Significantly reduced processing time for big data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;polars&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pl&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;age&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. FastAPI – The Modern Way to Build APIs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Django and Flask are great, but &lt;strong&gt;FastAPI&lt;/strong&gt; is a whole different level. It’s fast, has built-in validation, and generates API docs automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time saved:&lt;/strong&gt; Less boilerplate, automatic validation, and speedier performance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;fastapi&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FastAPI&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nd"&gt;@app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;read_root&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello, FastAPI!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Pydantic – Stop Writing Manual Data Validation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you hate writing manual validation logic, &lt;strong&gt;Pydantic&lt;/strong&gt; is your best friend. It allows you to define data models with automatic validation using Python type hints.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time saved:&lt;/strong&gt; No need to write complex validation functions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pydantic&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BaseModel&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;
&lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;John&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;25&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Raises validation error
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6. Loguru – Logging Made Ridiculously Simple&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Python’s built-in logging module is powerful but overcomplicated. &lt;strong&gt;Loguru&lt;/strong&gt; makes logging as easy as writing a print statement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time saved:&lt;/strong&gt; No need to configure complex logging settings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;loguru&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;logger&lt;/span&gt;
&lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;This is an info message&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;7. TQDM – Add Progress Bars with Zero Effort&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you work with loops that take time, &lt;strong&gt;TQDM&lt;/strong&gt; is a must-have. It lets you add &lt;strong&gt;progress bars&lt;/strong&gt; to your loops with a single line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time saved:&lt;/strong&gt; Makes long-running loops visually trackable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;tqdm&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tqdm&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;tqdm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;  
    &lt;span class="k"&gt;pass&lt;/span&gt;  &lt;span class="c1"&gt;# Your logic here
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;8. Shapely – Work with Geometric Objects Effortlessly&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you deal with geospatial data, &lt;strong&gt;Shapely&lt;/strong&gt; makes working with geometric objects a breeze.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time saved:&lt;/strong&gt; No need to manually compute intersections, distances, or shapes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;shapely.geometry&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Point&lt;/span&gt;
&lt;span class="n"&gt;point&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Point&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;2.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;point&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;point&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;9. Pytest – Write Better Tests, Faster&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Forget about Python’s built-in &lt;code&gt;unittest&lt;/code&gt;. &lt;strong&gt;Pytest&lt;/strong&gt; makes writing and running tests intuitive and efficient.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time saved:&lt;/strong&gt; Cleaner syntax, auto-discovery, and better debugging.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_example&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run all tests with a single command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pytest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;10. Playwright – Automate Browser Actions Like a Pro&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For web scraping or automated testing, &lt;strong&gt;Playwright&lt;/strong&gt; is a powerful alternative to Selenium.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time saved:&lt;/strong&gt; Faster execution, headless browsing, and better handling of modern web apps.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;playwright.sync_api&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sync_playwright&lt;/span&gt;
&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;sync_playwright&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;browser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chromium&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;launch&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new_page&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;goto&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://example.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;title&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you find yourself repeating certain tasks, look for a Python library that can &lt;strong&gt;automate&lt;/strong&gt; or &lt;strong&gt;simplify&lt;/strong&gt; it. Chances are, someone has already built the solution for you.&lt;/p&gt;

&lt;p&gt;Which of these libraries have you used? Got any more time-saving Python gems? Drop them in the comments!&lt;/p&gt;

</description>
      <category>python</category>
      <category>productivity</category>
      <category>programming</category>
      <category>automation</category>
    </item>
    <item>
      <title>Everyone Teaches Coding, But No One Talks About These 5 Skills Developers Actually Need.</title>
      <dc:creator>Balraj Singh</dc:creator>
      <pubDate>Tue, 28 Jan 2025 14:41:25 +0000</pubDate>
      <link>https://dev.to/balrajola/everyone-teaches-coding-but-no-one-talks-about-these-5-skills-developers-actually-need-jf3</link>
      <guid>https://dev.to/balrajola/everyone-teaches-coding-but-no-one-talks-about-these-5-skills-developers-actually-need-jf3</guid>
      <description>&lt;p&gt;Coding bootcamps, YouTube tutorials, and online courses have one thing in common: they teach you how to write code. But ask any seasoned developer, and they’ll tell you—writing code is just one thing. The reality of being a developer is far messier, more nuanced, and requires a set of skills that no tutorial will ever truly cover.&lt;/p&gt;

&lt;p&gt;Here’s what nobody is talking about: the five skills that separate average developers from exceptional ones. If you’re tired of generic advice like "learn data structures" or "master algorithms," this one’s for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The Art of Asking the Right Questions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ever heard of "rubber duck debugging"? Developers joke about explaining their code to a rubber duck to find bugs. But here’s the deeper truth: &lt;em&gt;your ability to ask questions is directly tied to your ability to solve problems.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When you’re stuck on a feature, the solution quickly often comes down to asking the right questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;What assumptions am I making about this code?&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;What happens if I handle this edge case differently?&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Have I truly understood the user’s needs, or am I guessing?&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stop memorizing syntax—learn how to interrogate your own thought process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The Skill of Reading Between the Lines (a.k.a. Reading Code)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Writing code is glamorized. Reading code? Not so much.&lt;/p&gt;

&lt;p&gt;But let me tell you: most of your career will involve someone else’s mess or revisiting your own cryptic comments from six months ago. Reading code isn’t just a technical skill—it’s an exercise in empathy.&lt;/p&gt;

&lt;p&gt;To read code effectively, you need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pattern recognition:&lt;/strong&gt; Spot how the codebase organizes logic, handles errors, or repeats patterns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context awareness:&lt;/strong&gt; Understand &lt;em&gt;why&lt;/em&gt; something was written that way, not just &lt;em&gt;how.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Curiosity:&lt;/strong&gt; Ask yourself, “What problem does this code solve? Is it still relevant?”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Mastering the Non-Technical: Communication&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hot take: The biggest bugs in software often come from miscommunication, not bad code.&lt;/p&gt;

&lt;p&gt;You’re not just building software; you’re translating someone’s abstract idea into functional reality. This means you need to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Listen actively:&lt;/strong&gt; Understand what stakeholders &lt;em&gt;really&lt;/em&gt; want, not just what they say they want.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write clearly:&lt;/strong&gt; Your documentation, comments, and commit messages should make sense to a future you (or anyone else).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Collaborate effectively:&lt;/strong&gt; Whether it’s pair programming or debating architecture choices in a meeting, your ability to communicate makes or breaks the project.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pro tip: Practice explaining technical concepts to non-technical people. It’ll sharpen your understanding and make you a better developer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Don't Freak Out&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here’s a reality check: you will never have all the answers upfront.&lt;/p&gt;

&lt;p&gt;Specs will be incomplete. The client’s requirements will change mid-sprint. The library you’re using might suddenly become unmaintained. The ability to stay calm, adapt, and navigate uncertainty is what sets the pros apart.&lt;/p&gt;

&lt;p&gt;How to build this skill:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Learn to prototype quickly:&lt;/strong&gt; Build small, disposable versions to clarify vague requirements.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Document assumptions:&lt;/strong&gt; Write down what you think you know and revisit it as the project evolves.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Be okay with being wrong:&lt;/strong&gt; Iteration is the name of the game.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Thinking Beyond the Code: Systems Thinking&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Developers often obsess over their immediate task: &lt;em&gt;Build this feature. Fix that bug.&lt;/em&gt; But exceptional developers see the bigger picture. They think in systems.&lt;/p&gt;

&lt;p&gt;Systems thinking means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Understanding how your code impacts the performance, scalability, and maintainability of the entire application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Considering edge cases, failure points, and how your feature integrates with other parts of the system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Thinking about the &lt;strong&gt;user’s journey&lt;/strong&gt; beyond just the screen you’re coding.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, let’s say you’re optimizing a database query. A systems thinker won’t stop at making the query faster; they’ll ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How does this query impact the overall server load?&lt;/li&gt;
&lt;li&gt;What happens if traffic spikes tomorrow?&lt;/li&gt;
&lt;li&gt;Is this optimization worth the trade-off in readability or maintainability?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, the next time you’re grinding through another coding tutorial, pause and ask yourself: &lt;em&gt;Am I learning how to code? Or am I learning how to be a developer?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Big difference.&lt;/p&gt;

</description>
      <category>coding</category>
      <category>beginners</category>
      <category>productivity</category>
      <category>developer</category>
    </item>
  </channel>
</rss>
