<?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>10 AI Tools to Build a 10 Engineering Workflow in 2026</title>
      <dc:creator>Balraj Singh</dc:creator>
      <pubDate>Tue, 21 Jul 2026 10:04:05 +0000</pubDate>
      <link>https://dev.to/balrajola/10-ai-tools-to-build-a-10x-engineering-workflow-in-2026-1ad6</link>
      <guid>https://dev.to/balrajola/10-ai-tools-to-build-a-10x-engineering-workflow-in-2026-1ad6</guid>
      <description>&lt;p&gt;Ten AI subscriptions will not make you a 10× engineer.&lt;/p&gt;

&lt;p&gt;A connected AI workflow might.&lt;/p&gt;

&lt;p&gt;The real advantage is not generating more code. It is reducing the time spent understanding systems, searching for context, testing changes, reviewing work, and debugging production issues.&lt;/p&gt;

&lt;p&gt;Here are 10 AI tools worth adding to your engineering workflow:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. ChatGPT with Codex
&lt;/h3&gt;

&lt;p&gt;Use it to turn ambiguous requirements into a clear plan, compare approaches, identify risks, and delegate bounded implementation tasks.&lt;/p&gt;

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

&lt;p&gt;Use it to understand unfamiliar repositories through generated documentation, architecture diagrams, and codebase-aware questions.&lt;/p&gt;

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

&lt;p&gt;Give your coding agent current, version-specific library documentation instead of relying on outdated APIs or model memory.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Claude Code
&lt;/h3&gt;

&lt;p&gt;Useful for exploring large codebases, tracing dependencies, planning changes, and implementing multi-file tasks from the terminal.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Cursor
&lt;/h3&gt;

&lt;p&gt;A strong choice for fast iteration inside the editor, especially for refactoring, debugging, and frontend development.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. GitHub Copilot
&lt;/h3&gt;

&lt;p&gt;Keep AI close to everyday engineering work through inline suggestions, chat, command-line assistance, pull requests, and issue workflows.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Playwright MCP
&lt;/h3&gt;

&lt;p&gt;Let an AI agent navigate your application, reproduce browser flows, inspect UI behaviour, and help generate end-to-end tests.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. CodeRabbit
&lt;/h3&gt;

&lt;p&gt;Use automated AI review before spending human attention on a pull request. It can highlight risks, inconsistencies, and missing tests.&lt;/p&gt;

&lt;h3&gt;
  
  
  9. Sentry Seer
&lt;/h3&gt;

&lt;p&gt;Connect production errors, traces, logs, and source code to investigate incidents and identify likely root causes.&lt;/p&gt;

&lt;h3&gt;
  
  
  10. n8n
&lt;/h3&gt;

&lt;p&gt;Automate handoffs between tickets, coding agents, GitHub, CI pipelines, monitoring systems, and team notifications.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to integrate them into one workflow
&lt;/h2&gt;

&lt;p&gt;Do not adopt all 10 tools randomly.&lt;/p&gt;

&lt;p&gt;Build a repeatable engineering loop:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understand:&lt;/strong&gt; DeepWiki + Context7&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Plan:&lt;/strong&gt; ChatGPT with Codex&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Build:&lt;/strong&gt; Claude Code, Cursor, or GitHub Copilot&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Verify:&lt;/strong&gt; Playwright MCP + CodeRabbit&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Operate:&lt;/strong&gt; Sentry Seer&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Automate:&lt;/strong&gt; n8n&lt;/p&gt;

&lt;p&gt;Pass the same task brief through each stage:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Desired outcome&lt;/li&gt;
&lt;li&gt;Relevant context&lt;/li&gt;
&lt;li&gt;Constraints and non-goals&lt;/li&gt;
&lt;li&gt;Acceptance criteria&lt;/li&gt;
&lt;li&gt;Verification steps&lt;/li&gt;
&lt;li&gt;Risks requiring human review&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A 10× engineer is not someone who generates 10 times more code.&lt;/p&gt;

&lt;p&gt;It is someone who removes more friction while keeping quality, understanding, and engineering judgment visible.&lt;/p&gt;

&lt;p&gt;Which AI tool has genuinely changed your engineering workflow?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>AI Coding Agents Can Make Junior Developers Faster. Can They Still Make Them Better?</title>
      <dc:creator>Balraj Singh</dc:creator>
      <pubDate>Mon, 20 Jul 2026 13:10:06 +0000</pubDate>
      <link>https://dev.to/balrajola/ai-coding-agents-can-make-junior-developers-faster-can-they-still-make-them-better-38gl</link>
      <guid>https://dev.to/balrajola/ai-coding-agents-can-make-junior-developers-faster-can-they-still-make-them-better-38gl</guid>
      <description>&lt;p&gt;AI may help junior developers ship faster.&lt;/p&gt;

&lt;p&gt;It may also slow down how they become senior.&lt;/p&gt;

&lt;p&gt;That sounds like an argument against AI coding tools.&lt;/p&gt;

&lt;p&gt;It is not.&lt;/p&gt;

&lt;p&gt;Coding agents are excellent at removing repetitive work, exploring unfamiliar code, proposing first drafts, writing tests, and helping engineers move from an idea to an implementation.&lt;/p&gt;

&lt;p&gt;But software engineering skill was never built only by completing tickets.&lt;/p&gt;

&lt;p&gt;A lot of it was learned almost by accident.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tracing unfamiliar code&lt;/li&gt;
&lt;li&gt;Reading documentation because the first attempt failed&lt;/li&gt;
&lt;li&gt;Debugging a wrong assumption for two hours&lt;/li&gt;
&lt;li&gt;Comparing several imperfect approaches&lt;/li&gt;
&lt;li&gt;Seeing why a clean solution breaks in production&lt;/li&gt;
&lt;li&gt;Reviewing someone else's trade-offs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those moments were frustrating.&lt;/p&gt;

&lt;p&gt;They were also where engineers built mental models.&lt;/p&gt;

&lt;h2&gt;
  
  
  The invisible curriculum of software engineering
&lt;/h2&gt;

&lt;p&gt;Formal learning can teach syntax, frameworks, algorithms, and design patterns.&lt;/p&gt;

&lt;p&gt;Daily engineering teaches something different:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Where abstractions leak&lt;/li&gt;
&lt;li&gt;Which assumptions fail under real traffic&lt;/li&gt;
&lt;li&gt;How data moves across a system&lt;/li&gt;
&lt;li&gt;Why an apparently small change has a large blast radius&lt;/li&gt;
&lt;li&gt;When a test suite is giving false confidence&lt;/li&gt;
&lt;li&gt;How product decisions become architectural constraints&lt;/li&gt;
&lt;li&gt;Which trade-offs matter six months later&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is the invisible curriculum of software engineering.&lt;/p&gt;

&lt;p&gt;It is rarely written down as a course.&lt;/p&gt;

&lt;p&gt;Engineers absorb it while investigating, debugging, reviewing, and recovering from mistakes.&lt;/p&gt;

&lt;p&gt;Coding agents can shorten many of those activities.&lt;/p&gt;

&lt;p&gt;That is good for delivery.&lt;/p&gt;

&lt;p&gt;But it raises an uncomfortable question:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When the agent removes the struggle, does it also remove some of the learning?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A simple example
&lt;/h2&gt;

&lt;p&gt;Imagine a junior developer is asked to fix a retry bug in a payment integration.&lt;/p&gt;

&lt;p&gt;Without an agent, they may need to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Trace the request through several services.&lt;/li&gt;
&lt;li&gt;Read logs from failed attempts.&lt;/li&gt;
&lt;li&gt;Learn how the current retry mechanism works.&lt;/li&gt;
&lt;li&gt;Discover why retries can create duplicate operations.&lt;/li&gt;
&lt;li&gt;Read about idempotency.&lt;/li&gt;
&lt;li&gt;Compare fixed delays with exponential backoff.&lt;/li&gt;
&lt;li&gt;Add tests for failure cases.&lt;/li&gt;
&lt;li&gt;Explain the trade-off during review.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That process is slow.&lt;/p&gt;

&lt;p&gt;It may also teach them about distributed systems, failure handling, observability, and production risk.&lt;/p&gt;

&lt;p&gt;Now imagine the same developer gives a coding agent this task:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Fix the retry bug and add tests.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The agent inspects the repository, updates the retry logic, adds exponential backoff and jitter, writes tests, and presents a polished explanation.&lt;/p&gt;

&lt;p&gt;The task may be completed much faster.&lt;/p&gt;

&lt;p&gt;But what did the developer actually learn?&lt;/p&gt;

&lt;p&gt;Could they explain why jitter matters?&lt;/p&gt;

&lt;p&gt;Could they recognise an idempotency problem in another system?&lt;/p&gt;

&lt;p&gt;Could they debug the code when the next failure does not match the generated tests?&lt;/p&gt;

&lt;p&gt;Shipping the change and understanding the change are not the same outcome.&lt;/p&gt;

&lt;h2&gt;
  
  
  The risk of knowledge debt
&lt;/h2&gt;

&lt;p&gt;A recent paper, &lt;a href="https://arxiv.org/abs/2607.06101" rel="noopener noreferrer"&gt;&lt;em&gt;Agents That Teach: Towards Designing Incidental Learning Back into AI-Assisted Software Development&lt;/em&gt;&lt;/a&gt;, describes this risk as &lt;strong&gt;knowledge debt&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Knowledge debt is the gap that accumulates when an agent makes changes a developer cannot fully understand, explain, or maintain independently.&lt;/p&gt;

&lt;p&gt;It is similar to technical debt in one important way:&lt;/p&gt;

&lt;p&gt;The cost may remain invisible until the system changes or fails.&lt;/p&gt;

&lt;p&gt;A developer can remain productive while the agent is available and the task stays inside familiar boundaries.&lt;/p&gt;

&lt;p&gt;The debt appears when they need to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Debug a new failure mode&lt;/li&gt;
&lt;li&gt;Modify the generated design&lt;/li&gt;
&lt;li&gt;Review a similar change from someone else&lt;/li&gt;
&lt;li&gt;Respond during an incident&lt;/li&gt;
&lt;li&gt;Make a decision without the same context&lt;/li&gt;
&lt;li&gt;Explain why the system behaves as it does&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Not every AI-assisted change creates knowledge debt.&lt;/p&gt;

&lt;p&gt;The debt appears when delegation replaces comprehension rather than accelerating it.&lt;/p&gt;

&lt;p&gt;Some warning signs are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can describe what changed, but not why that approach was chosen.&lt;/li&gt;
&lt;li&gt;You cannot explain which alternatives were rejected.&lt;/li&gt;
&lt;li&gt;You trust the tests but cannot explain what important risks they do not cover.&lt;/li&gt;
&lt;li&gt;You accept an architectural decision because the agent sounded confident.&lt;/li&gt;
&lt;li&gt;You struggle to continue once the generated solution leaves the happy path.&lt;/li&gt;
&lt;li&gt;The agent conversation contains more reasoning than the pull request or documentation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why this matters for becoming senior
&lt;/h2&gt;

&lt;p&gt;The difference between a junior and a senior engineer is not simply the amount of code they can produce.&lt;/p&gt;

&lt;p&gt;Senior engineers are expected to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frame ambiguous problems&lt;/li&gt;
&lt;li&gt;Identify hidden constraints&lt;/li&gt;
&lt;li&gt;Predict failure modes&lt;/li&gt;
&lt;li&gt;Make trade-offs&lt;/li&gt;
&lt;li&gt;Understand blast radius&lt;/li&gt;
&lt;li&gt;Review other people's work&lt;/li&gt;
&lt;li&gt;Protect long-term system quality&lt;/li&gt;
&lt;li&gt;Make good decisions with incomplete information&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those abilities are built through repeated reasoning.&lt;/p&gt;

&lt;p&gt;If AI completes more of the reasoning invisibly, a junior engineer may deliver more work without getting enough practice in the judgment required at the next level.&lt;/p&gt;

&lt;p&gt;The danger is not that junior engineers will stop writing code.&lt;/p&gt;

&lt;p&gt;The danger is that teams may mistake higher output for faster development of engineering capability.&lt;/p&gt;

&lt;h2&gt;
  
  
  The answer is not to use less AI
&lt;/h2&gt;

&lt;p&gt;Telling engineers to avoid coding agents is neither realistic nor useful.&lt;/p&gt;

&lt;p&gt;The better approach is to design learning back into the workflow.&lt;/p&gt;

&lt;p&gt;Here are seven practices I find useful.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Predict before asking the agent
&lt;/h2&gt;

&lt;p&gt;Before generating a solution, write down your current view:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is the likely root cause?&lt;/li&gt;
&lt;li&gt;Which part of the system is involved?&lt;/li&gt;
&lt;li&gt;What could fail?&lt;/li&gt;
&lt;li&gt;What evidence would prove the change is correct?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your prediction does not need to be right.&lt;/p&gt;

&lt;p&gt;The value comes from making your reasoning active before seeing the agent's answer.&lt;/p&gt;

&lt;p&gt;You can then compare your model with the agent's model rather than passively accepting its output.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Ask for a map before asking for code
&lt;/h2&gt;

&lt;p&gt;Do not begin every task with implementation.&lt;/p&gt;

&lt;p&gt;Ask the agent to first:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Trace the relevant code path&lt;/li&gt;
&lt;li&gt;Identify the important files and dependencies&lt;/li&gt;
&lt;li&gt;State its assumptions&lt;/li&gt;
&lt;li&gt;Highlight missing context&lt;/li&gt;
&lt;li&gt;Describe the current behaviour&lt;/li&gt;
&lt;li&gt;List possible approaches&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This turns the agent into an exploration partner before it becomes an implementation engine.&lt;/p&gt;

&lt;p&gt;It also gives you a chance to correct a misunderstanding before it becomes a large diff.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Ask which approaches it rejected
&lt;/h2&gt;

&lt;p&gt;The final solution hides much of the useful learning.&lt;/p&gt;

&lt;p&gt;Ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What other approaches did you consider?&lt;/li&gt;
&lt;li&gt;Why did you reject them?&lt;/li&gt;
&lt;li&gt;Which trade-off made this option preferable?&lt;/li&gt;
&lt;li&gt;Under what conditions would another approach be better?&lt;/li&gt;
&lt;li&gt;Where are you least confident?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Senior judgment is often built by comparing reasonable options, not by memorising one correct answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Keep at least one important decision human-owned
&lt;/h2&gt;

&lt;p&gt;The agent can explore, analyse, and recommend.&lt;/p&gt;

&lt;p&gt;But for unfamiliar or high-impact work, keep an important decision explicitly owned by the engineer.&lt;/p&gt;

&lt;p&gt;That decision might involve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Product behaviour&lt;/li&gt;
&lt;li&gt;A data model&lt;/li&gt;
&lt;li&gt;An API contract&lt;/li&gt;
&lt;li&gt;A security boundary&lt;/li&gt;
&lt;li&gt;An architectural dependency&lt;/li&gt;
&lt;li&gt;A migration strategy&lt;/li&gt;
&lt;li&gt;A rollout or rollback plan&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not to create artificial human work.&lt;/p&gt;

&lt;p&gt;It is to make sure the engineer still practises the decisions that build judgment.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Review the highest-risk reasoning, not only the final diff
&lt;/h2&gt;

&lt;p&gt;Line-by-line review is necessary, but it is not enough.&lt;/p&gt;

&lt;p&gt;Ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which assumption creates the most risk?&lt;/li&gt;
&lt;li&gt;What is the blast radius if this is wrong?&lt;/li&gt;
&lt;li&gt;Which edge case is hardest to observe?&lt;/li&gt;
&lt;li&gt;What do the tests not prove?&lt;/li&gt;
&lt;li&gt;Is the change reversible?&lt;/li&gt;
&lt;li&gt;Who will understand this during an incident?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AI can produce a convincing implementation around a weak assumption.&lt;/p&gt;

&lt;p&gt;The most valuable review may be reviewing the decision behind the code.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Explain the change back in your own words
&lt;/h2&gt;

&lt;p&gt;After the agent finishes, close the loop.&lt;/p&gt;

&lt;p&gt;Explain:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What changed&lt;/li&gt;
&lt;li&gt;Why it changed&lt;/li&gt;
&lt;li&gt;Why this approach was selected&lt;/li&gt;
&lt;li&gt;What could still go wrong&lt;/li&gt;
&lt;li&gt;How the change will be verified&lt;/li&gt;
&lt;li&gt;How it can be rolled back&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This can become part of the pull request description or decision record.&lt;/p&gt;

&lt;p&gt;A useful test is simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Could I explain this change to another engineer without reopening the agent conversation?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If not, some knowledge may still be trapped inside the tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Preserve occasional unaided practice
&lt;/h2&gt;

&lt;p&gt;Not every task needs to become a lesson.&lt;/p&gt;

&lt;p&gt;But some deliberate practice matters.&lt;/p&gt;

&lt;p&gt;Occasionally:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Trace the unfamiliar path manually.&lt;/li&gt;
&lt;li&gt;Debug before asking the agent for the answer.&lt;/li&gt;
&lt;li&gt;Write the first test yourself.&lt;/li&gt;
&lt;li&gt;Review a change without an AI summary.&lt;/li&gt;
&lt;li&gt;Solve the unfamiliar part before requesting optimisation.&lt;/li&gt;
&lt;li&gt;Predict the production failure before running the tests.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We do not become better at a skill merely by watching a tool perform it.&lt;/p&gt;

&lt;p&gt;Some capabilities still need repetitions.&lt;/p&gt;

&lt;h2&gt;
  
  
  A learning-aware prompt for coding agents
&lt;/h2&gt;

&lt;p&gt;Here is a prompt you can adapt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Before changing any code:

1. Map the relevant code path and dependencies.
2. Explain the current behaviour.
3. State your assumptions and missing context.
4. Propose at least two approaches.
5. Explain the trade-offs and which approach you recommend.
6. Identify the highest-risk failure modes.
7. Wait for my decision before implementation.

After implementation:

8. Explain the most important design decision.
9. Describe what the tests prove and what they do not prove.
10. Give me one question that checks whether I understood the change.
11. Summarise the information that should remain in the pull request or documentation.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will not remove every risk.&lt;/p&gt;

&lt;p&gt;But it changes the interaction from:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Agent solves. Developer accepts.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;to:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Agent explores. Developer decides. Both make the reasoning visible.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What teams can do
&lt;/h2&gt;

&lt;p&gt;Individual habits help, but teams also shape how engineers learn.&lt;/p&gt;

&lt;p&gt;A team using coding agents heavily could add a few lightweight practices:&lt;/p&gt;

&lt;h3&gt;
  
  
  Add reasoning to pull requests
&lt;/h3&gt;

&lt;p&gt;Require the author to explain the highest-risk decision, not paste the agent's complete transcript.&lt;/p&gt;

&lt;h3&gt;
  
  
  Review understanding as well as correctness
&lt;/h3&gt;

&lt;p&gt;Ask the author to describe the failure modes and trade-offs during review.&lt;/p&gt;

&lt;p&gt;This is not an exam.&lt;/p&gt;

&lt;p&gt;It is a way to confirm that knowledge remains inside the team.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use agents to teach during real work
&lt;/h3&gt;

&lt;p&gt;Ask agents to surface unfamiliar concepts, rejected alternatives, or architectural context while engineers are already solving a task.&lt;/p&gt;

&lt;p&gt;Learning should be connected to the code in front of the developer, not delivered as generic advice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Protect deep-work opportunities
&lt;/h3&gt;

&lt;p&gt;Do not optimise every task for maximum delegation.&lt;/p&gt;

&lt;p&gt;Some tasks are valuable because they expose engineers to unfamiliar systems, production behaviour, and complex decisions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Measure more than output
&lt;/h3&gt;

&lt;p&gt;More completed tasks or merged pull requests can be useful signals.&lt;/p&gt;

&lt;p&gt;They do not tell you whether:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Review effort increased&lt;/li&gt;
&lt;li&gt;Rework increased&lt;/li&gt;
&lt;li&gt;Engineers understand the generated systems&lt;/li&gt;
&lt;li&gt;On-call capability improved&lt;/li&gt;
&lt;li&gt;Junior engineers are building independent judgment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AI adoption should improve both delivery and engineering capability.&lt;/p&gt;

&lt;h2&gt;
  
  
  The coding agent we should want
&lt;/h2&gt;

&lt;p&gt;The best coding agent will not only produce a correct patch.&lt;/p&gt;

&lt;p&gt;It will help the engineer understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The system it changed&lt;/li&gt;
&lt;li&gt;The alternatives it considered&lt;/li&gt;
&lt;li&gt;The trade-off it selected&lt;/li&gt;
&lt;li&gt;The risks that remain&lt;/li&gt;
&lt;li&gt;The evidence required to trust the result&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is a higher standard than code generation.&lt;/p&gt;

&lt;p&gt;It treats learning as part of developer productivity rather than as a cost outside it.&lt;/p&gt;

&lt;p&gt;AI can make engineers faster.&lt;/p&gt;

&lt;p&gt;The better goal is to make them faster &lt;strong&gt;and&lt;/strong&gt; more capable.&lt;/p&gt;

&lt;p&gt;The best coding agents will not only help engineers finish the task.&lt;/p&gt;

&lt;p&gt;They will help engineers become better at the task.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>learning</category>
      <category>career</category>
    </item>
    <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>
  </channel>
</rss>
