Skip to content
Back to skills

Detecting Agent Environment

ASecurity

Utilities and patterns for detecting execution environment (CI/CD vs local, network access, available ports, timeouts). Use when you need to adapt scripts or workflows based on where the agent is running, or when creating helper scripts that need environment-aware behavior.

  • 666 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 8, 2026
toolsbashtestinggitci/cdperformance

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill detecting-agent-environment --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Detecting Agent Environment?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Detecting Agent Environment
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-detecting-agent-environment/badge)](https://www.skillsdirectory.com/skills/majiayu000-detecting-agent-environment)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: detecting-agent-environment
description: Utilities and patterns for detecting execution environment (CI/CD vs local, network access, available ports, timeouts). Use when you need to adapt scripts or workflows based on where the agent is running, or when creating helper scripts that need environment-aware behavior.
---

# Agent Helper Scripts

Utilities for GitHub Copilot agents working on Y-Not Radio site.

## Environment Detection

Use `detect-environment.sh` to adapt scripts to different environments:

```bash
# Source the utility
source bin/agent-helpers/detect-environment.sh

# Print environment info
print_environment

# Check environment
if detect_ci; then
  echo "Running in CI/CD"
  # Use optimized workflow
fi

if ! detect_network; then
  echo "Network restricted - cannot pull packages"
  exit 1
fi

# Get appropriate timeout
TIMEOUT=$(get_timeout "service_ready")
timeout $TIMEOUT bash -c 'until service_ready; do sleep 5; done'
```

## Creating New Helper Scripts

When creating helper scripts:

1. **Source environment detection**
   ```bash
   source "$(dirname "$0")/detect-environment.sh"
   print_environment
   ```

2. **Use appropriate timeouts**
   ```bash
   TIMEOUT=$(get_timeout "npm_install")
   timeout $TIMEOUT npm install
   ```

3. **Provide clear output**
   ```bash
   echo "✅ Success message"
   echo "⚠️  Warning message"
   echo "❌ Error message"
   ```

4. **Exit with proper codes**
   ```bash
   exit 0  # Success
   exit 1  # Failure
   ```

5. **Log to .agent-tmp/**
   ```bash
   mkdir -p .agent-tmp
   command 2>&1 | tee .agent-tmp/command.log
   ```

## Related Skills

Before creating scripts or PRs, see:

- `testing-pr-changes` skill - Success criteria and testing workflows
- `agent-automation-infrastructure` skill - Current automation state and pre-built images

## Performance Baselines

Scripts should respect these baselines:

| Operation | Expected | Warning | Failure |
|-----------|----------|---------|---------|
| Container start | < 60s | 60-120s | > 120s |
| npm install | < 120s | 120-300s | > 300s |
| Service ready | < 180s | 180-360s | > 360s |

If exceeding "Warning" thresholds, report performance issues in PR.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.