Agent skill
detecting-agent-environment
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.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/detecting-agent-environment
SKILL.md
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:
# 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:
-
Source environment detection
bashsource "$(dirname "$0")/detect-environment.sh" print_environment -
Use appropriate timeouts
bashTIMEOUT=$(get_timeout "npm_install") timeout $TIMEOUT npm install -
Provide clear output
bashecho "✅ Success message" echo "⚠️ Warning message" echo "❌ Error message" -
Exit with proper codes
bashexit 0 # Success exit 1 # Failure -
Log to .agent-tmp/
bashmkdir -p .agent-tmp command 2>&1 | tee .agent-tmp/command.log
Related Skills
Before creating scripts or PRs, see:
testing-pr-changesskill - Success criteria and testing workflowsagent-automation-infrastructureskill - 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.
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?