alert-time-window-with-buffer
Compute a query time window that covers the alert plus a 30-min buffer by parsing startsAt from various schemas (Alertmanager nested, top-level…
Skill by kjuhwa
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/kjuhwa-alert-time-window-with-buffer
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/alert-time-window-with-buffer
What's inside
- Skill name
alert-time-window-with-buffer- Description
- Compute a query time window that covers the alert plus a 30-min buffer by parsing startsAt from various schemas (Alertmanager nested, top-level, annotations.timestamp), with a 60-min minimum and a sentinel "0001-01-01" guard.
- License
- MIT
- Instructions
- 41 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Alert Time Window with Buffer
## When to use
Your agent queries Loki/Datadog/Grafana with a `time_range_minutes` parameter. Use the alert's own start time so the window covers the relevant period, but add a buffer so context before and after the alert is included. Multiple alert schemas put the timestamp in different places.
## How it works
- Look for `startsAt` in three places: `alerts[0].startsAt` (Alertmanager nested), top-level `startsAt`/`timestamp`, then `annotations.timestamp`.
- Parse with `datetime.fromisoformat(starts_at.replace("Z", "+00:00"))` to handle the trailing-Z variant.
- Treat year `< 2000` as a zero-value sentinel ("0001-01-01" from Alertmanager when the field isn't populated).
- Window = `max(60, (now - alert_time_minutes) + 35)` so we always have at least an hour and always include 30+ min of post-alert context.
## Example
```python
def _alert_time_range_minutes(raw_alert):
starts_at = None
alerts = raw_alert.get("alerts", [])
if alerts and isinstance(alerts, list):
starts_at = alerts[0].get("startsAt")
if not starts_at:
starts_at = raw_alert.get("startsAt") or raw_alert.get("timestamp")
if not starts_at:
annotations = raw_alert.get("annotations") or raw_alert.get("commonAnnotations") or {}
starts_at = annotations.get("timestamp")
if not starts_at: return 60
try:
alert_time = datetime.fromisoformat(starts_at.replace("Z", "+00:00"))
if alert_time.year < 2000: # zero-value sentinel
return 60
minutes_ago = int((datetime.now(UTC) - alert_time).total_seconds() / 60)
return max(60, minutes_ago + 35) # 5 min pre + 30 min post buffer
except (ValueError, TypeError):
return 60
```
## Gotchas
- `datetime.fromisoformat` in Python 3.11+ handles offset suffixes; for older Pythons, replace `"Z"` with `"+00:00"` first.
- The minimum 60-min window matters — many backends (e.g. Loki) won't return useful data for a 1-min window even if the alert just fired.
- Always parse annotations as a fallback; some alert sources put `timestamp` only in the human-readable annotations section.From kjuhwa/skills-hub, MIT.
More from kjuhwa/skills-hub
- 0.409score
skills-hub
kjuhwa
Central skill/knowledge registry that syncs with kjuhwa/skills.git.
SkillDFreshness: DClaude Code +9 - 0.406score
langsmith-traceable-node-decorator-pattern
kjuhwa
Wrap each LangGraph node function with @traceable(name=...) so every step appears as a discrete child run in LangSmith, plus emit semantic LLM run_names via…
SkillDFreshness: DClaude Code +9 - 0.406score
llm-empty-plan-controller-fallback
kjuhwa
When a planning LLM returns an empty action list, force a deterministic verification action from a priority-ordered fallback list so the agent never spins on…
SkillDFreshness: DClaude Code +9 - 0.406score
anthropic-compatible-endpoint-swap
kjuhwa
Point the Claude Agent SDK at any Anthropic-compatible endpoint (OpenRouter, Vercel AI Gateway, Ollama, custom) by setting ANTHROPIC_BASE_URL +…
SkillDFreshness: DClaude Code +9 - 0.406score
bash-ast-permission-validator
kjuhwa
Validate agent bash commands by parsing them into an AST (bash-parser) and evaluating each subcommand of a pipeline/&&/|| chain against an allowlist, instead…
SkillDFreshness: DClaude Code +9 - 0.406score
claude-agent-sdk-multi-provider-bridge
kjuhwa
Drive non-Anthropic providers (OpenRouter, Ollama, Vercel AI Gateway, any Anthropic-compatible endpoint) through the Claude Agent SDK by swapping base URL +…
SkillDFreshness: DClaude Code +9 - 0.406score
evidence-driven-claim-validator
kjuhwa
Reject LLM-generated root-cause claims that aren't supported by the actual evidence dict — claim mentions "memory" but no host_metrics?
SkillDFreshness: DClaude Code +9 - 0.406score
fetch-interceptor-via-require-preload
kjuhwa
Patch globalThis.fetch in SDK subprocesses BEFORE the SDK captures it, by shipping a CJS interceptor bundle and loading it with node --require / bun --preload…
SkillDFreshness: DClaude Code +9 - 0.406score
healthy-short-circuit-skip-llm
kjuhwa
Bypass an expensive LLM diagnosis when an alert is provably healthy (resolved/info severity, no error annotations, evidence-investigated-and-empty), guarded…
SkillDFreshness: DClaude Code +9 - 0.406score
json-schema-from-python-signature
kjuhwa
Generate a JSON Schema for an LLM tool's input from a Python function signature using inspect + get_type_hints, mapping str→string, int→integer, list→array…
SkillDFreshness: DClaude Code +9 - 0.406score
langgraph-auth-inject-from-runnable-config
kjuhwa
Hydrate auth/user/org/thread/run identifiers into LangGraph state from the RunnableConfig at the very first node, so every downstream node sees a uniform…
SkillDFreshness: DClaude Code +9 - 0.406score
langgraph-compat-shim-import-path-preserved
kjuhwa
Keep a one-line import-shim module at an old path (e.g.
SkillDFreshness: DClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 17
- Last commit (this folder)
- Apr 24, 2026 (6 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/kjuhwa/skills-hub
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from kjuhwa
- 0.409score
skills-hub
kjuhwa
Central skill/knowledge registry that syncs with kjuhwa/skills.git.
SkillDFreshness: DClaude Code +9 - 0.406score
llm-empty-plan-controller-fallback
kjuhwa
When a planning LLM returns an empty action list, force a deterministic verification action from a priority-ordered fallback list so the agent never spins on…
SkillDFreshness: DClaude Code +9 - 0.406score
langsmith-traceable-node-decorator-pattern
kjuhwa
Wrap each LangGraph node function with @traceable(name=...) so every step appears as a discrete child run in LangSmith, plus emit semantic LLM run_names via…
SkillDFreshness: DClaude Code +9 - 0.406score
anthropic-compatible-endpoint-swap
kjuhwa
Point the Claude Agent SDK at any Anthropic-compatible endpoint (OpenRouter, Vercel AI Gateway, Ollama, custom) by setting ANTHROPIC_BASE_URL +…
SkillDFreshness: DClaude Code +9 - 0.406score
bash-ast-permission-validator
kjuhwa
Validate agent bash commands by parsing them into an AST (bash-parser) and evaluating each subcommand of a pipeline/&&/|| chain against an allowlist, instead…
SkillDFreshness: DClaude Code +9 - 0.406score
credential-cache-file-for-mcp-subprocess
kjuhwa
Write decrypted per-source credentials to a session-scoped .credential-cache.json on disk so MCP stdio subprocesses can read them without the parent passing…
SkillDFreshness: DClaude Code +9
Cite this page
alert-time-window-with-buffer skill. Agent Mart. https://agentmart.dev/skills/kjuhwa-alert-time-window-with-buffer (last updated 2026-10-24)