resource-limited-testing

Runs test suites, builds, and browser automation under memory and CPU caps on Linux and macOS.

Updated Aug 4, 2026
One-click install
npx skills add https://github.com/tschallacka/ai-skills --skill resource-limited-testing-tschallacka
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: resource-limited-testing
Source: https://github.com/tschallacka/ai-skills/tree/main/resource-limited-testing
Command: npx skills add https://github.com/tschallacka/ai-skills --skill resource-limited-testing-tschallacka

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires memlimit, cpulimit, and includes scripts (resource) components.

What problem does it solve? Heavyweight commands like full test suites, builds, static analyzers, and headless browsers can exhaust a machine's memory or CPU, causing the OS to kill unrelated processes or freeze the system. This Skill wraps such commands in a platform-appropriate resource cap so a runaway job cannot take down the rest of the machine. ## Core Features & Use Cases - Cross-platform wrapper: limited-run.sh <memory> <cpu> -- <command> uses a transient systemd user scope with MemoryMax and CPUQuota on Linux, and memlimit plus cpulimit on macOS. - Honest degradation: When no cap mechanism exists (e.g., macOS without memlimit), the wrapper warns, names the missing tool, and falls back to nice priority instead of pretending a limit is enforced. - Workload presets: Starting memory/CPU presets for unit tests, integration suites, builds, linters, and browser automation, plus guidance for wrapping child processes like browser drivers. - Use Case: Before running a full integration test suite that spawns a headless browser, invoke the wrapper with a 6G memory cap and 400% CPU quota so the suite cannot OOM the host. ## Quick Start Run my full test suite through the limited-run wrapper with a 6G memory cap and 400% CPU quota so it cannot exhaust this machine.

Frequently Asked Questions about resource-limited-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I limit memory usage of a test suite on Linux?▼

Run the suite through limited-run.sh, which wraps it in a transient systemd --user scope with MemoryMax, MemorySwapMax=0, and CPUQuota. For example, limited-run.sh 6G 400 -- ./run-tests.sh caps the whole process tree at 6 GB.

How do I cap RAM usage of a command on macOS?▼

On Apple Silicon macOS, the wrapper uses memlimit, which refuses allocations that would push real resident memory past the cap. Install it via the official installer script or Homebrew, then run limited-run.sh with your desired limit.

Does ulimit -v work as a memory limit on macOS?▼

No. ulimit -v (RLIMIT_AS) measures reserved virtual address space, not real RAM, and is rejected outright on Apple Silicon. The wrapper uses memlimit instead, which checks actual resident memory via phys_footprint.

Why is my wrapped process not limited when it starts a browser driver?▼

Each wrapper invocation is its own budget, and a separately started child process like a browser driver may escape the parent's cap. Start standalone child processes through limited-run.sh as well so they join their own capped scope.

What happens when no resource limit mechanism is available?▼

The wrapper warns that the memory limit is not enforced, names memlimit and how to install it, and degrades to nice priority plus optional cpulimit. In that state you should explain the limitation before running anything that could exhaust the machine.

Is nice the same as a CPU usage limit?▼

No. nice only changes scheduling priority, making the process yield to others; it does not cap CPU consumption. For a real limit use CPUQuota on Linux or cpulimit as a best-effort percentage throttle on macOS.