Pattern detection

From akillness/jeo-skills · View interactive version

Pattern detection is an AI agent skill from the GitHub repository akillness/jeo-skills. Route repeated pattern, rule, and anomaly work into one detection packet before suggesting tools or fixes. Use when the user needs reusable scans, suspicious repeated shapes, grouped outlier candidates, or first-pass anomaly triage across code, logs/events, telemetry, and metric tables. Choose one p

How to use this skill

Skill file

Pattern Detection

When to use this skill

Do not use this skill as the main workflow when:

Core idea

pattern-detection should behave like a detection packet router, not a giant bag of regexes.

  1. Normalize the prompt into one primary detection packet.
  2. Pick the cheapest evidence mode that can surface trustworthy candidates.
  3. Return grouped findings with confidence and false-positive notes.
  4. Give one fastest validation step.
  5. Route out aggressively once the bottleneck becomes diagnosis, explanation, remediation, or operations.

Read these support docs before choosing the packet:

Instructions

Step 1: Normalize the request

Convert the prompt into this intake shape first:

pattern_detection_packet:
  primary_packet: text-prefilter | structural-code-rule | log-event-pattern | metric-anomaly
  evidence_shape: code | configs | logs | events | telemetry | tables | time-series | mixed | unknown
  detection_goal: repeated-shape | risky-structure | noisy-family | suspicious-spike | drift | outlier | rule-draft | shortlist
  grouping_key: file-path | symbol-shape | error-family | event-name | build-version | environment | browser-device | cohort | metric-segment | unknown
  trust_risk: broad-match | parser-drift | instrumentation-change | denominator-gap | seasonality | sample-size | none | mixed | unknown
  route_after: stay-here | log-analysis | data-analysis | codebase-search | security-best-practices | monitoring-observability | code-review

Choose one primary packet for the run. If two are plausible, pick the one that reduces uncertainty fastest.

Step 2: Choose the packet

| Packet | Use when | Best fits | Typical outputs |

|---|---|---|---|

| text-prefilter | You need a cheap first pass to narrow a big scope | TODO/FIXME clusters, repeated strings, suspicious config values, broad error families | candidate files/lines, counts, and next packet suggestion |

| structural-code-rule | Syntax or call shape matters more than plain text | risky API usage, duplicate branching/error shapes, migration candidates, rule drafts | grouped match families, exclusions, reusable rule idea |

| log-event-pattern | Repeated signals show up in logs or event records | noisy retries, browser/build splits, repeated errors, suspicious event families | grouped clusters, spread/count context, likely segmentation keys |

| metric-anomaly | The pattern lives in aggregates or time windows | KPI spikes/drops, retention or funnel anomalies, suspicious spend or telemetry shifts | suspicious segments/windows, baseline note, confidence and caveats |

Packet rules:

Step 3: Narrow the evidence before claiming a pattern

Apply at least one narrowing move before interpreting results:

Useful heuristics by packet:

Step 4: Surface grouped candidates, not a raw hit list

Use this order:

  1. Candidate family — what repeated shape or anomaly exists?
  2. Why it matters — correctness, reliability, security, cost, UX, or player/product impact
  3. Confidence — high / medium / low
  4. False-positive risk — what could make it misleading?
  5. Next check — the fastest validation or route-out

Do not silently turn detection into a full diagnosis, code rewrite, dashboard memo, or alert rollout.

Step 5: Use packet-specific heuristics

For `text-prefilter`
For `structural-code-rule`
For `log-event-pattern`
For `metric-anomaly`

Step 6: Return one compact detection brief

Default response shape:

## Detection brief
- Packet: text-prefilter | structural-code-rule | log-event-pattern | metric-anomaly
- Scope: [files / logs / rows / metrics / time window]
- Grouping key: [file family / symbol shape / error family / cohort / segment]
- Trust level: high | medium | low

## Candidate findings
1. [pattern family or anomaly]
   - Why it matters: ...
   - Confidence: high | medium | low
   - False-positive risk: ...
   - Next check: ...
2. ...

## Route-out
- stay here | log-analysis | data-analysis | codebase-search | security-best-practices | monitoring-observability | code-review

Keep it compact. The point is to leave the user with the smallest trustworthy shortlist, not a giant implementation memo.

Step 7: Route out aggressively

Switch when the next job is no longer first-pass detection:

If the evidence is too thin:

  1. mark confidence low
  2. ask for the smallest missing anchor only if required: scope, time window, grouping key, or baseline
  3. do not pretend certainty from one noisy excerpt or thin sample

Examples

Example 1: Repeated risky code shape

Prompt:

Scan this repo for repeated risky error-handling patterns and tell me what to inspect first.

Good response shape:

Example 2: KPI spike triage

Prompt:

We have a KPI spike in a CSV export. Is this pattern-detection or data-analysis?

Good response shape:

Example 3: Gameplay telemetry outliers

Prompt:

Look for suspicious gameplay telemetry outliers after yesterday's update.

Good response shape:

Example 4: Alert or anomaly?

Prompt:

We keep getting noisy anomaly alerts on one metric; should I debug the threshold, inspect the pattern, or write a dashboard summary?

Good response shape:

Best practices

  1. Start with the unit of evidence and grouping key, not the tool name.
  2. Use the cheapest trustworthy packet before escalating.
  3. Always include confidence, false-positive risk, and one next check.
  4. Group findings into candidate families, not raw hit lists.
  5. Distinguish detection from diagnosis, remediation, explanation, and alert operations.
  6. Treat parser, instrumentation, seasonality, and denominator issues as first-class caveats.
  7. Prefer reusable rule thinking when the same pattern is likely to recur.

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.