<?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: Chris</title>
    <description>The latest articles on DEV Community by Chris (@johnsonrcl).</description>
    <link>https://dev.to/johnsonrcl</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F940563%2Fd522e52f-ac8e-4013-82f3-02a77c766cac.jpeg</url>
      <title>DEV Community: Chris</title>
      <link>https://dev.to/johnsonrcl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/johnsonrcl"/>
    <language>en</language>
    <item>
      <title>Rubber Duck Debugging: Why You Should Keep a Duck on Your Desk</title>
      <dc:creator>Chris</dc:creator>
      <pubDate>Wed, 30 Apr 2025 18:15:18 +0000</pubDate>
      <link>https://dev.to/johnsonrcl/rubber-duck-debugging-why-you-should-keep-a-duck-on-your-desk-4cap</link>
      <guid>https://dev.to/johnsonrcl/rubber-duck-debugging-why-you-should-keep-a-duck-on-your-desk-4cap</guid>
      <description>&lt;h3&gt;
  
  
  TL;DR
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Rubber duck debugging&lt;/strong&gt;—a.k.a. &lt;em&gt;rubber ducking&lt;/em&gt;—means explaining code aloud to a $2 bath toy. Speaking forces your brain to linearize the problem, surface hidden assumptions, and fix bugs faster than most IDE extensions. Try it once; you'll keep the duck.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where Rubber Duck Debugging Came From
&lt;/h2&gt;

&lt;p&gt;The practice hit developer lore via &lt;em&gt;The Pragmatic Programmer&lt;/em&gt; (1999): place a rubber duck next to your keyboard and narrate every line of code until the flaw reveals itself. It spread because it's cheap, tool-agnostic, and embarrassingly effective.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Programmers Have Rubber Ducks — and Why &lt;em&gt;You&lt;/em&gt; Should Too
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Reason&lt;/th&gt;
&lt;th&gt;What Happens in Your Brain&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Externalizes working memory&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Speaking creates a linear narrative, off-loading details that clog short-term memory.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Triggers the "self-explain" effect&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Verbalizing assumptions lights up the same error-detection circuits as a peer code review.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Zero-friction pair programming&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The duck never judges, never interrupts, and is always awake at 2 a.m.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For a deeper dive into why clear communication outperforms clever hacks, catch &lt;strong&gt;Trisha Gee&lt;/strong&gt; on &lt;em&gt;Gun.io Frontier&lt;/em&gt; → &lt;a href="https://gun.io/frontier/2019/07/episode-88-soft-skills-communication-and-programming-as-a-thinking-activity-with-trisha-gee/" rel="noopener noreferrer"&gt;Episode 88: "Soft Skills, Communication, and Programming as a Thinking Activity."&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  5-Step Rubber Duck Debug Routine &lt;em&gt;(Copy-Paste Checklist)&lt;/em&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Summarize the bug in one sentence.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State "expected vs. actual" output.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Walk the input → output path aloud, line by line.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Call out every assumption&lt;/strong&gt; (e.g., "&lt;code&gt;user_id&lt;/code&gt; is always non-null").
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log discoveries immediately&lt;/strong&gt; in your issue tracker &lt;em&gt;before&lt;/em&gt; editing code.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Skip a step and the duck's magic weakens.&lt;/p&gt;




&lt;h2&gt;
  
  
  Advanced Rubber-Ducking Variations
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Technique&lt;/th&gt;
&lt;th&gt;Best For&lt;/th&gt;
&lt;th&gt;Payoff&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Pair-Duck&lt;/strong&gt;&lt;br&gt;(two devs + duck)&lt;/td&gt;
&lt;td&gt;Race-condition sleuthing&lt;/td&gt;
&lt;td&gt;Real-time idea bounce-back&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Remote-Duck&lt;/strong&gt;&lt;br&gt;(camera-on stand-up)&lt;/td&gt;
&lt;td&gt;Distributed teams&lt;/td&gt;
&lt;td&gt;Keeps async work honest&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;AI-Duck&lt;/strong&gt;&lt;br&gt;(LLM chat &lt;em&gt;after&lt;/em&gt; talking aloud)&lt;/td&gt;
&lt;td&gt;3 a.m. solo sessions&lt;/td&gt;
&lt;td&gt;Instant doc lookup &amp;amp; code suggestions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ballmer-Peak Boost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Afternoon slump&lt;/td&gt;
&lt;td&gt;See our focus-curve deep dive: &lt;a href="https://gun.io/news/2025/04/exploring-the-ballmer-peak/" rel="noopener noreferrer"&gt;Exploring the Ballmer Peak&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;&lt;strong&gt;Short answer:&lt;/strong&gt; Yes—almost every dev who's tried it keeps coming back, because forcing code into spoken language surfaces hidden assumptions and breaks analysis paralysis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What real programmers say (sampled from a &lt;a href="https://www.reddit.com/r/learnprogramming/comments/11lfdkx/thoughts_on_rubber_ducky_debugging/" rel="noopener noreferrer"&gt;100-comment Reddit thread on r/learnprogramming&lt;/a&gt;):&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;Insight&lt;/th&gt;
&lt;th&gt;Representative takeaway&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Locks in linear thinking&lt;/td&gt;
&lt;td&gt;"Saying it out loud arranges the knowledge in a coherent way that includes all details. In your head it's easy to jump over steps."&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Exposes silent assumptions&lt;/td&gt;
&lt;td&gt;"I only rubber-duck when I'm &lt;em&gt;sure&lt;/em&gt; the code should work but doesn't. Talking through control-flow shows where my logic really breaks."&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Works with any audience—even cats&lt;/td&gt;
&lt;td&gt;Developers reported using spouses, cats, action figures, a testing goat, and Slack channels. The object doesn't matter; the forced explanation does.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Acts as 'last-resort' focus mode&lt;/td&gt;
&lt;td&gt;Many treat it as a step after logs, breakpoints, and Google searches fail—it's the mental reset that finally clicks.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Transfers to teaching &amp;amp; tutoring&lt;/td&gt;
&lt;td&gt;Ex-tutors noted that explaining concepts out loud is identical to duck-debugging: you discover the gaps only when you teach.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pairs well with sketches &amp;amp; walks&lt;/td&gt;
&lt;td&gt;Several devs combine verbalizing with drawing flows on paper or taking a short walk—anything that offloads working memory.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Anecdotal but consistent results&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the Reddit thread, &lt;em&gt;every&lt;/em&gt; commenter who had tried the technique called it "useful," "indispensable," or their "last-resort lifesaver."&lt;/li&gt;
&lt;li&gt;No one reported it making things worse—worst-case, you waste 90 seconds describing the bug and move on.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Bottom line: Rubber-ducking isn't a silver bullet, but it's the cheapest, lowest-friction cognitive dump you can do. When logs, breakpoints, and chat-GPT prompts stall, pick up the duck, start talking, and watch missing details leap out.&lt;/p&gt;




&lt;h2&gt;
  
  
  FAQ (on Rubber Duck Debugging &amp;amp; Rubber Ducking)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Q: Is whispering—or thinking silently—enough?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
No. Audible words engage motor-speech pathways that silent reading doesn't.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Can any object replace the duck?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Technically yes, but a dedicated prop cements the ritual. Ducks also add a dash of humor your brain remembers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Should teams formalize rubber duck debugging?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Absolutely. Add "Have you ducked it?" to your PR checklist and keep a bowl of ducks in the dev pit.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to Choose Your First Debug Duck
&lt;/h2&gt;

&lt;p&gt;Not all ducks are created equal. The perfect rubber duck should be:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Desk-appropriate size&lt;/strong&gt; — Big enough to see, small enough not to block your monitor&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expression matters&lt;/strong&gt; — Go for a slightly confused or curious look (mimics how you feel debugging)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Non-squeaky&lt;/strong&gt; — Unless you want to annoy your entire open-office floor&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Distinctive&lt;/strong&gt; — A themed duck (astronaut, pirate, etc.) adds personality to your debugging ritual&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Pro tip: Some developers name their ducks after legendary computer scientists. There's something satisfying about telling "Grace Hopper" about your pointer arithmetic problems.&lt;/p&gt;




&lt;h2&gt;
  
  
  Rubber Duck Debugging for Remote Teams
&lt;/h2&gt;

&lt;p&gt;As distributed teams become the norm, rubber ducking has evolved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Virtual duck backgrounds&lt;/strong&gt; for video calls signal "I'm in duck-debug mode" to teammates&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slack duck-channels&lt;/strong&gt; give remote teams a place to post their duck explanations when they need to work through problems asynchronously&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Duck-debugging sessions&lt;/strong&gt; scheduled on team calendars create space for focused debugging without interruption&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Beyond Code: Rubber Duck Problem-Solving in Other Domains
&lt;/h2&gt;

&lt;p&gt;The duck's power isn't limited to code. The same verbalization technique works for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Product specifications&lt;/strong&gt; — Talking through user stories reveals ambiguities&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Technical writing&lt;/strong&gt; — Explaining documentation aloud highlights missing steps&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Architecture planning&lt;/strong&gt; — Articulating system designs exposes edge cases&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client proposals&lt;/strong&gt; — Verbalizing deliverables catches scope creep before it happens&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even non-technical team members benefit from a desk duck for thinking through complex problems and decisions.&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting Your Team Onboard the Duck Train
&lt;/h2&gt;

&lt;p&gt;Introducing rubber duck debugging to skeptical teammates:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Start with a duck bowl&lt;/strong&gt; in common areas with a simple instructions card&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Share a quick win&lt;/strong&gt; from your own experience ("This duck saved me 3 hours yesterday")&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Duck-branded debugging&lt;/strong&gt; swag (stickers work great) normalizes the practice&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Duck retrospectives&lt;/strong&gt; where team members share what they discovered through ducking&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Remember: Like any debugging technique, the duck works best when everyone embraces it without judgment.&lt;/p&gt;




&lt;h2&gt;
  
  
  Duck Debugging Pro Tips from Gun.io's Senior Engineers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Duck rotation system&lt;/strong&gt; — Switch ducks monthly to keep the practice fresh&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Developer duck collection&lt;/strong&gt; — Different ducks for different bug types (network ducks, database ducks, etc.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pre-commit duck check&lt;/strong&gt; — Make "explain it to the duck" the last step before pushing code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Duck documentation&lt;/strong&gt; — Keep a duck-log of bugs solved to spot recurring issues&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Senior Gun.io developer Martha Chen puts it best: "My most productive debugging tool isn't my IDE or my terminal—it's my rubber duck named Alan Turing."&lt;/p&gt;




&lt;h3&gt;
  
  
  Don't Duck Your Hiring Challenges
&lt;/h3&gt;

&lt;p&gt;The last thing you should have to rubber duck is your hiring pipeline. Let us handle that for you. While your developers focus on debugging code with their trusty ducks, our talent team eliminates the need to debug your recruitment process.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://app.gun.io/sign-up/?accountType=FREELANCER" rel="noopener noreferrer"&gt;Apply to join our developer network →&lt;/a&gt;&lt;br&gt;
&lt;a href="https://app.gun.io/sign-up/?accountType=COMPANY" rel="noopener noreferrer"&gt;Hire pre-vetted (and duck-equipped) developers →&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Store Multi-Line Strings in JSON</title>
      <dc:creator>Chris</dc:creator>
      <pubDate>Wed, 23 Apr 2025 21:26:18 +0000</pubDate>
      <link>https://dev.to/johnsonrcl/how-to-store-multi-line-strings-in-json-2f00</link>
      <guid>https://dev.to/johnsonrcl/how-to-store-multi-line-strings-in-json-2f00</guid>
      <description>&lt;p&gt;JSON remains the foundation of configuration files, API payloads, and—increasingly—prompt engineering workflows. While its strict syntax ensures data portability, it also presents a challenge: raw line breaks are invalid within JSON strings. This limitation frequently affects developers working with SSH keys, certificates, SQL queries, or extensive Markdown blocks.&lt;/p&gt;

&lt;p&gt;With the rise of generative AI technologies, JSON has become even more essential, now powering:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI function calling &amp;amp; tool invocation&lt;/strong&gt; – where arguments must conform to strict JSON standards&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt-engineering frameworks&lt;/strong&gt; (LangChain, LlamaIndex) that transmit multi-line prompts and code snippets&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JSONL corpora&lt;/strong&gt; designed for fine-tuning Large Language Models&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vector-store metadata&lt;/strong&gt; where document chunks require newline-friendly formatting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This guide offers three production-ready storage techniques, best practices for AI prompts, and power tips you can immediately implement in your pipeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Multi-Line Strings Matter in the AI Era
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;AI Use-Case&lt;/th&gt;
&lt;th&gt;Why Newlines Are Critical&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Prompt templates&lt;/td&gt;
&lt;td&gt;System or user prompts frequently include code blocks and Markdown formatting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Function calling&lt;/td&gt;
&lt;td&gt;You may need to pass complete &lt;a href="https://gun.io/guest-posts/2019/07/how-to-handle-json-like-a-boss/" rel="noopener noreferrer"&gt;JSON schemas&lt;/a&gt; or SQL queries as arguments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RAG ingestion&lt;/td&gt;
&lt;td&gt;Chunked documents stored as JSONL require intact paragraph breaks for quality embeddings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fine-tuning&lt;/td&gt;
&lt;td&gt;Conversation histories in JSONL depend on newline-preserved content for training accuracy&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; Storing prompts or documents as an array of lines maintains clean training data and prevents models from hallucinating missing line breaks.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;JSON strings cannot contain literal newlines; they must be escaped&lt;/li&gt;
&lt;li&gt;The most readable approach: store each line as an array element and use &lt;code&gt;join("\n")&lt;/code&gt; at runtime&lt;/li&gt;
&lt;li&gt;Alternatives: escape &lt;code&gt;\n&lt;/code&gt; within a single long string or base64-encode the entire content&lt;/li&gt;
&lt;li&gt;Always generate JSON with a standards-compliant library—&lt;code&gt;JSON.stringify&lt;/code&gt;, &lt;code&gt;json.dumps&lt;/code&gt;, etc.—rather than manually concatenating strings&lt;/li&gt;
&lt;li&gt;Validate with JSONLint or our open-source JSON validation CLI for immediate feedback&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Stop Hand-Rolling JSON (Best Practice)
&lt;/h2&gt;


&lt;p&gt;"Use a standards-compliant JSON library instead of constructing raw strings like a monster." — every experienced engineer&lt;/p&gt;

&lt;p&gt;Manually constructing JSON through string concatenation is fragile and unsafe. Libraries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Guarantee validity (proper escaping, no stray commas)&lt;/li&gt;
&lt;li&gt;Prevent injection vulnerabilities when untrusted data is interpolated&lt;/li&gt;
&lt;li&gt;Enhance maintainability—you modify objects, not delicate text strings&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Implementation Examples
&lt;/h3&gt;

&lt;h4&gt;
  
  
  JavaScript / Node
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;promptTemplate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You are a helpful assistant.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Answer with JSON only.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;userMarkdown&lt;/span&gt; &lt;span class="c1"&gt;// multiline Markdown from the front-end&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;payload&lt;/span&gt; &lt;span class="o"&gt;=&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gpt-4o&lt;/span&gt;&lt;span class="dl"&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;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;promptTemplate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}]&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://api.openai.com/v1/chat/completions&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;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Authorization&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Bearer &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;body&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="nx"&gt;payload&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;h4&gt;
  
  
  Python
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;base64&lt;/span&gt;
&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;publicKeyB64&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;base64&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;b64encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;...pem bytes...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;indent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1. Array-of-Lines Pattern (Most Readable)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"servers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"servername.com"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"publicKey"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"-----BEGIN PUBLIC KEY-----"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0VmDBbzXdgubV/X8JP9B"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"...snip..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"-----END PUBLIC KEY-----"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At runtime:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;publicKey&lt;/span&gt; &lt;span class="o"&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;servers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;servername.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;publicKey&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt; Human-readable, diff-friendly, works with any JSON parser, no additional decode step required.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Slightly larger payload size; must remember to &lt;code&gt;join()&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Escaped Newlines (Compact but Less Readable)
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"prompt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"You are a helpful assistant.&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s2"&gt;Your job is to answer questions clearly and concisely."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Quality editors highlight &lt;code&gt;\n&lt;/code&gt; sequences, but large text blocks become difficult to compare. This format represents how your JSON will ultimately look after serialization by a standard library. Remember that you should never manually insert escape sequences yourself—always use proper serialization libraries like &lt;code&gt;JSON.stringify()&lt;/code&gt; or &lt;code&gt;json.dumps()&lt;/code&gt; to ensure correct escaping and avoid subtle bugs.&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Base64 Encoding (Required for Binary Data)
&lt;/h2&gt;


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

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Buffer&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="s2"&gt;node:buffer&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;publicKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Buffer&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="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;publicKeyB64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;base64&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;utf8&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Ideal for certificates (PEM/DER), images, or any binary content that doesn't require visual inspection.&lt;/p&gt;
&lt;h2&gt;
  
  
  Designing Prompt Schemas (Metadata-First DSL)
&lt;/h2&gt;

&lt;p&gt;Rather than delivering a single monolithic prompt string, many engineering teams now structure prompts as organized fields—effectively creating a domain-specific language (DSL) built on JSON:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"system"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"You are a helpful assistant."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"instructions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Always respond in a calm, informative tone."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"example_input"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"What is the capital of France?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"example_output"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"The capital of France is Paris."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Benefits
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Clear separation between system message, user instructions, and examples&lt;/li&gt;
&lt;li&gt;Easier to tokenize, version-control, and troubleshoot than a massive text block&lt;/li&gt;
&lt;li&gt;Compatible with OpenAI function calling and other schema-driven APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Store Prompts as Markdown → Compile to JSON
&lt;/h2&gt;

&lt;p&gt;For maximum readability with non-technical stakeholders, maintain prompts in plain Markdown (&lt;code&gt;.md&lt;/code&gt; or &lt;code&gt;.prompt&lt;/code&gt;) and compile them during your build process:&lt;/p&gt;

&lt;h3&gt;
  
  
  prompt.md
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;You are a contract-lawyer AI.

Your task is to:
&lt;span class="p"&gt;1.&lt;/span&gt; Summarize obligations
&lt;span class="p"&gt;2.&lt;/span&gt; List liabilities
&lt;span class="p"&gt;3.&lt;/span&gt; Flag deadlines
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  build.js
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;fs&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;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;prompt.md&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;utf8&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;job&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;system&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\r?\n&lt;/span&gt;&lt;span class="sr"&gt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&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;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;prompt.json&lt;/span&gt;&lt;span class="dl"&gt;"&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="nx"&gt;job&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Validation &amp;amp; Linting
&lt;/h2&gt;

&lt;p&gt;Before committing your changes, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jsonlint config.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or paste your JSON into &lt;a href="https://jsonlint.com" rel="noopener noreferrer"&gt;JSONLint&lt;/a&gt;. Both tools immediately identify stray control characters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security Considerations
&lt;/h2&gt;

&lt;p&gt;When working with multi-line strings in JSON, keep these security aspects in mind:&lt;/p&gt;

&lt;h3&gt;
  
  
  Injection Risks
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The Array-of-Lines pattern inherently provides better isolation of potentially malicious strings&lt;/li&gt;
&lt;li&gt;Always validate input before parsing to prevent JSON injection attacks&lt;/li&gt;
&lt;li&gt;For user-generated content, consider additional sanitization beyond standard JSON escaping&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Sensitive Data Handling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Avoid storing credentials directly in JSON config files, even when properly escaped&lt;/li&gt;
&lt;li&gt;For API keys and certificates, prefer environment variables or dedicated secret management services&lt;/li&gt;
&lt;li&gt;If secrets must be in JSON, implement proper access controls and consider encryption at rest&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Transmission Security
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Base64 encoding provides no security benefits on its own—it's encoding, not encryption&lt;/li&gt;
&lt;li&gt;Always use HTTPS/TLS when transmitting JSON containing sensitive multi-line data&lt;/li&gt;
&lt;li&gt;Consider field-level encryption for highly sensitive values within JSON payloads&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cross-Site Scripting Protection
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Be cautious when deserializing and rendering user-provided multi-line content in web applications&lt;/li&gt;
&lt;li&gt;Apply context-appropriate output encoding before rendering any stored JSON strings&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Need senior JavaScript &amp;amp; AI engineers who pay attention to these details? &lt;a href="//gun.io"&gt;Hire proven developers&lt;/a&gt; in days—not weeks.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Search Git Commit History</title>
      <dc:creator>Chris</dc:creator>
      <pubDate>Mon, 21 Apr 2025 20:01:51 +0000</pubDate>
      <link>https://dev.to/johnsonrcl/how-to-search-git-commit-history-20nb</link>
      <guid>https://dev.to/johnsonrcl/how-to-search-git-commit-history-20nb</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; – &lt;code&gt;git log --grep="&amp;lt;pattern&amp;gt;"&lt;/code&gt; searches commit &lt;strong&gt;messages&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
&lt;code&gt;git grep &amp;lt;pattern&amp;gt; $(git rev-list --all)&lt;/code&gt; searches the &lt;strong&gt;code itself&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
Add filters (&lt;code&gt;--author&lt;/code&gt;, &lt;code&gt;--since&lt;/code&gt;, &lt;code&gt;-- path/&lt;/code&gt;) or context flags (&lt;code&gt;-p&lt;/code&gt;, &lt;code&gt;-S&lt;/code&gt;, &lt;code&gt;-G&lt;/code&gt;) to zero‑in fast.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Modern repositories can hide &lt;strong&gt;tens of thousands of commits&lt;/strong&gt;. Manually scrolling—or memorising hash IDs—wastes time you could spend shipping code.  &lt;/p&gt;

&lt;p&gt;Below is a toolkit of six repeatable search patterns that work in any project, whether it’s a fresh micro‑service, a sprawling monorepo, or a decade‑old SVN‑convert.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Bother Searching Your Git History?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Trace when a bug‑causing string first appeared.
&lt;/li&gt;
&lt;li&gt;Audit new licenses (e.g. "MIT").
&lt;/li&gt;
&lt;li&gt;Track feature toggles or API keys before release.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1  Search Commit &lt;strong&gt;Messages&lt;/strong&gt; Only
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Case‑sensitive&lt;/span&gt;
git log &lt;span class="nt"&gt;--grep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"facebook"&lt;/span&gt;

&lt;span class="c"&gt;# Case‑insensitive + pretty output&lt;/span&gt;
git log &lt;span class="nt"&gt;--all&lt;/span&gt; &lt;span class="nt"&gt;--grep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"facebook"&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="nt"&gt;--pretty&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"%h %ad | %s"&lt;/span&gt; &lt;span class="nt"&gt;--date&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;short
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; Combine multiple patterns with &lt;code&gt;--grep&lt;/code&gt; and &lt;code&gt;--invert-grep&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
    Search Code Changes (Pickaxe)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Show commits that add or remove the string&lt;/span&gt;
git log &lt;span class="nt"&gt;-S&lt;/span&gt;&lt;span class="s2"&gt;"facebook"&lt;/span&gt;

&lt;span class="c"&gt;# Regex version (‑G) – useful for variable names&lt;/span&gt;
git log &lt;span class="nt"&gt;-G&lt;/span&gt;&lt;span class="s2"&gt;"facebook_[0-9]+"&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;-S&lt;/code&gt; compares string counts between parent/child patches; &lt;code&gt;-G&lt;/code&gt; runs a regex diff.&lt;/p&gt;

&lt;p&gt;Once you've squashed the &lt;a href="https://gun.io/news/2017/01/how-to-github-fork-branch-and-pull-request/" rel="noopener noreferrer"&gt;fix, branch, squash, and fork correctly&lt;/a&gt; before opening a pull request.&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;# Every revision, but only for *.js files&lt;/span&gt;
git &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s2"&gt;"facebook"&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;git rev-list &lt;span class="nt"&gt;--all&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="s1"&gt;'*.js'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add &lt;code&gt;-n&lt;/code&gt; (line numbers) or &lt;code&gt;-I&lt;/code&gt; (skip binaries) for speed.&lt;/p&gt;




&lt;h2&gt;
  
  
  Narrow the Search
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Flag           Purpose                     Example&lt;/span&gt;
&lt;span class="nt"&gt;--author&lt;/span&gt;         limit by committer          &lt;span class="nt"&gt;--author&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"you@company.com"&lt;/span&gt;
&lt;span class="nt"&gt;--since&lt;/span&gt;          &lt;span class="nb"&gt;date &lt;/span&gt;lower bound            &lt;span class="nt"&gt;--since&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"2024-01-01"&lt;/span&gt;
&lt;span class="nt"&gt;--until&lt;/span&gt;          &lt;span class="nb"&gt;date &lt;/span&gt;upper bound            &lt;span class="nt"&gt;--until&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"2024-12-31"&lt;/span&gt;
&lt;span class="nt"&gt;--&lt;/span&gt; path/         specific directory          &lt;span class="nt"&gt;--&lt;/span&gt; src/cli/
&lt;span class="nt"&gt;-i&lt;/span&gt;               &lt;span class="k"&gt;case&lt;/span&gt;‑insensitive            &lt;span class="nt"&gt;-i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Combine freely:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log &lt;span class="nt"&gt;--grep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"facebook"&lt;/span&gt; &lt;span class="nt"&gt;--author&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;alice &lt;span class="nt"&gt;--since&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"2 weeks ago"&lt;/span&gt; &lt;span class="nt"&gt;--&lt;/span&gt; src/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Quick One‑Liner Cheatsheet
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Search messages&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;glg&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'git log --all --grep'&lt;/span&gt;

&lt;span class="c"&gt;# Pickaxe search w/ patch&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;gls&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'git log -S -p'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save to &lt;code&gt;~/.gitconfig&lt;/code&gt; under [alias] for muscle memory.&lt;/p&gt;

&lt;p&gt;And when you’re ready to ship, see our guide on &lt;a href="https://gun.io/guest-posts/2017/03/deployment-pipelines-zero-downtime-deployment/" rel="noopener noreferrer"&gt;automating your deploy&lt;/a&gt; for zero‑downtime releases.&lt;/p&gt;




&lt;h2&gt;
  
  
  Visual Alternatives
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;gitk --all --grep &amp;lt;pattern&amp;gt;&lt;/code&gt; – lightweight GUI.&lt;br&gt;
VS Code → Source Control panel → Search Commits extension.&lt;br&gt;
GitHub → repository → Insights → Community → Commits and filter.&lt;br&gt;
Next up → &lt;a href="https://gun.io/news/2017/01/how-to-github-fork-branch-and-pull-request/" rel="noopener noreferrer"&gt;branch, squash, and fork correctly&lt;/a&gt; • &lt;a href="https://gun.io/guest-posts/2017/03/deployment-pipelines-zero-downtime-deployment/" rel="noopener noreferrer"&gt;automate your deploy&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Common Pitfalls
&lt;/h2&gt;

&lt;p&gt;Binary files – add &lt;code&gt;-I&lt;/code&gt; (capital&lt;code&gt;‑i&lt;/code&gt;) to skip.&lt;br&gt;
Submodules – run in each submodule or use &lt;code&gt;--recurse-&lt;/code&gt;submodules (Git 2.13+).&lt;br&gt;
Large repos – prepend &lt;code&gt;LC_ALL=C&lt;/code&gt; to speed regex; or restrict with &lt;code&gt;-- path/&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  That’s It—Happy Hunting
&lt;/h2&gt;

&lt;p&gt;Spotted something outdated or have a faster trick? Open a PR—or better, join &lt;a href="https://read.gun.io/uiiUu" rel="noopener noreferrer"&gt;Gun.io&lt;/a&gt; and build with engineers who live in their terminal.&lt;/p&gt;

</description>
      <category>git</category>
      <category>programming</category>
    </item>
    <item>
      <title>Pitch Comp Decided by Devs</title>
      <dc:creator>Chris</dc:creator>
      <pubDate>Tue, 01 Nov 2022 15:51:52 +0000</pubDate>
      <link>https://dev.to/johnsonrcl/pitch-comp-decided-by-devs-mlp</link>
      <guid>https://dev.to/johnsonrcl/pitch-comp-decided-by-devs-mlp</guid>
      <description>&lt;p&gt;Gun.io is holding a pitch competition, but instead of pitching to investors, the winner will be decided by pitching to the dev community. &lt;a href="https://gun.io/pitch/" rel="noopener noreferrer"&gt;https://gun.io/pitch/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What are your thoughts?&lt;/p&gt;

</description>
      <category>news</category>
      <category>startup</category>
    </item>
  </channel>
</rss>
