agentleFS
cirnecirne/agent-skills/skills/prod-error-fix/SKILL.md

prod-error-fix

Skill2 starsChanged 5 months agoMITView on GitHub

Triage New Relic errors in production or staging, pick the single highest-priority real failure, and fix it via /fix. Filters expected auth, not-found, validation, and abort errors. Use when the user asks to check prod/staging errors, fix a production error, triage NR APM, or invokes /prod-error-fix. Apply a repo prod-error-fix.local overlay when present.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Follow this skill first. Then read project New Relic config in this order.

    line 14
  2. Distinctive:

    Do not invent another repo’s app names.

    line 24
  3. Very specific:

    Default time window: SINCE 4 days ago.

    line 30
  4. Very specific:

    Run these in parallel with the resolved NRQL command.

    line 49
  5. Very specific:

    Add appName IN (…) or entity.name IN (…) once names are known.

    line 65
  6. Very specific:

    Use the stack and URI. If the overlay has a diagnosis table, use it.

    line 94
  7. Very specific:

    Follow /fix (and /fix.local when present):

    line 98

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Prod error fix (single highest-priority)

Find real production or staging failures in New Relic, pick one that most needs repair, then hand off to /fix. Do not commit unless the user asks.

Follow this skill first. Then read project New Relic config in this order; later sources override earlier ones on the same field:

  1. Project /newrelic — first file that exists:
    • .cursor/skills/newrelic/SKILL.md or .claude/skills/newrelic/SKILL.md
    • else .cursor/commands/newrelic.md or .claude/commands/newrelic.md
    • else .cursor/rules/newrelic.mdc This is the source for account id, app or entity names, the NRQL command, and where stacks live. A command or rule counts; do not require the folder to be named skills/.
  2. prod-error-fix.local — .cursor/skills/prod-error-fix.local/SKILL.md. Extra skips, diagnosis, and backlog. It may also override New Relic fields when /newrelic is silent or wrong for error triage.
  3. Defaults below, only for fields neither file sets.

Do not invent another repo’s app names. If none of those files exist, use defaults and say so.

Default user intent (use verbatim when no window is given):

check New Relic for errors in prod or staging from the last 4 days. if you find any, pick the one that most needs repair and /fix it. ignore spurious or expected errors such as legitimate authentication errors.

Default time window: SINCE 4 days ago.

Defaults (project /newrelic or the overlay may replace any row)

Take these from the project /newrelic instructions when they state them: account id, which apps are in scope for errors (production, then staging, including a browser app when one is named), the exact NRQL invocation, and the log or error attribute that holds a stack. Ignore unrelated telemetry (page-view counts, custom events, cost). Browser errors are in scope.

SettingDefault
Account idNEW_RELIC_ACCOUNT_ID from the environment or repo .env. If unset, omit --accountId and let the CLI profile choose.
CredentialsNEW_RELIC_API_KEY (NRAK-…) in repo .env or the environment. A license key is not a query key. Source .env once if the shell has not: set -a && [ -f .env ] && . ./.env && set +a. Ask for a key only after a query fails.
App namesDo not hardcode. After the first successful query, SELECT uniques(appName) FROM Transaction SINCE 4 days ago LIMIT 30 and prefer names containing Production or Prod, then Staging.
NRQL commandFirst match: (1) overlay command, (2) pnpm run newrelic:nrql -- "<NRQL>" when package.json defines newrelic:nrql, (3) newrelic nrql query --accountId "$NEW_RELIC_ACCOUNT_ID" "<NRQL>" when the CLI exists (drop --accountId if the id is unset).
Stack tracesLog.error.stack (or error.stack on Log). TransactionError.stackTrace is null for the Node agent.
FixShared /fix, then the repo’s /fix.local if it exists.
VerifyShared /verify-this.
BacklogDiscover the repo’s tracker the way /backlog does (docs/README.md, AGENTS.md, GitHub issues, or whatever that repo already uses). Do not assume a markdown bug list.

Step 1 — Triage

Run these in parallel with the resolved NRQL command. Substitute the overlay’s appName list when it has one; otherwise drop the appName IN (…) clause on the first pass and add it after discovery.

# Backend exceptions — exclude synthetic HTTP status rows
<nrql> "SELECT count(*) FROM TransactionError WHERE error.message NOT LIKE 'HttpError%' AND error.class NOT IN ('AbortError') SINCE 4 days ago FACET error.message, appName LIMIT 30"

# Browser exceptions (same window). Use the browser appName from /newrelic when it names one.
<nrql> "SELECT count(*) FROM JavaScriptError SINCE 4 days ago FACET errorMessage, appName LIMIT 30"

# Top URIs for the leading real error (swap the message filter after the first pass)
<nrql> "SELECT count(*) FROM TransactionError WHERE error.message LIKE '%YOUR_ERROR%' SINCE 4 days ago FACET request.uri, appName LIMIT 20"

# Stack traces
<nrql> "SELECT timestamp, message, error.message, error.stack FROM Log WHERE error.stack IS NOT NULL AND error.message NOT LIKE 'HttpError%' SINCE 4 days ago LIMIT 5"

Add appName IN (…) or entity.name IN (…) once names are known.

Skip (expected / spurious)

PatternWhy skip
HttpError 401, 403Legit auth
HttpError 404Missing resource, probes, or stale links
HttpError 400Client validation
AbortError, The operation was abortedClient disconnect / timeout

The overlay may add more skips. Do not skip a class without evidence. If volume is high and a user route is affected, investigate.

Step 2 — Pick one new error

Skip anything already in the backlog. Before ranking, discover how this repo tracks work (shared /backlog: docs/README.md, AGENTS.md, then an existing tracker such as GitHub issues). Search that tracker for each candidate’s error message, class, and URI. If an item already covers it — open or closed — drop that candidate. Do not re-pick the same failure every session. Only stay on an existing item when the user names that id.

Rank what remains by user impact:

  1. Users hit it — a page, a browser error, or an API the UI calls — over background jobs
  2. Production over staging when prod is in scope
  3. Higher count in the window (same root cause)
  4. Uncaught / 500 over handled warnings
  5. Known systemic class named in the overlay — one fix may help many call sites; note siblings, do not fix them in this session

Pick exactly one that is not already tracked. Mention runners-up briefly, including any skipped because they are already filed. If every real error is already in the backlog, say so and stop. Do not file a duplicate or start a second fix.

Step 3 — Diagnose

Use the stack and URI. If the overlay has a diagnosis table, use it. Otherwise name the failing function and the input that produced the error, then hand off to /fix.

Step 4 — Fix

Follow /fix (and /fix.local when present):

  1. TDD — failing test (or eval if agent-shaped) that reproduces the failure mode
  2. Minimal fix — match local patterns
  3. Verify — /verify-this → VERIFIED / NOT VERIFIED / INCONCLUSIVE with evidence
  4. Commit — only when the user asks, via /commit

Step 5 — Report

## NR triage (last N days)
| Error | Count | App | URI | Skip? |
...

## Chosen error
[message, why highest priority]

## Root cause
[1–2 sentences]

## Fix
[files / pattern]

## Verification
VERIFIED | NOT VERIFIED | INCONCLUSIVE — [evidence]

## Not fixed (same class)
[sibling call sites left alone]

Step 6 — Backlog (after VERIFIED)

Record the fix in this repo’s tracker, using the same discovery as Step 2 (shared /backlog). That might be GitHub issues, an in-repo bug index, or something else. Do not invent a second system. Experimental, reverted, or INCONCLUSIVE fixes stay in the report only.

Related

  • Repo prod-error-fix.local when present
  • Shared /fix · /verify-this · /backlog · /commit

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.