<?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: Shahid</title>
    <description>The latest articles on DEV Community by Shahid (@shahidkhans).</description>
    <link>https://dev.to/shahidkhans</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F390826%2Fd32a69a7-5c57-4c4d-99a5-4403af1e50fa.jpeg</url>
      <title>DEV Community: Shahid</title>
      <link>https://dev.to/shahidkhans</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shahidkhans"/>
    <language>en</language>
    <item>
      <title>Stop Running 5 Databases: PostgreSQL Does It All in 2026</title>
      <dc:creator>Shahid</dc:creator>
      <pubDate>Mon, 15 Jun 2026 10:37:20 +0000</pubDate>
      <link>https://dev.to/shahidkhans/stop-running-5-databases-postgresql-does-it-all-in-2026-1a2e</link>
      <guid>https://dev.to/shahidkhans/stop-running-5-databases-postgresql-does-it-all-in-2026-1a2e</guid>
      <description>&lt;p&gt;&lt;em&gt;How a 35-year-old open-source database became the default choice for relational storage, full-text search, vector AI workloads, geospatial queries, and event-driven architecture — in a single deployment.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Most production architectures look like a small city: a relational database for core data, a document store for flexible schemas, an Elasticsearch cluster for search, a vector database for AI-powered features, and a message broker stitching it all together. Five services. Five deployment pipelines. Five monitoring dashboards. Five points of failure — all to solve problems that, in most applications, &lt;strong&gt;one database already handles&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That database is PostgreSQL. It started as a research project at UC Berkeley in the 1980s and has quietly evolved into one of the most capable data platforms ever built. In 2026, as teams race to bolt AI onto their stacks without doubling infrastructure costs, Postgres has emerged as the default answer — not because it's new, but because it was built right.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Makes Postgres Different
&lt;/h2&gt;

&lt;p&gt;At its core, Postgres is a relational, ACID-compliant SQL database: tables, rows, foreign keys, joins, everything you'd expect. What separates it architecturally from MySQL or SQLite is that it was &lt;strong&gt;built for extensibility from day one&lt;/strong&gt;. There is a formalized plugin API that lets you add new data types, new index strategies, and entirely new capabilities via a single &lt;code&gt;CREATE EXTENSION&lt;/code&gt; command. This is not a bolt-on feature or a marketing checkbox — it is a deeply deliberate design choice baked into the query engine itself.&lt;/p&gt;

&lt;p&gt;The result: Postgres doesn't just store data. It becomes the entire data layer of your application, without stitching together a fleet of specialized services you need to deploy, monitor, and keep in sync.&lt;/p&gt;




&lt;h2&gt;
  
  
  Replacing the Document Store: JSONB
&lt;/h2&gt;

&lt;p&gt;The standard pitch for MongoDB has always been: &lt;em&gt;relational schemas are too rigid for modern applications.&lt;/em&gt; Postgres answers that directly with &lt;code&gt;JSONB&lt;/code&gt; — a binary-encoded JSON column type that lets you store fully schemaless documents right next to your strict relational tables, in the same database, under the same transaction.&lt;/p&gt;

&lt;p&gt;You can query deep into nested JSON using path expressions, check for key existence, test containment, and — critically — put a &lt;strong&gt;GIN index&lt;/strong&gt; on the entire document so those queries stay fast at scale:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;     &lt;span class="nb"&gt;SERIAL&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;email&lt;/span&gt;  &lt;span class="nb"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;data&lt;/span&gt;   &lt;span class="n"&gt;JSONB&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;idx_users_data&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="n"&gt;GIN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;-- Find all users on the 'pro' plan&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="k"&gt;data&lt;/span&gt; &lt;span class="o"&gt;@&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'{"plan": "pro"}'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your schemaless layer and your relational layer live in the same table, under the same backup, in the same &lt;code&gt;SELECT&lt;/code&gt;. No data synchronization. No eventual consistency headaches. No second server.&lt;/p&gt;




&lt;h2&gt;
  
  
  Replacing Elasticsearch: Built-in Full-Text Search
&lt;/h2&gt;

&lt;p&gt;Elasticsearch is powerful — but it's also one of the heaviest pieces of infrastructure you can operate. It needs its own cluster, its own memory tuning, its own index lifecycle management, and it demands you keep two copies of your data in sync at all times.&lt;/p&gt;

&lt;p&gt;Postgres has a native full-text search engine that handles tokenization, stemming (so "running" matches "run" and "runs"), stop-word filtering, relevance ranking, and indexed retrieval. For the overwhelming majority of product search boxes and content discovery features, it is more than sufficient:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- GIN-indexed full-text search&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;idx_articles_fts&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;articles&lt;/span&gt; &lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="n"&gt;GIN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;to_tsvector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="c1"&gt;-- Ranked search results&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;ts_rank&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;to_tsvector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;rank&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;articles&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="n"&gt;to_tsquery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'distributed &amp;amp; systems'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;to_tsvector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;@@&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;rank&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The only time Elasticsearch genuinely pulls ahead is at massive scale with advanced requirements — complex multi-language synonym pipelines, cross-cluster federation, or deep faceted navigation. For everything else, Postgres saves you an entire infrastructure tier.&lt;/p&gt;




&lt;h2&gt;
  
  
  Replacing Pinecone and Weaviate: AI-Native Vector Search
&lt;/h2&gt;

&lt;p&gt;This is the capability that has become non-negotiable in 2026. Every application now has an AI feature. Every AI feature needs semantic search. The &lt;code&gt;pgvector&lt;/code&gt; extension adds a native vector column type and approximate nearest-neighbor (ANN) search, making Postgres the backbone of &lt;strong&gt;Retrieval-Augmented Generation (RAG) pipelines&lt;/strong&gt; without standing up a dedicated vector database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;EXTENSION&lt;/span&gt; &lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;documents&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;        &lt;span class="nb"&gt;SERIAL&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;content&lt;/span&gt;   &lt;span class="nb"&gt;TEXT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;embedding&lt;/span&gt; &lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1536&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;-- HNSW index for fast approximate nearest-neighbor search&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;documents&lt;/span&gt; &lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="n"&gt;hnsw&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;embedding&lt;/span&gt; &lt;span class="n"&gt;vector_cosine_ops&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;-- Semantic similarity search&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;embedding&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'[0.12, 0.47, ...]'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;similarity&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;documents&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;embedding&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'[0.12, 0.47, ...]'&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For workloads under roughly 100 million vectors, Postgres with pgvector eliminates dedicated vector database overhead with no measurable quality trade-off.  The real advantage over standalone vector databases isn't just eliminating a service — it's &lt;strong&gt;composability&lt;/strong&gt;: your vector search can be combined with &lt;code&gt;WHERE&lt;/code&gt; filters, &lt;code&gt;JOIN&lt;/code&gt;s across tables, and Row-Level Security in a single query. Pinecone cannot join against your application data. Postgres can.&lt;/p&gt;




&lt;h2&gt;
  
  
  Replacing Redis and RabbitMQ: Queues and Pub/Sub
&lt;/h2&gt;

&lt;p&gt;Two underused, underappreciated Postgres features handle most messaging needs without introducing a broker.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;LISTEN&lt;/code&gt; / &lt;code&gt;NOTIFY&lt;/code&gt;&lt;/strong&gt; is a lightweight pub/sub mechanism built directly into the wire protocol. One session publishes a text payload to a named channel; every subscribed session receives it in milliseconds. It's not Kafka — but for triggering background workers, pushing cache invalidation events, or wiring up a simple notification system, it's zero-infrastructure pub/sub.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;SELECT FOR UPDATE SKIP LOCKED&lt;/code&gt;&lt;/strong&gt; turns an ordinary table into a reliable, concurrent job queue. Multiple workers pull jobs simultaneously without race conditions, because each &lt;code&gt;SELECT&lt;/code&gt; atomically locks the row it claims and skips all rows already locked by other workers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Worker atomically claims the next available job&lt;/span&gt;
&lt;span class="k"&gt;BEGIN&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;jobs&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'pending'&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;created_at&lt;/span&gt;
&lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;SKIP&lt;/span&gt; &lt;span class="n"&gt;LOCKED&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- ... process the job ...&lt;/span&gt;

&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;jobs&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'done'&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;COMMIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a worker crashes mid-job, the transaction rolls back and the row becomes claimable again — automatic exactly-once delivery, built on the ACID guarantees you already have.&lt;/p&gt;




&lt;h2&gt;
  
  
  Replacing Geospatial APIs: PostGIS
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;PostGIS&lt;/code&gt; extension is one of the most capable geospatial engines in the entire software ecosystem — commercial or otherwise. It adds geometry and geography column types (points, lines, polygons, multipolygons), spatial indexing via GiST, and a rich library of functions for distance calculations, intersection tests, buffering, and coordinate system transformations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Find all stores within 5km of a user's location in Bengaluru&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;ST_Distance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;location&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ST_MakePoint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;77&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;5946&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;9716&lt;/span&gt;&lt;span class="p"&gt;)::&lt;/span&gt;&lt;span class="n"&gt;geography&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;dist_meters&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;stores&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;ST_DWithin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;location&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;ST_MakePoint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;77&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;5946&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;9716&lt;/span&gt;&lt;span class="p"&gt;)::&lt;/span&gt;&lt;span class="n"&gt;geography&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="mi"&gt;5000&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;dist_meters&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Entire commercial GIS platforms used by governments and logistics companies worldwide are built on PostGIS. It replaces the need for a separate geospatial API service for any proximity or boundary query against your own data.&lt;/p&gt;




&lt;h2&gt;
  
  
  The SQL You're Probably Under-Using
&lt;/h2&gt;

&lt;p&gt;Beyond extensions, most developers use roughly 60% of Postgres's SQL capabilities. The remaining 40% eliminates entire categories of application-layer code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Window Functions&lt;/strong&gt; compute aggregates across rows related to the current row without collapsing them like &lt;code&gt;GROUP BY&lt;/code&gt; does — running totals, moving averages, percentile ranks, all in a single pass:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
  &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;running_total&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;order_date&lt;/span&gt;
    &lt;span class="k"&gt;ROWS&lt;/span&gt; &lt;span class="k"&gt;BETWEEN&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="k"&gt;PRECEDING&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="k"&gt;CURRENT&lt;/span&gt; &lt;span class="k"&gt;ROW&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;rolling_7day_avg&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Recursive CTEs&lt;/strong&gt; walk tree structures — org hierarchies, category trees, threaded comments, dependency graphs — in pure SQL, with no application-side recursion or multiple round trips:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="k"&gt;RECURSIVE&lt;/span&gt; &lt;span class="n"&gt;category_tree&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;parent_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;depth&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;categories&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;parent_id&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;

  &lt;span class="k"&gt;UNION&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt;

  &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parent_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;depth&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;categories&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;
  &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;category_tree&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parent_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;category_tree&lt;/span&gt; &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;depth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Atomic Upserts&lt;/strong&gt; handle the classic insert-or-update race condition with a single statement — no optimistic locking, no read-then-write, no race:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;inventory&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;product_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stock&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;CONFLICT&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;product_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;DO&lt;/span&gt; &lt;span class="k"&gt;UPDATE&lt;/span&gt;
  &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;stock&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;EXCLUDED&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stock&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;updated_at&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;NOW&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Indexes: A Write Tax for a Read Benefit
&lt;/h2&gt;

&lt;p&gt;Postgres gives you multiple index types, each precision-engineered for a different access pattern. Picking the right one is one of the highest-leverage optimizations available:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Index Type&lt;/th&gt;
&lt;th&gt;Best For&lt;/th&gt;
&lt;th&gt;Typical Use Case&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;B-tree&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Equality, ranges, ordering (default)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;WHERE created_at &amp;gt; '2025-01-01'&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;GIN&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;JSONB keys, full-text search, arrays&lt;/td&gt;
&lt;td&gt;&lt;code&gt;data @&amp;gt; '{"plan": "pro"}'&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;GiST&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Geometry, ranges, fuzzy matching&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ST_DWithin(location, point, 500)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;BRIN&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Massive append-only time-series tables&lt;/td&gt;
&lt;td&gt;IoT sensor logs, event streams&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;HNSW / IVFFlat&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Vector ANN similarity search&lt;/td&gt;
&lt;td&gt;Embedding-based semantic retrieval&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every index is a &lt;strong&gt;write tax for a read benefit&lt;/strong&gt; — it makes &lt;code&gt;INSERT&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt;, and &lt;code&gt;DELETE&lt;/code&gt; slightly slower because Postgres maintains the index alongside the table. Add indexes surgically, guided by &lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt; output, not speculatively:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;EXPLAIN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;ANALYZE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;BUFFERS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;customer_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1234&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'shipped'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The most important thing to look for in the output: &lt;strong&gt;Seq Scan vs Index Scan&lt;/strong&gt;. A sequential scan on a large table is your bottleneck. An appropriately chosen index on the same query is your fix.&lt;/p&gt;




&lt;h2&gt;
  
  
  PostgreSQL 18: Built for the AI Era
&lt;/h2&gt;

&lt;p&gt;PostgreSQL 18, released in 2026, doubles down on AI-era workloads with several meaningful improvements.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Asynchronous I/O&lt;/strong&gt; significantly reduces latency on storage-bound operations, directly benefiting heavy embedding writes and similarity search workloads&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skip-scan on multicolumn indexes&lt;/strong&gt; makes filtering around vector similarity searches dramatically faster&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UUIDv7 index optimization&lt;/strong&gt; improves insert and scan performance for tables that use UUID primary keys — common in distributed and event-driven systems&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automatic data checksums&lt;/strong&gt; are now enabled by default on new clusters, eliminating a common silent data corruption risk&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OAuth 2.0 authentication&lt;/strong&gt; support out of the box for enterprise identity integration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These aren't cosmetic improvements — they're direct responses to the workload patterns that have emerged as teams integrate LLMs and AI features into their production stacks.&lt;/p&gt;




&lt;h2&gt;
  
  
  Under the Hood: Three Mechanisms That Explain Everything
&lt;/h2&gt;

&lt;p&gt;Three internal systems explain most of Postgres's observable behavior — and knowing them prevents a category of production incidents.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MVCC (Multi-Version Concurrency Control)&lt;/strong&gt; is why readers and writers never block each other. When you update a row, Postgres doesn't overwrite it. It writes a &lt;em&gt;new version&lt;/em&gt; of the row and marks the old one as expired. Every transaction sees the world as it existed when that transaction started, regardless of what other transactions are doing concurrently. This is what makes &lt;code&gt;SERIALIZABLE&lt;/code&gt; isolation achievable without locking tables.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WAL (Write-Ahead Log)&lt;/strong&gt; is why Postgres survives crashes with full consistency. Every change is written to a sequential log &lt;em&gt;before&lt;/em&gt; it's applied to data files on disk. On restart after a crash, Postgres replays the WAL and arrives at exactly the state it would have been in had the crash never happened. The same WAL stream is also shipped to read replicas in real time — replication is essentially a free side effect of crash recovery.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VACUUM and Dead Tuple Bloat&lt;/strong&gt; is the tax you pay for MVCC. Because old row versions aren't overwritten, they accumulate as "dead tuples" on disk. The background &lt;code&gt;autovacuum&lt;/code&gt; process reclaims this space continuously. In write-heavy workloads, autovacuum can fall behind — leading to table bloat, index bloat, and eventually a transaction ID wraparound emergency. Monitor &lt;code&gt;pg_stat_user_tables&lt;/code&gt; for &lt;code&gt;n_dead_tup&lt;/code&gt; values that keep climbing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Scaling Postgres: What's Real and What's Honest
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Read scaling&lt;/strong&gt; is well-understood: stream the WAL to standby servers and route &lt;code&gt;SELECT&lt;/code&gt; queries across them. Read replicas are typically milliseconds behind the primary.&lt;br&gt;
&lt;strong&gt;Write scaling&lt;/strong&gt; is the honest hard limit. One primary accepts all writes. When you genuinely hit that ceiling, these are your options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Table Partitioning&lt;/strong&gt; — splits large tables (by month, by region, by tenant) into physical partitions; Postgres prunes irrelevant partitions at query time, dramatically reducing scan sizes on time-series or multi-tenant data&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Citus&lt;/strong&gt; — distributes both data and queries across a cluster of Postgres nodes, enabling horizontal write scaling while keeping the full Postgres SQL interface&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PgBouncer&lt;/strong&gt; — not a scaling tool but an operational necessity. Each Postgres connection is a full OS process consuming 5–10MB of RAM. Serverless functions and connection-heavy frameworks will exhaust your connection limit quickly. PgBouncer pools thousands of application connections onto a small, stable set of real server connections, and it belongs in every production deployment
***&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When to Reach for Something Else
&lt;/h2&gt;

&lt;p&gt;Postgres is honest about its limits. You should be too.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pure hot-path in-memory cache&lt;/strong&gt; at millions of ops/sec → Redis; Postgres is not a memory store&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Horizontal write sharding across 10+ nodes from day one&lt;/strong&gt; → purpose-built distributed systems like Cassandra or CockroachDB&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Petabyte-scale OLAP with complex aggregations&lt;/strong&gt; → columnar engines like ClickHouse, DuckDB, or BigQuery will be orders of magnitude faster&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High-throughput real-time event streaming&lt;/strong&gt; → Kafka or Redpanda own that space; &lt;code&gt;NOTIFY&lt;/code&gt; doesn't match their throughput guarantees&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The engineering discipline is: &lt;strong&gt;start with Postgres, measure your actual bottlenecks, and add specialized tooling only when you've conclusively outgrown what Postgres offers.&lt;/strong&gt; The biggest architectural mistake teams make is adding distributed complexity in anticipation of hypothetical scale that never arrives.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why the License Is a Competitive Moat
&lt;/h2&gt;

&lt;p&gt;Postgres is governed by the PostgreSQL Global Development Group — a community intentionally structured so that no single company can change its terms.  The license is permissive, similar in spirit to BSD/MIT. You own your deployment. You control your upgrade path.&lt;/p&gt;

&lt;p&gt;This is not a footnote. In recent years, MongoDB switched to SSPL and Redis changed to BSL, sending engineering teams scrambling for alternatives. That cannot structurally happen with Postgres. The community governance model is the moat — and in a world where vendor lock-in risk has become a real architecture consideration, that stability has genuine business value.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Single-Database Architecture
&lt;/h2&gt;

&lt;p&gt;One database. One backup strategy. One set of credentials. One monitoring dashboard. One &lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt;. It handles your relational data, your documents, your full-text search, your vector embeddings, your geospatial queries, your job queue, and your pub/sub events — and it has been reliably doing so for production systems at scale for over thirty years.&lt;/p&gt;

&lt;p&gt;In 2026, the question isn't whether Postgres is capable enough. The question is whether your architecture has already added five services it didn't need.&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>ai</category>
      <category>programming</category>
    </item>
    <item>
      <title>Testing MCP Server Tools in AI Agents — A Practical Guide</title>
      <dc:creator>Shahid</dc:creator>
      <pubDate>Sun, 24 May 2026 08:26:10 +0000</pubDate>
      <link>https://dev.to/shahidkhans/testing-mcp-server-tools-in-ai-agents-a-practical-guide-1c9d</link>
      <guid>https://dev.to/shahidkhans/testing-mcp-server-tools-in-ai-agents-a-practical-guide-1c9d</guid>
      <description>&lt;p&gt;&lt;strong&gt;Building an MCP server is only half the job. The other half — testing its tools — is where most developers drop the ball.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're using the &lt;a href="https://ai-sdk.dev/docs/introduction" rel="noopener noreferrer"&gt;Vercel AI SDK&lt;/a&gt; to build AI agents with Model Context Protocol (MCP), you already know how powerful tool-calling can be. But an untested tool is a liability. A hallucinating LLM calling a broken tool can cause cascading failures that are notoriously hard to debug in production. This guide walks you through a layered testing strategy — from fast unit tests to full end-to-end evaluations.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Testing MCP Tools Is Uniquely Hard
&lt;/h2&gt;

&lt;p&gt;MCP tools sit at the intersection of three systems: your &lt;strong&gt;server logic&lt;/strong&gt;, the &lt;strong&gt;LLM's tool selection behavior&lt;/strong&gt;, and the &lt;strong&gt;AI SDK's execution pipeline&lt;/strong&gt;. A bug can live in any one of them. Testing just the server in isolation gives you false confidence — you also need to verify that the LLM actually &lt;em&gt;picks&lt;/em&gt; the right tool for a given prompt, and that the AI SDK correctly routes the call.&lt;/p&gt;




&lt;h2&gt;
  
  
  Layer 1: Unit Test Tool Logic Directly
&lt;/h2&gt;

&lt;p&gt;Before involving any LLM, test your tool's &lt;code&gt;execute()&lt;/code&gt; function in complete isolation. The AI SDK lets you invoke tool execution directly with a typed input:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;search-docs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;MCP transport options&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;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[],&lt;/span&gt; &lt;span class="na"&gt;toolCallId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;test-001&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="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;documents&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toBeGreaterThan&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This runs in milliseconds, costs nothing, and catches the most common bugs — wrong output shapes, missing error handling, and schema mismatches.&lt;/p&gt;




&lt;h2&gt;
  
  
  Layer 2: Inspect Schemas with the MCP Inspector
&lt;/h2&gt;

&lt;p&gt;Run the official &lt;code&gt;@modelcontextprotocol/inspector&lt;/code&gt; CLI tool against your server before writing a single test:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx @modelcontextprotocol/inspector node dist/server.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The browser UI lets you browse all registered tools, manually invoke them with custom inputs, and inspect raw JSON-RPC payloads. This is your &lt;strong&gt;smoke test&lt;/strong&gt; — it confirms your server is reachable and your schemas are well-formed. Do this after every new tool you add.&lt;/p&gt;




&lt;h2&gt;
  
  
  Layer 3: Mock the LLM for Integration Tests
&lt;/h2&gt;

&lt;p&gt;Real LLM API calls are slow, flaky, and expensive in CI pipelines. The AI SDK ships a &lt;code&gt;MockLanguageModelV1&lt;/code&gt; in &lt;code&gt;ai/test&lt;/code&gt; specifically for this:&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="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;MockLanguageModelV1&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;ai/test&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;generateText&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;ai&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;mockModel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;MockLanguageModelV1&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;doGenerate&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;finishReason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tool-calls&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;toolCalls&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt;
      &lt;span class="na"&gt;toolCallType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;function&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;toolCallId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;call-1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;toolName&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-weather&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;location&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Bengaluru&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;rawCall&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;rawPrompt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;rawSettings&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;usage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;promptTokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;completionTokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;}),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;toolResults&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;generateText&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;mockModel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;mcpTools&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;What is the weather in Bengaluru?&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 tests your entire AI agent pipeline — tool registration, execution, result parsing — without a single API call.&lt;/p&gt;




&lt;h2&gt;
  
  
  Layer 4: Evaluate Tool Selection Accuracy
&lt;/h2&gt;

&lt;p&gt;The hardest problem to test is: &lt;em&gt;will the LLM choose the right tool?&lt;/em&gt; A tool with a vague description might get ignored. A poorly scoped tool might be called when it shouldn't be. Use &lt;code&gt;mcp-evals&lt;/code&gt; for structured grading:&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="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;evalTool&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;mcp-evals&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;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;evalTool&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Find all open GitHub issues labeled bug&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;expectedTool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;list-github-issues&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;grader&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;openai/gpt-4o&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Score: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;score&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, Passed: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;passed&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run these evals whenever you change a tool's name, description, or input schema — those are the highest-risk moments.&lt;/p&gt;




&lt;h2&gt;
  
  
  The One Rule That Saves Hours of Debugging
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Always call &lt;code&gt;await mcpClient.close()&lt;/code&gt; after every test.&lt;/strong&gt; Leaving MCP connections open causes port conflicts, zombie processes, and flaky tests in CI. Wrap every test suite in a &lt;code&gt;beforeAll&lt;/code&gt;/&lt;code&gt;afterAll&lt;/code&gt; block:&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="nf"&gt;beforeAll&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;mcpClient&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;createMCPClient&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="nf"&gt;afterAll&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;mcpClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  What to Test at Each Layer
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Speed&lt;/th&gt;
&lt;th&gt;Cost&lt;/th&gt;
&lt;th&gt;Tests&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;tool.execute()&lt;/code&gt; directly&lt;/td&gt;
&lt;td&gt;Fast&lt;/td&gt;
&lt;td&gt;Free&lt;/td&gt;
&lt;td&gt;Logic, output schema, error handling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MCP Inspector&lt;/td&gt;
&lt;td&gt;Manual&lt;/td&gt;
&lt;td&gt;Free&lt;/td&gt;
&lt;td&gt;Schema validity, tool discoverability&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MockLanguageModelV1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fast&lt;/td&gt;
&lt;td&gt;Free&lt;/td&gt;
&lt;td&gt;Full agent pipeline, tool routing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;mcp-evals&lt;/code&gt; grading&lt;/td&gt;
&lt;td&gt;Slow&lt;/td&gt;
&lt;td&gt;LLM cost&lt;/td&gt;
&lt;td&gt;Tool selection accuracy by description&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Start with Layer 1 for every tool, use Layer 3 for CI, and run Layer 4 before any deployment that touches tool descriptions or names. Your future self — staring at a 3 AM production incident — will thank you.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Have questions about testing a specific tool type? Drop them in the comments below.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>vercel</category>
      <category>agentskills</category>
    </item>
    <item>
      <title>How do I calculate how many shares to buy based on ATR and risk management?</title>
      <dc:creator>Shahid</dc:creator>
      <pubDate>Sun, 10 May 2026 06:42:51 +0000</pubDate>
      <link>https://dev.to/shahidkhans/how-do-i-calculate-how-many-shares-to-buy-based-on-atr-and-risk-management-agn</link>
      <guid>https://dev.to/shahidkhans/how-do-i-calculate-how-many-shares-to-buy-based-on-atr-and-risk-management-agn</guid>
      <description>&lt;p&gt;One of the most common questions I see from traders is: &lt;em&gt;"I like this setup — but how many shares should I buy?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Most people guess. Or buy a round number. Or deploy whatever cash they have.&lt;/p&gt;

&lt;p&gt;Here's the systematic answer using ATR.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;The Framework&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;ATR(14) tells you how much a stock moves on an average day. Using that as your stop foundation means your stop is calibrated to the stock's actual volatility — not an arbitrary percentage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1 — Stop Distance&lt;/strong&gt;&lt;br&gt;
Stop Distance = ATR × Multiplier&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;2× ATR → short-term / swing trades&lt;/li&gt;
&lt;li&gt;3× ATR → positional / long-term (recommended)&lt;/li&gt;
&lt;li&gt;4× ATR → very wide, for high-volatility stocks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2 — Risk Budget&lt;/strong&gt;&lt;br&gt;
Risk Budget = Capital × Risk %&lt;br&gt;
Standard: 1% of capital per trade.&lt;br&gt;
₹1,00,000 capital → ₹1,000 max loss per trade&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3 — Position Size&lt;/strong&gt;&lt;br&gt;
Units = Risk Budget ÷ Stop Distance&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Example (round numbers)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Stock price: ₹500 | ATR(14): ₹5 | Capital: ₹1,00,000&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ATR Mult&lt;/th&gt;
&lt;th&gt;Stop Dist&lt;/th&gt;
&lt;th&gt;Stop Price&lt;/th&gt;
&lt;th&gt;Units&lt;/th&gt;
&lt;th&gt;Deployed&lt;/th&gt;
&lt;th&gt;Max Loss&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;2×&lt;/td&gt;
&lt;td&gt;₹10&lt;/td&gt;
&lt;td&gt;₹490&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;₹50,000&lt;/td&gt;
&lt;td&gt;₹1,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;3× ★&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;₹15&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;₹485&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;66&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;₹33,000&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;₹990&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4×&lt;/td&gt;
&lt;td&gt;₹20&lt;/td&gt;
&lt;td&gt;₹480&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;₹25,000&lt;/td&gt;
&lt;td&gt;₹1,000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Notice the max loss stays ~₹1,000 across all levels. The multiplier controls stop tightness — not your risk amount. Your position size automatically adjusts.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;The YOLO trap&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Buying 200 units (full ₹1L deployed) with a 3× ATR stop risks:&lt;br&gt;
200 × ₹15 = &lt;strong&gt;₹3,000 = 3% of capital&lt;/strong&gt; in one trade.&lt;/p&gt;

&lt;p&gt;Across 4 simultaneous positions that's 12% exposure. One bad week is devastating.&lt;/p&gt;

&lt;p&gt;ATR position sizing keeps each trade capped at 1% regardless of entry price or volatility level.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Free Calculator&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I built a browser-based tool that does all this math instantly — enter your ATR, entry price, capital and risk %, and it simulates across all multiplier levels with a comparison table and charts.&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;&lt;a href="https://trade-atr.sk7.workers.dev/" rel="noopener noreferrer"&gt;https://trade-atr.sk7.workers.dev/&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No login, no signup — runs entirely in your browser.&lt;/p&gt;

</description>
      <category>stock</category>
      <category>stockmarket</category>
    </item>
    <item>
      <title>npm vs pnpm: The Ultimate Command Comparison Cheat Sheet</title>
      <dc:creator>Shahid</dc:creator>
      <pubDate>Fri, 22 Aug 2025 13:49:58 +0000</pubDate>
      <link>https://dev.to/shahidkhans/npm-vs-pnpm-the-ultimate-command-comparison-cheat-sheet-pp0</link>
      <guid>https://dev.to/shahidkhans/npm-vs-pnpm-the-ultimate-command-comparison-cheat-sheet-pp0</guid>
      <description>&lt;p&gt;pnpm and npm are both package managers for JavaScript, but they handle dependency installation and management differently. &lt;strong&gt;Direct command translation between npm and pnpm is nearly 1:1&lt;/strong&gt;—most operations you run in npm can be run in pnpm with the same arguments, but under the hood, pnpm is typically faster and far more disk-efficient due to its unique content-addressable storage approach and symlinking strategy.&lt;/p&gt;

&lt;p&gt;Below is a direct, &lt;strong&gt;command-by-command comparison&lt;/strong&gt; between npm and pnpm for common package management tasks. The table uses &lt;code&gt;npm&lt;/code&gt; as the reference, with the equivalent &lt;code&gt;pnpm&lt;/code&gt; command, and notes any important behavioral differences.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;npm Command&lt;/th&gt;
&lt;th&gt;pnpm Command&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Initialize project&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm init&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm init&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Both create &lt;code&gt;package.json&lt;/code&gt;; behavior identical.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Install all dependencies&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm install&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm install&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;pnpm uses a global store and symlinks for speed/space; npm duplicates packages.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Add dependency&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm add &amp;lt;package&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm add &amp;lt;package&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Both save to &lt;code&gt;package.json&lt;/code&gt; by default; options like &lt;code&gt;--save-dev&lt;/code&gt; work the same.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Add dev dependency&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm add -D &amp;lt;package&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm add -D &amp;lt;package&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Both add to &lt;code&gt;devDependencies&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Add optional dependency&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm add -O &amp;lt;package&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm add -O &amp;lt;package&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Both add to &lt;code&gt;optionalDependencies&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Add global package&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm add -g &amp;lt;package&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm add -g &amp;lt;package&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;pnpm's global store is more efficient.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Remove package&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm remove &amp;lt;package&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm remove &amp;lt;package&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Both remove from &lt;code&gt;package.json&lt;/code&gt; and &lt;code&gt;node_modules&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Update package&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm update &amp;lt;package&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm update &amp;lt;package&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;pnpm updates from its global store, often faster.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Check outdated packages&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm outdated&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm outdated&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Both show outdated packages.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Run script&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm run &amp;lt;script&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm &amp;lt;script&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;pnpm does not require &lt;code&gt;run&lt;/code&gt; keyword if script exists in &lt;code&gt;package.json&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Run command&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npx &amp;lt;command&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm dlx &amp;lt;command&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;pnpm uses &lt;code&gt;dlx&lt;/code&gt; to download and run commands like &lt;code&gt;npx&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Prune node_modules&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm prune&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm prune&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;pnpm &lt;strong&gt;always&lt;/strong&gt; removes extraneous/orphaned packages, no package args allowed.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;List installed packages&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm ls&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm ls&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Both list dependency trees.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Audit for vulnerabilities&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm audit&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pnpm audit&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Both check for security issues.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Install pnpm globally&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm install -g pnpm&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;pnpm&lt;/code&gt; can be installed via npm or other methods.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Key Differences Under the Hood&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Installation Speed &amp;amp; Disk Space&lt;/strong&gt;: pnpm is typically much faster and uses far less disk space than npm, especially in large projects, because it stores each package version once globally and symlinks into project &lt;code&gt;node_modules&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dependency Resolution&lt;/strong&gt;: pnpm enforces &lt;strong&gt;strict&lt;/strong&gt; dependency resolution, which can help avoid "phantom" dependencies (packages not listed in &lt;code&gt;package.json&lt;/code&gt; but still accessible). npm’s flattened &lt;code&gt;node_modules&lt;/code&gt; can sometimes allow this.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monorepo/Workspaces&lt;/strong&gt;: pnpm has built-in, optimized support for monorepos and workspaces; npm requires extra configuration for similar features.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ecosystem&lt;/strong&gt;: npm has the largest ecosystem and widest compatibility; pnpm’s is growing but smaller.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Global Store&lt;/strong&gt;: pnpm’s global store is a major architectural difference—reducing duplication across all projects on your system.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;When to Use Which&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use npm&lt;/strong&gt; if you want maximum ecosystem compatibility, are working on small projects, or need the broadest community support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use pnpm&lt;/strong&gt; if you value disk space, installation speed, strict dependency isolation, or are managing large projects/monorepos.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Summary&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;For most day-to-day commands, just replace &lt;code&gt;npm&lt;/code&gt; with &lt;code&gt;pnpm&lt;/code&gt;.&lt;/strong&gt; The key differences are internal (speed, disk usage, dependency resolution), not in the command syntax. However, pnpm’s architecture means your projects will install faster, use less disk space, and be more strictly isolated—benefits that grow with project size and complexity.&lt;/p&gt;

&lt;p&gt;If you need a &lt;strong&gt;specific npm command translated to pnpm&lt;/strong&gt; that isn’t listed above, just ask—the mapping is nearly always straightforward!&lt;/p&gt;

</description>
      <category>npm</category>
      <category>pnpm</category>
      <category>node</category>
      <category>programming</category>
    </item>
    <item>
      <title>From Zero to AI-Powered Developer: Your Complete Claude Code CLI Setup Guide</title>
      <dc:creator>Shahid</dc:creator>
      <pubDate>Wed, 06 Aug 2025 06:43:45 +0000</pubDate>
      <link>https://dev.to/shahidkhans/from-zero-to-ai-powered-developer-your-complete-claude-code-cli-setup-guide-4l9i</link>
      <guid>https://dev.to/shahidkhans/from-zero-to-ai-powered-developer-your-complete-claude-code-cli-setup-guide-4l9i</guid>
      <description>&lt;p&gt;&lt;em&gt;Setting up your development environment with AI assistance used to be a pipe dream. Today, it's a 10-minute process that could transform how you write code forever. Here's everything you need to know to get Claude Code running on your system—from installation to your first AI-powered commit.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The landscape of software development is shifting rapidly, and at the center of this transformation is &lt;strong&gt;Claude Code&lt;/strong&gt;—Anthropic's command-line AI assistant that brings enterprise-level coding capabilities directly to your terminal. Whether you're a seasoned developer or just starting your coding journey, this comprehensive guide will get you up and running with one of 2025's most powerful development tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why Claude Code Setup Matters More Than Ever&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Before diving into the technical details, it's worth understanding what makes Claude Code different from other AI coding tools. Unlike browser-based chatbots or IDE plugins that work in isolation, Claude Code operates as a &lt;strong&gt;full-fledged development partner&lt;/strong&gt; that can read your entire codebase, understand your project architecture, and make coordinated changes across multiple files simultaneously.&lt;/p&gt;

&lt;p&gt;The setup process might seem straightforward, but getting it right from the beginning can mean the difference between a seamless development experience and hours of troubleshooting down the line.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Pre-Flight Check: System Requirements That Actually Matter&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;The Baseline Requirements&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Before you begin, ensure your system meets these essential requirements:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operating Systems&lt;/strong&gt;: macOS 10.15+, Ubuntu 20.04+/Debian 10+, or Windows 10+ (with WSL 1, WSL 2, or Git for Windows)&lt;br&gt;
&lt;strong&gt;Hardware&lt;/strong&gt;: 4GB+ RAM minimum&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Software&lt;/strong&gt;: Node.js 18+ (LTS version strongly recommended)&lt;br&gt;
&lt;strong&gt;Network&lt;/strong&gt;: Stable internet connection for authentication and AI processing&lt;br&gt;
&lt;strong&gt;Shell Environment&lt;/strong&gt;: Works optimally with Bash, Zsh, or Fish&lt;br&gt;
&lt;strong&gt;Geographic Location&lt;/strong&gt;: Must be in an Anthropic-supported country&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;The Often-Overlooked Details&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;What the documentation doesn't emphasize enough is that &lt;strong&gt;your shell choice can significantly impact your experience&lt;/strong&gt;. While Claude Code works across different shells, Bash and Zsh users report the most stable experience, particularly when integrating with IDE workflows and managing complex project structures.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Installation Methods: Choosing Your Path to Success&lt;/strong&gt;
&lt;/h2&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Method 1: NPM Installation (The Reliable Standard)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;For most developers, the NPM route provides the most predictable setup experience:&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;-g&lt;/span&gt; @anthropic-ai/claude-code
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Critical Warning&lt;/strong&gt;: Never use &lt;code&gt;sudo&lt;/code&gt; with this command. The &lt;code&gt;sudo npm install -g&lt;/code&gt; approach can create permission issues and security vulnerabilities that will plague your entire setup. If you encounter permission errors, configure your npm permissions properly or consider the local installation method instead.&lt;/p&gt;

&lt;p&gt;This approach works best when you have a properly configured Node.js environment and npm permissions set up correctly on your system.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Method 2: Native Binary Installation (The Cutting-Edge Choice)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;For developers who want access to the latest features or need to avoid npm permission complexities entirely, the native binary installation offers a compelling alternative.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For macOS, Linux, and WSL:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install stable version (recommended for most users)&lt;/span&gt;
curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://claude.ai/install.sh | bash

&lt;span class="c"&gt;# Install latest version (for early adopters)&lt;/span&gt;
curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://claude.ai/install.sh | bash &lt;span class="nt"&gt;-s&lt;/span&gt; latest

&lt;span class="c"&gt;# Install specific version (for compatibility requirements)&lt;/span&gt;
curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://claude.ai/install.sh | bash &lt;span class="nt"&gt;-s&lt;/span&gt; 1.0.58
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;For Windows PowerShell:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install stable version&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;irm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;https://claude.ai/install.ps1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;iex&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# Install latest version&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;scriptblock&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;Create&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;irm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;https://claude.ai/install.ps1&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;latest&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The native binary installation often provides better performance and eliminates dependency conflicts, making it particularly attractive for developers working in complex environments.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Method 3: Local Installation Migration&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If you already have a global npm installation and are experiencing autoupdater permission issues, Claude Code provides a seamless migration path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude migrate-installer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command transitions your installation to a local setup that avoids common permission pitfalls. Some users may be automatically migrated to this method during updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Platform-Specific Considerations That Make or Break Your Setup&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Windows: Navigating the Complexity&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Windows users have two primary paths, each with distinct advantages:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 1: WSL Integration (Strongly Recommended)&lt;/strong&gt;&lt;br&gt;
Both WSL 1 and WSL 2 are fully supported, but the experience is significantly smoother within a Linux subsystem. Install Ubuntu 20.04+ or Debian 10+ through WSL, then follow the standard Linux installation process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 2: Native Windows with Git Bash&lt;/strong&gt;&lt;br&gt;
This approach requires Git for Windows and additional configuration. For portable Git installations, you'll need to specify the bash path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$env&lt;/span&gt;:CLAUDE_CODE_GIT_BASH_PATH&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"C:&lt;/span&gt;&lt;span class="se"&gt;\P&lt;/span&gt;&lt;span class="s2"&gt;rogram Files&lt;/span&gt;&lt;span class="se"&gt;\G&lt;/span&gt;&lt;span class="s2"&gt;it&lt;/span&gt;&lt;span class="se"&gt;\b&lt;/span&gt;&lt;span class="s2"&gt;in&lt;/span&gt;&lt;span class="se"&gt;\b&lt;/span&gt;&lt;span class="s2"&gt;ash.exe"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Linux and macOS: The Straightforward Path&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Installation on Unix-based systems is typically seamless using either the npm or native binary methods. The primary consideration is ensuring your Node.js version meets the LTS requirements.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Post-Installation Verification: Ensuring Everything Works&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;After installation, verification is crucial to avoid discovering setup issues during critical development moments:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Check installation health and configuration&lt;/span&gt;
claude doctor

&lt;span class="c"&gt;# Verify global availability and version&lt;/span&gt;
claude &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you used the native binary installation method, you might need to add Claude to your system PATH:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'export PATH="$HOME/.local/bin:$PATH"'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember to restart your terminal or source your profile for PATH changes to take effect.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Authentication: Your Gateway to AI-Powered Development&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Claude Code offers three distinct authentication approaches, each suited to different use cases:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Option 1: Anthropic Console (Default Path)&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Requires an active billing account at console.anthropic.com&lt;/li&gt;
&lt;li&gt;Uses OAuth for secure authentication&lt;/li&gt;
&lt;li&gt;Navigate to your project directory and run &lt;code&gt;claude&lt;/code&gt; to begin the authentication flow&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Option 2: Claude App Integration (Pro/Max Plans)&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Perfect for developers with existing Claude Pro or Max subscriptions&lt;/li&gt;
&lt;li&gt;Provides unified billing and account management&lt;/li&gt;
&lt;li&gt;Log in with your Claude.ai credentials during the initial launch&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Option 3: Enterprise Platforms&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Designed for organizations using Amazon Bedrock or Google Vertex AI&lt;/li&gt;
&lt;li&gt;Requires additional configuration for cloud infrastructure integration&lt;/li&gt;
&lt;li&gt;Ideal for enterprise environments with existing AI platform investments&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;First Session: Making Contact with Your AI Development Partner&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Your first Claude Code session sets the foundation for all future interactions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Navigate to your project directory:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /path/to/your/project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Launch Claude Code:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Complete the authentication flow following the prompts&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;You'll be greeted with the welcome interface:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;✻ Welcome to Claude Code!
...
&amp;gt; Try "create a util logging.py that..."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This welcome prompt isn't just ceremonial—it's your first indication that Claude Code has successfully connected to Anthropic's servers and is ready to assist with your development workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Essential Configuration for Maximum Effectiveness&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Environment Variables for Advanced Users&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;While not required for basic operation, setting up environment variables can enhance your Claude Code experience:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# For direct API access (add to ~/.bashrc, ~/.zshrc, or ~/.profile)&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-api-key-here"&lt;/span&gt;

&lt;span class="c"&gt;# For Amazon Bedrock integration&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CLAUDE_CODE_USE_BEDROCK&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1

&lt;span class="c"&gt;# For Google Vertex AI integration&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CLAUDE_CODE_USE_VERTEX&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Project-Level Context: The CLAUDE.md Secret Weapon&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;One of Claude Code's most powerful features is its ability to maintain project context through a &lt;code&gt;CLAUDE.md&lt;/code&gt; file placed in your project root. This file acts as a persistent briefing document that Claude Code references for every interaction:&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;# Project: Web Application Backend&lt;/span&gt;

&lt;span class="gu"&gt;## Structure&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`src/`&lt;/span&gt; - Main application code
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`tests/`&lt;/span&gt; - Test suites and fixtures
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`docs/`&lt;/span&gt; - Project documentation
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`config/`&lt;/span&gt; - Configuration files

&lt;span class="gu"&gt;## Conventions&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Use TypeScript for all new files
&lt;span class="p"&gt;-&lt;/span&gt; Follow REST API naming conventions
&lt;span class="p"&gt;-&lt;/span&gt; Implement comprehensive error handling
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This context file dramatically improves Claude Code's understanding of your project, resulting in more accurate suggestions and fewer misaligned implementations.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Command Reference: Your Daily Development Arsenal&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Understanding Claude Code's command structure is essential for effective usage:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Command&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Purpose&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Use Case&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Start interactive mode&lt;/td&gt;
&lt;td&gt;Beginning a development session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude "task"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Execute one-time task&lt;/td&gt;
&lt;td&gt;Quick fixes or implementations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude -p "query"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Run query and exit&lt;/td&gt;
&lt;td&gt;Getting explanations or guidance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude -c&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Continue recent conversation&lt;/td&gt;
&lt;td&gt;Resuming interrupted work&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude -r&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Resume previous conversation&lt;/td&gt;
&lt;td&gt;Returning to earlier discussions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude commit&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Create Git commit&lt;/td&gt;
&lt;td&gt;Automated commit message generation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/clear&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Clear conversation history&lt;/td&gt;
&lt;td&gt;Starting fresh within a session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/help&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show available commands&lt;/td&gt;
&lt;td&gt;Discovering new capabilities&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/config&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Configure settings&lt;/td&gt;
&lt;td&gt;Customizing your experience&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;IDE Integration: Bringing AI Into Your Editor&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;VS Code Integration Made Simple&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Claude Code's VS Code integration transforms your editor into an AI-powered development environment:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Start Claude Code from your VS Code terminal:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Enable IDE integration:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /ide
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Install the extension when prompted&lt;/strong&gt;
Claude Code will automatically detect VS Code and guide you through extension installation. Alternatively, you can manually install the &lt;code&gt;claude-code.vsix&lt;/code&gt; file from your installation directory.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Support for Alternative IDEs&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Claude Code also integrates with Cursor and other modern editors using a similar process—start Claude Code from the editor's terminal and use the &lt;code&gt;/ide&lt;/code&gt; command to enable integration.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Troubleshooting: Solving Common Setup Challenges&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Permission Errors&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use the local installation method: &lt;code&gt;claude migrate-installer&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Never use &lt;code&gt;sudo&lt;/code&gt; with npm installation&lt;/li&gt;
&lt;li&gt;Configure npm permissions properly for your user account&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Windows Compatibility Issues&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Prioritize WSL for the best experience&lt;/li&gt;
&lt;li&gt;Ensure Git for Windows is properly installed for native usage&lt;/li&gt;
&lt;li&gt;Configure the correct Git Bash path for portable installations&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Authentication Problems&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Run &lt;code&gt;claude doctor&lt;/code&gt; to diagnose authentication status&lt;/li&gt;
&lt;li&gt;Re-authenticate using &lt;code&gt;claude /login&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Verify you're accessing Claude Code from a supported geographic region&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;PATH Configuration Issues&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Add Claude to your PATH following the post-installation instructions&lt;/li&gt;
&lt;li&gt;Remove outdated aliases or symlinks that might conflict&lt;/li&gt;
&lt;li&gt;Restart your terminal session after PATH modifications&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Beyond Setup: What Comes Next&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;With Claude Code properly installed and configured, you're positioned to leverage one of the most sophisticated AI development tools available today. The setup process we've covered here creates the foundation for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multi-file debugging and refactoring&lt;/strong&gt; across complex codebases&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Intelligent code generation&lt;/strong&gt; that understands your project's patterns&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automated testing and documentation&lt;/strong&gt; that stays in sync with your code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Architecture-aware suggestions&lt;/strong&gt; that respect your existing design decisions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Investment in Your Development Future&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Setting up Claude Code properly isn't just about getting a tool running—it's about establishing a development workflow that can adapt and scale with your projects. The time invested in understanding authentication options, configuring environment variables, and creating comprehensive project context pays dividends in every subsequent coding session.&lt;/p&gt;

&lt;p&gt;Whether you're building your next startup, contributing to open source, or tackling enterprise-scale applications, Claude Code's CLI interface provides a consistent, powerful foundation for AI-assisted development.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your development environment is ready. Your AI coding partner is waiting. The only question remaining is: what will you build first?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Ready to take your development workflow to the next level? With Claude Code properly configured, you're just one &lt;code&gt;claude&lt;/code&gt; command away from experiencing the future of software development.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claudeai</category>
      <category>claudecode</category>
      <category>codingagent</category>
      <category>aicode</category>
    </item>
    <item>
      <title>Generate Full Stack React Native Expo project in Seconds ⌚🚀</title>
      <dc:creator>Shahid</dc:creator>
      <pubDate>Thu, 17 Jul 2025 07:46:32 +0000</pubDate>
      <link>https://dev.to/shahidkhans/generate-full-stack-react-native-expo-project-in-seconds-180n</link>
      <guid>https://dev.to/shahidkhans/generate-full-stack-react-native-expo-project-in-seconds-180n</guid>
      <description>&lt;h2&gt;
  
  
  Generate Full Stack React Native project in Seconds.
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Run the below command and get relax
&lt;code&gt;
npx rn-new@latest rn-nw-rnr2 --react-navigation --nativewind --npm --i18next&amp;nbsp; --firebase --drawer --tabs --import-alias --no-install
&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>reactnative</category>
      <category>expo</category>
      <category>mobile</category>
    </item>
    <item>
      <title>Ready-made React &amp; Next.js blocks, Framer Motion FX</title>
      <dc:creator>Shahid</dc:creator>
      <pubDate>Thu, 17 Jul 2025 07:28:15 +0000</pubDate>
      <link>https://dev.to/shahidkhans/ready-made-react-nextjs-blocks-framer-motion-fx-22ig</link>
      <guid>https://dev.to/shahidkhans/ready-made-react-nextjs-blocks-framer-motion-fx-22ig</guid>
      <description>&lt;p&gt;Elevate your next project with a curated suite of minimalist, production-ready UI components crafted in Tailwind CSS, React, and Next.js. Copy-and-paste landing pages, portfolios, and full-stack templates—complete with seamless Supabase integration—let you launch in minutes. Built-in Framer Motion animations, mobile-first responsiveness, and WCAG-focused accessibility ensure every site looks polished and performs flawlessly. Ship professional, scalable web experiences faster than ever.&lt;br&gt;
Visit &lt;a href="https://skiper-ui.com/" rel="noopener noreferrer"&gt;https://skiper-ui.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tailwindcss</category>
      <category>nextjs</category>
      <category>react</category>
      <category>shadcn</category>
    </item>
    <item>
      <title>A Practical Guide to Gemini CLI</title>
      <dc:creator>Shahid</dc:creator>
      <pubDate>Sun, 06 Jul 2025 05:16:08 +0000</pubDate>
      <link>https://dev.to/shahidkhans/a-practical-guide-to-gemini-cli-941</link>
      <guid>https://dev.to/shahidkhans/a-practical-guide-to-gemini-cli-941</guid>
      <description>&lt;h2&gt;
  
  
  Advanced Usage Examples for Gemini CLI
&lt;/h2&gt;

&lt;p&gt;Gemini CLI is a powerful AI assistant for developers, but its true potential shines when you leverage its advanced features and workflow integrations. Here are practical, effective usage examples to help you get more out of Gemini CLI:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Deep Codebase Exploration and Summarization&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Summarize architecture and module roles:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "@./ Summarize the architecture and main modules of this project"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Explain a specific function or file:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "@src/utils/helpers.js Explain the purpose and logic of this file"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Map data flows or dependencies:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "@src/ @lib/ Map the data flow between these directories"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. &lt;strong&gt;Automated Bug Detection and Fixing&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Analyze and fix a GitHub issue:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "@search https://github.com/yourrepo/issues/123 Analyze this issue and suggest a fix plan"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Detect and fix bugs in a directory:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "@src/ Scan for common bugs and suggest fixes"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Apply suggested code changes:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Gemini will preview diffs and ask for your approval before applying edits[1].&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Test Generation and Coverage Analysis&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Generate unit tests for a file:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "@src/components/Button.jsx Generate unit tests for this component"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Review and improve test coverage:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "@src/ @tests/ Analyze and suggest improvements for test coverage"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Create integration tests:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "@api/ Generate integration tests for all endpoints"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. &lt;strong&gt;Documentation and Reporting&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Generate markdown documentation:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "@src/ Generate markdown documentation for all exported functions"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Summarize recent changes as a changelog:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "Summarize all codebase changes today in changelog format"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Save documentation to a file:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "Save this summary as docs/CHANGELOG.md"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. &lt;strong&gt;Workflow Automation and Integration&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Automate code review in CI/CD:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add to your pre-commit hook:
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
gemini review &lt;span class="nt"&gt;--staged-files&lt;/span&gt; &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;checklist
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Generate docs during build:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  gemini docs &lt;span class="nt"&gt;--input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;src/ &lt;span class="nt"&gt;--output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;docs/ &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;markdown
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Integrate with Makefile:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight make"&gt;&lt;code&gt;  &lt;span class="nl"&gt;review&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
    gemini review &lt;span class="nt"&gt;--files&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;$(&lt;/span&gt;&lt;span class="s2"&gt;FILES&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--severity&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;medium
  &lt;span class="nl"&gt;docs&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
    gemini docs &lt;span class="nt"&gt;--auto-update&lt;/span&gt; &lt;span class="nt"&gt;--watch&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6. &lt;strong&gt;Shell and System Commands&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Run shell commands directly:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  !ls -al
  !npm test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Search for text within files:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "Find all TODO comments in the codebase"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  7. &lt;strong&gt;Project Customization and Memory&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Define project rules and context in &lt;code&gt;GEMINI.md&lt;/code&gt;:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;  # Project: E-commerce Platform
  ## Context
&lt;span class="p"&gt;  -&lt;/span&gt; React frontend, Node.js backend, MongoDB
  ## Standards
&lt;span class="p"&gt;  -&lt;/span&gt; Use functional components
&lt;span class="p"&gt;  -&lt;/span&gt; Follow REST API conventions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Store preferences for consistent AI responses:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "Remember: always use async/await in this project"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  8. &lt;strong&gt;Real-Time Web Search and Research&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ground prompts with live web data:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "@search What are the latest security best practices for Node.js?"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fetch and analyze external data:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "@web-fetch https://api.example.com/data Analyze this API response"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  9. &lt;strong&gt;Multi-Agent and MCP Integration&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Extend Gemini CLI with custom tools via MCP:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Configure &lt;code&gt;.gemini/settings.json&lt;/code&gt; to add new abilities (e.g., GitHub integration, image generation)[1][2].&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Interact with external APIs or services:&lt;/strong&gt;
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini -p "Use the GitHub MCP tool to list all open pull requests"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  10. &lt;strong&gt;Batch Jobs and Non-Interactive Mode&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Automate repetitive tasks:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  gemini --all_files -p "Refactor all functions to use ES6 syntax"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Run in CI/CD pipelines for automated analysis and reporting[3]:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  gemini review &lt;span class="nt"&gt;--all_files&lt;/span&gt; &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;summary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Table: Gemini CLI Built-in Tools Overview
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Command Example&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ReadFolder&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ls&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;List files/folders in a directory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ReadFile&lt;/td&gt;
&lt;td&gt;&lt;code&gt;read-file&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Read content of a single file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ReadManyFiles&lt;/td&gt;
&lt;td&gt;&lt;code&gt;read-many-files&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Read multiple files at once&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FindFiles&lt;/td&gt;
&lt;td&gt;&lt;code&gt;glob&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Search files by pattern&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SearchText&lt;/td&gt;
&lt;td&gt;&lt;code&gt;grep&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Search for text within files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Edit&lt;/td&gt;
&lt;td&gt;&lt;code&gt;edit&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Apply code changes via diffs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WriteFile&lt;/td&gt;
&lt;td&gt;&lt;code&gt;write-file&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Create new files with content&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shell&lt;/td&gt;
&lt;td&gt;&lt;code&gt;!npm test&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Run shell/system commands&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WebFetch&lt;/td&gt;
&lt;td&gt;&lt;code&gt;web-fetch&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fetch and analyze web content&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GoogleSearch&lt;/td&gt;
&lt;td&gt;&lt;code&gt;web-search&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Perform Google search for real-time info&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SaveMemory&lt;/td&gt;
&lt;td&gt;&lt;code&gt;memoryTool&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Store facts/preferences for session&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Tips for Effective Use
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use the &lt;code&gt;@&lt;/code&gt; syntax to reference files or directories for context-aware prompts.&lt;/li&gt;
&lt;li&gt;Leverage the 1 million token context window for large projects.&lt;/li&gt;
&lt;li&gt;Integrate Gemini CLI into your scripts, CI/CD, and editor workflows for automation and consistency.&lt;/li&gt;
&lt;li&gt;Customize project behavior with &lt;code&gt;GEMINI.md&lt;/code&gt; and settings files for tailored AI responses[1][2][4].&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By combining these advanced examples and integrations, you can unlock the full power of Gemini CLI for code analysis, automation, documentation, and workflow optimization[1][2][4][3].&lt;/p&gt;

&lt;p&gt;[1] &lt;a href="https://www.datacamp.com/tutorial/gemini-cli" rel="noopener noreferrer"&gt;https://www.datacamp.com/tutorial/gemini-cli&lt;/a&gt;&lt;br&gt;
[2] &lt;a href="https://dev.to/proflead/gemini-cli-full-tutorial-2ab5"&gt;https://dev.to/proflead/gemini-cli-full-tutorial-2ab5&lt;/a&gt;&lt;br&gt;
[3] &lt;a href="https://www.infoq.com/news/2025/07/google-gemini-cli/" rel="noopener noreferrer"&gt;https://www.infoq.com/news/2025/07/google-gemini-cli/&lt;/a&gt;&lt;br&gt;
[4] &lt;a href="https://mpgone.com/how-to-use-gemini-cli-complete-guide-for-developers-and-beginners/" rel="noopener noreferrer"&gt;https://mpgone.com/how-to-use-gemini-cli-complete-guide-for-developers-and-beginners/&lt;/a&gt;&lt;br&gt;
[5] &lt;a href="https://github.com/google-gemini/gemini-cli" rel="noopener noreferrer"&gt;https://github.com/google-gemini/gemini-cli&lt;/a&gt;&lt;br&gt;
[6] &lt;a href="https://github.com/reugn/gemini-cli" rel="noopener noreferrer"&gt;https://github.com/reugn/gemini-cli&lt;/a&gt;&lt;br&gt;
[7] &lt;a href="https://buymeacoffee.com/rsahan/gemini-your-terminal-a-comprehensive-guide-using-gemini-cli" rel="noopener noreferrer"&gt;https://buymeacoffee.com/rsahan/gemini-your-terminal-a-comprehensive-guide-using-gemini-cli&lt;/a&gt;&lt;br&gt;
[8] &lt;a href="https://astconsulting.in/gemini-cli/gemini-cli-future-ai-command-lines" rel="noopener noreferrer"&gt;https://astconsulting.in/gemini-cli/gemini-cli-future-ai-command-lines&lt;/a&gt;&lt;br&gt;
[9] &lt;a href="https://www.youtube.com/watch?v=T76NbeTdDFA" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=T76NbeTdDFA&lt;/a&gt;&lt;br&gt;
[10] &lt;a href="https://dev.to/therealmrmumba/7-insane-gemini-cli-tips-that-will-make-you-a-superhuman-developer-2d7h"&gt;https://dev.to/therealmrmumba/7-insane-gemini-cli-tips-that-will-make-you-a-superhuman-developer-2d7h&lt;/a&gt;&lt;br&gt;
[11] &lt;a href="https://www.youtube.com/watch?v=VSiHh4KyK6A" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=VSiHh4KyK6A&lt;/a&gt;&lt;br&gt;
[12] &lt;a href="https://learn.netdata.cloud/docs/ai-&amp;amp;-ml/devops-copilot/gemini-cli" rel="noopener noreferrer"&gt;https://learn.netdata.cloud/docs/ai-&amp;amp;-ml/devops-copilot/gemini-cli&lt;/a&gt;&lt;br&gt;
[13] &lt;a href="https://www.youtube.com/watch?v=lEBO36eovns" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=lEBO36eovns&lt;/a&gt;&lt;br&gt;
[14] &lt;a href="https://www.youtube.com/watch?v=bMSq6ghdIYk" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=bMSq6ghdIYk&lt;/a&gt;&lt;br&gt;
[15] &lt;a href="https://cloud.google.com/gemini/docs/codeassist/gemini-cli" rel="noopener noreferrer"&gt;https://cloud.google.com/gemini/docs/codeassist/gemini-cli&lt;/a&gt;&lt;br&gt;
[16] &lt;a href="https://www.youtube.com/watch?v=CqL5kB8pOfo" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=CqL5kB8pOfo&lt;/a&gt;&lt;br&gt;
[17] &lt;a href="https://blog.google/technology/developers/introducing-gemini-cli-open-source-ai-agent/" rel="noopener noreferrer"&gt;https://blog.google/technology/developers/introducing-gemini-cli-open-source-ai-agent/&lt;/a&gt;&lt;br&gt;
[18] &lt;a href="https://www.reddit.com/r/GeminiAI/comments/1lkojt8/gemini_cli_a_comprehensive_guide_to_understanding/" rel="noopener noreferrer"&gt;https://www.reddit.com/r/GeminiAI/comments/1lkojt8/gemini_cli_a_comprehensive_guide_to_understanding/&lt;/a&gt;&lt;br&gt;
[19] &lt;a href="https://momen.app/blogs/practical-tips-for-using-gemini-cli-in-real-projects/" rel="noopener noreferrer"&gt;https://momen.app/blogs/practical-tips-for-using-gemini-cli-in-real-projects/&lt;/a&gt;&lt;br&gt;
[20] &lt;a href="https://www.youtube.com/watch?v=we2HwLyKYEg" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=we2HwLyKYEg&lt;/a&gt;&lt;br&gt;
[21] &lt;a href="https://github.com/Ramesh-tester/gemini-cli-action" rel="noopener noreferrer"&gt;https://github.com/Ramesh-tester/gemini-cli-action&lt;/a&gt;&lt;br&gt;
[22] &lt;a href="https://www.linkedin.com/pulse/drowning-pull-requests-automate-your-github-workflow-franziska-2rexe" rel="noopener noreferrer"&gt;https://www.linkedin.com/pulse/drowning-pull-requests-automate-your-github-workflow-franziska-2rexe&lt;/a&gt;&lt;br&gt;
[23] &lt;a href="https://cloud.google.com/code/docs/shell/write-code-gemini" rel="noopener noreferrer"&gt;https://cloud.google.com/code/docs/shell/write-code-gemini&lt;/a&gt;&lt;br&gt;
[24] &lt;a href="https://devops.com/gemini-cli-the-open-source-ai-agent-thats-revolutionizing-terminal-workflows/" rel="noopener noreferrer"&gt;https://devops.com/gemini-cli-the-open-source-ai-agent-thats-revolutionizing-terminal-workflows/&lt;/a&gt;&lt;br&gt;
[25] &lt;a href="https://www.marktechpost.com/2025/06/28/getting-started-with-gemini-command-line-interface-cli/" rel="noopener noreferrer"&gt;https://www.marktechpost.com/2025/06/28/getting-started-with-gemini-command-line-interface-cli/&lt;/a&gt;&lt;br&gt;
[26] &lt;a href="https://github.com/google-gemini/gemini-cli/actions/workflows/ci.yml" rel="noopener noreferrer"&gt;https://github.com/google-gemini/gemini-cli/actions/workflows/ci.yml&lt;/a&gt;&lt;br&gt;
[27] &lt;a href="https://www.linkedin.com/pulse/gemini-command-line-interface-cli-ultimate-ai-agent-lozano-grijalba-tkl2f" rel="noopener noreferrer"&gt;https://www.linkedin.com/pulse/gemini-command-line-interface-cli-ultimate-ai-agent-lozano-grijalba-tkl2f&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gemini</category>
    </item>
    <item>
      <title>Gemini CLI: The AI-Powered Command Line Revolution for Developers</title>
      <dc:creator>Shahid</dc:creator>
      <pubDate>Sun, 06 Jul 2025 05:14:29 +0000</pubDate>
      <link>https://dev.to/shahidkhans/gemini-cli-the-ai-powered-command-line-revolution-for-developers-a7e</link>
      <guid>https://dev.to/shahidkhans/gemini-cli-the-ai-powered-command-line-revolution-for-developers-a7e</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The command line has long been the developer’s home for productivity, automation, and deep code work. With the arrival of &lt;strong&gt;Gemini CLI&lt;/strong&gt;, Google’s open-source AI agent, the terminal is now supercharged with advanced AI capabilities—enabling developers to code, debug, document, and automate tasks using natural language, all from within their favorite shell environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Gemini CLI?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Gemini CLI&lt;/strong&gt; is an open-source command-line tool that brings the power of Google’s Gemini 2.5 Pro model directly to your terminal. It’s designed for developers who want AI assistance for coding, content generation, problem-solving, and workflow automation—without leaving the command line[1][2][3][4].&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;1 million token context window&lt;/strong&gt;: Analyze and understand even the largest codebases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Natural language prompts&lt;/strong&gt;: Interact with your codebase, files, and tools using plain English.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real-time web search&lt;/strong&gt;: Ground your prompts with up-to-date information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open-source extensibility&lt;/strong&gt;: Customize, inspect, and contribute to the tool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Seamless integration&lt;/strong&gt;: Works with VS Code, GitHub, and CI/CD pipelines[1][2][3][5].&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installation and Setup
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.js v18 or higher&lt;/li&gt;
&lt;li&gt;(Recommended) Python 3.8+ and git for advanced features[4][6]&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Quick Start:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Run instantly (no install):&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  npx https://github.com/google-gemini/gemini-cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Global installation:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&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;-g&lt;/span&gt; @google/gemini-cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Launch Gemini CLI:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Authentication:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authenticate with your Google account or set your API key:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GEMINI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your_api_key_here"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;API keys can be generated from Google AI Studio or Google Cloud Console[4][6].&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Using Gemini CLI in Your Codebase
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Project Initialization
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to your project directory:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;cd &lt;/span&gt;path/to/your/project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;(Optional) Initialize Gemini CLI for project-specific context:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Start the CLI:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Natural Language Prompts and File Context
&lt;/h3&gt;

&lt;p&gt;Gemini CLI uses the &lt;code&gt;@&lt;/code&gt; syntax to reference files or directories in prompts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Single file: &lt;code&gt;@src/main.py&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Directory: &lt;code&gt;@src/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Multiple: &lt;code&gt;@src/ @tests/&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example Commands:&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;Action&lt;/th&gt;
&lt;th&gt;Example Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Summarize architecture&lt;/td&gt;
&lt;td&gt;&lt;code&gt;gemini -p "@./ Summarize the architecture of this project"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Explain a file&lt;/td&gt;
&lt;td&gt;&lt;code&gt;gemini -p "@src/main.py Explain this file's purpose and structure"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Analyze dependencies&lt;/td&gt;
&lt;td&gt;&lt;code&gt;gemini -p "@package.json @src/index.js Analyze the dependencies used"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Review test coverage&lt;/td&gt;
&lt;td&gt;&lt;code&gt;gemini -p "@src/ @tests/ Analyze test coverage for the source code"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Overview of all files&lt;/td&gt;
&lt;td&gt;&lt;code&gt;gemini --all_files -p "Analyze the project structure and dependencies"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Summarize today’s changes&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;gt; Give me a summary of all of the changes made to the codebase today.&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fix a bug or issue&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;gt; Analyze this GitHub issue: [@search ] and suggest a fix plan.&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Advanced Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Editing and refactoring&lt;/strong&gt;: Request code improvements or refactoring.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bug detection and fixing&lt;/strong&gt;: Let Gemini suggest and apply fixes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test generation&lt;/strong&gt;: Auto-generate test cases for your code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documentation&lt;/strong&gt;: Generate markdown docs, changelogs, and diagrams.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search grounding&lt;/strong&gt;: Use &lt;code&gt;@search&lt;/code&gt; for real-time information retrieval[2][3][5].&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Workflow Integration and Automation
&lt;/h2&gt;

&lt;p&gt;Gemini CLI is designed to fit seamlessly into existing developer workflows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Editor/IDE Agnostic&lt;/strong&gt;: Use in any terminal, or integrate with VS Code, IntelliJ, Vim, and more[5].&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Git Hooks&lt;/strong&gt;: Automate code reviews or documentation generation on commit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build Scripts &amp;amp; Makefiles&lt;/strong&gt;: Add AI-powered steps to your build and deployment pipelines.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI/CD Integration&lt;/strong&gt;: Run Gemini CLI in non-interactive mode for automated code analysis and reporting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom Extensions&lt;/strong&gt;: Build and share your own plugins for linting, testing, migration, and security[5][7].&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example: Git Pre-commit Hook&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
gemini review &lt;span class="nt"&gt;--staged-files&lt;/span&gt; &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;checklist
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gemini docs &lt;span class="nt"&gt;--input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;src/ &lt;span class="nt"&gt;--output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;docs/ &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;markdown
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Real-World Use Cases
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Codebase Exploration&lt;/strong&gt;: Instantly summarize architecture, module roles, and data flows in large projects[2][8].&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bug Audits&lt;/strong&gt;: Analyze folders of scripts, detect bugs, and receive step-by-step fix plans[8].&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pull Request Management&lt;/strong&gt;: Scan and auto-close spam PRs, or generate review checklists[9].&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-step Workflows&lt;/strong&gt;: Chain prompts to generate code, tests, docs, and push to GitHub in one go[9].&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Testing&lt;/strong&gt;: Connect to Postman or Swagger files for automated API validation[10].&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Community and Extensibility
&lt;/h2&gt;

&lt;p&gt;Gemini CLI is fully open source (Apache 2.0). Developers can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inspect and modify the code for security and transparency.&lt;/li&gt;
&lt;li&gt;Contribute features, bug fixes, and extensions.&lt;/li&gt;
&lt;li&gt;Share workflow templates and integration patterns with the community[1][11][7].&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Best Practices
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;gemini init&lt;/code&gt; to set up project-specific configuration (e.g., &lt;code&gt;GEMINI.md&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Reference directories or use &lt;code&gt;--all_files&lt;/code&gt; for large projects.&lt;/li&gt;
&lt;li&gt;Leverage the 1 million token context window for deep code analysis.&lt;/li&gt;
&lt;li&gt;Automate repetitive tasks with scripts and hooks.&lt;/li&gt;
&lt;li&gt;Stay updated with community extensions and best practices[5][11][7].&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🎁 Want to use Gemini CLI in more advanced way read the below article
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://dev.to/shahidkhans/a-practical-guide-to-gemini-cli-941"&gt;Practical Guide to Gemini CLI&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Gemini CLI&lt;/strong&gt; is redefining what’s possible in the terminal. By combining the power of Google’s Gemini AI with the flexibility of the command line, developers can now code, debug, document, and automate with unprecedented speed and intelligence. Whether you’re working solo or as part of a team, Gemini CLI is a must-have tool for the modern developer’s workflow[1][2][3][4][5][11].&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For more details, visit the official Gemini CLI documentation and GitHub repository.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;[1] &lt;a href="https://blog.google/technology/developers/introducing-gemini-cli-open-source-ai-agent/" rel="noopener noreferrer"&gt;https://blog.google/technology/developers/introducing-gemini-cli-open-source-ai-agent/&lt;/a&gt;&lt;br&gt;
[2] &lt;a href="https://www.datacamp.com/tutorial/gemini-cli" rel="noopener noreferrer"&gt;https://www.datacamp.com/tutorial/gemini-cli&lt;/a&gt;&lt;br&gt;
[3] &lt;a href="https://www.infoq.com/news/2025/07/google-gemini-cli/" rel="noopener noreferrer"&gt;https://www.infoq.com/news/2025/07/google-gemini-cli/&lt;/a&gt;&lt;br&gt;
[4] &lt;a href="https://www.f22labs.com/blogs/what-is-google-gemini-cli-how-to-install-and-use-it/" rel="noopener noreferrer"&gt;https://www.f22labs.com/blogs/what-is-google-gemini-cli-how-to-install-and-use-it/&lt;/a&gt;&lt;br&gt;
[5] &lt;a href="https://mpgone.com/how-to-use-gemini-cli-complete-guide-for-developers-and-beginners/" rel="noopener noreferrer"&gt;https://mpgone.com/how-to-use-gemini-cli-complete-guide-for-developers-and-beginners/&lt;/a&gt;&lt;br&gt;
[6] &lt;a href="https://dev.to/auden/google-gemini-cli-tutorial-how-to-install-and-use-it-with-images-4phb"&gt;https://dev.to/auden/google-gemini-cli-tutorial-how-to-install-and-use-it-with-images-4phb&lt;/a&gt;&lt;br&gt;
[7] &lt;a href="https://topmostads.com/google-gemini-cli-free-open-source-guide/" rel="noopener noreferrer"&gt;https://topmostads.com/google-gemini-cli-free-open-source-guide/&lt;/a&gt;&lt;br&gt;
[8] &lt;a href="https://javascript.plainenglish.io/i-tried-googles-gemini-cli-and-it-changed-how-i-code-forever-4794d3c02081" rel="noopener noreferrer"&gt;https://javascript.plainenglish.io/i-tried-googles-gemini-cli-and-it-changed-how-i-code-forever-4794d3c02081&lt;/a&gt;&lt;br&gt;
[9] &lt;a href="https://dev.to/therealmrmumba/7-insane-gemini-cli-tips-that-will-make-you-a-superhuman-developer-2d7h"&gt;https://dev.to/therealmrmumba/7-insane-gemini-cli-tips-that-will-make-you-a-superhuman-developer-2d7h&lt;/a&gt;&lt;br&gt;
[10] &lt;a href="https://momen.app/blogs/practical-tips-for-using-gemini-cli-in-real-projects/" rel="noopener noreferrer"&gt;https://momen.app/blogs/practical-tips-for-using-gemini-cli-in-real-projects/&lt;/a&gt;&lt;br&gt;
[11] &lt;a href="https://devops.com/gemini-cli-the-open-source-ai-agent-thats-revolutionizing-terminal-workflows/" rel="noopener noreferrer"&gt;https://devops.com/gemini-cli-the-open-source-ai-agent-thats-revolutionizing-terminal-workflows/&lt;/a&gt;&lt;br&gt;
[12] &lt;a href="https://www.zdnet.com/article/geminis-command-line-tool-is-a-hidden-productivity-game-changer-and-its-free/" rel="noopener noreferrer"&gt;https://www.zdnet.com/article/geminis-command-line-tool-is-a-hidden-productivity-game-changer-and-its-free/&lt;/a&gt;&lt;br&gt;
[13] &lt;a href="https://github.com/google-gemini/gemini-cli" rel="noopener noreferrer"&gt;https://github.com/google-gemini/gemini-cli&lt;/a&gt;&lt;br&gt;
[14] &lt;a href="https://cloud.google.com/gemini/docs/codeassist/gemini-cli" rel="noopener noreferrer"&gt;https://cloud.google.com/gemini/docs/codeassist/gemini-cli&lt;/a&gt;&lt;br&gt;
[15] &lt;a href="https://dev.to/proflead/gemini-cli-full-tutorial-2ab5"&gt;https://dev.to/proflead/gemini-cli-full-tutorial-2ab5&lt;/a&gt;&lt;br&gt;
[16] &lt;a href="https://www.youtube.com/watch?v=KUCZe1xBKFM" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=KUCZe1xBKFM&lt;/a&gt;&lt;br&gt;
[17] &lt;a href="https://hackernoon.com/complete-gemini-cli-setup-guide-for-your-terminal" rel="noopener noreferrer"&gt;https://hackernoon.com/complete-gemini-cli-setup-guide-for-your-terminal&lt;/a&gt;&lt;br&gt;
[18] &lt;a href="https://simonwillison.net/2025/Jun/25/gemini-cli/" rel="noopener noreferrer"&gt;https://simonwillison.net/2025/Jun/25/gemini-cli/&lt;/a&gt;&lt;br&gt;
[19] &lt;a href="https://cloud.google.com/gemini/docs/discover/write-prompts" rel="noopener noreferrer"&gt;https://cloud.google.com/gemini/docs/discover/write-prompts&lt;/a&gt;&lt;br&gt;
[20] &lt;a href="https://ikala.ai/blog/ai-trends/google-gemini-cli-in-depth-analysis-the-ai-agent-ecosystem-war-for-the-developer-terminal/" rel="noopener noreferrer"&gt;https://ikala.ai/blog/ai-trends/google-gemini-cli-in-depth-analysis-the-ai-agent-ecosystem-war-for-the-developer-terminal/&lt;/a&gt;&lt;br&gt;
[21] &lt;a href="https://geminicli.tech" rel="noopener noreferrer"&gt;https://geminicli.tech&lt;/a&gt;&lt;br&gt;
[22] &lt;a href="https://www.reddit.com/r/GeminiAI/comments/1lkojt8/gemini_cli_a_comprehensive_guide_to_understanding/" rel="noopener noreferrer"&gt;https://www.reddit.com/r/GeminiAI/comments/1lkojt8/gemini_cli_a_comprehensive_guide_to_understanding/&lt;/a&gt;&lt;br&gt;
[23] &lt;a href="https://www.youtube.com/watch?v=CqL5kB8pOfo" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=CqL5kB8pOfo&lt;/a&gt;&lt;br&gt;
[24] &lt;a href="https://www.youtube.com/watch?v=we2HwLyKYEg" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=we2HwLyKYEg&lt;/a&gt;&lt;br&gt;
[25] &lt;a href="https://github.com/google-gemini/gemini-cli/issues/3088/linked_closing_reference" rel="noopener noreferrer"&gt;https://github.com/google-gemini/gemini-cli/issues/3088/linked_closing_reference&lt;/a&gt;&lt;br&gt;
[26] &lt;a href="https://www.linkedin.com/pulse/evaluating-google-gemini-cli-my-developer-experience-majid-sheikh-og51f" rel="noopener noreferrer"&gt;https://www.linkedin.com/pulse/evaluating-google-gemini-cli-my-developer-experience-majid-sheikh-og51f&lt;/a&gt;&lt;br&gt;
[27] &lt;a href="https://www.reddit.com/r/singularity/comments/1lk5h19/google_introduces_gemini_cli_a_light_opensource/" rel="noopener noreferrer"&gt;https://www.reddit.com/r/singularity/comments/1lk5h19/google_introduces_gemini_cli_a_light_opensource/&lt;/a&gt;&lt;br&gt;
[28] &lt;a href="https://www.linkedin.com/pulse/gemini-cli-future-coding-now-mr-parvez-mosharaf-dfz0c" rel="noopener noreferrer"&gt;https://www.linkedin.com/pulse/gemini-cli-future-coding-now-mr-parvez-mosharaf-dfz0c&lt;/a&gt;&lt;br&gt;
[29] &lt;a href="https://github.com/google-gemini/gemini-cli/issues/2779" rel="noopener noreferrer"&gt;https://github.com/google-gemini/gemini-cli/issues/2779&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gemini</category>
      <category>vibecoding</category>
    </item>
    <item>
      <title>open-source animated components for Tailwind and Shadcn</title>
      <dc:creator>Shahid</dc:creator>
      <pubDate>Fri, 27 Jun 2025 05:34:22 +0000</pubDate>
      <link>https://dev.to/shahidkhans/open-source-animated-components-for-tailwind-and-shadcn-10of</link>
      <guid>https://dev.to/shahidkhans/open-source-animated-components-for-tailwind-and-shadcn-10of</guid>
      <description>&lt;p&gt;open-source component Animation library built with React, TypeScript, Tailwind CSS, Motion and Shadcn CLI&lt;br&gt;
&lt;a href="https://animate-ui.com/" rel="noopener noreferrer"&gt;https://animate-ui.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F28zplydofpeecmlerm7b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F28zplydofpeecmlerm7b.png" alt="animate-ui " width="800" height="711"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tailwindcss</category>
      <category>shadcn</category>
      <category>webanimation</category>
    </item>
    <item>
      <title>Setting Up Row-Level Security in Supabase User and Admin Roles</title>
      <dc:creator>Shahid</dc:creator>
      <pubDate>Mon, 26 May 2025 17:53:41 +0000</pubDate>
      <link>https://dev.to/shahidkhans/setting-up-row-level-security-in-supabase-user-and-admin-2ac1</link>
      <guid>https://dev.to/shahidkhans/setting-up-row-level-security-in-supabase-user-and-admin-2ac1</guid>
      <description>&lt;p&gt;Row-Level Security (RLS) in Supabase is a powerful feature that allows you to control access to your database tables at the row level, ensuring users can only access or modify data they’re authorized to. In this post, we’ll walk through setting up RLS on a &lt;code&gt;profiles&lt;/code&gt; table in Supabase, where authenticated users can view and edit their own profiles, and admins can view and edit all profiles. Let’s dive in!&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A Supabase project with authentication enabled.&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;profiles&lt;/code&gt; table in the &lt;code&gt;public&lt;/code&gt; schema with the following columns:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;id&lt;/code&gt; (UUID, references &lt;code&gt;auth.users(id)&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;is_admin&lt;/code&gt; (boolean, indicates admin status).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Basic familiarity with SQL and Supabase’s dashboard or SQL Editor.&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Enable RLS on the Profiles Table
&lt;/h2&gt;

&lt;p&gt;First, we need to enable RLS on the &lt;code&gt;profiles&lt;/code&gt; table to enforce access control. Without RLS, users could access all rows, which we want to avoid. Run the following SQL command in the Supabase SQL Editor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profiles&lt;/span&gt; &lt;span class="n"&gt;ENABLE&lt;/span&gt; &lt;span class="k"&gt;ROW&lt;/span&gt; &lt;span class="k"&gt;LEVEL&lt;/span&gt; &lt;span class="k"&gt;SECURITY&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ensures that no one can access the table unless we define explicit RLS policies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Define RLS Policies
&lt;/h2&gt;

&lt;p&gt;We’ll create four RLS policies to achieve our goal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allow authenticated users to view their own profile.&lt;/li&gt;
&lt;li&gt;Allow authenticated users to edit their own profile.&lt;/li&gt;
&lt;li&gt;Allow admins to view all profiles.&lt;/li&gt;
&lt;li&gt;Allow admins to edit all profiles.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Policy 1: Authenticated Users View Their Own Profile
&lt;/h3&gt;

&lt;p&gt;This policy allows logged-in users to view their own profile by matching their &lt;code&gt;auth.uid()&lt;/code&gt; (the user’s ID from Supabase Auth) with the &lt;code&gt;id&lt;/code&gt; column in the &lt;code&gt;profiles&lt;/code&gt; table.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;POLICY&lt;/span&gt; &lt;span class="nv"&gt;"Authenticated users can view their own profile"&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profiles&lt;/span&gt;
&lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt;
&lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;authenticated&lt;/span&gt;
&lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it does&lt;/strong&gt;: Only allows &lt;code&gt;SELECT&lt;/code&gt; queries for rows where the authenticated user’s ID matches the &lt;code&gt;id&lt;/code&gt; column.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Who it applies to&lt;/strong&gt;: Users with the &lt;code&gt;authenticated&lt;/code&gt; role (logged-in users).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Policy 2: Authenticated Users Edit Their Own Profile
&lt;/h3&gt;

&lt;p&gt;This policy allows users to update their own profile, again by matching &lt;code&gt;auth.uid()&lt;/code&gt; with the &lt;code&gt;id&lt;/code&gt; column.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;POLICY&lt;/span&gt; &lt;span class="nv"&gt;"Authenticated users can edit their own profile"&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profiles&lt;/span&gt;
&lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;UPDATE&lt;/span&gt;
&lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;authenticated&lt;/span&gt;
&lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it does&lt;/strong&gt;: Permits &lt;code&gt;UPDATE&lt;/code&gt; queries only on the user’s own profile row.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Who it applies to&lt;/strong&gt;: Authenticated users.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Policy 3 &amp;amp; 4: Admins View and Edit All Profiles
&lt;/h3&gt;

&lt;p&gt;Initially, you might write admin policies by checking the &lt;code&gt;is_admin&lt;/code&gt; column directly in the &lt;code&gt;profiles&lt;/code&gt; table, like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;POLICY&lt;/span&gt; &lt;span class="nv"&gt;"Admins can view all profiles"&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profiles&lt;/span&gt;
&lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt;
&lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;authenticated&lt;/span&gt;
&lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;is_admin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;POLICY&lt;/span&gt; &lt;span class="nv"&gt;"Admins can edit all profiles"&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profiles&lt;/span&gt;
&lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;UPDATE&lt;/span&gt;
&lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;authenticated&lt;/span&gt;
&lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;is_admin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, this approach requires Supabase to check the &lt;code&gt;is_admin&lt;/code&gt; column for the user’s own row, which can be inefficient, especially for large tables. Instead, we’ll use a &lt;strong&gt;security definer function&lt;/strong&gt; to optimize the admin check.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Create a Security Definer Function
&lt;/h2&gt;

&lt;p&gt;To improve performance and maintainability, let’s create a function that checks if a user is an admin by querying their &lt;code&gt;is_admin&lt;/code&gt; status. This avoids repetitive table scans in policies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;OR&lt;/span&gt; &lt;span class="k"&gt;REPLACE&lt;/span&gt; &lt;span class="k"&gt;FUNCTION&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_admin_user&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="n"&gt;UUID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;RETURNS&lt;/span&gt; &lt;span class="nb"&gt;BOOLEAN&lt;/span&gt;
&lt;span class="k"&gt;LANGUAGE&lt;/span&gt; &lt;span class="n"&gt;plpgsql&lt;/span&gt;
&lt;span class="k"&gt;SECURITY&lt;/span&gt; &lt;span class="k"&gt;DEFINER&lt;/span&gt;
&lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="err"&gt;$$&lt;/span&gt;
&lt;span class="k"&gt;DECLARE&lt;/span&gt;
  &lt;span class="n"&gt;is_admin&lt;/span&gt; &lt;span class="nb"&gt;BOOLEAN&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;BEGIN&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;profiles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_admin&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;is_admin&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profiles&lt;/span&gt;
  &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;profiles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;RETURN&lt;/span&gt; &lt;span class="n"&gt;is_admin&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;END&lt;/span&gt;&lt;span class="p"&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;ul&gt;
&lt;li&gt;
&lt;strong&gt;Why use &lt;code&gt;SECURITY DEFINER&lt;/code&gt;?&lt;/strong&gt; It runs with the privileges of the function’s creator, bypassing RLS for the internal query, making it more efficient.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What it does&lt;/strong&gt;: Takes a user ID, checks their &lt;code&gt;is_admin&lt;/code&gt; status in the &lt;code&gt;profiles&lt;/code&gt; table, and returns &lt;code&gt;true&lt;/code&gt; if they’re an admin, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, let’s update the admin policies to use this function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Drop existing admin policies if they exist&lt;/span&gt;
&lt;span class="k"&gt;DROP&lt;/span&gt; &lt;span class="n"&gt;POLICY&lt;/span&gt; &lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="nv"&gt;"Admins can view all profiles"&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profiles&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;DROP&lt;/span&gt; &lt;span class="n"&gt;POLICY&lt;/span&gt; &lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="nv"&gt;"Admins can edit all profiles"&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profiles&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Create new admin policies using the function&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;POLICY&lt;/span&gt; &lt;span class="nv"&gt;"Admins can view all profiles"&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profiles&lt;/span&gt;
&lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt;
&lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;authenticated&lt;/span&gt;
&lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_admin_user&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;()));&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;POLICY&lt;/span&gt; &lt;span class="nv"&gt;"Admins can edit all profiles"&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profiles&lt;/span&gt;
&lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;UPDATE&lt;/span&gt;
&lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;authenticated&lt;/span&gt;
&lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_admin_user&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;()));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These policies allow users identified as admins (via the &lt;code&gt;is_admin_user&lt;/code&gt; function) to view or edit all profiles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Auto-Create Profiles for New Users
&lt;/h2&gt;

&lt;p&gt;To ensure every user has a profile (and avoid issues where &lt;code&gt;is_admin_user&lt;/code&gt; returns &lt;code&gt;NULL&lt;/code&gt;), create a trigger that automatically adds a profile when a new user signs up:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;OR&lt;/span&gt; &lt;span class="k"&gt;REPLACE&lt;/span&gt; &lt;span class="k"&gt;FUNCTION&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;create_profile_for_new_user&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;RETURNS&lt;/span&gt; &lt;span class="k"&gt;TRIGGER&lt;/span&gt;
&lt;span class="k"&gt;LANGUAGE&lt;/span&gt; &lt;span class="n"&gt;plpgsql&lt;/span&gt;
&lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="err"&gt;$$&lt;/span&gt;
&lt;span class="k"&gt;BEGIN&lt;/span&gt;
  &lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profiles&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;is_admin&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;NEW&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;FALSE&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;NEW&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;END&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt;$$&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TRIGGER&lt;/span&gt; &lt;span class="n"&gt;on_auth_user_created&lt;/span&gt;
&lt;span class="k"&gt;AFTER&lt;/span&gt; &lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;
&lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;EACH&lt;/span&gt; &lt;span class="k"&gt;ROW&lt;/span&gt;
&lt;span class="k"&gt;EXECUTE&lt;/span&gt; &lt;span class="k"&gt;FUNCTION&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;create_profile_for_new_user&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This sets &lt;code&gt;is_admin&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; by default for new users, ensuring the &lt;code&gt;profiles&lt;/code&gt; table is populated.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Testing the Policies
&lt;/h2&gt;

&lt;p&gt;To verify everything works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Test as a Regular User&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log in as a non-admin user (&lt;code&gt;is_admin = false&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Run a query like &lt;code&gt;SELECT * FROM profiles&lt;/code&gt; using the Supabase client:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;supabase&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;profiles&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;select&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&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;/code&gt;&lt;/pre&gt;


&lt;p&gt;This should return only the user’s own profile.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Try updating another user’s profile (e.g., &lt;code&gt;UPDATE profiles SET ... WHERE id = 'other_user_id'&lt;/code&gt;). It should fail.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Test as an Admin&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log in as an admin (&lt;code&gt;is_admin = true&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Run the same &lt;code&gt;SELECT&lt;/code&gt; query to confirm access to all profiles.&lt;/li&gt;
&lt;li&gt;Test an &lt;code&gt;UPDATE&lt;/code&gt; on any profile; it should succeed.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Use the SQL Editor&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simulate a user with &lt;code&gt;call auth.login_as_user('user_email')&lt;/code&gt; and test queries directly.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Troubleshooting Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No Data Returned&lt;/strong&gt;: Ensure &lt;code&gt;auth.uid()&lt;/code&gt; matches the &lt;code&gt;id&lt;/code&gt; column and that the user has a profile. Check if RLS is enabled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permission Errors&lt;/strong&gt;: If you see “new row violates row-level security policy,” verify the policy conditions and the user’s authentication status.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance Issues&lt;/strong&gt;: The &lt;code&gt;is_admin_user&lt;/code&gt; function reduces overhead, but ensure the &lt;code&gt;id&lt;/code&gt; column is indexed (it is by default if it’s the primary key).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Missing Profiles&lt;/strong&gt;: If a user lacks a profile row, the &lt;code&gt;is_admin_user&lt;/code&gt; function returns &lt;code&gt;NULL&lt;/code&gt;. The trigger above prevents this, but double-check for existing users.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Additional Considerations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;INSERT and DELETE Policies&lt;/strong&gt;: If your app allows profile creation or deletion, add policies for &lt;code&gt;INSERT&lt;/code&gt; and &lt;code&gt;DELETE&lt;/code&gt;. For example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;  &lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;POLICY&lt;/span&gt; &lt;span class="nv"&gt;"Users can create their own profile"&lt;/span&gt;
  &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profiles&lt;/span&gt;
  &lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;INSERT&lt;/span&gt;
  &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;authenticated&lt;/span&gt;
  &lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="k"&gt;CHECK&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Service Role for Admin Tasks&lt;/strong&gt;: Use the &lt;code&gt;service_role&lt;/code&gt; key for server-side operations that need to bypass RLS, but keep it secure and never expose it client-side.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt;: For large tables, monitor query performance. The &lt;code&gt;is_admin_user&lt;/code&gt; function is optimized, but consider caching admin status if needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;With these RLS policies and the &lt;code&gt;is_admin_user&lt;/code&gt; function, you’ve set up a secure and scalable access control system for your &lt;code&gt;profiles&lt;/code&gt; table in Supabase. Authenticated users can manage their own profiles, while admins have full access to all profiles. Always test thoroughly in a development environment before going live, and consult the &lt;a href="https://supabase.com/docs/guides/auth/row-level-security" rel="noopener noreferrer"&gt;Supabase RLS documentation&lt;/a&gt; for more details.&lt;/p&gt;

&lt;p&gt;Happy coding and let me know in the comments if you have questions or run into issues. I am running supabase self-hosted version. Contact for any paid setup &amp;amp; consulting work!&lt;/p&gt;

</description>
      <category>supabase</category>
    </item>
    <item>
      <title>Shadcn/UI Marketing Blocks</title>
      <dc:creator>Shahid</dc:creator>
      <pubDate>Wed, 05 Mar 2025 09:08:38 +0000</pubDate>
      <link>https://dev.to/shahidkhans/shadcnui-marketing-blocks-1f7l</link>
      <guid>https://dev.to/shahidkhans/shadcnui-marketing-blocks-1f7l</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/shahidkhans" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F390826%2Fd32a69a7-5c57-4c4d-99a5-4403af1e50fa.jpeg" alt="shahidkhans"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/shahidkhans/awesome-open-source-free-to-use-tailwind-css-component-5dmh" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Awesome Open-Source Free to use Tailwind / Shadcn CSS Components&lt;/h2&gt;
      &lt;h3&gt;Shahid ・ Dec 9 '24&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#tailwindcss&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#shadcn&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#nextjs&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>tailwindcss</category>
    </item>
  </channel>
</rss>
