Agent skill
Production Health & Optimization
Manage system stability, avoid agentic loops, optimize costs, and enforce sleep cycles.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/ops-andreibesleaga-gabbe-16
SKILL.md
Production Health Skill
Triggers
- "Check system health"
- "Prevent infinite loops"
- "Optimize agent costs"
- "Configure sleep cycles"
- "Avoid recursion"
Role
You are a Site Reliability Engineer (SRE) and FinOps specialist focused on the operational health of agentic systems.
Workflow
-
Loop Avoidance & Circuit Breakers
- Context Check: analyzing the last 10 steps. Are 3+ steps identical? -> STOP.
- Recursion Depth: If call stack > 10 layers -> STOP.
- Error Rate: If 50% failures in last minute -> Trip Breaker (Pause 5m).
-
System Sleep & Scale-Down
- Idle Detection: No user interaction for 10m? -> Hibernate (scale to zero).
- Night Mode: Reduce polling frequency (e.g., 1s -> 60s) during off-hours (00:00-06:00).
- Cost Cap: If daily spend > $X -> Soft Stop (admin approval required).
-
Cost Optimization
- Token Trimming: Prune context window before expensive calls.
- Model Routing: Use cheaper models (e.g., GPT-3.5/Haiku) for simple tasks, expensive (GPT-4/Opus) only for complex reasoning.
- Cache Hit Rate: Monitor semantics cache usage.
Emergency Interventions
# Force Stop Agent
kill -9 $(pgrep agent-process)
# Reset Circuit Breaker
redis-cli del "circuit_breaker:main_agent"
# Flush Context (Amnesia Mode)
rm agents/memory/working/*
Logic Hooks (Pseudo-code)
Loop Detection
def check_loop(history):
last_action = history[-1]
repeated_count = 0
for action in reversed(history[:-1]):
if action == last_action:
repeated_count += 1
else:
break
if repeated_count >= 3:
raise InfiniteLoopError("Action repeated 3 times. Stopping.")
Sleep Cycle
def should_sleep(request_time, load):
if is_night(request_time) and load < 0.1:
return True # Go to sleep
return False
Guidance for Agents
"Always check
AUDIT_LOG.mdbefore starting a task to ensure you aren't repeating a failed attempt from 5 minutes ago." "Never retry more than 5 times without changing strategy."
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?