agentleFS
TJaenichenTJaenichen/claude-code-harness/skills/project/dd-errors/SKILL.md

dd-errors

Skill0 starsChanged 3 months agoMITView on GitHub

Query Datadog logs for recent errors, error rates, or specific exceptions.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If no arguments are provided, default to: API errors in the last 1 hour.

    line 32
  2. Distinctive:

    If search terms were provided, append them to the query string.

    line 76
  3. Distinctive:

    If no results: report "No errors found" clearly

    line 97
  4. Very specific:

    If the response contains a page.after cursor, mention there are more results available

    line 98
  5. Very specific:

    If DD_API_KEY or DD_APP_KEY are not set, report clearly: "Datadog API keys not configured.

    line 102
  6. Distinctive:

    If the API returns an error, show the error message

    line 103
  7. Distinctive:

    If curl fails (network issue), report the connection error

    line 104

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Query Datadog Errors

Arguments: $ARGUMENTS

Argument parsing

Parse the arguments flexibly. They can appear in any order:

ArgumentDetectionDefault
ServiceMatches a known service alias (see table below)api
Time rangeMatches pattern like 1h, 30m, 24h, 7d1h
Search termsAnything else — added to the Datadog query as-is(none)

Service aliases

AliasDatadog service name
apiContoso.Payments.API
webContoso.Web.Presentation
depositContoso.Deposit.API

Adjust this table to your own service names; the alias is just a short handle for the prompt.

If no arguments are provided, default to: API errors in the last 1 hour.

Examples

  • /dd-errors → API errors, last 1h
  • /dd-errors deposit 24h → Contoso.Deposit.API errors, last 24h
  • /dd-errors api 4h OperationCanceledException → API errors matching that exception, last 4h
  • /dd-errors 30m NullReferenceException → API errors (default) with that search term, last 30m
  • /dd-errors deposit 7d GetCustomerAccountInfo → Contoso.Deposit.API, last 7 days, matching that method

API call

Build and execute a POST request to the Datadog EU Logs Search API.

Endpoint: https://api.datadoghq.eu/api/v2/logs/events/search

Authentication (via environment variables — use printenv not direct expansion):

DD-API-KEY: $(printenv DD_API_KEY)
DD-APPLICATION-KEY: $(printenv DD_APP_KEY)

Required flags: -s -k (silent + skip SSL verification for corporate proxy)

Request body:

{
  "filter": {
    "query": "<build query below>",
    "from": "now-<timerange>",
    "to": "now"
  },
  "sort": "-timestamp",
  "page": {"limit": 25}
}

Building the query

Always include:

  • service:<datadog service name>
  • @Properties.EnvironmentName:Production
  • -status:(info OR warn) (excludes info and warn — shows errors only)

If search terms were provided, append them to the query string.

Example query: -status:(info OR warn) @Properties.EnvironmentName:Production service:Contoso.Payments.API OperationCanceledException

Important: use a temp file for the JSON body

To avoid shell escaping issues, write the JSON body to a temp file and use -d @file:

# Write JSON to temp file, then curl with -d @file

Output formatting

Parse the JSON response and present a clean summary:

  1. Header: Service name, time range, total matches found
  2. Error table (for each log entry):
    • Timestamp (converted to local-friendly format)
    • Status/level
    • Message (first 120 chars, trimmed)
    • Host (if available)
  3. If no results: report "No errors found" clearly
  4. If the response contains a page.after cursor, mention there are more results available

Error handling

  • If DD_API_KEY or DD_APP_KEY are not set, report clearly: "Datadog API keys not configured. Set DD_API_KEY and DD_APP_KEY environment variables."
  • If the API returns an error, show the error message
  • If curl fails (network issue), report the connection error

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.