<?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: Daniyal</title>
    <description>The latest articles on DEV Community by Daniyal (@daniyal_71c91c7a6c4fb21af).</description>
    <link>https://dev.to/daniyal_71c91c7a6c4fb21af</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%2F3209108%2F2dbb0c5b-0497-4c2a-8339-2317cc8905b2.jpg</url>
      <title>DEV Community: Daniyal</title>
      <link>https://dev.to/daniyal_71c91c7a6c4fb21af</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/daniyal_71c91c7a6c4fb21af"/>
    <language>en</language>
    <item>
      <title>Your AI Agent Is Debugging Performance Like a Drunk Man. This Skill Teaches It the Brendan Gregg Method.</title>
      <dc:creator>Daniyal</dc:creator>
      <pubDate>Tue, 28 Jul 2026 23:29:41 +0000</pubDate>
      <link>https://dev.to/daniyal_71c91c7a6c4fb21af/your-ai-agent-is-debugging-performance-like-a-drunk-man-this-skill-teaches-it-the-brendan-4a2c</link>
      <guid>https://dev.to/daniyal_71c91c7a6c4fb21af/your-ai-agent-is-debugging-performance-like-a-drunk-man-this-skill-teaches-it-the-brendan-4a2c</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1f9wfq2u9a5lbke830ca.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1f9wfq2u9a5lbke830ca.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Your AI Agent Is Debugging Performance Like a Drunk Man. This Skill Teaches It the Brendan Gregg Method.
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;How I packaged the USE Method (Utilization, Saturation, Errors) and the TSA Method (Thread State Analysis) into a vendor-agnostic skill that turns Claude Code, Kimi Code, Codex, or any LLM agent into a methodical performance investigator — complete with root-cause analysis and evidence-backed postmortems.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;It's 2 a.m. Latency on your checkout API just went 20×. You open your AI coding agent — Claude Code, Codex, whatever you run — and type: &lt;em&gt;"the server is slow, figure out why."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And the agent does what agents do. It runs &lt;code&gt;top&lt;/code&gt;. It runs &lt;code&gt;df -h&lt;/code&gt;. Maybe &lt;code&gt;ps aux | grep java&lt;/code&gt;. Three commands it happens to know, a shrug dressed up as analysis, and a confident suggestion to "restart the service and see."&lt;/p&gt;

&lt;p&gt;There's a name for that, and Brendan Gregg coined it: the &lt;strong&gt;Streetlight Anti-Method&lt;/strong&gt; — searching for the problem only where the light happens to be, because those are the tools you know. Its cousin is the &lt;strong&gt;Drunk Man Anti-Method&lt;/strong&gt;: change things at random until the problem goes away. Most AI agents debug performance exactly like this, because nothing in their context tells them not to.&lt;/p&gt;

&lt;p&gt;Meanwhile, the actual discipline of performance analysis has been solved for over a decade. Gregg's &lt;strong&gt;USE Method&lt;/strong&gt; finds roughly 80% of server issues with 5% of the effort. His &lt;strong&gt;TSA Method&lt;/strong&gt; decomposes where every thread's time actually goes. These are &lt;em&gt;procedures&lt;/em&gt; — checklists, like the emergency ones in a flight manual — and procedures are exactly what an LLM agent executes beautifully, once you write them down.&lt;/p&gt;

&lt;p&gt;So I wrote them down. Meet &lt;strong&gt;&lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill" rel="noopener noreferrer"&gt;brendangregg-use-tsa-skill&lt;/a&gt;&lt;/strong&gt; — a vendor-agnostic, MIT-licensed &lt;strong&gt;agent skill&lt;/strong&gt; that gives any AI coding agent the full methodology: systematic performance troubleshooting, root cause analysis, and the postmortem report at the end.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the Skill Actually Teaches
&lt;/h2&gt;

&lt;p&gt;The core is two complementary methods, plus the supporting toolbox:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;USE — Utilization, Saturation, Errors.&lt;/strong&gt; Resource-oriented. For &lt;em&gt;every&lt;/em&gt; resource — CPUs, memory capacity, network interfaces, storage I/O and capacity, controllers, interconnects, and the ones everyone forgets (mutex locks, thread pools, file descriptors, and cgroup/hypervisor limits) — the agent checks three things: how busy is it, how much work is queued behind it, and is it erroring. It's deliberately question-first: instead of starting from whatever metrics a tool happens to show and working backwards, you start from the complete list of questions and find the metrics to answer them. What can't be measured becomes a documented &lt;em&gt;known-unknown&lt;/em&gt; instead of an &lt;em&gt;unknown-unknown&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TSA — Thread State Analysis.&lt;/strong&gt; Thread-oriented, USE's mirror image. For each thread of interest, split time into six exclusive states: &lt;strong&gt;Executing, Runnable, Anonymous Paging, Sleeping, Lock, Idle&lt;/strong&gt;. Then investigate the biggest states first with state-appropriate tools. The killer heuristic: if more than ~10% of time is Runnable or Anonymous Paging, fix those &lt;em&gt;first&lt;/em&gt; — latency states can be tuned to zero, and they're often the cheapest wins in all of performance engineering.&lt;/p&gt;

&lt;p&gt;Around that core, the skill packs the rest of Gregg's toolbox: &lt;strong&gt;off-CPU analysis&lt;/strong&gt; (why threads block, with stack traces), &lt;strong&gt;flame graphs&lt;/strong&gt; (where on-CPU time goes, visually), &lt;strong&gt;workload characterization&lt;/strong&gt;, &lt;strong&gt;drill-down analysis&lt;/strong&gt;, the &lt;strong&gt;RED method&lt;/strong&gt; for microservices, the &lt;strong&gt;60-second Linux triage&lt;/strong&gt; (the famous "60,000 milliseconds" checklist), 24 methodologies, 6 anti-methodologies to refuse, and the performance mantras for deciding the fix.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fehl9rz0258nf22nls9e3.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fehl9rz0258nf22nls9e3.png" alt=" " width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Procedure Is the Product
&lt;/h2&gt;

&lt;p&gt;Here's what happens when the skill is installed and you say &lt;em&gt;"prod is slow, triage it"&lt;/em&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Phase 0  PROBLEM STATEMENT   What changed? Quantify it. Who's affected?
Phase 1  60s TRIAGE          uptime, dmesg, vmstat, mpstat, pidstat,
                             iostat, free, sar ×2, top — errors first
Phase 2  USE SWEEP           every resource: utilization, saturation, errors
Phase 3  TSA SWEEP           every thread: executing/runnable/paging/
                             sleeping/lock/idle
Phase 4  DRILL DOWN          flame graphs, off-CPU stacks, time division
Phase 5  ROOT CAUSE          causal chain, every link evidence-backed
Phase 6  FIX &amp;amp; VERIFY        re-measure with the SAME instruments
Phase 7  REPORT              triage note / RCA / postmortem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The golden rules baked into &lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/blob/main/SKILL.md" rel="noopener noreferrer"&gt;SKILL.md&lt;/a&gt; are what change agent behavior: &lt;em&gt;diagnose before touching anything&lt;/em&gt;; &lt;em&gt;installed ≠ working&lt;/em&gt;; &lt;em&gt;rule out alternatives explicitly and keep the evidence&lt;/em&gt;; &lt;em&gt;quantify everything&lt;/em&gt;; &lt;em&gt;the first bottleneck you find may be a problem, not the problem&lt;/em&gt;; &lt;em&gt;be candid about what you can't measure&lt;/em&gt;; &lt;em&gt;absolute dates in all reports&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Real Shape of a Real Investigation
&lt;/h2&gt;

&lt;p&gt;The repo includes a &lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/blob/main/examples/example-postmortem.md" rel="noopener noreferrer"&gt;worked example postmortem&lt;/a&gt; — a fictional-but-realistic incident that shows the expected depth. Short version:&lt;/p&gt;

&lt;p&gt;API p99 goes 95ms → 1.9s after a 14:02 deploy. The naive agent says "the deploy broke the code, roll back." The methodical agent works the phases. The 60-second sweep &lt;em&gt;exonerates&lt;/em&gt; the host: CPU 48%, no iowait, zero retransmits, clean dmesg. TSA on the application threads shows &lt;strong&gt;61% of time in Runnable&lt;/strong&gt; — threads ready to run, waiting for a CPU — &lt;em&gt;on a half-idle host&lt;/em&gt;. That combination is the signature of exactly one thing: a resource-control limit. Two &lt;code&gt;cat&lt;/code&gt; commands later: &lt;code&gt;cpu.max&lt;/code&gt; allows 1.5 CPUs, and &lt;code&gt;cpu.stat nr_throttled&lt;/code&gt; is climbing 54,000 times per minute. The deploy had doubled the replica count; nobody resized the cgroup quota.&lt;/p&gt;

&lt;p&gt;Root cause: not the code, not the host — the quota. Fix: raise the limit. &lt;strong&gt;Verified&lt;/strong&gt;: &lt;code&gt;nr_throttled&lt;/code&gt; flat at zero for 72 hours, p99 back to 110ms under a 1.4× load test. And the postmortem records what was &lt;em&gt;ruled out&lt;/em&gt; — host CPU, memory, disk, network — each with the command and output that exonerated it.&lt;/p&gt;

&lt;p&gt;That last part is what separates an RCA from a guess. The skill's &lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/tree/main/templates" rel="noopener noreferrer"&gt;report templates&lt;/a&gt; — triage, RCA, and postmortem — demand an evidence table where every claim maps to a command and its output, and an investigation log where dead ends stay on the record.&lt;/p&gt;

&lt;h2&gt;
  
  
  An Honest Word About the Sources
&lt;/h2&gt;

&lt;p&gt;Everything in the skill is an original distillation — with attribution — of Brendan Gregg's publicly published work: the &lt;a href="https://www.brendangregg.com/usemethod.html" rel="noopener noreferrer"&gt;USE&lt;/a&gt; and &lt;a href="https://www.brendangregg.com/tsamethod.html" rel="noopener noreferrer"&gt;TSA&lt;/a&gt; method pages, the USE Linux checklist and Rosetta Stone, the off-CPU analysis and flame graph pages, the methodology list, and &lt;em&gt;Systems Performance: Enterprise and the Cloud&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;One discovery from the research worth sharing: &lt;strong&gt;Gregg's OS-specific TSA checklists were never actually published.&lt;/strong&gt; His &lt;code&gt;tsa-linux.html&lt;/code&gt; page has been an "Under construction" stub since 2014 — I verified it against a decade of Wayback Machine snapshots. So the &lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/blob/main/references/tsa-linux.md" rel="noopener noreferrer"&gt;TSA-on-Linux instructions&lt;/a&gt; in the repo are a &lt;em&gt;labeled reconstruction&lt;/em&gt;, assembled from his TSA method page, the USE-Linux checklist, and his off-CPU work — and marked as such, because a skill that preaches "evidence over guessing" has to hold itself to the same standard.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install It in 30 Seconds
&lt;/h2&gt;

&lt;p&gt;The skill is a plain directory with a &lt;code&gt;SKILL.md&lt;/code&gt; — no build, no dependencies, nothing executable. Pick your agent:&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;# Claude Code&lt;/span&gt;
git clone https://github.com/thecsdoctor/brendangregg-use-tsa-skill &lt;span class="se"&gt;\&lt;/span&gt;
  ~/.claude/skills/brendangregg-use-tsa

&lt;span class="c"&gt;# Kimi Code&lt;/span&gt;
git clone https://github.com/thecsdoctor/brendangregg-use-tsa-skill &lt;span class="se"&gt;\&lt;/span&gt;
  ~/.kimi-code/skills/brendangregg-use-tsa

&lt;span class="c"&gt;# OpenAI Codex&lt;/span&gt;
git clone https://github.com/thecsdoctor/brendangregg-use-tsa-skill &lt;span class="se"&gt;\&lt;/span&gt;
  ~/.codex/skills/brendangregg-use-tsa

&lt;span class="c"&gt;# Universal (agentskills-compatible agents)&lt;/span&gt;
git clone https://github.com/thecsdoctor/brendangregg-use-tsa-skill &lt;span class="se"&gt;\&lt;/span&gt;
  ~/.agents/skills/brendangregg-use-tsa
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OpenClaw discovers it from your workspace &lt;code&gt;skills/&lt;/code&gt; directory; for Gemini CLI, Cursor, Windsurf, and Aider the &lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/blob/main/README.md" rel="noopener noreferrer"&gt;README&lt;/a&gt; has per-tool instructions — and for any other LLM, pasting &lt;code&gt;SKILL.md&lt;/code&gt; into the system prompt works too. Then just talk to it: &lt;em&gt;"this box feels slow, triage it and tell me what you ruled out."&lt;/em&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fk9mj7odh55scgqr16ta5.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fk9mj7odh55scgqr16ta5.png" alt=" " width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;AI agents are being handed production access faster than they're being handed engineering discipline. The gap between "can run commands" and "knows how to investigate" is exactly where 3 a.m. incidents get longer, rollbacks get riskier, and postmortems get vaguer. &lt;strong&gt;Agent skills&lt;/strong&gt; — reusable, versioned, shareable instruction packs — are how that gap closes: not by making models smarter in general, but by giving them the specific procedures senior engineers carry in their heads.&lt;/p&gt;

&lt;p&gt;Performance analysis is the perfect test case, because the methodology literature is explicit that guessing is the failure mode. Gregg's line on methodology-free analysis: it "can become a fishing expedition, where metrics are examined ad hoc, until the issue is found – if it is at all." The skill's job is to make the fishing expedition structurally impossible.&lt;/p&gt;

&lt;p&gt;Star it, fork it, tear it apart: &lt;strong&gt;&lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill" rel="noopener noreferrer"&gt;github.com/thecsdoctor/brendangregg-use-tsa-skill&lt;/a&gt;&lt;/strong&gt;. Contributions are welcome — especially per-OS checklist expansions and new worked examples. And the next time your agent suggests "restart it and see," you'll know exactly which skill it's missing.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6u9zbdhhiz2dig29ddt3.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6u9zbdhhiz2dig29ddt3.png" alt=" " width="800" height="520"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; AI Agents, Claude Code, LLM Tools, Performance Engineering, Root Cause Analysis, Brendan Gregg, USE Method, TSA Method, Linux Performance, Observability, SRE, DevOps, Incident Response, Postmortem, Flame Graphs, eBPF, Off-CPU Analysis, OpenAI Codex, Kimi Code, OpenClaw, Agent Skills, SKILL.md, Site Reliability Engineering, Debugging, Troubleshooting&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Canonical links:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repo: &lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill" rel="noopener noreferrer"&gt;https://github.com/thecsdoctor/brendangregg-use-tsa-skill&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/blob/main/SKILL.md" rel="noopener noreferrer"&gt;SKILL.md — the procedure&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/blob/main/references/use-method.md" rel="noopener noreferrer"&gt;USE Method reference&lt;/a&gt; · &lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/blob/main/references/tsa-method.md" rel="noopener noreferrer"&gt;TSA Method reference&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/blob/main/references/use-linux-checklist.md" rel="noopener noreferrer"&gt;Linux USE checklist&lt;/a&gt; · &lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/blob/main/references/tsa-linux.md" rel="noopener noreferrer"&gt;TSA on Linux (reconstruction)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/blob/main/references/linux-60s-triage.md" rel="noopener noreferrer"&gt;60-second triage&lt;/a&gt; · &lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/blob/main/references/offcpu-and-flame-graphs.md" rel="noopener noreferrer"&gt;Off-CPU &amp;amp; flame graphs&lt;/a&gt; · &lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/blob/main/references/methodology-toolbox.md" rel="noopener noreferrer"&gt;Methodology toolbox&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/tree/main/templates" rel="noopener noreferrer"&gt;Report templates&lt;/a&gt; · &lt;a href="https://github.com/thecsdoctor/brendangregg-use-tsa-skill/blob/main/examples/example-postmortem.md" rel="noopener noreferrer"&gt;Worked example postmortem&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>agentskills</category>
      <category>performance</category>
      <category>systems</category>
    </item>
  </channel>
</rss>
