agentleFS
jscott3201jscott3201/yet-more-skills/skills/rust-python-bindings/SKILL.md

rust-python-bindings

Skill4 starsChanged 2 months agoApache-2.0View on GitHub

Plan or implement a mixed Rust/Python binding change: map PyO3 contracts and select ownership, async, free-threading, buffer, or wheel checks. Use for the boundary as a whole, not pure Rust or pure Python work.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When installed, use the specialist that matches the work:

    line 19

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rust Python Bindings

Read local instructions, the actual PyO3/async-bridge/maturin versions, Python support policy, and build path. Keep language-independent behavior in Rust and conversion, Python exceptions, and Python-facing lifecycle in the binding. This entry is the map for a mixed task, not a requirement to invoke every specialist.

Map the exposed contract

Locate Cargo and Python manifests, workspace/default-member/excluded-crate status, module registration, public imports, stubs, interpreter selection, and existing tests. Separate distribution, Rust crate, and Python import names. A Rust workspace gate cannot validate an excluded binding, Python behavior, or installed package contents.

For each changed crossing, identify owner and borrow duration, thread/loop affinity, mutation, conversions, errors, and cleanup. Preserve domain identity, units, precision, null/sentinel distinctions, and protocol side-effect semantics. Do not remove a correct owned copy just to claim zero-copy, retain borrowed Python references beyond attachment, or weaken safe-core policy for binding macros.

Select only relevant checks

When installed, use the specialist that matches the work:

ConcernSkill
Bound/Py ownership, pyclass borrows, conversions, exceptions, stubspyo3-ownership-errors
Tokio/asyncio, blocking wrappers, cancellation, close/droppyo3-async-lifecycle
Module declarations, shared state, post-import GIL, concurrencypyo3-free-threading
Boundary profiling, batching, NumPy/buffers, ownership and retentionpyo3-buffer-performance
Maturin, ABI, native wheels, sdist, installed typed consumerspyo3-wheel-release

They are optional depth, not mandatory dependencies. If unavailable, apply the relevant checks below and use primary documentation. Do not add new agents, model settings, approval rounds, or unrequested CI.

Baseline safeguards

Extract or retain valid owned inputs before detached/async work, then attach to use Python APIs. Attachment is not application mutual exclusion on GIL-disabled Python. Release borrow guards and core locks before reentrant callbacks. Since PyO3 0.28 module support defaults changed; neither adding nor omitting gil_used=false is proof of concurrency correctness.

Trace each runtime's owner, admission/close, task cancellation, callbacks, and final destruction. The async bridge can cancel its wrapped Rust future, but already-sent writes, independently spawned tasks, and blocking work have their own lifetime. Keep immediate abort distinct from graceful shutdown and finalizer behavior.

Validate the actual Python interface: exceptions, arguments/defaults, returned awaitables, context managers, top-level/submodule imports, and type consumers. For support claims use the intended interpreter and verify post-import GIL state. Stable ABI, free-threading, and subinterpreters are distinct promises.

Build and test an explicit installed wheel outside the checkout when packaging or release claims matter. Use native hosts/containers for promised platforms, not emulation/cross-compilation as substitute evidence. Coordinate build ownership and keep expensive matrices in established release lanes.

Report the change, Rust and Python checks separately, artifact and interpreter evidence, and unrun platform/concurrency cases. Read verification notes.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.