subprocess-safety

subprocess-safety is a skill for Claude Code, Codex from ZaxbyHub/opencode-swarm. It costs 61 tokens per session (2,435 once invoked), scanned A, original, MIT.

A set of rules for safely running subprocesses, which are programs started by another program. It applies to code that uses functions such as spawn or child_process.

In plain words
What is it for?
Use it when adding, changing, or reviewing code that starts child processes, including Git tools, hooks, services, plugins, and tests that depend on subprocesses.
Why use it?
It helps prevent subprocesses from hanging, running in the wrong folder, or leaving resources behind. It also addresses Windows compatibility and makes subprocess code easier to test.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents); mentions AGENTS.md; mentions Codex.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { _internals } from '../../src/utils/gitignore-warning';.

Good fit Use it when adding, changing, or reviewing code that starts child processes, including Git tools, hooks, services, plugins, and tests that depend on subprocesses.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/ZaxbyHub/opencode-swarm
agentmods
npx agentmods add skills/zaxbyhub/opencode-swarm/subprocess-safety

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for subprocess-safety

README.md
[![agentmods](https://agentmods.dev/badge/skills/zaxbyhub/opencode-swarm/subprocess-safety/github.svg)](https://agentmods.dev/skills/zaxbyhub/opencode-swarm/subprocess-safety)
Your own site
<a href="https://agentmods.dev/skills/zaxbyhub/opencode-swarm/subprocess-safety"><img src="https://agentmods.dev/badge/skills/zaxbyhub/opencode-swarm/subprocess-safety/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for subprocess-safety

Your own site · 80×15
<a href="https://agentmods.dev/skills/zaxbyhub/opencode-swarm/subprocess-safety"><img src="https://agentmods.dev/badge/skills/zaxbyhub/opencode-swarm/subprocess-safety.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,435 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Agent Snooping · line 13
    Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.
    Fix: Remove all code or instructions that list or read other skills' files or directories. Skills should operate independently; cross-skill access is a privilege escalation.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00061 $0.02435
Opus 5.5 $0.00024 $0.00974
Sonnet 5.5 $0.00012 $0.00487
Haiku 4.5 $0.00006 $0.00244

Measured 1mo ago against content hash 4a307a67cfc0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

subprocess-safety scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

description: Guidelines for safe subprocess calls in opencode-swarm. Load before adding, modifying, or reviewing any file that calls spawn, spawnSync, bunSpawn, or child_process. Covers the six required properties, Windo
.agents/skills/subprocess-safety/SKILL.md · 214 lines

How it starts

The opening of the file, as written. The whole thing — 214 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Subprocess Safety

Read, in order:

  1. AGENTS.md (Invariant 3: subprocesses)
  2. docs/engineering-invariants.md (subsection 3)
  3. .agents/skills/writing-tests/SKILL.md if tests are touched
  4. .agents/skills/mock-to-internals-migration/SKILL.md if converting mock.module to _internals

Codex-specific execution notes:

  • This skill consolidates AGENTS.md Invariant 3 into an actionable checklist.
  • The canonical spawn shape and six required properties are non-negotiable per AGENTS.md.
  • The CI quality job enforces these via bun run check:invariants (Check 1: subprocess timeout).
  • Violations are advisory in CI but blocking in code review.

When to use this skill

  • You are adding, modifying, or reviewing a subprocess call (bunSpawn, spawn, spawnSync, child_process.execFile, etc.)
  • You are writing or updating tests that exercise subprocess-dependent code
  • A PR review flags a subprocess call missing timeout, cwd, or cleanup

Scope

This skill applies to all files that spawn child processes:

  • src/utils/git*.ts
  • src/hooks/*.ts
  • src/tools/*.ts
  • src/services/*.ts
  • src/plugins/*.ts
  • src/index.ts (init-path subprocesses)
  • Any test file (tests/**) that stubs or exercises subprocess code

Canonical spawn shape

Every subprocess call MUST follow this pattern:

const PER_CALL_TIMEOUT_MS = 10_000; // module-level constant (choose an appropriate value)

const proc = bunSpawn(['git', '-C', dir, 'rev-parse', '--show-toplevel'], {
  stdin: 'ignore',
  cwd: dir,
  timeout: PER_CALL_TIMEOUT_MS,
  // stdout/stderr: piped, bounded, or ignored
});
try {
  const result = await proc;
  // process result
} finally {
  proc.kill(); // best-effort cleanup
}

Six required properties

Property Required Rationale
Array-form args Yes No shell-string commands (injection risk, quoting hell)
cwd or git -C Yes Never rely on inherited process.cwd()
stdin: 'ignore' Yes A never-closed stdin pipe under Bun/Windows can block child exit (v7.3.3)
timeout: <ms> Yes No subprocess is "always fast" on every platform
stdout/stderr bounded Yes Never leave piped stream unattended on long-running child
proc.kill() in finally Yes Outer withTimeout lets awaiter proceed but doesn't abort child

Read the full file on GitHub · 214 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed 4a307a67cfc0
  2. 1mo ago Changed · +1 lines cae534d27aaa
  3. 3mo ago First seen · 213 lines · 61 tokens per session scan A b675c2c2de60

Subscribe to this mod's changes

subprocess-safety is a skill published in the GitHub repository ZaxbyHub/opencode-swarm (549 stars, last pushed today), licensed MIT. It adds 61 tokens to every session and 2,435 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

subprocess-safety compared with skills from other repositories

subprocess-safety next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
subprocess-safetyZaxbyHub/opencode-swarmSkill549todayMITA61Claude Code, Codex
safeinstall-installMickdownunder/SafeInstallSkill34d agoMITA49Codex
safeinstall-setupMickdownunder/SafeInstallSkill34d agoMITA49Codex
safeinstall-checkMickdownunder/SafeInstallSkill34d agoMITA51Codex
safeinstall-statusMickdownunder/SafeInstallSkill34d agoMITA53Codex
repo-hygieneQwenLM/qwen-codeSkill31ktodayApache-2.0A48Claude Code, Codex
requirements-writermvschwarz/openrigSkill9.0ktodayApache-2.0A28Claude Code, Codex