<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Arun Kumar Rajamandrapu on Medium]]></title>
        <description><![CDATA[Stories by Arun Kumar Rajamandrapu on Medium]]></description>
        <link>https://medium.com/@arunece488?source=rss-02ae7c0e94f9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*z0SbgqdrDQcr7qvl</url>
            <title>Stories by Arun Kumar Rajamandrapu on Medium</title>
            <link>https://medium.com/@arunece488?source=rss-02ae7c0e94f9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 13:35:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arunece488/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Defect Resolver: How We Turned a 60-Minute Triage Ritual Into a 5-Minute Agent Workflow]]></title>
            <link>https://medium.com/@arunece488/the-defect-resolver-how-we-turned-a-60-minute-triage-ritual-into-a-5-minute-agent-workflow-b20d27c53964?source=rss-02ae7c0e94f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/b20d27c53964</guid>
            <dc:creator><![CDATA[Arun Kumar Rajamandrapu]]></dc:creator>
            <pubDate>Wed, 27 May 2026 14:05:57 GMT</pubDate>
            <atom:updated>2026-05-27T14:05:57.027Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A field report on building a Cursor agent that pulls a defect from Jira, finds root cause across a dozen microservices, posts a Jira comment, and raises a peer-reviewed PR — without inventing facts.</em></p><h3>The 8 PM problem</h3><p>Every engineering team has the same Tuesday-night ritual. A ticket lands in Jira: <em>“In view/approve mode the dropdown is still editable. Steps to reproduce attached.”</em> The on-call engineer sighs, opens six tabs — Jira, the monorepo, three microservice repos, Datadog logs, a stack-trace viewer — and starts the slow work of <em>triage</em>.</p><p>An hour. Sometimes three. Multiplied by every defect in every sprint.</p><p>That’s the problem we built Defect Resolver to solve.</p><h3>What it is</h3><p>Defect Resolver is a <a href="https://cursor.com/">Cursor</a> agent skill — a single Markdown file that teaches Cursor’s coding agent how to triage a defect from end to end. You invoke it with a slash command and a Jira link:</p><p>/defect-resolver https://&lt;your-jira-host&gt;/browse/PROJECT-1234</p><p>…and it runs a deterministic, seven-step pipeline. The whole thing — Jira fetch through Copilot-reviewed PR — runs in roughly seven minutes for a typical defect that historically took the better part of an afternoon.</p><p>But the time-savings aren’t the interesting part. The discipline is.</p><h3>The skill is literally a Markdown file</h3><p>The whole agent is configured in plain English. There’s no orchestrator, no LangGraph, no vector DB, no fine-tune. Here’s the structural skeleton (sensitive identifiers replaced with placeholders):</p><p>— -</p><p>name: defect-resolver</p><p>description: Triages Jira defects using Jira, Datadog, and Sourcegraph</p><p>across the &lt;your-org&gt; GitHub organisation. Use when the user provides</p><p>a Jira defect key or URL and asks for root cause analysis, code search,</p><p>a Jira comment draft, or an optional fix/PR workflow.</p><p><strong>— -</strong></p><p><strong># Defect Resolver</strong></p><p>Critical operating rules:</p><p>- Always search Sourcegraph across `repo:^github\.com/&lt;your-org&gt;/`</p><p>from the first code query.</p><p>- Always use the `dev` branch unless the user explicitly specifies another.</p><p>- Always identify confirmed impacted repositories before querying Datadog.</p><p>- <strong>**Jira comments auto-post without approval.**</strong> Post the new comment via</p><p>the comment-only MCP tool immediately — no yes/no gate.</p><p>- **Never modify the Jira issue description, summary, status, assignee,</p><p>labels, components, or any other field.** This skill is strictly</p><p><em>*comment-only*</em> on Jira.</p><p>- <strong>**PR creation is the only hard approval gate.**</strong> Never create a branch,</p><p>commit, push, or open a PR unless the user explicitly asks in the</p><p>current message (e.g. “fix this”, “raise a PR”).</p><p>- <strong>**Mandatory Copilot code review**</strong> between PR open and Jira fix-comment.</p><p>- <strong>**Coding standards enforcement**</strong> before linting, via the dedicated</p><p>`coding-standards` skill.</p><p>- <strong>**Copilot instructions are mandatory generation guidance**</strong> — load</p><p>`.github/copilot-instructions.md` and `.github/instructions/*.md`</p><p>before authoring any code.</p><p>That’s it. The intelligence lives in those rules, not in the plumbing.</p><p>A companion system.md prompt anchors the agent&#39;s role on every turn:</p><p><strong># System Prompt</strong></p><p>You are the Defect Resolver for the &lt;your-org&gt; GitHub organisation.</p><p>Your job is to triage defects using Jira MCP, Sourcegraph MCP, and</p><p>Datadog MCP. Start every code investigation with an organisation-wide</p><p>Sourcegraph scope:</p><p>repo:^github\.com/&lt;your-org&gt;/</p><p>Use the `dev` branch by default.</p><p>Do not claim root cause without evidence from logs, traces, stack</p><p>traces, or code references. If evidence is incomplete, label the</p><p>result as a hypothesis and list missing evidence.</p><p>Never post to Jira until the comment is shown in chat for transparency.</p><p>Never create a branch, commit, or pull request unless the user</p><p>explicitly asks for a fix or PR.</p><p>Do not include secrets, bearer tokens, API keys, full JWTs, or bulk</p><p>raw identifiers in chat or Jira output. Summarise and redact.</p><p>Plain English. The model reads it on every turn. When it forgets, you add a rule. When it does the wrong thing, you add a rule. The skill file <em>is</em> the agent.</p><h3>The eight rules that matter</h3><h3>Rule 1: Always search the whole organisation, from the first query</h3><p>The single most common failure pattern in an unsupervised LLM is <em>premature narrowing</em>. The model sees “the dropdown is buggy” and dives straight into one repo, never noticing the bug is in a shared library three repos over.</p><p>So every Sourcegraph search begins with an org-wide prefix — never a bare query:</p><p>// Always do this</p><p>repo:^github\.com/&lt;your-org&gt;/ &lt;token-from-jira&gt;</p><p>// Only after Step 2 confirms a code hit</p><p>repo:^github\.com/&lt;your-org&gt;/&lt;specific-repo&gt; lang:java &lt;symbol&gt;</p><p>The workflow file spells out the exact MCP call sequence the agent must follow:</p><p>// Step 2a — discover all repos in the org</p><p>list_repos({ query: “&lt;your-product-prefix&gt;”, limit: 50 })</p><p>// Step 2c — confirm code ownership for each token from the ticket</p><p>keyword_search({</p><p>query: “repo:^github\\.com/&lt;your-org&gt;/ &lt;token&gt; lang:java”</p><p>})</p><p>// Step 2c — read surrounding context before citing</p><p>read_file({</p><p>repo: “github.com/&lt;your-org&gt;/&lt;repo-name&gt;”,</p><p>path: “src/main/java/…/SomeService.java”,</p><p>revision: “dev”</p><p>})</p><p>The agent discovers the candidate repository set empirically — by asking Sourcegraph what code actually mentions the symptom — before narrowing. No hard-coded ownership map. No guessing.</p><h3>Rule 2: Confirmed repos drive everything downstream</h3><p>A Sourcegraph hit alone isn’t enough. The agent must read_file and confirm the surrounding context is relevant. Only repos that survive that confirmation step proceed to Datadog.</p><p>Datadog service: tags are then derived from the confirmed repo list, never guessed:</p><p>// Strip your project prefix to derive the service tag</p><p>GitHub repo: &lt;prefix&gt;_payments-api</p><p>Datadog service: payments-api</p><p>// And query Datadog only for those services</p><p>search_datadog_logs({</p><p>query: “service:payments-api env:prod status:error”,</p><p>from: “now-24h”,</p><p>to: “now”</p><p>})</p><p>This avoids the classic mistake of “let me just grep production logs and see what looks angry” — which always returns <em>something</em>, which is always misleading.</p><h3>Rule 3: Never claim root cause without evidence</h3><p>The single line in the system prompt that’s worth more than any model upgrade:</p><blockquote>Do not claim root cause without evidence from logs, traces, stack traces, or code references. If evidence is incomplete, label the result as a hypothesis and list missing evidence.</blockquote><p>In a recent UI defect run, the agent looked through 24 hours of logs and traces across the implicated services and found exactly nothing. Instead of inventing a backend story, it wrote:</p><blockquote>“This is a client-side defect; no backend footprint is expected, and none was found in the resolved time window (now-24h → now). Root cause confirmed by code inspection in &lt;file&gt;:&lt;line-range&gt;, not by logs.&quot;</blockquote><p>That single honest sentence saved the assigned developer from chasing a server-side ghost.</p><h3>Rule 4: Jira writes are comment-only — at every stage</h3><p>Agents that can mutate ticket descriptions, statuses, assignees, or labels become organisational hazards. They overwrite the QA reporter’s careful repro steps. They reassign tickets to themselves.</p><p>So the skill is configured to use exactly one Jira write tool, hard-coded in the rule:</p><blockquote>The only Jira write tool permitted is addCommentToJiraIssue (or its MCP equivalent). Do not call updateJiraIssue, editJiraIssue, setJiraIssueField, or any other field-mutation MCP tool — at any stage — under any circumstance.</blockquote><p>If the fix changes the world, the world hears about it in a new comment. The original ticket stays pristine.</p><h3>Rule 5: Comments auto-post; PRs do not</h3><p>The asymmetric approval gate is the single most important design decision in the whole skill. Cheap actions auto-execute; expensive actions require explicit confirmation.</p><p>COMMENTS PULL REQUESTS</p><p>──────── ─────────────</p><p>Cheap — easy to delete Expensive — notifies reviewers,</p><p>consumes attention, kicks off CI</p><p>Auto-posted, no gate Hard approval gate: must hear</p><p>“raise a PR” / “fix this” in</p><p>the current message</p><p>If wrong, human edits/deletes If wrong, team learns to ignore</p><p>the agent</p><p>Analysis runs (steps 1–6) never trigger code changes. Even when the root cause is obvious. Even when the fix is one line. This asymmetry is what makes the agent safe to leave running in chat all day.</p><h3>Rule 6: Project conventions are loaded — never invented</h3><p>Before the agent writes any code, it pulls the target repository’s .github/copilot-instructions.md and every .github/instructions/*.md from the integration branch:</p><p>read_file({</p><p>repo: “github.com/&lt;your-org&gt;/&lt;repo&gt;”,</p><p>path: “.github/copilot-instructions.md”,</p><p>revision: “dev”</p><p>})</p><p>read_file({</p><p>repo: “github.com/&lt;your-org&gt;/&lt;repo&gt;”,</p><p>path: “.github/instructions/logging.md”,</p><p>revision: “dev”</p><p>})</p><p>Those files are treated as authoritative project guidance. When they conflict with anything else, the precedence is explicit:</p><ol><li>The repo’s own Copilot instructions win for architecture, layering, domain naming, logging conventions, error handling, test structure.</li><li>The coding-standards skill wins for syntactic rules that tooling can enforce (.editorconfig, ESLint, tsconfig, Checkstyle, Spotless).</li><li>Neighbouring already-merged code wins when neither speaks to the question.</li></ol><p>The agent then produces a ### Copilot instructions applied block in chat, naming the files loaded and the rules that influenced the edit. If you reviewed the PR, you can audit <em>why</em> the agent shaped the code the way it did.</p><p>If a repository has no Copilot instructions, the skill states this explicitly:</p><p>### Copilot instructions applied</p><p>&lt;repo&gt;: no .github/copilot-instructions.md on dev —</p><p>neighbouring code used as fallback.</p><p>Never invented. That’s the rule.</p><h3>Rule 7: Mandatory Copilot code review between push and Jira fix-comment</h3><p>After the PR opens, but before the agent posts a fix summary to Jira, it requests a <a href="https://docs.github.com/en/copilot/using-github-copilot/code-review">GitHub Copilot code review</a> on the PR:</p><p>gh pr edit &lt;PR-number&gt; — repo &lt;owner&gt;/&lt;repo&gt; — add-reviewer Copilot</p><p>Then it polls for up to five minutes (every 30 seconds), using the public GitHub REST API:</p><p><em># PR-level reviews</em></p><p>gh api repos/&lt;owner&gt;/&lt;repo&gt;/pulls/&lt;PR-number&gt;/reviews \</p><p>— jq ‘.[] | select(</p><p>.user.login == “Copilot” or</p><p>.user.login == “copilot-pull-request-reviewer[bot]”</p><p>) | { state, submitted_at, body }’</p><p><em># Inline review comments</em></p><p>gh api repos/&lt;owner&gt;/&lt;repo&gt;/pulls/&lt;PR-number&gt;/comments \</p><p>— jq ‘.[] | select(</p><p>.user.login == “Copilot” or</p><p>.user.login == “copilot-pull-request-reviewer[bot]”</p><p>) | { path, line, body }’</p><p>The findings are surfaced in chat under a mandatory section, with every comment triaged into a severity bucket:</p><p><strong>### Copilot code review</strong></p><p>- <strong>**Overall verdict:**</strong> COMMENTED</p><p>- <strong>**PR-level summary:**</strong> &lt;verbatim from Copilot&gt;</p><p>| File | Line | Severity | Comment | Recommended action |</p><p>| — — — — — — — | — — — | — — — — — — — | — — — — — — — — — — — | — — — — — — — — — — — — |</p><p>| Foo.java | 42 | 🔴 critical | “Possible NPE…” | <strong>**fix now**</strong> |</p><p>| Bar.spec.ts | 15 | 🟡 suggestion| “Consider edge…” | <strong>**defer to reviewer**</strong> |</p><p>| Baz.html | 7 | 🟢 nit | “Prefer template…” | <strong>**dismiss with reason**</strong>|</p><p>The agent never auto-applies Copilot’s suggestions. They’re surfaced; the human decides. The exception: if the user explicitly says <em>“apply Copilot’s suggestions”</em> in the current message, the agent commits a follow-up:</p><p>chore: address Copilot review comments (&lt;JIRA-KEY&gt;)</p><p>That’s the only way auto-edits land on a branch that has already been opened for review.</p><h3>Rule 8: Sensitive data never leaves the agent</h3><p>Bearer tokens, API keys, full JWTs, bulk identifiers (think VINs, customer IDs, account numbers) — none of it ever lands in Jira or chat output. The system prompt is explicit:</p><blockquote>Do not include secrets, bearer tokens, API keys, full JWTs, or bulk raw identifiers in chat or Jira output. Summarise and redact.</blockquote><p>The agent is allowed to <em>reason about</em> the existence of an identifier — <em>“the request carried a vehicle identifier in the path”</em> — but never to <em>paste</em> one.</p><h3>What does the code-fix sub-workflow look like?</h3><p>When the user says <em>“raise a PR”</em>, the agent runs steps 7a–7g. Branch naming, commit format, and PR body are all standardised:</p><p><em># 7d — branch &amp; commit</em></p><p>git checkout -b fix/PROJECT-1234-short-kebab-description</p><p><em># On PowerShell, write commit message to a temp file (heredocs aren’t supported)</em></p><p>git add path/to/file path/to/file.spec</p><p>git commit -F .git/COMMIT_MSG_PROJECT-1234.txt</p><p>The commit message format is enforced by the workflow:</p><p>fix: &lt;short imperative summary&gt; (PROJECT-1234)</p><p>&lt;paragraph explaining what was broken and why&gt;</p><p>Changes:</p><p>- &lt;file&gt;: &lt;what changed and why&gt;</p><p>- &lt;file&gt;: &lt;what changed and why&gt;</p><p>Expected: &lt;measurable outcome&gt;</p><p>And the PR open is the single hard gate — the agent must show the proposed title, base branch, reviewers, and body, then ask for confirmation before this call lands:</p><p>gh pr create \</p><p>— repo &lt;owner&gt;/&lt;repo&gt; \</p><p>— base dev \</p><p>— title “fix: &lt;summary&gt; (PROJECT-1234)” \</p><p>— body-file .git/PR_BODY_PROJECT-1234.md</p><p>If the user declines, the branch stays pushed and the agent hands back the compare URL so they can open it manually:</p><p>https://github.com/&lt;owner&gt;/&lt;repo&gt;/compare/dev...fix/PROJECT-1234-...?expand=1</p><h3>The coding-standards skill: never invent, always infer</h3><p>Before any commit, a second skill audits everything the agent has just written. Its hard rule:</p><blockquote>Never invent conventions. Read repo config first (.editorconfig, tsconfig.json, eslint.config.*, .eslintrc*, checkstyle.xml, pom.xml, .prettierrc*, .stylelintrc*, pyproject.toml). Only fall back to language defaults when nothing is configured.</blockquote><p>It batches findings into three buckets:</p><p>🟢 auto-fix Safe &amp; mechanical &amp; scoped to the diff. Apply immediately.</p><p>(rename a private local, add @Override, sort imports,</p><p>normalise indentation, drop wildcard imports)</p><p>🟡 confirm Safe locally but visible at the file boundary. Show</p><p>a one-line diff and ask the user before applying.</p><p>(cross-file private rename, template binding string,</p><p>SCSS class used in HTML)</p><p>🔴 surface only Would break callers or change public API. Do not edit.</p><p>(rename a public Java method, an exported TS symbol,</p><p>a DB column, a Liquibase changeset id, an HTTP route,</p><p>a Kafka topic, an Angular @Input/@Output)</p><p>The output is a mandatory ### Coding standards audit table in chat, naming the source-of-truth files and listing every finding. If the audit is clean, it&#39;s a one-liner. No invented opinions.</p><h3>The Jira comment template</h3><p>Every analysis ends with an auto-posted Jira comment that follows the same structure, so anyone reading the ticket sees a consistent format:</p><p><strong>## Defect analysis (AI-assisted)</strong></p><p><strong>**Issue:**</strong> PROJECT-1234 — &lt;one-line restatement&gt;</p><p><strong>### Summary</strong></p><p>- <strong>**Symptom:**</strong> …</p><p>- <strong>**Environment / window:**</strong> prod, last 24h (`now-24h → now`)</p><p>- <strong>**Impacted repositories:**</strong> &lt;list with primary vs secondary&gt;</p><p>- <strong>**Datadog by microservice:**</strong> &lt;table — service tag, query, outcome&gt;</p><p><strong>### Root cause</strong></p><p>❤–6 sentences&gt;</p><p><strong>### Evidence</strong></p><p>- <strong>**Logs / traces:**</strong> &lt;per service — short excerpt or “none”&gt;</p><p>- <strong>**Code:**</strong> `&lt;repo&gt;/&lt;path&gt;` — &lt;why this path explains the failure&gt;</p><p><strong>### Fix &amp; Pull Request</strong></p><p>- <strong>**Branch:**</strong> `fix/PROJECT-1234-short-description`</p><p>- <strong>**PR:**</strong> [PR #&lt;number&gt;](&lt;PR URL&gt;)</p><p>- <strong>**What was changed:**</strong> &lt;one-line summary&gt;</p><p>- <strong>**Verification:**</strong> &lt;repro steps to confirm after deploy&gt;</p><p><strong>### Copilot code review</strong></p><p>- <strong>**Verdict:**</strong> APPROVED / CHANGES_REQUESTED / COMMENTED / PENDING</p><p>- <strong>**Summary:**</strong> &lt;one-sentence summary&gt;</p><p>- <strong>**Inline comments addressed in this PR:**</strong> &lt;count, or “none”&gt;</p><p>- <strong>**Inline comments deferred to reviewer:**</strong> &lt;count, or “none”&gt;</p><p>- <strong>**Inline comments dismissed:**</strong> &lt;count, or “none”&gt;</p><p>cc @&lt;reporter&gt; @&lt;assignee&gt; — PR raised for review.</p><p>Please verify after merge to `dev`.</p><p>Structured. Predictable. Easy to skim. The QA reporter and the assigned developer both know exactly where to look.The 8 PM problem</p><p>Every engineering team has the same Tuesday-night ritual. A ticket lands in Jira: <em>“In view/approve mode the dropdown is still editable. Steps to reproduce attached.”</em> The on-call engineer sighs, opens six tabs — Jira, the monorepo, three microservice repos, Datadog logs, a stack-trace viewer — and starts the slow work of <em>triage</em>.</p><p>An hour. Sometimes three. Multiplied by every defect in every sprint.</p><p>That’s the problem we built Defect Resolver to solve.</p><h3>What it is</h3><p>Defect Resolver is a <a href="https://cursor.com/">Cursor</a> agent skill — a single Markdown file that teaches Cursor’s coding agent how to triage a defect from end to end. You invoke it with a slash command and a Jira link:</p><p>/defect-resolver https://&lt;your-jira-host&gt;/browse/PROJECT-1234</p><p>…and it runs a deterministic, seven-step pipeline. The whole thing — Jira fetch through Copilot-reviewed PR — runs in roughly seven minutes for a typical defect that historically took the better part of an afternoon.</p><p>But the time-savings aren’t the interesting part. The discipline is.</p><h3>The skill is literally a Markdown file</h3><p>The whole agent is configured in plain English. There’s no orchestrator, no LangGraph, no vector DB, no fine-tune. Here’s the structural skeleton (sensitive identifiers replaced with placeholders):</p><p>— -</p><p>name: defect-resolver</p><p>description: Triages Jira defects using Jira, Datadog, and Sourcegraph</p><p>across the &lt;your-org&gt; GitHub organisation. Use when the user provides</p><p>a Jira defect key or URL and asks for root cause analysis, code search,</p><p>a Jira comment draft, or an optional fix/PR workflow.</p><p><strong>— -</strong></p><p><strong># Defect Resolver</strong></p><p>Critical operating rules:</p><p>- Always search Sourcegraph across `repo:^github\.com/&lt;your-org&gt;/`</p><p>from the first code query.</p><p>- Always use the `dev` branch unless the user explicitly specifies another.</p><p>- Always identify confirmed impacted repositories before querying Datadog.</p><p>- <strong>**Jira comments auto-post without approval.**</strong> Post the new comment via</p><p>the comment-only MCP tool immediately — no yes/no gate.</p><p>- **Never modify the Jira issue description, summary, status, assignee,</p><p>labels, components, or any other field.** This skill is strictly</p><p><em>*comment-only*</em> on Jira.</p><p>- <strong>**PR creation is the only hard approval gate.**</strong> Never create a branch,</p><p>commit, push, or open a PR unless the user explicitly asks in the</p><p>current message (e.g. “fix this”, “raise a PR”).</p><p>- <strong>**Mandatory Copilot code review**</strong> between PR open and Jira fix-comment.</p><p>- <strong>**Coding standards enforcement**</strong> before linting, via the dedicated</p><p>`coding-standards` skill.</p><p>- <strong>**Copilot instructions are mandatory generation guidance**</strong> — load</p><p>`.github/copilot-instructions.md` and `.github/instructions/*.md`</p><p>before authoring any code.</p><p>That’s it. The intelligence lives in those rules, not in the plumbing.</p><p>A companion system.md prompt anchors the agent&#39;s role on every turn:</p><p><strong># System Prompt</strong></p><p>You are the Defect Resolver for the &lt;your-org&gt; GitHub organisation.</p><p>Your job is to triage defects using Jira MCP, Sourcegraph MCP, and</p><p>Datadog MCP. Start every code investigation with an organisation-wide</p><p>Sourcegraph scope:</p><p>repo:^github\.com/&lt;your-org&gt;/</p><p>Use the `dev` branch by default.</p><p>Do not claim root cause without evidence from logs, traces, stack</p><p>traces, or code references. If evidence is incomplete, label the</p><p>result as a hypothesis and list missing evidence.</p><p>Never post to Jira until the comment is shown in chat for transparency.</p><p>Never create a branch, commit, or pull request unless the user</p><p>explicitly asks for a fix or PR.</p><p>Do not include secrets, bearer tokens, API keys, full JWTs, or bulk</p><p>raw identifiers in chat or Jira output. Summarise and redact.</p><p>Plain English. The model reads it on every turn. When it forgets, you add a rule. When it does the wrong thing, you add a rule. The skill file <em>is</em> the agent.</p><h3>The eight rules that matter</h3><h3>Rule 1: Always search the whole organisation, from the first query</h3><p>The single most common failure pattern in an unsupervised LLM is <em>premature narrowing</em>. The model sees “the dropdown is buggy” and dives straight into one repo, never noticing the bug is in a shared library three repos over.</p><p>So every Sourcegraph search begins with an org-wide prefix — never a bare query:</p><p>// Always do this</p><p>repo:^github\.com/&lt;your-org&gt;/ &lt;token-from-jira&gt;</p><p>// Only after Step 2 confirms a code hit</p><p>repo:^github\.com/&lt;your-org&gt;/&lt;specific-repo&gt; lang:java &lt;symbol&gt;</p><p>The workflow file spells out the exact MCP call sequence the agent must follow:</p><p>// Step 2a — discover all repos in the org</p><p>list_repos({ query: “&lt;your-product-prefix&gt;”, limit: 50 })</p><p>// Step 2c — confirm code ownership for each token from the ticket</p><p>keyword_search({</p><p>query: “repo:^github\\.com/&lt;your-org&gt;/ &lt;token&gt; lang:java”</p><p>})</p><p>// Step 2c — read surrounding context before citing</p><p>read_file({</p><p>repo: “github.com/&lt;your-org&gt;/&lt;repo-name&gt;”,</p><p>path: “src/main/java/…/SomeService.java”,</p><p>revision: “dev”</p><p>})</p><p>The agent discovers the candidate repository set empirically — by asking Sourcegraph what code actually mentions the symptom — before narrowing. No hard-coded ownership map. No guessing.</p><h3>Rule 2: Confirmed repos drive everything downstream</h3><p>A Sourcegraph hit alone isn’t enough. The agent must read_file and confirm the surrounding context is relevant. Only repos that survive that confirmation step proceed to Datadog.</p><p>Datadog service: tags are then derived from the confirmed repo list, never guessed:</p><p>// Strip your project prefix to derive the service tag</p><p>GitHub repo: &lt;prefix&gt;_payments-api</p><p>Datadog service: payments-api</p><p>// And query Datadog only for those services</p><p>search_datadog_logs({</p><p>query: “service:payments-api env:prod status:error”,</p><p>from: “now-24h”,</p><p>to: “now”</p><p>})</p><p>This avoids the classic mistake of “let me just grep production logs and see what looks angry” — which always returns <em>something</em>, which is always misleading.</p><h3>Rule 3: Never claim root cause without evidence</h3><p>The single line in the system prompt that’s worth more than any model upgrade:</p><blockquote>Do not claim root cause without evidence from logs, traces, stack traces, or code references. If evidence is incomplete, label the result as a hypothesis and list missing evidence.</blockquote><p>In a recent UI defect run, the agent looked through 24 hours of logs and traces across the implicated services and found exactly nothing. Instead of inventing a backend story, it wrote:</p><blockquote>“This is a client-side defect; no backend footprint is expected, and none was found in the resolved time window (now-24h → now). Root cause confirmed by code inspection in &lt;file&gt;:&lt;line-range&gt;, not by logs.&quot;</blockquote><p>That single honest sentence saved the assigned developer from chasing a server-side ghost.</p><h3>Rule 4: Jira writes are comment-only — at every stage</h3><p>Agents that can mutate ticket descriptions, statuses, assignees, or labels become organisational hazards. They overwrite the QA reporter’s careful repro steps. They reassign tickets to themselves.</p><p>So the skill is configured to use exactly one Jira write tool, hard-coded in the rule:</p><blockquote>The only Jira write tool permitted is addCommentToJiraIssue (or its MCP equivalent). Do not call updateJiraIssue, editJiraIssue, setJiraIssueField, or any other field-mutation MCP tool — at any stage — under any circumstance.</blockquote><p>If the fix changes the world, the world hears about it in a new comment. The original ticket stays pristine.</p><h3>Rule 5: Comments auto-post; PRs do not</h3><p>The asymmetric approval gate is the single most important design decision in the whole skill. Cheap actions auto-execute; expensive actions require explicit confirmation.</p><p>COMMENTS PULL REQUESTS</p><p>──────── ─────────────</p><p>Cheap — easy to delete Expensive — notifies reviewers,</p><p>consumes attention, kicks off CI</p><p>Auto-posted, no gate Hard approval gate: must hear</p><p>“raise a PR” / “fix this” in</p><p>the current message</p><p>If wrong, human edits/deletes If wrong, team learns to ignore</p><p>the agent</p><p>Analysis runs (steps 1–6) never trigger code changes. Even when the root cause is obvious. Even when the fix is one line. This asymmetry is what makes the agent safe to leave running in chat all day.</p><h3>Rule 6: Project conventions are loaded — never invented</h3><p>Before the agent writes any code, it pulls the target repository’s .github/copilot-instructions.md and every .github/instructions/*.md from the integration branch:</p><p>read_file({</p><p>repo: “github.com/&lt;your-org&gt;/&lt;repo&gt;”,</p><p>path: “.github/copilot-instructions.md”,</p><p>revision: “dev”</p><p>})</p><p>read_file({</p><p>repo: “github.com/&lt;your-org&gt;/&lt;repo&gt;”,</p><p>path: “.github/instructions/logging.md”,</p><p>revision: “dev”</p><p>})</p><p>Those files are treated as authoritative project guidance. When they conflict with anything else, the precedence is explicit:</p><ol><li>The repo’s own Copilot instructions win for architecture, layering, domain naming, logging conventions, error handling, test structure.</li><li>The coding-standards skill wins for syntactic rules that tooling can enforce (.editorconfig, ESLint, tsconfig, Checkstyle, Spotless).</li><li>Neighbouring already-merged code wins when neither speaks to the question.</li></ol><p>The agent then produces a ### Copilot instructions applied block in chat, naming the files loaded and the rules that influenced the edit. If you reviewed the PR, you can audit <em>why</em> the agent shaped the code the way it did.</p><p>If a repository has no Copilot instructions, the skill states this explicitly:</p><p>### Copilot instructions applied</p><p>&lt;repo&gt;: no .github/copilot-instructions.md on dev —</p><p>neighbouring code used as fallback.</p><p>Never invented. That’s the rule.</p><h3>Rule 7: Mandatory Copilot code review between push and Jira fix-comment</h3><p>After the PR opens, but before the agent posts a fix summary to Jira, it requests a <a href="https://docs.github.com/en/copilot/using-github-copilot/code-review">GitHub Copilot code review</a> on the PR:</p><p>gh pr edit &lt;PR-number&gt; — repo &lt;owner&gt;/&lt;repo&gt; — add-reviewer Copilot</p><p>Then it polls for up to five minutes (every 30 seconds), using the public GitHub REST API:</p><p><em># PR-level reviews</em></p><p>gh api repos/&lt;owner&gt;/&lt;repo&gt;/pulls/&lt;PR-number&gt;/reviews \</p><p>— jq ‘.[] | select(</p><p>.user.login == “Copilot” or</p><p>.user.login == “copilot-pull-request-reviewer[bot]”</p><p>) | { state, submitted_at, body }’</p><p><em># Inline review comments</em></p><p>gh api repos/&lt;owner&gt;/&lt;repo&gt;/pulls/&lt;PR-number&gt;/comments \</p><p>— jq ‘.[] | select(</p><p>.user.login == “Copilot” or</p><p>.user.login == “copilot-pull-request-reviewer[bot]”</p><p>) | { path, line, body }’</p><p>The findings are surfaced in chat under a mandatory section, with every comment triaged into a severity bucket:</p><p><strong>### Copilot code review</strong></p><p>- <strong>**Overall verdict:**</strong> COMMENTED</p><p>- <strong>**PR-level summary:**</strong> &lt;verbatim from Copilot&gt;</p><p>| File | Line | Severity | Comment | Recommended action |</p><p>| — — — — — — — | — — — | — — — — — — — | — — — — — — — — — — — | — — — — — — — — — — — — |</p><p>| Foo.java | 42 | 🔴 critical | “Possible NPE…” | <strong>**fix now**</strong> |</p><p>| Bar.spec.ts | 15 | 🟡 suggestion| “Consider edge…” | <strong>**defer to reviewer**</strong> |</p><p>| Baz.html | 7 | 🟢 nit | “Prefer template…” | <strong>**dismiss with reason**</strong>|</p><p>The agent never auto-applies Copilot’s suggestions. They’re surfaced; the human decides. The exception: if the user explicitly says <em>“apply Copilot’s suggestions”</em> in the current message, the agent commits a follow-up:</p><p>chore: address Copilot review comments (&lt;JIRA-KEY&gt;)</p><p>That’s the only way auto-edits land on a branch that has already been opened for review.</p><h3>Rule 8: Sensitive data never leaves the agent</h3><p>Bearer tokens, API keys, full JWTs, bulk identifiers (think VINs, customer IDs, account numbers) — none of it ever lands in Jira or chat output. The system prompt is explicit:</p><blockquote>Do not include secrets, bearer tokens, API keys, full JWTs, or bulk raw identifiers in chat or Jira output. Summarise and redact.</blockquote><p>The agent is allowed to <em>reason about</em> the existence of an identifier — <em>“the request carried a vehicle identifier in the path”</em> — but never to <em>paste</em> one.</p><h3>What does the code-fix sub-workflow look like?</h3><p>When the user says <em>“raise a PR”</em>, the agent runs steps 7a–7g. Branch naming, commit format, and PR body are all standardised:</p><p><em># 7d — branch &amp; commit</em></p><p>git checkout -b fix/PROJECT-1234-short-kebab-description</p><p><em># On PowerShell, write commit message to a temp file (heredocs aren’t supported)</em></p><p>git add path/to/file path/to/file.spec</p><p>git commit -F .git/COMMIT_MSG_PROJECT-1234.txt</p><p>The commit message format is enforced by the workflow:</p><p>fix: &lt;short imperative summary&gt; (PROJECT-1234)</p><p>&lt;paragraph explaining what was broken and why&gt;</p><p>Changes:</p><p>- &lt;file&gt;: &lt;what changed and why&gt;</p><p>- &lt;file&gt;: &lt;what changed and why&gt;</p><p>Expected: &lt;measurable outcome&gt;</p><p>And the PR open is the single hard gate — the agent must show the proposed title, base branch, reviewers, and body, then ask for confirmation before this call lands:</p><p>gh pr create \</p><p>— repo &lt;owner&gt;/&lt;repo&gt; \</p><p>— base dev \</p><p>— title “fix: &lt;summary&gt; (PROJECT-1234)” \</p><p>— body-file .git/PR_BODY_PROJECT-1234.md</p><p>If the user declines, the branch stays pushed and the agent hands back the compare URL so they can open it manually:</p><p>https://github.com/&lt;owner&gt;/&lt;repo&gt;/compare/dev...fix/PROJECT-1234-...?expand=1</p><h3>The coding-standards skill: never invent, always infer</h3><p>Before any commit, a second skill audits everything the agent has just written. Its hard rule:</p><blockquote>Never invent conventions. Read repo config first (.editorconfig, tsconfig.json, eslint.config.*, .eslintrc*, checkstyle.xml, pom.xml, .prettierrc*, .stylelintrc*, pyproject.toml). Only fall back to language defaults when nothing is configured.</blockquote><p>It batches findings into three buckets:</p><p>🟢 auto-fix Safe &amp; mechanical &amp; scoped to the diff. Apply immediately.</p><p>(rename a private local, add @Override, sort imports,</p><p>normalise indentation, drop wildcard imports)</p><p>🟡 confirm Safe locally but visible at the file boundary. Show</p><p>a one-line diff and ask the user before applying.</p><p>(cross-file private rename, template binding string,</p><p>SCSS class used in HTML)</p><p>🔴 surface only Would break callers or change public API. Do not edit.</p><p>(rename a public Java method, an exported TS symbol,</p><p>a DB column, a Liquibase changeset id, an HTTP route,</p><p>a Kafka topic, an Angular @Input/@Output)</p><p>The output is a mandatory ### Coding standards audit table in chat, naming the source-of-truth files and listing every finding. If the audit is clean, it&#39;s a one-liner. No invented opinions.</p><h3>The Jira comment template</h3><p>Every analysis ends with an auto-posted Jira comment that follows the same structure, so anyone reading the ticket sees a consistent format:</p><p><strong>## Defect analysis (AI-assisted)</strong></p><p><strong>**Issue:**</strong> PROJECT-1234 — &lt;one-line restatement&gt;</p><p><strong>### Summary</strong></p><p>- <strong>**Symptom:**</strong> …</p><p>- <strong>**Environment / window:**</strong> prod, last 24h (`now-24h → now`)</p><p>- <strong>**Impacted repositories:**</strong> &lt;list with primary vs secondary&gt;</p><p>- <strong>**Datadog by microservice:**</strong> &lt;table — service tag, query, outcome&gt;</p><p><strong>### Root cause</strong></p><p>❤–6 sentences&gt;</p><p><strong>### Evidence</strong></p><p>- <strong>**Logs / traces:**</strong> &lt;per service — short excerpt or “none”&gt;</p><p>- <strong>**Code:**</strong> `&lt;repo&gt;/&lt;path&gt;` — &lt;why this path explains the failure&gt;</p><p><strong>### Fix &amp; Pull Request</strong></p><p>- <strong>**Branch:**</strong> `fix/PROJECT-1234-short-description`</p><p>- <strong>**PR:**</strong> [PR #&lt;number&gt;](&lt;PR URL&gt;)</p><p>- <strong>**What was changed:**</strong> &lt;one-line summary&gt;</p><p>- <strong>**Verification:**</strong> &lt;repro steps to confirm after deploy&gt;</p><p><strong>### Copilot code review</strong></p><p>- <strong>**Verdict:**</strong> APPROVED / CHANGES_REQUESTED / COMMENTED / PENDING</p><p>- <strong>**Summary:**</strong> &lt;one-sentence summary&gt;</p><p>- <strong>**Inline comments addressed in this PR:**</strong> &lt;count, or “none”&gt;</p><p>- <strong>**Inline comments deferred to reviewer:**</strong> &lt;count, or “none”&gt;</p><p>- <strong>**Inline comments dismissed:**</strong> &lt;count, or “none”&gt;</p><p>cc @&lt;reporter&gt; @&lt;assignee&gt; — PR raised for review.</p><p>Please verify after merge to `dev`.</p><p>Structured. Predictable. Easy to skim. The QA reporter and the assigned developer both know exactly where to look.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b20d27c53964" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>