<?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: Ashok Naik</title>
    <description>The latest articles on DEV Community by Ashok Naik (@a_shokn).</description>
    <link>https://dev.to/a_shokn</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F247627%2F36c29948-5b1f-43a1-b4ce-fc28e6d8491a.jpg</url>
      <title>DEV Community: Ashok Naik</title>
      <link>https://dev.to/a_shokn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/a_shokn"/>
    <language>en</language>
    <item>
      <title>Agent Teams: Agentic Engineering Comes to Claude Code</title>
      <dc:creator>Ashok Naik</dc:creator>
      <pubDate>Tue, 10 Feb 2026 04:10:34 +0000</pubDate>
      <link>https://dev.to/a_shokn/agent-teams-agentic-engineering-comes-to-claude-code-38cg</link>
      <guid>https://dev.to/a_shokn/agent-teams-agentic-engineering-comes-to-claude-code-38cg</guid>
      <description>&lt;p&gt;&lt;em&gt;Andrej Karpathy's vision of orchestrating AI agents is now a terminal command away&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;A year ago, Andrej Karpathy coined "vibe coding"—the gleefully reckless way of prompting AI, accepting everything it spits out, and iterating by pasting error messages back in. It was fun. It was fast. It was chaos.&lt;/p&gt;

&lt;p&gt;Last week, Karpathy declared that era over:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Agentic engineering: AI does the implementation, human owns the architecture, quality, and correctness."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The shift is fundamental. You're no longer prompting a single AI. You're &lt;strong&gt;orchestrating a team of agents&lt;/strong&gt;—coding assistants that execute, test, and refine code while you act as architect, reviewer, and decision-maker.&lt;/p&gt;

&lt;p&gt;Karpathy described this at Y Combinator's AI Startup School:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"You're not just coding with AI, you're managing a team of AIs, each playing a specific role in your pipeline. It's like Zapier meets GitHub Copilot meets chaos."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The punchline? &lt;strong&gt;Claude Code just shipped this.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's called &lt;strong&gt;Agent Teams&lt;/strong&gt;, and it turns Karpathy's vision of agentic engineering into something you can run from your terminal today.&lt;/p&gt;




&lt;h2&gt;
  
  
  What: Your First Agent Swarm
&lt;/h2&gt;

&lt;p&gt;Karpathy talked about "partial autonomy"—tools with an "autonomy slider" that let you dial in how much control AI has, from simple suggestions to fully automated generation. Agent Teams are exactly this, cranked to eleven.&lt;/p&gt;

&lt;p&gt;One Claude session acts as the &lt;strong&gt;team lead&lt;/strong&gt;. It spawns &lt;strong&gt;teammates&lt;/strong&gt;—separate Claude instances, each in their own context window—that work independently on assigned tasks. They communicate directly with each other, share a task list, and synthesize findings.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Karpathy's Vision&lt;/th&gt;
&lt;th&gt;Claude Code's Implementation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Orchestrating multiple AI agents&lt;/td&gt;
&lt;td&gt;Team Lead coordinates teammates&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Each agent plays a specific role&lt;/td&gt;
&lt;td&gt;Teammates spawned with specialized prompts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fast generation-verification loops&lt;/td&gt;
&lt;td&gt;Hooks for quality gates at task completion&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Human owns architecture + correctness&lt;/td&gt;
&lt;td&gt;Lead reviews plans, approves before implementation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Autonomy slider&lt;/td&gt;
&lt;td&gt;Delegate mode restricts lead to coordination-only&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This is Karpathy's "managing a team of AIs" made real. Not one agent doing everything. Multiple specialized agents, coordinated through a shared task list, communicating directly to converge on solutions.&lt;/p&gt;

&lt;p&gt;Karpathy also described LLMs as "brilliant interns with perfect recall but no judgment." Agent Teams address this by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Requiring &lt;strong&gt;plan approval&lt;/strong&gt; before implementation&lt;/li&gt;
&lt;li&gt;Enforcing &lt;strong&gt;quality gates&lt;/strong&gt; via hooks&lt;/li&gt;
&lt;li&gt;Keeping humans &lt;strong&gt;in the loop&lt;/strong&gt; as decision-makers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The team lead is still Claude. But the human owns the architecture.&lt;/p&gt;




&lt;h2&gt;
  
  
  How: Building Your First Agent Team
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Enable the Feature
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;settings.json&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Start a Team
&lt;/h3&gt;

&lt;p&gt;Describe what you want in natural language:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create an agent team to refactor our authentication module.
Spawn three teammates:
- One for frontend auth components
- One for backend API endpoints
- One for test coverage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude creates the team, spawns teammates, assigns work via a shared task list, and synthesizes results.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Architecture
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Team Lead&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Creates team, spawns teammates, coordinates work&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Teammates&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Separate Claude instances working assigned tasks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Task List&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Shared work items teammates claim and complete&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Mailbox&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Messaging for direct inter-agent communication&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Display Modes
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;In-process mode&lt;/strong&gt; (default): All teammates run inside your terminal. Use &lt;code&gt;Shift+Up/Down&lt;/code&gt; to select and message teammates directly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Split-pane mode&lt;/strong&gt;: Each teammate gets its own pane. Requires tmux or iTerm2.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"teammateMode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"tmux"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Control Patterns
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Specify models and count:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create a team with 4 teammates using Sonnet.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Require plan approval:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Spawn an architect teammate to refactor auth.
Require plan approval before any changes.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The lead reviews plans and either approves or rejects with feedback—exactly like a senior engineer reviewing a junior's approach.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Delegate mode&lt;/strong&gt; (Shift+Tab twice): Restricts the lead to coordination-only. Pure orchestration, no implementation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Talk directly to teammates:&lt;/strong&gt; In split-pane mode, click any pane. In in-process mode, &lt;code&gt;Shift+Up/Down&lt;/code&gt; to select, then type.&lt;/p&gt;

&lt;h3&gt;
  
  
  Quality Gates with Hooks
&lt;/h3&gt;

&lt;p&gt;Karpathy emphasized "fast generation-verification loops where AI generates work and humans quickly audit it." Hooks enforce this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"TeammateIdle"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"prompt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"prompt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Did the teammate complete all acceptance criteria? Exit code 2 to send back."&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"TaskCompleted"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"prompt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"prompt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Are tests passing? Documentation updated? Exit code 2 to prevent completion."&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The autonomy slider in action—you control how much verification happens at each step.&lt;/p&gt;




&lt;h2&gt;
  
  
  When: Use Cases That Work
&lt;/h2&gt;

&lt;p&gt;Karpathy said we're in the "decade of agents" rather than just the "year of agents." Agent Teams are most effective when &lt;strong&gt;parallel exploration adds real value&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Research and Review
&lt;/h3&gt;

&lt;p&gt;A single reviewer gravitates toward one issue type at a time. Split the work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create an agent team to review PR #142:
- One focused on security implications
- One checking performance impact
- One validating test coverage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each applies a different filter. The lead synthesizes across all three.&lt;/p&gt;

&lt;h3&gt;
  
  
  Competing Hypotheses (Scientific Debate)
&lt;/h3&gt;

&lt;p&gt;When root cause is unclear, make teammates adversarial:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Users report the app exits after one message.
Spawn 5 teammates to investigate different hypotheses.
Have them debate and try to disprove each other's theories.
Update the findings doc with consensus.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The theory that survives multiple challenges is more likely correct.&lt;/p&gt;

&lt;h3&gt;
  
  
  New Modules or Features
&lt;/h3&gt;

&lt;p&gt;Teammates each own a separate piece:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create a team for the new notification system:
- Frontend components
- Backend services
- Database schema and migrations
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Cross-Layer Coordination
&lt;/h3&gt;

&lt;p&gt;Changes spanning frontend, backend, and tests—each owned by a different teammate with the lead coordinating handoffs.&lt;/p&gt;




&lt;h2&gt;
  
  
  When NOT to Use
&lt;/h2&gt;

&lt;p&gt;Karpathy noted that fully autonomous agents still "get tripped up just a couple of steps into a job." Agent Teams add coordination overhead and use significantly more tokens. Avoid them for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sequential tasks&lt;/strong&gt; where each step depends on the previous&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Same-file edits&lt;/strong&gt; where teammates would conflict&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High-dependency work&lt;/strong&gt; requiring constant context sharing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple tasks&lt;/strong&gt; where coordination overhead exceeds benefit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For these, use &lt;strong&gt;subagents&lt;/strong&gt; instead—they spawn within a single session and report back.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Subagents&lt;/th&gt;
&lt;th&gt;Agent Teams&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Context&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Results return to caller&lt;/td&gt;
&lt;td&gt;Fully independent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Communication&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Report to main agent only&lt;/td&gt;
&lt;td&gt;Message each other&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Coordination&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Main agent manages all&lt;/td&gt;
&lt;td&gt;Self-coordination via task list&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Best for&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Focused tasks, only result matters&lt;/td&gt;
&lt;td&gt;Complex work needing discussion&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Token cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Lower&lt;/td&gt;
&lt;td&gt;Higher&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  The Compound Effect
&lt;/h2&gt;

&lt;p&gt;Karpathy's vision of Software 3.0 is that "the role of the engineer shifts from direct author to orchestrator." With Agent Teams + Skills + Hooks, this compounds:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Week 1:&lt;/strong&gt; Single Claude session. Manual coordination. Frequent context switches.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Week 4:&lt;/strong&gt; Agent Teams for complex work. Teammates inherit shared CLAUDE.md learnings. Task lists capture institutional knowledge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Week 12:&lt;/strong&gt; Your project runs like Karpathy's agentic engineering vision—specialized agents, coordinated workflows, quality gates enforced by hooks, learnings persisted across sessions.&lt;/p&gt;

&lt;p&gt;The pieces are all here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Skills&lt;/strong&gt; package domain knowledge that grows over time&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hooks&lt;/strong&gt; create verification loops&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent Teams&lt;/strong&gt; enable parallel orchestration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CLAUDE.md&lt;/strong&gt; stores accumulated learnings every teammate inherits&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Bottom Line
&lt;/h2&gt;

&lt;p&gt;Karpathy said agentic engineering is "a serious engineering discipline involving autonomous agents." It's professionally legible. You can say it to your VP of Engineering without embarrassment.&lt;/p&gt;

&lt;p&gt;Agent Teams make this concrete:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Vibe coding = YOLO&lt;br&gt;
Agentic engineering = AI does implementation, human owns architecture&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The infrastructure is here. Multiple Claude instances. Shared task lists. Direct inter-agent messaging. Quality gates via hooks. Human-in-the-loop plan approval.&lt;/p&gt;

&lt;p&gt;The decade of agents starts with &lt;code&gt;CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Start with research and review. The rest follows.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/agent-teams" rel="noopener noreferrer"&gt;Agent Teams Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/sub-agents" rel="noopener noreferrer"&gt;Subagents Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/hooks" rel="noopener noreferrer"&gt;Hooks Reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=kMNSAhsyiDg" rel="noopener noreferrer"&gt;Andrej Karpathy: Software Is Changing (Again) - YC AI Startup School&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://addyosmani.com/blog/agentic-engineering/" rel="noopener noreferrer"&gt;Addy Osmani: Agentic Engineering&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;How are you using multi-agent orchestration in your workflows? Share your patterns in the comments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>programming</category>
      <category>claudecode</category>
    </item>
    <item>
      <title>The Missing Piece in AI Agents: Continual Learning</title>
      <dc:creator>Ashok Naik</dc:creator>
      <pubDate>Fri, 09 Jan 2026 04:37:53 +0000</pubDate>
      <link>https://dev.to/a_shokn/the-missing-piece-in-ai-agents-continual-learning-4i9j</link>
      <guid>https://dev.to/a_shokn/the-missing-piece-in-ai-agents-continual-learning-4i9j</guid>
      <description>&lt;p&gt;&lt;em&gt;Why the smartest AI still can't learn like a junior developer—and what we can do about it&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Billion Dollar Problem
&lt;/h2&gt;

&lt;p&gt;Dwarkesh Patel, host of one of tech's most influential podcasts, recently dropped a provocative essay that's been circulating in AI circles. His core argument cuts deep:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"The reason humans are so useful is not mainly their raw intelligence. It's their ability to build up context, interrogate their own failures, and pick up small improvements and efficiencies as they practice a task."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Think about that. A junior developer joins your team. Day one, they're useless. Day thirty? They know where the bodies are buried. They've learned your codebase quirks, your team's preferences, your deployment rituals. They've made mistakes and &lt;em&gt;never made them again&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Now think about your AI assistant. You correct it. It adapts. Session ends. Next session? Blank slate. Same mistakes. Same corrections. Infinite loop.&lt;/p&gt;

&lt;p&gt;This is what Dwarkesh calls the &lt;strong&gt;continual learning problem&lt;/strong&gt;—and he argues it's the single biggest bottleneck to AI becoming genuinely useful:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Every day, you have to do a hundred things that require judgment, situational awareness, and skills &amp;amp; context learned on the job. These tasks differ not just across different people, but from one day to the next even for the same person. It is not possible to automate even a single job by just baking in some predefined set of skills."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The AI labs are spending billions trying to "bake in" skills through reinforcement learning—teaching models to use Excel, browse the web, write code. But as Dwarkesh points out, this fundamentally misses how humans actually work:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Human workers are valuable precisely because we don't need to build schleppy training loops for every small part of their job."&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What Continual Learning Actually Means
&lt;/h2&gt;

&lt;p&gt;Let's be precise. Continual learning isn't just "memory." It's the ability to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Learn from corrections&lt;/strong&gt; - Make a mistake, get feedback, never repeat it&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build context over time&lt;/strong&gt; - Understand your specific environment, preferences, workflows&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Generalize from experience&lt;/strong&gt; - Apply lessons from one situation to novel ones&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Self-improve without retraining&lt;/strong&gt; - Get better at the job &lt;em&gt;while doing the job&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Current LLMs fail at all four. They're frozen at training time. Every session starts from zero.&lt;/p&gt;

&lt;p&gt;But here's the thing: &lt;strong&gt;we don't have to wait for the labs to solve this.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With the right architecture, you can build continual learning &lt;em&gt;on top of&lt;/em&gt; current models. It won't be as elegant as a fundamental breakthrough—but it works. And it compounds.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Solution: External Memory + Reflection Loops
&lt;/h2&gt;

&lt;p&gt;The pattern is simple in concept:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Experience → Capture → Reflect → Persist → Apply
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of hoping the model learns internally, we build external systems that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Capture what happens during sessions&lt;/li&gt;
&lt;li&gt;Reflect on patterns, mistakes, and successes&lt;/li&gt;
&lt;li&gt;Persist learnings to files the model reads on startup&lt;/li&gt;
&lt;li&gt;Apply accumulated knowledge to future sessions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is exactly what Anthropic's &lt;strong&gt;Agent Skills&lt;/strong&gt; and &lt;strong&gt;Hooks&lt;/strong&gt; system enables in Claude Code. Let's break down how to build it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Agent Skills: Your Knowledge Base
&lt;/h2&gt;

&lt;p&gt;Skills are folders of instructions, scripts, and resources that Claude loads dynamically. They solve a specific problem: &lt;strong&gt;how do you give an AI domain expertise without stuffing everything into context?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The answer is progressive disclosure:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Level 1:&lt;/strong&gt; Skill name and description (always in context)&lt;br&gt;
&lt;strong&gt;Level 2:&lt;/strong&gt; Full SKILL.md (loaded when relevant)&lt;br&gt;
&lt;strong&gt;Level 3:&lt;/strong&gt; Supporting files (loaded on demand)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.claude/skills/
└── my-domain/
    ├── SKILL.md           # Core instructions
    ├── common-mistakes.md # Grows over time
    ├── preferences.md     # User-specific learnings
    └── scripts/
        └── validate.sh    # Executable tools
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The magic is in &lt;code&gt;common-mistakes.md&lt;/code&gt;. This file starts empty. Over time, through reflection, it accumulates every error Claude has made and learned from. Each session, Claude reads it. Each session, Claude avoids those mistakes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SKILL.md structure:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="nn"&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;project-conventions&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Team coding standards and learned patterns. Use when writing or reviewing code.&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="gh"&gt;# Project Conventions&lt;/span&gt;

&lt;span class="gu"&gt;## Always&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Use TypeScript strict mode
&lt;span class="p"&gt;-&lt;/span&gt; Add error handling to all async functions
&lt;span class="p"&gt;-&lt;/span&gt; Follow the patterns in /src/utils

&lt;span class="gu"&gt;## Common Mistakes (Auto-Updated)&lt;/span&gt;
See common-mistakes.md for patterns learned from past sessions.

&lt;span class="gu"&gt;## User Preferences (Auto-Updated)&lt;/span&gt;
See preferences.md for this user's specific preferences.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Skills solve the "baking in" problem Dwarkesh criticizes—but in a composable, updatable way. You're not retraining the model. You're building a living knowledge base it consults.&lt;/p&gt;




&lt;h2&gt;
  
  
  Hooks: The Feedback Loop
&lt;/h2&gt;

&lt;p&gt;Hooks are custom commands that execute at specific points in Claude's workflow. They're your quality gates and learning triggers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stop Hook&lt;/strong&gt; - Fires when Claude finishes a task:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Stop"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"prompt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"prompt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Before finishing: Did you make any mistakes this session? Did the user correct you? What patterns should be remembered?"&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;SubagentStop Hook&lt;/strong&gt; - Fires when a subagent completes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"SubagentStop"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"prompt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"prompt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Evaluate: Was the subagent's approach optimal? What would improve future runs?"&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;PreCompact Hook&lt;/strong&gt; - Fires before context compression:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"PreCompact"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"echo 'Reminder: Run /reflect to capture learnings before they compress away'"&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hooks create the "interrogate their own failures" capability Dwarkesh says humans have. The AI doesn't just finish—it pauses to evaluate what happened.&lt;/p&gt;




&lt;h2&gt;
  
  
  The /reflect Command: Synthesis Engine
&lt;/h2&gt;

&lt;p&gt;This is where continual learning actually happens. The &lt;code&gt;/reflect&lt;/code&gt; command triggers Claude to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Analyze the current session&lt;/li&gt;
&lt;li&gt;Identify corrections, mistakes, and successful patterns&lt;/li&gt;
&lt;li&gt;Update CLAUDE.md and skill files with permanent learnings&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Create the command:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# .claude/commands/reflect.md
---
description: Analyze session and update knowledge base with learnings
---
&lt;/span&gt;
You are analyzing this session to extract permanent learnings.

&lt;span class="gu"&gt;## Review&lt;/span&gt;
Examine the conversation for:
&lt;span class="p"&gt;-&lt;/span&gt; User corrections ("no, use X not Y", "actually...", "that's wrong")
&lt;span class="p"&gt;-&lt;/span&gt; Repeated mistakes
&lt;span class="p"&gt;-&lt;/span&gt; Successful patterns worth preserving
&lt;span class="p"&gt;-&lt;/span&gt; Preferences expressed

&lt;span class="gu"&gt;## Synthesize&lt;/span&gt;
For each learning:
&lt;span class="p"&gt;1.&lt;/span&gt; Abstract the general principle (not just the specific instance)
&lt;span class="p"&gt;2.&lt;/span&gt; Determine scope (project-specific or global?)
&lt;span class="p"&gt;3.&lt;/span&gt; Check for conflicts with existing rules

&lt;span class="gu"&gt;## Update&lt;/span&gt;
Add learnings to appropriate files:
&lt;span class="p"&gt;-&lt;/span&gt; CLAUDE.md for general rules
&lt;span class="p"&gt;-&lt;/span&gt; skills/&lt;span class="err"&gt;*&lt;/span&gt;/common-mistakes.md for domain-specific errors
&lt;span class="p"&gt;-&lt;/span&gt; skills/&lt;span class="err"&gt;*&lt;/span&gt;/preferences.md for user preferences

Format as one-line bullets. Be specific.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The flow:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Session happens → User corrects Claude → 
Hook reminds to reflect → User runs /reflect → 
Claude analyzes conversation → Claude proposes updates → 
User approves → Files updated → 
Next session starts with new knowledge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  The Compound Effect
&lt;/h2&gt;

&lt;p&gt;Here's what Dwarkesh is missing when he's bearish on current AI: &lt;strong&gt;you don't need the model to learn internally.&lt;/strong&gt; You need the &lt;em&gt;system&lt;/em&gt; to learn.&lt;/p&gt;

&lt;p&gt;Week 1: CLAUDE.md has 20 lines. Claude makes frequent mistakes.&lt;/p&gt;

&lt;p&gt;Week 4: CLAUDE.md has 50 lines. Common mistakes file has 15 entries. Mistakes down 40%.&lt;/p&gt;

&lt;p&gt;Week 12: Knowledge base has hundreds of learnings. Claude rarely makes mistakes you've seen before.&lt;/p&gt;

&lt;p&gt;This is continual learning—implemented externally, but functionally equivalent. Claude isn't learning in the ML sense. But the &lt;em&gt;system&lt;/em&gt; is learning. And from the user's perspective, that's what matters.&lt;/p&gt;

&lt;p&gt;The compounding is real:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every correction becomes a permanent rule&lt;/li&gt;
&lt;li&gt;Every preference gets captured&lt;/li&gt;
&lt;li&gt;Every mistake becomes a guardrail&lt;/li&gt;
&lt;li&gt;Knowledge accumulates across sessions, projects, team members&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Advanced: The Diary Pattern
&lt;/h2&gt;

&lt;p&gt;For deeper reflection, implement session diaries:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create /diary command:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# .claude/commands/diary.md
---
description: Capture session details for later reflection
---
&lt;/span&gt;
Capture this session:
&lt;span class="p"&gt;
1.&lt;/span&gt; What was accomplished
&lt;span class="p"&gt;2.&lt;/span&gt; Key decisions made and why
&lt;span class="p"&gt;3.&lt;/span&gt; Challenges encountered
&lt;span class="p"&gt;4.&lt;/span&gt; User feedback and corrections
&lt;span class="p"&gt;5.&lt;/span&gt; Patterns that worked well

Save to: ~/.claude/memory/diary/YYYY-MM-DD-session.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Then /reflect reads diaries:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Analyze diary entries in ~/.claude/memory/diary/

Identify patterns across multiple sessions:
&lt;span class="p"&gt;-&lt;/span&gt; Recurring mistakes → Add to common-mistakes.md
&lt;span class="p"&gt;-&lt;/span&gt; Consistent preferences → Add to preferences.md
&lt;span class="p"&gt;-&lt;/span&gt; Successful approaches → Add to SKILL.md

Synthesize into rules. Remove redundant entries.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This mimics how humans learn—not just from individual corrections, but from patterns across experiences.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;Dwarkesh argues that solving continual learning won't be "a singular one-and-done achievement"—it'll feel like how we solved in-context learning, with gradual progress over years.&lt;/p&gt;

&lt;p&gt;I agree. But we don't have to wait.&lt;/p&gt;

&lt;p&gt;The tools exist today to build systems that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Capture corrections automatically&lt;/li&gt;
&lt;li&gt;Synthesize learnings through reflection&lt;/li&gt;
&lt;li&gt;Persist knowledge across sessions&lt;/li&gt;
&lt;li&gt;Compound improvements over time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's not as elegant as a new architecture. It's infrastructure. Plumbing. But it works.&lt;/p&gt;

&lt;p&gt;And when the labs eventually crack continual learning at the model level? Your external knowledge base becomes training data. Your accumulated learnings become fine-tuning signal. The work compounds either way.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Bottom Line
&lt;/h2&gt;

&lt;p&gt;Dwarkesh is right that continual learning is the bottleneck. He's wrong that we have to wait for the labs to solve it.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;What It Does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Skills&lt;/td&gt;
&lt;td&gt;Package domain knowledge that grows over time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hooks&lt;/td&gt;
&lt;td&gt;Create feedback loops for self-evaluation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;/reflect&lt;/td&gt;
&lt;td&gt;Synthesize experience into permanent rules&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CLAUDE.md&lt;/td&gt;
&lt;td&gt;Store accumulated learnings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Diaries&lt;/td&gt;
&lt;td&gt;Capture raw experience for pattern mining&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The agents that win won't be the ones with the best base models. They'll be the ones with the best learning infrastructure—systems that turn every session into compound improvement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Start with /reflect. The rest follows.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/skills" rel="noopener noreferrer"&gt;Agent Skills Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/hooks" rel="noopener noreferrer"&gt;Hooks Reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills" rel="noopener noreferrer"&gt;Equipping Agents with Skills (Anthropic Engineering)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/BayramAnnakov/claude-reflect" rel="noopener noreferrer"&gt;claude-reflect Plugin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.dwarkesh.com/p/thoughts-on-ai-progress-dec-2025" rel="noopener noreferrer"&gt;Dwarkesh Patel: Thoughts on AI Progress&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/engineering/building-agents-with-the-claude-agent-sdk" rel="noopener noreferrer"&gt;Building Agents with Claude Agent SDK&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;What's your approach to making AI learn across sessions? Share your patterns in the comments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>How the Creator of Claude Code Actually Uses It</title>
      <dc:creator>Ashok Naik</dc:creator>
      <pubDate>Tue, 06 Jan 2026 04:23:14 +0000</pubDate>
      <link>https://dev.to/a_shokn/how-the-creator-of-claude-code-actually-uses-it-32df</link>
      <guid>https://dev.to/a_shokn/how-the-creator-of-claude-code-actually-uses-it-32df</guid>
      <description>&lt;p&gt;Boris Cherny built Claude Code. When someone asked how he actually uses it, his answer surprised everyone: &lt;strong&gt;it's surprisingly vanilla.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But don't let "vanilla" fool you. His setup is a masterclass in AI-assisted development that any developer can steal.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Think of his approach like conducting an orchestra—each Claude instance plays its part while you orchestrate the symphony.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;The stakes?&lt;/strong&gt; Most developers use one AI assistant at a time. Boris runs 15+ simultaneously. Here's exactly how.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Principles
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Mindset Shifts:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AI coding is asynchronous, not synchronous&lt;/li&gt;
&lt;li&gt;Plan first, execute second&lt;/li&gt;
&lt;li&gt;Mistakes become institutional knowledge&lt;/li&gt;
&lt;li&gt;Verification loops are non-negotiable&lt;/li&gt;
&lt;li&gt;Automate everything you do twice&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What Makes Boris's Setup Different:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Running 15+ Claude instances in parallel&lt;/li&gt;
&lt;li&gt;Shared team knowledge in version-controlled files&lt;/li&gt;
&lt;li&gt;Automated workflows via slash commands and subagents&lt;/li&gt;
&lt;li&gt;Quality gates through hooks and verification&lt;/li&gt;
&lt;li&gt;Institutional learning from every mistake&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Parallel Execution Framework
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Terminal Setup (5 Parallel Claudes)
&lt;/h3&gt;

&lt;p&gt;Boris runs 5 Claude instances in his terminal simultaneously, numbered 1-5 in tabs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❌ WRONG: Run one Claude, wait for it, start another
✅ RIGHT: Run 5 Claudes, context-switch between them as they work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The Smart Setup:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Number your tabs 1-5&lt;/strong&gt; → Quick visual reference&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enable system notifications&lt;/strong&gt; → Know when Claude needs input&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Let them cook&lt;/strong&gt; → Check in periodically, not constantly&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Batch your reviews&lt;/strong&gt; → Review multiple outputs together&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The 5-Layer Productivity Stack
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Layer 1: Model Selection (Bigger = Faster)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Counterintuitive Truth:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Boris uses Opus 4.5 exclusively&lt;/li&gt;
&lt;li&gt;Despite being larger and slower than Sonnet&lt;/li&gt;
&lt;li&gt;Total time to completion is almost always shorter&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why Bigger Wins:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Less steering required&lt;/li&gt;
&lt;li&gt;Better tool use out of the box&lt;/li&gt;
&lt;li&gt;Fewer correction cycles&lt;/li&gt;
&lt;li&gt;Less clarification needed&lt;/li&gt;
&lt;li&gt;Better first-attempt quality&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Layer 2: The Living CLAUDE.md
&lt;/h3&gt;

&lt;p&gt;The Claude Code team shares a single &lt;code&gt;CLAUDE.md&lt;/code&gt; checked into git:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Golden Rule:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Anytime Claude does something wrong, add it to CLAUDE.md&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Team Workflow:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;1.&lt;/span&gt; Everyone contributes multiple times per week
&lt;span class="p"&gt;2.&lt;/span&gt; Tag @claude on PRs to add learnings
&lt;span class="p"&gt;3.&lt;/span&gt; Review CLAUDE.md changes like any code
&lt;span class="p"&gt;4.&lt;/span&gt; Mistakes compound into institutional knowledge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What Goes In:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Common errors Claude makes&lt;/li&gt;
&lt;li&gt;Project-specific conventions&lt;/li&gt;
&lt;li&gt;Domain knowledge Claude needs&lt;/li&gt;
&lt;li&gt;Edge cases and gotchas&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Layer 3: Plan Mode (The 1-Shot Enabler)
&lt;/h3&gt;

&lt;p&gt;Most sessions start in Plan mode (&lt;code&gt;shift+tab&lt;/code&gt; twice):&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Workflow:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Enter Plan mode
2. Iterate on plan with Claude until it's right
3. Switch to auto-accept edits mode
4. Claude executes—usually in one shot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why This Works:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Planning time is cheap&lt;/li&gt;
&lt;li&gt;Execution rework is expensive&lt;/li&gt;
&lt;li&gt;Good plans eliminate debug cycles&lt;/li&gt;
&lt;li&gt;Auto-accept mode enables flow state&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Layer 4: Slash Commands (Inner Loop Automation)
&lt;/h3&gt;

&lt;p&gt;Boris uses slash commands for any workflow done multiple times per day:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example: &lt;code&gt;/commit-push-pr&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;-&lt;/span&gt; Used dozens of times daily
&lt;span class="p"&gt;-&lt;/span&gt; Pre-computes git status via inline bash
&lt;span class="p"&gt;-&lt;/span&gt; Minimizes round trips to model
&lt;span class="p"&gt;-&lt;/span&gt; Lives in .claude/commands/
&lt;span class="p"&gt;-&lt;/span&gt; Checked into git for team sharing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The Pattern:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identify repetitive prompting patterns&lt;/li&gt;
&lt;li&gt;Encode as slash command&lt;/li&gt;
&lt;li&gt;Add inline bash for context pre-computation&lt;/li&gt;
&lt;li&gt;Share with team via git&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Layer 5: Subagents (Specialized Automation)
&lt;/h3&gt;

&lt;p&gt;Beyond slash commands, Boris maintains specialized subagents:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Active Subagents:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;code-simplifier&lt;/strong&gt; → Simplifies code after Claude completes work&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;verify-app&lt;/strong&gt; → Detailed E2E testing instructions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom agents&lt;/strong&gt; → Automate common PR workflows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Think of Subagents As:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Your code review checklist, automated and delegated to specialized agents&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The Most Important Tip: Verification Loops
&lt;/h2&gt;

&lt;p&gt;Boris saves his most critical advice for last:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Give Claude a way to verify its work.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Claude tests every change to claude.ai/code using the Chrome extension. It opens a browser, tests the UI, and iterates until the code works and the UX feels right.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Verification by Domain:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Domain&lt;/th&gt;
&lt;th&gt;Verification Method&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;CLI tools&lt;/td&gt;
&lt;td&gt;Run bash commands&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Backend&lt;/td&gt;
&lt;td&gt;Run test suite&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Frontend&lt;/td&gt;
&lt;td&gt;Browser testing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mobile&lt;/td&gt;
&lt;td&gt;Phone simulator&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;The Impact:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;2-3x quality improvement on final results&lt;/li&gt;
&lt;li&gt;Without verification: generating code&lt;/li&gt;
&lt;li&gt;With verification: shipping working software&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The Harsh Reality:&lt;/strong&gt; Everyone has access to the same AI tools. The developers winning are those who build systems around them.&lt;/p&gt;

&lt;p&gt;Boris's "vanilla" setup works because the systems are solid:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Parallel execution&lt;/td&gt;
&lt;td&gt;Maximize throughput&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shared CLAUDE.md&lt;/td&gt;
&lt;td&gt;Institutional learning&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Slash commands&lt;/td&gt;
&lt;td&gt;Automate inner loops&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Subagents&lt;/td&gt;
&lt;td&gt;Specialize workflows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hooks&lt;/td&gt;
&lt;td&gt;Quality gates&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Verification&lt;/td&gt;
&lt;td&gt;Ship working code&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/terminal-config" rel="noopener noreferrer"&gt;Terminal Config &amp;amp; Notifications&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/slash-commands" rel="noopener noreferrer"&gt;Slash Commands Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/sub-agents" rel="noopener noreferrer"&gt;Sub-agents Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/hooks-guide" rel="noopener noreferrer"&gt;Hooks Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/chrome" rel="noopener noreferrer"&gt;Chrome Extension&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/anthropics/claude-plugins-official/tree/main/plugins/ralph-wiggum" rel="noopener noreferrer"&gt;Ralph Wiggum Plugin&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;What's your Claude Code setup? Drop your tips in the comments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>claudecode</category>
      <category>devtools</category>
    </item>
    <item>
      <title>How to Break the AI-Generated UI Curse: Your Guide to Authentic, Professional Design</title>
      <dc:creator>Ashok Naik</dc:creator>
      <pubDate>Thu, 14 Aug 2025 08:47:19 +0000</pubDate>
      <link>https://dev.to/a_shokn/how-to-break-the-ai-generated-ui-curse-your-guide-to-authentic-professional-design-2en</link>
      <guid>https://dev.to/a_shokn/how-to-break-the-ai-generated-ui-curse-your-guide-to-authentic-professional-design-2en</guid>
      <description>&lt;p&gt;&lt;em&gt;Transform your generic AI outputs into stunning, human-centered interfaces that users actually love&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;We've all seen it. That instantly recognizable "AI-generated" look that screams "template" from across the room. While AI can help with tasks like data analysis or creating quick mockups, it can't replace the human touch in UX. The result? A digital landscape littered with eerily similar interfaces that feel as soulless as a corporate stock photo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here's the brutal truth:&lt;/strong&gt; 95% of designers say that design is at least as important for AI-powered products as traditional ones, while 52% say it's MORE important. Yet paradoxically, we're seeing more generic, AI-churned interfaces than ever before.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Think of AI UI generation like fast food—it fills the immediate need but lacks the craftsmanship and soul that makes people remember the experience.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The stakes? By 2025, AI and machine learning will generate an estimated $4 trillion in business value, but only for companies that can distinguish their digital experiences from the AI-generated noise.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎯 The Anatomy of "Generic AI Look" (And How to Spot It)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🚩 Red Flags That Scream "AI-Generated"
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Visual Symptoms:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✨ Overly perfect gradients with no character&lt;/li&gt;
&lt;li&gt;🎨 Color palettes pulled from the same 5 trending combinations
&lt;/li&gt;
&lt;li&gt;📱 Card-based layouts that feel like everyone else's&lt;/li&gt;
&lt;li&gt;🔲 Spacing that's mathematically perfect but emotionally cold&lt;/li&gt;
&lt;li&gt;🖼️ Stock-photo-esque illustration styles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Interaction Symptoms:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🎭 Zero micro-interactions or personality&lt;/li&gt;
&lt;li&gt;⚡ Generic hover states (if any)&lt;/li&gt;
&lt;li&gt;📋 Template-driven user flows with no contextual intelligence&lt;/li&gt;
&lt;li&gt;🔄 Copy-paste navigation patterns regardless of use case&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Recent testing of 4 major AI UI generators revealed that most tools produce either "too random or non-functional" results, with designs requiring significant human intervention to become usable.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ The Human-Centered Iteration Framework
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: 🎯 Treat AI as Your Junior Designer (Not Your Creative Director)
&lt;/h3&gt;

&lt;p&gt;A top-voted Reddit post suggests treating AI not as a magical designer, but as a junior assistant. Here's how to manage that relationship:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❌ WRONG: "AI, create my entire app interface"
✅ RIGHT: "AI, give me 3 wireframe variations for a dashboard sidebar"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The Smart Workflow:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Request rough drafts&lt;/strong&gt; → Get the skeleton, not the soul&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Iteratively refine&lt;/strong&gt; → Focus on one component at a time
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zoom into details&lt;/strong&gt; → Adjust spacing, alignment, micro-interactions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apply context&lt;/strong&gt; → Add your brand's personality and user insights&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step 2: 🎨 Style Extraction &amp;amp; Reference-Driven Design
&lt;/h3&gt;

&lt;p&gt;Detailed guides advocate starting with style references: grab inspiration from design sites (Dribbble, Mobbin), then use tools that extract or replicate CSS and style parameters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Modern Toolchain:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Inspiration Sources:&lt;/strong&gt; Dribbble, Mobbin, Land-book&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Style Extraction:&lt;/strong&gt; Cursor, TwixCN, Super Design&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Component Libraries:&lt;/strong&gt; shadcn/ui, Radix, Headless UI&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Animation Libraries:&lt;/strong&gt; Framer Motion, Lottie, CSS animations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Pro Strategy:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;1.&lt;/span&gt; Collect 3-5 reference designs that nail your vibe
&lt;span class="p"&gt;2.&lt;/span&gt; Extract common patterns (spacing, typography, color theory)
&lt;span class="p"&gt;3.&lt;/span&gt; Create a style guide BEFORE touching AI tools
&lt;span class="p"&gt;4.&lt;/span&gt; Use AI to generate components, then apply your style system
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ⚡ The 5-Layer Authenticity Stack
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Layer 1: 🎨 Visual Identity Beyond Templates
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Custom Color Psychology:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Move beyond AI's default palettes&lt;/li&gt;
&lt;li&gt;Use color theory to evoke specific emotions&lt;/li&gt;
&lt;li&gt;Test contrast ratios for accessibility (4.5:1 minimum)&lt;/li&gt;
&lt;li&gt;Create semantic color tokens (not just primary/secondary)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Typography Hierarchy:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ditch generic font pairings&lt;/li&gt;
&lt;li&gt;Big, bold, and capitalized typography is trending in 2024&lt;/li&gt;
&lt;li&gt;Mix typefaces strategically for emphasis&lt;/li&gt;
&lt;li&gt;Consider variable fonts for performance and flexibility&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Layer 2: 🔄 Micro-Interactions That Matter
&lt;/h3&gt;

&lt;p&gt;Microinteractions are those tiny, often overlooked moments in user interfaces that elevate an experience from functional to delightful. Here's how to nail them:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Micro-Interaction Checklist:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ &lt;strong&gt;Immediate feedback&lt;/strong&gt; → User knows their action registered&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;Purpose-driven&lt;/strong&gt; → Every animation solves a UX problem&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;Consistent language&lt;/strong&gt; → Unified motion design system&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;Human touch&lt;/strong&gt; → Add personality that evokes emotion&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Examples That Work:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Subtle button feedback */&lt;/span&gt;
&lt;span class="nc"&gt;.button&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-2px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;4px&lt;/span&gt; &lt;span class="m"&gt;8px&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0.15&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;all&lt;/span&gt; &lt;span class="m"&gt;0.2s&lt;/span&gt; &lt;span class="n"&gt;ease&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* Loading state with personality */&lt;/span&gt;
&lt;span class="nc"&gt;.loading&lt;/span&gt;&lt;span class="nd"&gt;::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"Brewing something awesome..."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pulse&lt;/span&gt; &lt;span class="m"&gt;1.5s&lt;/span&gt; &lt;span class="n"&gt;infinite&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;h3&gt;
  
  
  Layer 3: 🏗️ Contextual Layout Intelligence
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Beyond Generic Grids:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bento Boxing: Intentional, modular layouts that prioritize clarity and focus&lt;/li&gt;
&lt;li&gt;Dynamic layouts with overlapping elements, textured backgrounds, and thoughtfully placed layers&lt;/li&gt;
&lt;li&gt;Responsive design that adapts to content, not just screen size&lt;/li&gt;
&lt;li&gt;Progressive disclosure based on user journey stage&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Layer 4: 📝 Copy That Sounds Human
&lt;/h3&gt;

&lt;p&gt;UX copywriting is being half-drafted by AI and polished by humans. The magic happens in that polish:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Before (AI Generic):&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Error: Invalid input detected. Please try again."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;After (Human Touch):&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Oops! That doesn't look quite right. Mind giving it another shot?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Layer 5: 🧠 Intentional User Experience Architecture
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;The Questions AI Can't Answer:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What's the user's emotional state at this moment?&lt;/li&gt;
&lt;li&gt;How does this interface fit into their daily workflow?&lt;/li&gt;
&lt;li&gt;What accessibility needs haven't been considered?&lt;/li&gt;
&lt;li&gt;How does this experience reflect our brand values?&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🎯 Advanced Techniques: Beyond the Basics
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🔬 The Component Audit Method
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Weekly Practice:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Screenshot 5 interfaces you admire&lt;/li&gt;
&lt;li&gt;Analyze what makes them feel "not AI-generated"
&lt;/li&gt;
&lt;li&gt;Identify 3 specific techniques you can adapt&lt;/li&gt;
&lt;li&gt;Test one new approach in your current project&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  🎭 Personality Injection Points
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Where to Add Character:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Empty states&lt;/strong&gt; → Turn "No data" into storytelling opportunities&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error messages&lt;/strong&gt; → Error screens that make you chuckle, not cry&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Loading states&lt;/strong&gt; → Show progress with personality&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Onboarding flows&lt;/strong&gt; → Guide with enthusiasm, not instructions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Success confirmations&lt;/strong&gt; → Celebrate user achievements&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔍 The Details That Matter
&lt;/h3&gt;

&lt;p&gt;Microscopic details that enhance navigability, color palettes that evoke specific emotions, intuitive layouts that guide the user separate great interfaces from generic ones.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Checklist for Polish:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Custom icon set (not generic Material/Feather icons)&lt;/li&gt;
&lt;li&gt;[ ] Consistent border radius system (4px, 8px, 16px hierarchy)&lt;/li&gt;
&lt;li&gt;[ ] Intentional whitespace ratios (not just random spacing)&lt;/li&gt;
&lt;li&gt;[ ] Custom illustration style (even simple geometric patterns)&lt;/li&gt;
&lt;li&gt;[ ] Branded interaction sounds (subtle audio feedback)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🚀 Production-Ready Implementation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🏭 Modern Development Stack
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Design System Foundation&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;theme&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;colors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Semantic naming &amp;gt; generic naming&lt;/span&gt;
    &lt;span class="na"&gt;surfacePrimary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#ffffff&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;textEmphasis&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#1a1a1a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;interactionPrimary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#2563eb&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;feedbackSuccess&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#059669&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;spacing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Consistent scale based on 8px grid&lt;/span&gt;
    &lt;span class="na"&gt;xs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;4px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;sm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;8px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;md&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;16px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="na"&gt;lg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;24px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;xl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;32px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;xxl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;48px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Branded motion language&lt;/span&gt;
    &lt;span class="na"&gt;easeOut&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cubic-bezier(0.25, 0.46, 0.45, 0.94)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;fast&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;150ms&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;normal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;250ms&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;slow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;350ms&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📊 Quality Metrics That Matter
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Measure Human-Centered Success:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Time to First Interaction&lt;/strong&gt; &amp;lt; 100ms&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Perceived Performance Score&lt;/strong&gt; &amp;gt; 85/100&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accessibility Score&lt;/strong&gt; (axe-core) = 100%&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User Sentiment&lt;/strong&gt; → Track qualitative feedback&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Brand Recognition&lt;/strong&gt; → A/B test branded vs generic variants&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🎉 The Bottom Line: Your Competitive Advantage
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The Harsh Reality:&lt;/strong&gt; AI adoption is deepening across workflows, but there's a quality perception gap between developers and designers. While everyone's using the same AI tools, the companies winning are those who understand that &lt;strong&gt;AI creates the foundation, but humans create the magic&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  📈 Real-World Success Metrics
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Case Study:&lt;/strong&gt; Companies implementing human-centered AI workflows report:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📈 &lt;strong&gt;40% increase in user engagement&lt;/strong&gt; compared to generic AI interfaces&lt;/li&gt;
&lt;li&gt;💰 &lt;strong&gt;25% higher conversion rates&lt;/strong&gt; on human-polished designs
&lt;/li&gt;
&lt;li&gt;⚡ &lt;strong&gt;60% faster design iteration cycles&lt;/strong&gt; when AI and humans collaborate effectively&lt;/li&gt;
&lt;li&gt;🎯 &lt;strong&gt;3x higher brand recognition&lt;/strong&gt; in user testing compared to template-based designs&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🔥 The Future Is Human-AI Collaboration
&lt;/h2&gt;

&lt;p&gt;The teams that thrive are those who understand that best practices endure, while thinking critically about how to adapt them to emerging technologies. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't fight the AI revolution—lead it.&lt;/strong&gt; The future belongs to designers who can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;⚡ &lt;strong&gt;Leverage AI for speed&lt;/strong&gt; without sacrificing soul&lt;/li&gt;
&lt;li&gt;🎨 &lt;strong&gt;Inject human insight&lt;/strong&gt; where it matters most
&lt;/li&gt;
&lt;li&gt;🔄 &lt;strong&gt;Iterate rapidly&lt;/strong&gt; while maintaining quality standards&lt;/li&gt;
&lt;li&gt;📊 &lt;strong&gt;Measure impact&lt;/strong&gt; beyond just aesthetic appeal&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Remember:&lt;/strong&gt; Your users don't care if your interface was made by AI or aliens. They care if it solves their problems beautifully, efficiently, and memorably. That's the human touch no algorithm can replicate.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Ready to transform your AI outputs from generic to genius? Start with just one component and watch the magic happen. Your users (and your boss) will thank you.&lt;/em&gt; ✨&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; #ai #design #ui #ux #microinteractions #designsystem #userexperience #frontend #webdesign #mobiledesign&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>vibecoding</category>
      <category>vite</category>
      <category>react</category>
    </item>
    <item>
      <title>LangGraph &amp; LangChain: Building Agentic AI</title>
      <dc:creator>Ashok Naik</dc:creator>
      <pubDate>Sun, 27 Jul 2025 17:13:21 +0000</pubDate>
      <link>https://dev.to/a_shokn/langgraph-langchain-building-agentic-ai-k58</link>
      <guid>https://dev.to/a_shokn/langgraph-langchain-building-agentic-ai-k58</guid>
      <description>&lt;p&gt;&lt;em&gt;Transform your LLMs from static chatbots into dynamic, tool-using agents that can reason, act, and collaborate&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 From Static to Smart: The Agentic Revolution
&lt;/h2&gt;

&lt;p&gt;Traditional Large Language Models (LLMs) are like brilliant consultants with amnesia—they give great advice but forget everything after each conversation. While powerful for text generation and reasoning, they lack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🧠 &lt;strong&gt;Memory&lt;/strong&gt; - No context between interactions&lt;/li&gt;
&lt;li&gt;🛠️ &lt;strong&gt;Tool Usage&lt;/strong&gt; - Can't interact with external systems
&lt;/li&gt;
&lt;li&gt;🔄 &lt;strong&gt;Iterative Problem-Solving&lt;/strong&gt; - Can't refine their approach&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Agentic AI&lt;/strong&gt; changes the game by creating dynamic, goal-oriented systems that can reason, act, and adapt over time.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Think of it as upgrading from a calculator to a personal assistant who remembers your preferences, can call APIs, and collaborates with other specialists.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🏗️ The Dynamic Duo: LangChain vs LangGraph
&lt;/h2&gt;

&lt;h3&gt;
  
  
  LangChain: The Foundation Layer 🧱
&lt;/h3&gt;

&lt;p&gt;Perfect for &lt;strong&gt;linear workflows&lt;/strong&gt; and &lt;strong&gt;rapid prototyping&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Classic LangChain chain
from langchain.chains import LLMChain
from langchain.prompts import PromptTemplate

prompt = PromptTemplate(template="Summarize: {text}")
chain = LLMChain(llm=model, prompt=prompt)
result = chain.run("Your text here")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;✅ Sequential processing pipelines&lt;/li&gt;
&lt;li&gt;✅ Quick prototypes and demos&lt;/li&gt;
&lt;li&gt;✅ Simple Q&amp;amp;A systems&lt;/li&gt;
&lt;li&gt;✅ Text generation workflows&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  LangGraph: The Orchestration Engine ⚙️
&lt;/h3&gt;

&lt;p&gt;Built for &lt;strong&gt;complex workflows&lt;/strong&gt; with &lt;strong&gt;cycles and state&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# LangGraph workflow with memory
from langgraph.graph import StateGraph
from langgraph.checkpoint.memory import MemorySaver

workflow = StateGraph(YourState)
workflow.add_node("step1", your_function)
workflow.add_edge("step1", "step2")

memory = MemorySaver()
app = workflow.compile(checkpointer=memory)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;✅ Multi-agent coordination&lt;/li&gt;
&lt;li&gt;✅ Human-in-the-loop workflows&lt;/li&gt;
&lt;li&gt;✅ Stateful, long-running processes&lt;/li&gt;
&lt;li&gt;✅ Complex decision trees&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🎯 5 Essential Workflow Patterns
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. 🤖 Single Agent with Tools
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Perfect for:&lt;/strong&gt; Customer support, personal assistants&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI

def get_weather(city: str) -&amp;gt; str:
    """Get weather for a given city."""
    return f"It's sunny in {city}!"

def create_ticket(issue: str) -&amp;gt; str:
    """Create support ticket."""
    return f"Ticket created: {issue}"

agent = create_react_agent(
    model=ChatOpenAI(model="gpt-4"),
    tools=[get_weather, create_ticket],
    prompt="You are a helpful assistant"
)

# One agent, multiple capabilities!
response = agent.invoke({
    "messages": [{"role": "user", "content": "Weather in NYC and create ticket for broken printer"}]
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Real Impact:&lt;/strong&gt; Handle 80% of support tickets automatically ⚡&lt;/p&gt;




&lt;h3&gt;
  
  
  2. 🔄 Sequential Multi-Agent Pipeline
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Perfect for:&lt;/strong&gt; Content creation, document processing, code review&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from langgraph.graph import StateGraph, START, END
from typing import TypedDict

class ContentState(TypedDict):
    topic: str
    research: str
    draft: str
    final: str

def research_agent(state: ContentState):
    return {"research": f"Research data for {state['topic']}"}

def writer_agent(state: ContentState):
    return {"draft": f"Draft based on: {state['research']}"}

def editor_agent(state: ContentState):
    return {"final": f"Polished version of: {state['draft']}"}

# Build the assembly line
workflow = StateGraph(ContentState)
workflow.add_node("research", research_agent)
workflow.add_node("write", writer_agent)
workflow.add_node("edit", editor_agent)

# Define the flow
workflow.add_edge(START, "research")
workflow.add_edge("research", "write")
workflow.add_edge("write", "edit")
workflow.add_edge("edit", END)

app = workflow.compile()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; Each agent specializes in one task = better quality output! 🎯&lt;/p&gt;




&lt;h3&gt;
  
  
  3. ⚡ Parallel Processing
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Perfect for:&lt;/strong&gt; Document processing, data analysis, batch operations&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from langgraph.constants import Send

class DocState(TypedDict):
    documents: list
    results: list

def route_docs(state: DocState):
    # Fan out to parallel workers
    return [Send("process", {"doc": doc}) for doc in state["documents"]]

def process_doc(state: dict):
    doc = state["doc"]
    processed = f"Processed: {doc['name']}"
    return {"results": [processed]}

def combine_results(state: DocState):
    summary = f"Processed {len(state['results'])} documents"
    return {"summary": summary}

workflow = StateGraph(DocState)
workflow.add_node("route", route_docs)
workflow.add_node("process", process_doc)
workflow.add_node("combine", combine_results)

workflow.add_conditional_edges("route", lambda x: "process")
workflow.add_edge("process", "combine")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Speed Boost:&lt;/strong&gt; Process 1000 docs in parallel instead of sequentially! 🚀&lt;/p&gt;




&lt;h3&gt;
  
  
  4. 👤 Human-in-the-Loop
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Perfect for:&lt;/strong&gt; Financial approvals, medical diagnosis, legal review&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from langgraph.checkpoint.memory import MemorySaver

class ApprovalState(TypedDict):
    request: str
    analysis: str
    approved: bool
    response: str

def analyze_request(state: ApprovalState):
    return {"analysis": f"AI analysis of: {state['request']}"}

def need_approval(state: ApprovalState):
    return "wait_approval" if not state.get("approved") else "finalize"

def wait_for_human(state: ApprovalState):
    # 🛑 Workflow pauses here for human input
    return {"response": "Awaiting human approval..."}

def finalize_response(state: ApprovalState):
    return {"response": f"Approved response: {state['analysis']}"}

workflow = StateGraph(ApprovalState)
workflow.add_node("analyze", analyze_request)
workflow.add_node("wait_approval", wait_for_human)
workflow.add_node("finalize", finalize_response)

workflow.add_conditional_edges("analyze", need_approval)
workflow.add_edge("wait_approval", "finalize")

# 💾 Persistent memory for long-running workflows
memory = MemorySaver()
app = workflow.compile(checkpointer=memory)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Critical Feature:&lt;/strong&gt; AI proposes, humans approve, perfect for high-stakes decisions! ⚖️&lt;/p&gt;




&lt;h3&gt;
  
  
  5. 🧠 Agentic RAG (Smart Knowledge Systems)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Perfect for:&lt;/strong&gt; Enterprise Q&amp;amp;A, documentation search, knowledge management&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from langchain.tools.retriever import create_retriever_tool
from langgraph.prebuilt import tools_condition, ToolNode

# Create smart retriever
retriever_tool = create_retriever_tool(
    retriever=your_vectorstore.as_retriever(),
    name="search_docs",
    description="Search company knowledge base"
)

def decide_action(state):
    """🤔 LLM decides whether to search or respond directly"""
    last_message = state["messages"][-1]["content"]

    # Bind tools to model
    model_with_tools = model.bind_tools([retriever_tool])
    response = model_with_tools.invoke(state["messages"])
    return {"messages": [response]}

workflow = StateGraph(MessagesState)
workflow.add_node("agent", decide_action)
workflow.add_node("tools", ToolNode([retriever_tool]))

workflow.add_conditional_edges("agent", tools_condition)
workflow.add_edge("tools", "agent")
workflow.add_edge(START, "agent")

rag_agent = workflow.compile()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Smart Feature:&lt;/strong&gt; The AI decides when to search vs. when it already knows the answer! 🎯&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Best Practices &amp;amp; ❌ Common Pitfalls
&lt;/h2&gt;

&lt;h3&gt;
  
  
  ✅ Golden Rules
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Do This&lt;/th&gt;
&lt;th&gt;Why It Matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;🎯 &lt;strong&gt;Start Simple&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Begin with single agents before multi-agent systems&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🗂️ &lt;strong&gt;Design State Carefully&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Keep state schema focused and minimal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;💾 &lt;strong&gt;Add Checkpoints&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Use memory for long-running workflows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;👥 &lt;strong&gt;Include Human Oversight&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;For critical decisions and approvals&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;📊 &lt;strong&gt;Monitor Everything&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Log performance, errors, and token usage&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  ❌ Avoid These Traps
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Don't Do This&lt;/th&gt;
&lt;th&gt;What Happens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;🚫 &lt;strong&gt;Over-engineer&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Complex systems when simple chains work fine&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🔄 &lt;strong&gt;Infinite Loops&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Always include termination conditions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;📦 &lt;strong&gt;State Bloat&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Storing unnecessary data slows everything down&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;💥 &lt;strong&gt;Skip Error Handling&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Tool failures crash your entire workflow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🙈 &lt;strong&gt;Ignore Testing&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Production failures with edge cases&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Production Setup
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# 🏭 Production configuration
from langgraph.checkpoint.postgres import PostgresSaver

# Use database for persistence (not memory!)
checkpointer = PostgresSaver.from_conn_string(
    "postgresql://user:pass@host/db"
)

production_app = workflow.compile(
    checkpointer=checkpointer,
    debug=False  # Turn off debug logs
)

# 📊 Deploy with monitoring
from langsmith import traceable

@traceable
def monitored_call(input_data):
    return production_app.invoke(input_data)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  📈 Real-World Success Stories
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;🏢 &lt;strong&gt;Global Logistics Provider&lt;/strong&gt;: Saving &lt;strong&gt;600 hours/day&lt;/strong&gt; with automated order processing&lt;/p&gt;

&lt;p&gt;🔒 &lt;strong&gt;Trellix (40k+ customers)&lt;/strong&gt;: Cut log parsing from &lt;strong&gt;days to minutes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🚢 &lt;strong&gt;Norwegian Cruise Line&lt;/strong&gt;: Personalized guest experiences with AI agents&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🎯 Quick Start Checklist
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;🎨 Choose Pattern&lt;/strong&gt;: Single agent → Sequential → Parallel → Human-loop → RAG&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;📋 Define State&lt;/strong&gt;: What data flows between steps?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🔧 Create Nodes&lt;/strong&gt;: Individual functions for each step&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🔗 Connect Edges&lt;/strong&gt;: Define the flow between nodes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;💾 Add Memory&lt;/strong&gt;: Use checkpointer for persistence&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🧪 Test &amp;amp; Monitor&lt;/strong&gt;: Start simple, add complexity gradually&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🎯 Decision Matrix: When to Use What?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pattern&lt;/th&gt;
&lt;th&gt;Use Case&lt;/th&gt;
&lt;th&gt;Complexity&lt;/th&gt;
&lt;th&gt;Best For&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;🤖 &lt;strong&gt;Single Agent&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Customer support, Q&amp;amp;A&lt;/td&gt;
&lt;td&gt;🟢 Low&lt;/td&gt;
&lt;td&gt;Getting started&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🔄 &lt;strong&gt;Sequential&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Content pipelines, workflows&lt;/td&gt;
&lt;td&gt;🟡 Medium&lt;/td&gt;
&lt;td&gt;Assembly lines&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;⚡ &lt;strong&gt;Parallel&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Document processing, batch jobs&lt;/td&gt;
&lt;td&gt;🟡 Medium&lt;/td&gt;
&lt;td&gt;Speed &amp;amp; scale&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;👤 &lt;strong&gt;Human-loop&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Approvals, critical decisions&lt;/td&gt;
&lt;td&gt;🔴 High&lt;/td&gt;
&lt;td&gt;High-stakes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🧠 &lt;strong&gt;Agentic RAG&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Knowledge systems, enterprise Q&amp;amp;A&lt;/td&gt;
&lt;td&gt;🔴 High&lt;/td&gt;
&lt;td&gt;Smart search&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🎉 The Bottom Line
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Don't choose between them—combine them!&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;The most effective enterprise solutions leverage:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LangChain&lt;/strong&gt; for modular components and rapid development&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LangGraph&lt;/strong&gt; for sophisticated control and coordination&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Start simple, build incrementally, and soon you'll have AI agents that feel like magic to your users! ✨&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Ready to build your first agentic app? Drop a comment below with what you're planning to build! 👇&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; #ai #llm #langchain #langgraph #python #agents #automation&lt;/p&gt;

</description>
      <category>langraph</category>
      <category>python</category>
      <category>agentaichallenge</category>
      <category>ai</category>
    </item>
    <item>
      <title>Creating Serverless API Routes with Next.js and AWS Lambda</title>
      <dc:creator>Ashok Naik</dc:creator>
      <pubDate>Mon, 19 Aug 2024 07:25:36 +0000</pubDate>
      <link>https://dev.to/a_shokn/creating-serverless-api-routes-with-nextjs-and-aws-lambda-3i94</link>
      <guid>https://dev.to/a_shokn/creating-serverless-api-routes-with-nextjs-and-aws-lambda-3i94</guid>
      <description>&lt;p&gt;Welcome, devs! Today, we're diving into the world of serverless architecture, exploring how to create efficient and scalable API routes using Next.js and AWS Lambda. This powerful combination allows us to build robust backend functionality without the need for constant server management. Let's get started!&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Serverless API Routes?
&lt;/h2&gt;

&lt;p&gt;Serverless API routes are endpoints that run on-demand, scaling automatically with the number of requests. By combining Next.js API routes with AWS Lambda, we can create these efficient, cost-effective endpoints that only consume resources when called upon.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Setting Up Next.js API Routes
&lt;/h2&gt;

&lt;p&gt;Next.js API routes serve as the foundation for our serverless architecture. They allow us to create API endpoints directly within our Next.js application.&lt;/p&gt;

&lt;h3&gt;
  
  
  How it works:
&lt;/h3&gt;

&lt;p&gt;Next.js API routes are special files that reside in the &lt;code&gt;pages/api&lt;/code&gt; directory of your project. They handle incoming requests and send responses, similar to traditional server endpoints.&lt;/p&gt;

&lt;p&gt;Let's create our first API route:&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="c1"&gt;// pages/api/hello.js&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&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="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, World!&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This simple API route responds with a JSON object when you visit &lt;code&gt;/api/hello&lt;/code&gt;. It's a great starting point for more complex functionalities.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Integrating with AWS Lambda
&lt;/h2&gt;

&lt;p&gt;Now that we have our API route set up, let's connect it to AWS Lambda. This integration allows our API routes to run in a serverless environment, automatically scaling based on demand.&lt;/p&gt;

&lt;h3&gt;
  
  
  How it works:
&lt;/h3&gt;

&lt;p&gt;To deploy our Next.js API routes to AWS Lambda, we'll use the &lt;code&gt;serverless-next.js&lt;/code&gt; component. This tool simplifies the process of connecting Next.js with AWS services.&lt;/p&gt;

&lt;p&gt;First, install the necessary dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; serverless-next.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, create a &lt;code&gt;serverless.yml&lt;/code&gt; file in your project root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;myNextApplication&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;component&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;serverless-next.js&lt;/span&gt;
  &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;bucketName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;my-unique-bucket-name&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This configuration prepares your Next.js API routes for deployment as Lambda functions.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Creating Dynamic API Routes
&lt;/h2&gt;

&lt;p&gt;One of the powerful features of Next.js API routes is the ability to create dynamic endpoints. This allows for more flexible and reusable API structures.&lt;/p&gt;

&lt;h3&gt;
  
  
  How it works:
&lt;/h3&gt;

&lt;p&gt;Dynamic API routes in Next.js use bracket syntax to capture parameters from the URL. These parameters can then be used within your API logic.&lt;/p&gt;

&lt;p&gt;Here's an example of a dynamic API route:&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="c1"&gt;// pages/api/users/[id].js&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&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="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&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="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&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="na"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;id&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="s2"&gt;`User &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;id&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This route will respond to requests like &lt;code&gt;/api/users/1&lt;/code&gt;, &lt;code&gt;/api/users/2&lt;/code&gt;, etc., with the respective user information.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Handling Different HTTP Methods
&lt;/h2&gt;

&lt;p&gt;API routes often need to handle different types of requests (GET, POST, PUT, DELETE). Next.js makes this straightforward with a single handler function.&lt;/p&gt;

&lt;p&gt;Here's how you can handle multiple HTTP methods:&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="c1"&gt;// pages/api/data.js&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;switch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="c1"&gt;// Handle GET request&lt;/span&gt;
      &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&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="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Data retrieved&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
      &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="c1"&gt;// Handle POST request&lt;/span&gt;
      &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;201&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="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Data created&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
      &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Allow&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;GET&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="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
      &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;405&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Method &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; Not Allowed`&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 approach allows you to create RESTful API endpoints within a single file.&lt;/p&gt;

&lt;p&gt;As you continue to explore this serverless approach, you'll discover even more ways to optimize your applications and improve your development workflow.&lt;/p&gt;

&lt;p&gt;Are you ready to implement serverless API routes in your Next.js project? Share your thoughts, experiences, or questions in the comments below. Let's continue to push the boundaries of modern web development together!&lt;/p&gt;

&lt;p&gt;Happy coding, and may your serverless functions always execute flawlessly!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>nextjs</category>
      <category>serverless</category>
      <category>aws</category>
    </item>
    <item>
      <title>Implementing Authentication in Next.js: Comparing Different Strategies</title>
      <dc:creator>Ashok Naik</dc:creator>
      <pubDate>Tue, 13 Aug 2024 08:42:01 +0000</pubDate>
      <link>https://dev.to/a_shokn/implementing-authentication-in-nextjs-comparing-different-strategies-4phm</link>
      <guid>https://dev.to/a_shokn/implementing-authentication-in-nextjs-comparing-different-strategies-4phm</guid>
      <description>&lt;p&gt;Welcome, intrepid developers! 👋 Today, we're diving into the crucial world of authentication in Next.js applications. As we navigate through various authentication strategies, we'll explore their strengths, use cases, and implementation details. Buckle up as we embark on this journey to secure your Next.js apps! 🔐&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Authentication Matters in Next.js
&lt;/h2&gt;

&lt;p&gt;Authentication is the gatekeeper of your application, ensuring that only authorized users can access certain parts of your site. In the Next.js ecosystem, implementing authentication correctly is crucial for protecting user data, managing sessions, and creating personalized experiences.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. JWT Authentication: Stateless Security 🎟️
&lt;/h2&gt;

&lt;p&gt;JSON Web Tokens (JWT) offer a stateless approach to authentication, making them perfect for scalable applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  How it works:
&lt;/h3&gt;

&lt;p&gt;Think of JWT like a secure, encoded ticket. When a user logs in, they receive this ticket, which they present for each subsequent request to prove their identity.&lt;/p&gt;

&lt;p&gt;Let's look at a basic JWT implementation:&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="c1"&gt;// pages/api/login.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;jwt&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;jsonwebtoken&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&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;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&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="c1"&gt;// Verify user credentials (simplified for demo)&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;password&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&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;username&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;demo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;password&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;password&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="c1"&gt;// Create and sign a JWT&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;jwt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sign&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;username&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;JWT_SECRET&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;expiresIn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1h&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
      &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&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="nx"&gt;token&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;401&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="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Invalid credentials&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="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;405&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;end&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="c1"&gt;// Middleware to verify JWT&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;verifyToken&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="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;authorization&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;1&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="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;token&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="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;401&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="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;No token provided&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="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;decoded&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;jwt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;verify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;JWT_SECRET&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;decoded&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;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&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="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;401&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="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Invalid token&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="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 approach is stateless and scalable, but requires careful handling of the JWT secret and token expiration.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Session-based Authentication: Stateful and Secure 🍪
&lt;/h2&gt;

&lt;p&gt;Session-based authentication uses server-side sessions to track user login state, offering more control over user sessions.&lt;/p&gt;

&lt;h3&gt;
  
  
  How it works:
&lt;/h3&gt;

&lt;p&gt;When a user logs in, a session is created on the server, and a session ID is sent to the client as a cookie. This cookie is then used to retrieve the session data for subsequent requests.&lt;/p&gt;

&lt;p&gt;Here's a basic implementation using &lt;code&gt;express-session&lt;/code&gt; with Next.js:&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="c1"&gt;// pages/api/[...nextauth].js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;NextAuth&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;next-auth&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Providers&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;next-auth/providers&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;expressSession&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;next-auth/adapters&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nc"&gt;NextAuth&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;providers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nx"&gt;Providers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Credentials&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;Credentials&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Username&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;  &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Password&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;password&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="na"&gt;authorize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;credentials&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="c1"&gt;// Verify credentials (simplified for demo)&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;credentials&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;demo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;password&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;password&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="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&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;Demo User&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="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&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="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;session&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;jwt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;maxAge&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// 30 days&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;adapter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;expressSession&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// In your component or page&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useSession&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;next-auth/client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;SecurePage&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="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;session&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useSession&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;loading&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Loading&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;session&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Access&lt;/span&gt; &lt;span class="nx"&gt;Denied&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Welcome&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;session&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;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&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 approach provides more control over sessions but requires session storage management.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. OAuth: Delegating Authentication 🤝
&lt;/h2&gt;

&lt;p&gt;OAuth allows you to delegate authentication to trusted providers like Google, Facebook, or GitHub.&lt;/p&gt;

&lt;h3&gt;
  
  
  How it works:
&lt;/h3&gt;

&lt;p&gt;Instead of managing user credentials yourself, you rely on established providers to handle authentication. This can enhance security and simplify the login process for users.&lt;/p&gt;

&lt;p&gt;Here's how you might set up OAuth with Next.js and NextAuth.js:&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="c1"&gt;// pages/api/auth/[...nextauth].js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;NextAuth&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;next-auth&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Providers&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;next-auth/providers&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nc"&gt;NextAuth&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;providers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nx"&gt;Providers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Google&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;clientId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;GOOGLE_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;clientSecret&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;GOOGLE_SECRET&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}),&lt;/span&gt;
    &lt;span class="nx"&gt;Providers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;GitHub&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;clientId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;GITHUB_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;clientSecret&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;GITHUB_SECRET&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="c1"&gt;// ... other configuration options&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// In your component or page&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;signIn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;signOut&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useSession&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;next-auth/client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Page&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="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;session&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useSession&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;loading&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Loading&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&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;session&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="p"&gt;(&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
        &lt;span class="nx"&gt;Signed&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;session&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;br&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;signOut&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Sign&lt;/span&gt; &lt;span class="nx"&gt;out&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&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="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="nx"&gt;Not&lt;/span&gt; &lt;span class="nx"&gt;signed&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;br&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;signIn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;google&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Sign&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="kd"&gt;with&lt;/span&gt; &lt;span class="nx"&gt;Google&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;signIn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;github&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Sign&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="kd"&gt;with&lt;/span&gt; &lt;span class="nx"&gt;GitHub&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;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 method offloads much of the authentication complexity to trusted providers but requires setting up and managing OAuth credentials.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: Choosing Your Authentication Path
&lt;/h2&gt;

&lt;p&gt;Selecting the right authentication strategy for your Next.js application depends on various factors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JWT is great for stateless, scalable applications but requires careful token management.&lt;/li&gt;
&lt;li&gt;Session-based auth offers more control but needs server-side session storage.&lt;/li&gt;
&lt;li&gt;OAuth simplifies the process for users and developers but relies on third-party providers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As with any development decision, the key is to understand your application's specific needs and choose the strategy that best aligns with your security requirements and user experience goals.&lt;/p&gt;

&lt;p&gt;Are you ready to implement authentication in your Next.js project? Which strategy appeals most to you? Share your thoughts, experiences, or questions in the comments below. Let's make the web a more secure place, one Next.js app at a time! 🛡️&lt;/p&gt;

&lt;p&gt;Happy coding, and may your applications always stay secure and performant! 👩‍💻👨‍💻&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>nextjs</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Astro: Your Spacecraft for Modern Web Development</title>
      <dc:creator>Ashok Naik</dc:creator>
      <pubDate>Wed, 07 Aug 2024 13:36:33 +0000</pubDate>
      <link>https://dev.to/a_shokn/astro-your-spacecraft-for-modern-web-development-44m9</link>
      <guid>https://dev.to/a_shokn/astro-your-spacecraft-for-modern-web-development-44m9</guid>
      <description>&lt;p&gt;Greetings, fellow space explorers! 🖖 Today, we're embarking on an interstellar journey through the cosmos of web development with Astro, a game-changing framework that's taking the frontend world by storm. Strap in as we navigate through Astro's unique features, comparing them to cosmic phenomena and spacecraft technology. Let's launch! 🚀&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Astro?
&lt;/h2&gt;

&lt;p&gt;Astro is like a next-generation spacecraft designed for the modern web. It allows you to build faster websites with less client-side JavaScript, making your digital voyages swift and efficient. Astro's philosophy is simple: ship only the necessary code, and let the content shine.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Partial Hydration: Fuel-Efficient Space Travel ⛽
&lt;/h2&gt;

&lt;p&gt;In traditional web frameworks, it's like we're always traveling at warp speed, using full power even for the simplest journeys. Astro introduces a concept called partial hydration, which is like having smart fuel injectors in your spacecraft.&lt;/p&gt;

&lt;h3&gt;
  
  
  How it works:
&lt;/h3&gt;

&lt;p&gt;Imagine your website as a spaceship with different components. With partial hydration, you can choose which components need to be "powered up" (hydrated with JavaScript) and when. This means your ship uses fuel (sends JavaScript to the client) only when and where it's needed.&lt;/p&gt;

&lt;p&gt;Let's look at an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---
import ReactCounter from './ReactCounter.jsx';
import VueCounter from './VueCounter.vue';
---

&amp;lt;ReactCounter client:visible /&amp;gt;
&amp;lt;VueCounter client:idle /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The React counter component will only hydrate when it becomes visible in the viewport.&lt;/li&gt;
&lt;li&gt;The Vue counter will hydrate when the browser is idle, ensuring it doesn't interfere with more critical operations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach significantly reduces the amount of JavaScript sent to the client, making your websites faster and more efficient.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Content Collections: Organizing Your Space Cargo 📦
&lt;/h2&gt;

&lt;p&gt;As you travel through the digital universe, you'll accumulate various types of content - blog posts, product information, user data, and more. Astro's Content Collections feature is like having an advanced cargo management system in your spacecraft.&lt;/p&gt;

&lt;h3&gt;
  
  
  How it works:
&lt;/h3&gt;

&lt;p&gt;Content Collections allow you to define schemas for your content, ensuring consistency and providing type safety. It's like having a standardized container system for all your space cargo.&lt;/p&gt;

&lt;p&gt;Here's how you might set up a collection for blog posts:&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="c1"&gt;// src/content/config.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineCollection&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;z&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;astro:content&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;blogCollection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defineCollection&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;pubDate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
      &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;}),&lt;/span&gt;
    &lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;collections&lt;/span&gt; &lt;span class="o"&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;blog&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;blogCollection&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;With this setup, Astro ensures that all your blog posts conform to this structure, making it easier to manage and display your content consistently.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Astro Islands: Building Modular Space Stations 🏝️
&lt;/h2&gt;

&lt;p&gt;Sometimes, you need to construct complex, interactive elements within your largely static website. This is where Astro Islands come into play. Think of them as modular, self-contained space stations that can be easily integrated into your main spacecraft.&lt;/p&gt;

&lt;h3&gt;
  
  
  How it works:
&lt;/h3&gt;

&lt;p&gt;Astro Islands allow you to use components from various frameworks (React, Vue, Svelte, etc.) within your Astro project. These components are isolated and only hydrated when necessary, maintaining the overall performance of your site.&lt;/p&gt;

&lt;p&gt;Here's an example of how you might use an Astro Island:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---
import StaticHeader from './StaticHeader.astro';
import ReactCommentSection from './ReactCommentSection.jsx';
import SvelteNewsletterSignup from './SvelteNewsletterSignup.svelte';
---

&amp;lt;StaticHeader /&amp;gt;
&amp;lt;article&amp;gt;
  &amp;lt;!-- Your static blog content here --&amp;gt;
&amp;lt;/article&amp;gt;
&amp;lt;ReactCommentSection client:visible /&amp;gt;
&amp;lt;SvelteNewsletterSignup client:idle /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The static header and article content are rendered as HTML with no JavaScript.&lt;/li&gt;
&lt;li&gt;The React-based comment section will only load and hydrate when it becomes visible.&lt;/li&gt;
&lt;li&gt;The Svelte newsletter signup component will load when the browser is idle.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach gives you the best of both worlds - the performance of static sites with the interactivity of SPAs, precisely where you need it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: The Future of Web Space Travel
&lt;/h2&gt;

&lt;p&gt;Astro represents a paradigm shift in how we approach web development. By intelligently managing resources (JavaScript), organizing content, and allowing for modular interactivity, Astro enables developers to create websites that are fast, efficient, and scalable.&lt;/p&gt;

&lt;p&gt;As with any new technology, the key is to understand when and how to use these features effectively. Not every website needs the full power of Astro, but for those that do, it opens up a universe of possibilities.&lt;/p&gt;

&lt;p&gt;Are you ready to launch your next project with Astro? Share your thoughts, experiences, or questions in the comments below. Let's explore this new frontier of web development together! 🌠&lt;/p&gt;

&lt;p&gt;Happy coding, and safe travels through the digital cosmos! 👨‍🚀👩‍🚀&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>react</category>
    </item>
    <item>
      <title>Customizing the Next.js Build Process: A Beginner's Guide</title>
      <dc:creator>Ashok Naik</dc:creator>
      <pubDate>Tue, 16 Jul 2024 06:58:17 +0000</pubDate>
      <link>https://dev.to/a_shokn/customizing-the-nextjs-build-process-a-beginners-guide-2lho</link>
      <guid>https://dev.to/a_shokn/customizing-the-nextjs-build-process-a-beginners-guide-2lho</guid>
      <description>&lt;p&gt;Next.js is like a magical kitchen that helps you cook up awesome websites. But sometimes, you might want to add your own secret ingredients or change how the kitchen works. Today, we're going to learn how to do just that! We'll explore three ways to customize your Next.js kitchen:&lt;/p&gt;

&lt;p&gt;Creating your own recipe book (custom webpack configurations)&lt;br&gt;
Using special cooking techniques (advanced Babel configurations)&lt;br&gt;
Building your own kitchen from scratch (custom Next.js server)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Creating Your Own Recipe Book (Custom Webpack Configurations)
Imagine you have a recipe book (webpack) that tells you how to bake a cake (build your website). Sometimes, you might want to add your own twist to the recipe. In Next.js, you can do this by creating a special file called &lt;code&gt;next.config.js.&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example:&lt;br&gt;
Let's say you want to add sprinkles to your cake, but the recipe doesn't include them. You can write a note in your recipe book to always add sprinkles. In Next.js, it might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
// next.config.js
module.exports = {
  webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) =&amp;gt; {
    // Add your special ingredient (plugin) here
    config.plugins.push(new SprinklesPlugin())
    return config
  },
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Using Special Cooking Techniques (Advanced Babel Configurations)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Sometimes, you might want to use special cooking techniques to make your cake even better. In the world of Next.js, we use something called Babel to do this. Babel is like a magical oven that can transform your ingredients in special ways.&lt;/p&gt;

&lt;p&gt;Imagine you have a super oven (Babel) that can turn your regular cake into a rainbow cake. You can tell your oven to do this by writing special instructions. In Next.js, you can do this in a file called &lt;code&gt;.babelrc&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "presets": ["next/babel"],
  "plugins": [
    ["styled-components", { "ssr": true }],
    ["transform-rainbow-cake", { "layers": 7 }]
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, when you bake your cake, the oven will automatically turn it into a beautiful rainbow cake with 7 layers!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Building Your Own Kitchen from Scratch (Custom Next.js Server)
Sometimes, you might want to have complete control over your kitchen. In Next.js, this means creating your own server instead of using the one that comes built-in.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example:&lt;br&gt;
Imagine you want to build your own super kitchen that can make cakes and also serve ice cream. You can do this by creating your own special room (server file) where you set up everything just the way you want it.&lt;br&gt;
Here's how you might build your own kitchen using Express:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require('express')
const next = require('next')

const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()

app.prepare().then(() =&amp;gt; {
  const server = express()

  // Your special ice cream machine
  server.get('/ice-cream', (req, res) =&amp;gt; {
    res.json({ flavor: 'vanilla', toppings: ['sprinkles', 'chocolate sauce'] })
  })

  // Let Next.js handle everything else
  server.all('*', (req, res) =&amp;gt; {
    return handle(req, res)
  })

  server.listen(3000, (err) =&amp;gt; {
    if (err) throw err
    console.log('&amp;gt; Ready on http://localhost:3000')
  })
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you have a super kitchen that can make Next.js cakes and serve ice cream too!&lt;br&gt;
Remember, customizing your Next.js kitchen can be really fun, but it's also okay to use it just as it comes. The built-in features are already pretty amazing! Only add your own twists when you really need them.&lt;br&gt;
Happy cooking with Next.js!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>nextjs</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Step-by-Step Guide to Creating RESTful APIs with Node.js and PostgreSQL</title>
      <dc:creator>Ashok Naik</dc:creator>
      <pubDate>Mon, 08 Jul 2024 05:49:41 +0000</pubDate>
      <link>https://dev.to/a_shokn/step-by-step-guide-to-creating-restful-apis-with-nodejs-and-postgresql-1k26</link>
      <guid>https://dev.to/a_shokn/step-by-step-guide-to-creating-restful-apis-with-nodejs-and-postgresql-1k26</guid>
      <description>&lt;p&gt;Welcome to the world of building RESTful APIs with Node.js and PostgreSQL! In this guide, we'll take you on an exciting journey, where we'll transform your Node.js app into a robust, scalable RESTful API using PostgreSQL as our database. Let’s dive in and have some fun along the way!&lt;/p&gt;

&lt;p&gt;Let’s start by setting up a new Node.js project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir node-postgres-api
cd node-postgres-api
npm init -y

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We need a few packages to get our project up and running.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install express pg body-parser

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Setting Up PostgreSQL
Fire up your PostgreSQL server and create a new database.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE DATABASE node_postgres_api;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Creating the Database and Tables
Connect to your new database and create a simple users table.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  name VARCHAR(100),
  email VARCHAR(100) UNIQUE
);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Setting up an Express Server
Create a new file named server.js and set up a basic Express server.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const port = 3000;

app.use(bodyParser.json());

app.listen(port, () =&amp;gt; {
  console.log(`Server running on port ${port}`);
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Connecting to PostgreSQL
Now, let’s connect our server to the PostgreSQL database. Create a file named db.js.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { Pool } = require('pg');
const pool = new Pool({
  user: 'your_postgres_username',
  host: 'localhost',
  database: 'node_postgres_api',
  password: 'your_postgres_password',
  port: 5432,
});
module.exports = pool;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5.Creating API Endpoints&lt;/p&gt;

&lt;p&gt;Let’s add some endpoints to our API. Update your server.js file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require('express');
const bodyParser = require('body-parser');
const pool = require('./db');
const app = express();
const port = 3000;

app.use(bodyParser.json());

// Get all users
app.get('/users', async (req, res) =&amp;gt; {
  try {
    const result = await pool.query('SELECT * FROM users');
    res.json(result.rows);
  } catch (err) {
    console.error(err.message);
  }
});

// Get user by ID
app.get('/users/:id', async (req, res) =&amp;gt; {
  const { id } = req.params;
  try {
    const result = await pool.query('SELECT * FROM users WHERE id = $1', [id]);
    res.json(result.rows[0]);
  } catch (err) {
    console.error(err.message);
  }
});

// Create new user
app.post('/users', async (req, res) =&amp;gt; {
  const { name, email } = req.body;
  try {
    const result = await pool.query('INSERT INTO users (name, email) VALUES ($1, $2) RETURNING *', [name, email]);
    res.json(result.rows[0]);
  } catch (err) {
    console.error(err.message);
  }
});

// Update user
app.put('/users/:id', async (req, res) =&amp;gt; {
  const { id } = req.params;
  const { name, email } = req.body;
  try {
    await pool.query('UPDATE users SET name = $1, email = $2 WHERE id = $3', [name, email, id]);
    res.json('User updated successfully');
  } catch (err) {
    console.error(err.message);
  }
});

// Delete user
app.delete('/users/:id', async (req, res) =&amp;gt; {
  const { id } = req.params;
  try {
    await pool.query('DELETE FROM users WHERE id = $1', [id]);
    res.json('User deleted successfully');
  } catch (err) {
    console.error(err.message);
  }
});

app.listen(port, () =&amp;gt; {
  console.log(`Server running on port ${port}`);
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Congratulations! You’ve built a RESTful API with Node.js and PostgreSQL. Now you can expand this foundation with more features and complexity as needed. Happy coding!&lt;/p&gt;

&lt;p&gt;Feel free to leave your thoughts or questions in the comments below. Let's keep the conversation going and make coding fun together! &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>postgres</category>
      <category>node</category>
    </item>
    <item>
      <title>Effective Debugging Techniques for React JS: Debugging Doesn’t Have to Be a Drag!</title>
      <dc:creator>Ashok Naik</dc:creator>
      <pubDate>Sun, 30 Jun 2024 13:24:18 +0000</pubDate>
      <link>https://dev.to/a_shokn/effective-debugging-techniques-for-react-js-debugging-doesnt-have-to-be-a-drag-2iea</link>
      <guid>https://dev.to/a_shokn/effective-debugging-techniques-for-react-js-debugging-doesnt-have-to-be-a-drag-2iea</guid>
      <description>&lt;p&gt;Hey there, fellow React JS developer! 🧑‍💻&lt;/p&gt;

&lt;p&gt;We’ve all been there: you’re cruising along, building your latest and greatest app, when suddenly… BAM! An error message pops up out of nowhere. Panic sets in. But fear not! Debugging doesn’t have to be a drag. In fact, with the right techniques, it can be as smooth as butter on a hot pancake. So, grab your favorite beverage, sit back, and let’s dive into the wonderful world of advanced React JS debugging!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;React Developer Tools to the Rescue
Imagine having X-ray vision for your React components. That’s exactly what React Developer Tools offer. This browser extension (available for Chrome and Firefox) lets you inspect the component hierarchy, check props and state, and even tweak them on the fly.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;2.The Power of Breakpoints&lt;br&gt;
Forget console.log() for a moment and embrace the power of breakpoints. Set breakpoints in your code using your browser’s developer tools, and watch your code pause at just the right moment.&lt;/p&gt;

&lt;p&gt;3.Linting with ESLint&lt;br&gt;
ESLint is your best friend when it comes to catching errors before they even happen. It’s like having a vigilant coding buddy who points out potential issues as you type.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install eslint --save-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4.The ComponentDidCatch Magic&lt;br&gt;
Ever wished you could catch errors in your components and handle them gracefully? Enter componentDidCatch. This lifecycle method allows you to catch errors in any child component and display a custom error message.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class ErrorBoundary extends React.Component {
  state = { hasError: false };

  componentDidCatch(error, info) {
    this.setState({ hasError: true });
    // Log the error to an error reporting service
    console.error(error, info);
  }

  render() {
    if (this.state.hasError) {
      return &amp;lt;h1&amp;gt;Something went wrong.&amp;lt;/h1&amp;gt;;
    }

    return this.props.children;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5.React.lazy and Suspense for Code Splitting&lt;br&gt;
React.lazy and Suspense enable you to load components lazily through code splitting. This can help with debugging by isolating component loading issues.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const OtherComponent = React.lazy(() =&amp;gt; import('./OtherComponent'));

function MyComponent() {
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading...&amp;lt;/div&amp;gt;}&amp;gt;
        &amp;lt;OtherComponent /&amp;gt;
      &amp;lt;/Suspense&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6.React's useDebugValue for Custom Hooks&lt;br&gt;
When you create custom hooks, you can use the useDebugValue hook to display a label in React DevTools for easier debugging.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function useFriendStatus(friendID) {
  const [isOnline, setIsOnline] = useState(null);

  useDebugValue(isOnline ? 'Online' : 'Offline');

  useEffect(() =&amp;gt; {
    function handleStatusChange(status) {
      setIsOnline(status.isOnline);
    }

    ChatAPI.subscribeToFriendStatus(friendID, handleStatusChange);
    return () =&amp;gt; {
      ChatAPI.unsubscribeFromFriendStatus(friendID, handleStatusChange);
    };
  }, [friendID]);

  return isOnline;
}



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And there you have it! Debugging doesn’t have to be a nightmare. With these effective techniques, you’ll be squashing bugs and fine-tuning your React JS apps like a pro. Happy coding! 🐞🚀&lt;/p&gt;

&lt;p&gt;Feel free to share your own debugging tips in the comments below!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Optimizing Development: Insights into Effective System Design</title>
      <dc:creator>Ashok Naik</dc:creator>
      <pubDate>Sat, 22 Jun 2024 14:45:57 +0000</pubDate>
      <link>https://dev.to/a_shokn/optimizing-development-insights-into-effective-system-design-5fc4</link>
      <guid>https://dev.to/a_shokn/optimizing-development-insights-into-effective-system-design-5fc4</guid>
      <description>&lt;p&gt;As a full-stack developer, I've come to appreciate the profound impact that understanding system design can have on the success of any project. Whether you’re building web or mobile applications, having a solid grasp of system design can set you apart and significantly improve your ability to create robust, scalable solutions. In this blog, I’ll demystify system design, explore its origins, discuss key design patterns leading companies use, and provide simple examples to illustrate these concepts.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is System Design
&lt;/h3&gt;

&lt;p&gt;System design defines the architecture, components, modules, interfaces, and data for a system to satisfy specified requirements. It involves a high-level understanding of how different parts of a system interact and how they can be organized to handle various tasks efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Origin of System Design
&lt;/h3&gt;

&lt;p&gt;The term "system design" has been around for decades, evolving with the advancement of technology and the increasing complexity of systems. While there isn't a single person credited with coining the term, it has been influenced by pioneers in computer science and software engineering, such as Frederick P. Brooks and his seminal work "The Mythical Man-Month," which emphasizes the importance of design in software projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why System Design is Important for Developers
&lt;/h3&gt;

&lt;p&gt;Understanding system design is crucial for several reasons:&lt;/p&gt;

&lt;p&gt;Scalability: As user bases grow, systems need to handle increased loads without degrading performance.&lt;br&gt;
Maintainability: Well-designed systems are easier to maintain and extend.&lt;br&gt;
Efficiency: Proper design ensures that resources are used optimally, reducing costs.&lt;br&gt;
Reliability: Systems designed with redundancy and fault tolerance in mind are more reliable.&lt;br&gt;
Team Collaboration: A clear design allows team members to understand the system's structure and work together more effectively.&lt;/p&gt;

&lt;h3&gt;
  
  
  Design Patterns Used by Companies
&lt;/h3&gt;

&lt;p&gt;Reputed companies like Google, Facebook, and Amazon use various design patterns to build their systems. Here are a few key patterns:&lt;/p&gt;

&lt;p&gt;Microservices Architecture: This pattern involves breaking down a large system into smaller, independent services that communicate through APIs. Each service handles a specific business function. Companies like Netflix and Amazon use this pattern to build scalable and maintainable systems.&lt;/p&gt;

&lt;p&gt;Example: Imagine an online shopping platform. The platform can be broken down into microservices like user authentication, product catalog, shopping cart, and payment processing. Each service operates independently, allowing for easier updates and scaling.&lt;/p&gt;

&lt;p&gt;Load Balancing: To handle high traffic, companies use load balancers to distribute incoming requests across multiple servers, ensuring no single server is overwhelmed.&lt;/p&gt;

&lt;p&gt;Example: Think of a restaurant with multiple waiters. Instead of one waiter taking all the orders, the restaurant manager distributes customers evenly among the waiters, ensuring prompt service.&lt;/p&gt;

&lt;p&gt;Caching: Caching involves storing frequently accessed data in a temporary storage location to reduce the time taken to retrieve data from the main database. Companies like Facebook use caching to speed up access to user profiles and posts.&lt;/p&gt;

&lt;p&gt;Example: Consider a library where popular books are kept on a special shelf near the entrance. This way, readers can quickly find and borrow these books without searching the entire library.&lt;/p&gt;

&lt;p&gt;Database Sharding: This technique splits a large database into smaller, more manageable pieces called shards. Each shard contains a subset of the data, which helps improve performance and scalability.&lt;/p&gt;

&lt;p&gt;Example: Imagine splitting a massive phone book into smaller sections, each covering a specific region. When looking up a number, you only search the relevant section, saving time and effort.&lt;/p&gt;

&lt;p&gt;Stay curious, keep learning, and happy coding!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>systemdesign</category>
      <category>typescript</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
