Write and review GC-safe C++ code for the Hermes VM runtime.
The material indicates this is an open-source prompt/rules-style skill with no required secrets and no declared network, code execution, or data access capabilities, so overall risk is low. The main uncertainty is on the supply-chain side: low community adoption, no declared license, and unknown maintenance status.
The material explicitly states that no keys or environment variables are required; as a prompt/rules-style skill, there is no visible path for credential collection, storage, transmission, or abuse.
No remote endpoints are declared, and the system flags it as prompt-only; based on the material, there is no indication of user data being sent to third-party services.
This skill is documentation/rules about GC-safe C++ coding in the Hermes VM and does not describe spawning local processes, executing scripts, or invoking system capabilities.
The material does not show any ability to read, modify, or write local files, project data, or other resources; it only provides coding/review guidance and does not request data-plane permissions.
A positive factor is that it points to an auditable open-source GitHub repository and the content aligns with the Facebook Hermes project context; however, the provided metadata shows no declared license, 0 stars, and unknown maintenance, so supply-chain trust still warrants caution.
Copy the install command and let the AI configure it · recommended for beginners
Please install the "gc-safe-coding" skill from askskill: 1. Download https://raw.githubusercontent.com/facebook/hermes/static_h/.claude/skills/gc-safe-coding/SKILL.md 2. Save it as ~/.claude/skills/gc-safe-coding/SKILL.md 3. Reload skills and tell me it's ready
Please review the following Hermes VM C++ code for GC-safety. Focus on safe usage of Handle, GCScope, PseudoHandle, CallResult, and calls to _RJS functions, then provide line-by-line fix suggestions.
Identifies potential GC-safety issues and provides fixes aligned with Hermes VM conventions.
Using Hermes VM GC-safe coding rules, help me implement C++ code that accesses JSObject and StringPrimitive in the runtime, ensuring Handle or other safe wrappers are used correctly around operations that may trigger GC.
Produces a GC-safe C++ example and explains the key safety protections.
The following code in lib/VM/ stores a HermesValue directly and continues using it after calling an _RJS function. Please refactor it according to Hermes VM GC-safe rules to avoid dangling references or issues from object movement.
Returns refactored safe code and explains why the original implementation violated GC-safety rules.
For the full explanation and rationale, see doc/GCSafeCoding.md.
A GC safepoint is either a GC heap allocation or a function call that might
transitively reach one (regular C heap allocations like malloc are not
safepoints). Any function that takes Runtime & or PointerBase &
may trigger GC, unless documented otherwise or named with _noalloc/_nogc.
Functions with _RJS suffix invoke JavaScript recursively and always trigger
GC.
All raw pointers and PseudoHandles to GC objects must be rooted before any
GC safepoint. PseudoHandle<T> is not a root — it is just as dangerous as
a raw pointer across a safepoint. The same applies to bare SymbolID values
extracted from a non-uniqued source (e.g., the SymbolID pulled out of the
Handle<SymbolID> returned by getSymbolHandleFromPrimitive for a
freshly-allocated StringPrimitive): once nothing roots it, the lookup-table
slot is reclaimed by freeUnmarkedSymbols during sweep. Pin via
PinnedValue<SymbolID>.
All new code must use Locals + PinnedValue<T>. Do not introduce new
GCScope instances or makeHandle() calls.
struct : public Locals {
PinnedValue<JSObject> obj;
PinnedValue<StringPrimitive> str;
PinnedValue<SymbolID> sym;
PinnedValue<> genericValue;
} lv;
LocalsRAII lraii(runtime, &lv);
lv.obj = std::move(*callResult);lv.obj.castAndSetHermesValue<JSObject>(hv);lv.obj = somePtr;lv.obj = nullptr;lv.obj.template castAndSetHermesValue<T>(hv);PinnedValue<T> implicitly converts to Handle<T>. Pass directly to functions
that accept Handle<T>.
Always check for exceptions before using the value:
auto result = someOperation_RJS(runtime, args);
if (LLVM_UNLIKELY(result == ExecutionStatus::EXCEPTION))
return ExecutionStatus::EXCEPTION;
lv.obj = std::move(*result);
Not every use of Handle<> needs to be converted to PinnedValue. The rule
"use Locals, not GCScope" applies to creating new rooted values — allocating
new PinnedHermesValue slots via makeHandle() or Handle<> constructors.
The following are not allocating new handles and do not need conversion:
vmcast<>(handle) — casts an existing handle to a different type. It does
not take Runtime & and does not allocate a GCScope slot. The result points
to the same PinnedHermesValue as the input.args.getArgHandle(n) — returns a handle pointing into the register
stack, which is already a root. No new allocation.Handle<> parameter — the handle was allocated by
the caller; the callee is just using it.Only flag handle usage when a new PinnedHermesValue slot is being
allocated (via makeHandle(), makeMutableHandle(), or Handle<>/
MutableHandle<> constructors that take Runtime &).
PseudoHandle<T> — must be stored in
a PinnedValue before any call that takes Runtime & or is _RJS.
Watch for multi-step creation patterns: if Foo::create() returns a
PseudoHandle and the next line calls Bar::create(runtime), the first
PseudoHandle is stale after the second allocation.
Equally watch for capture-via-deref: auto *x = vmcast<T>(*pinned) extracts
a raw pointer from a pinned location (e.g., a PinnedHermesValue * such as
a napi_value). The pinned slot stays GC-safe, but the local raw pointer
does not. Re-deref *pinned at each use site, or pin via PinnedValue<T>.…
Analyze hermesvm binary size changes and regressions across commit ranges.
Add new JSI Runtime features with Hermes and SynthTrace support.
Programmatically rewrite non-top Git commits without needing an interactive editor.
Guide for adding a new IR instruction to the Hermes compiler. Use when the user asks to add, create, or define a new IR instruction (Inst/Instruction) in the Hermes intermediate representation. Covers all required files and the patterns for each.
Get idiomatic Relay guidance for React code, debugging, and code reviews.
Write and run Markdown-driven end-to-end tests for Relay apps.
Apply modern, safe, idiomatic C++ standards for writing, review, and refactoring.
Write, review, and refactor C++ with modern, safe, idiomatic standards.
Give AI coding agents persistent cross-session memory that survives context resets.
Attach to live C++ processes and inspect memory for debugging.
Build secure, observable, enterprise-ready MCP services and tools in C++.