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.

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

Install

Getting it into your agent

There is no command for this one: it runs only inside a plugin, and the catalogue could not identify which plugin ships it. The source is linked below.

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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.00030 $0.01218
Sonnet 5 $0.00012 $0.00487
Haiku 4.5 $0.00006 $0.00244

Measured 6d ago against content hash b675c2c2de60, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 6d 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 · 213 lines

How it starts

The opening of the file, as written. The whole thing — 213 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. .opencode/skills/generated/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 · 213 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. 6d 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 (464 stars, last pushed yesterday), licensed MIT. It adds 61 tokens to every session and 2,435 once invoked, about $0.0003 per session on Opus 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

Other skills, from other repositories

ux-create-manifest

Create the initial Product UX Bible for an existing web or full-screen web app by deeply auditing the repository, using sub-agents when available, and generating docs/ux manifests, schemas, budgets, surface maps, action taxonomy, and design-token policies from observed code.

h0x91b/dev-3.0 · 58 tokens

ux-principal

Principal UX architect skill for deciding WHERE a UI feature belongs, before it is implemented. Reads and maintains docs/ux manifests, classifies the feature, decides placement, navigation, surface, action hierarchy and complexity budgets, and produces a precise implementation brief without coding unless explicitly…

h0x91b/dev-3.0 · 87 tokens

full_unpackd_rep

Use when the task is to unpack a local reference repository into a Chinese structural topic page, update site navigation, stamp dates, and leave behind a reusable deconstruction note for the repo.

Harzva/learn-likecc · 42 tokens

gen-zhihu-article

Generate Zhihu article in the style of 22-庖丁解牛专题页-知乎图文终版.md.

Harzva/learn-likecc · 32 tokens

loloop

Use when a task should advance through repeated plan-driven loop cycles for an engineering project, paper, or long-running repo change. loloop wraps the official /loop idea with the repo's loop-in-loop method: read the current plan, inspect prior evolution notes, execute the current iteration, write a new evolution…

Harzva/learn-likecc · 0 tokens

zhihu-publish

Use when the task is to publish a Zhihu article from Markdown using the local browser-automation pipeline in this repo. Covers the text-only publishing chain, the multimodal chain that uploads Markdown images into the Zhihu editor, cookie-based login checks, and choosing between the stable text script and the richer…

Harzva/learn-likecc · 69 tokens