Agent skill

RustPython C-API Expansion

by RustPython in RustPython/RustPython

Implements missing CPython C-API functions in RustPython's crates/capi, mapping each header to its module with the pyo3-ffi header split.

MITAuto-check passedDevelopment

Install RustPython C-API Expansion

skills CLI
$ npx skills add RustPython/RustPython --skill rustpython-capi-expansion -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install RustPython/RustPython rustpython-capi-expansion --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/RustPython/RustPython.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/rustpython-capi-expansion .claude/skills/rustpython-capi-expansion && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
rustpython-capi-expansion
GitHub stars
22k
Token cost
~831 tokens
SKILL.md length
393 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

Implements missing CPython C-API functions in RustPython's crates/capi, mapping each header to its module with the pyo3-ffi header split.

  • Works in 10 steps: Identify requested missing APIs from the… → Open nearby capi modules in… → Implement only the requested functions… → …
  • Porting missing C-API functions from a CPython header into RustPython
  • SKILL.md covers Source of truth for target files, Implementation workflow, Testing rules and Style rules, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

The skill maps a requested C-API header to a target file using the pyo3-ffi/src layout, which mirrors the CPython header split: setobject.h goes to crates/capi/src/setobject.rs, dictobject.h to dictobject.rs and unicodeobject.h to unicodeobject.rs. It forbids inventing other target modules, and a missing target file is created and wired into crates/capi/src/lib.rs.

The workflow identifies the missing functions and their header, follows the style of neighboring capi modules, implements only the requested functions, keeps behavior aligned with CPython's contracts and reuses rustpython-vm functionality instead of re-implementing it, making a private VM helper public with a minimal change when needed. It prefers direct contract assumptions over defensive null checks unless local style asks for them, exposes only the ABI-stable surface needed for abi3 and abi3t, and adds basic tests that use pyo3 as a safe wrapper, run from crates/capi with targeted filters first.

When your agent uses it

  • Porting missing C-API functions from a CPython header into RustPython
  • Adding capi tests for newly implemented functions
  • Deciding which crates/capi file a given C-API function belongs in

Example prompts

  • “Add the missing set object functions from setobject.h to RustPython's capi crate.”
  • “Port the dict API functions from dictobject.h and add basic tests.”
  • “Which file in crates/capi should the unicodeobject.h functions go in?”

Requirements

  • A checkout of the RustPython repository
  • A Rust toolchain

Workflow steps

10 steps, taken from the first numbered list in SKILL.md.

  1. Identify requested missing APIs from the user request and their originating C API header.
  2. Open nearby capi modules in crates/capi/src/ and follow existing style and patterns.
  3. Implement only the requested functions in the mapped target file.
  4. Keep behavior aligned with CPython C-API contracts.
  5. Prefer using existing rustpython-vm functionality as much as possible instead of re-implementing behavior in capi.
  6. If a needed rustpython-vm helper exists but is private, make it public with a minimal, focused visibility change.
  7. Prefer direct contract assumptions over defensive null checks unless required by the established local style.
  8. Add basic tests only; do not overfit with very specific edge-case clutter.
  9. In tests, use pyo3 only as a safe wrapper over the API. Avoid raw pointer-heavy direct FFI-style tests.
  10. Run tests from crates/capi.

What it can do on your machine

Read from SKILL.md and the folder at commit 4b6ad58. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

RustPython C-API Expansion loads about 831 tokens when it runs. Until then it costs about 81 tokens; SKILL.md has 393 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~81
When it runs · the whole SKILL.md, loaded when a task matches
~831

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from RustPython/RustPython at commit 4b6ad58, republished under its MIT licence (© RustPython). 393 words, ~831 tokens.

Download SKILL.mdSave it as .claude/skills/rustpython-capi-expansion/SKILL.md (or your agent's skills folder).
name
rustpython-capi-expansion
description
Implement missing RustPython C-API functions in crates/capi using the pyo3-ffi header split mapping (`pyo3-ffi/src/*.rs`, mirroring CPython C API headers). Use this whenever the user asks to add or port C-API functions (for example from setobject.h, dictobject.h, unicodeobject.h) or add capi tests.

RustPython C-API Expansion

Use this workflow for adding missing C-API functions to RustPython.

Source of truth for target files

  • Use this mapping source: pyo3-ffi/src/*.rs, which mirrors the CPython header split used by the C API.
  • Map requested header APIs to crates/capi/src/<header_basename>.rs using that split. Examples:
    • setobject.h -> crates/capi/src/setobject.rs
    • dictobject.h -> crates/capi/src/dictobject.rs
    • unicodeobject.h -> crates/capi/src/unicodeobject.rs
  • Do not invent alternate target modules when the header split implies a direct target.
  • If the target file is not present yet, create it and wire it in crates/capi/src/lib.rs.

Implementation workflow

  1. Identify requested missing APIs from the user request and their originating C API header.
  2. Open nearby capi modules in crates/capi/src/ and follow existing style and patterns.
  3. Implement only the requested functions in the mapped target file.
  4. Keep behavior aligned with CPython C-API contracts.
  5. Prefer using existing rustpython-vm functionality as much as possible instead of re-implementing behavior in capi.
  6. If a needed rustpython-vm helper exists but is private, make it public with a minimal, focused visibility change.
  7. Prefer direct contract assumptions over defensive null checks unless required by the established local style.
  8. Add basic tests only; do not overfit with very specific edge-case clutter.
  9. In tests, use pyo3 only as a safe wrapper over the API. Avoid raw pointer-heavy direct FFI-style tests.
  10. Run tests from crates/capi.

Testing rules

  • Run test commands with working directory set to crates/capi.
  • Prefer targeted tests first (module/function filter), then broader capi tests if needed.
  • Keep test names concise (no required test_ prefix).
Show full SKILL.md (145 more words)Show less

Style rules

  • Follow existing RustPython capi coding style in neighboring files.
  • Reuse rustpython-vm methods and types first; avoid duplicating VM logic in capi wrappers.
  • When exposing previously private VM helpers, keep the API surface minimal and avoid unrelated refactors.
  • Only expose and implement ABI-stable C-API surface needed for abi3 / abi3t.
  • Add comments only when they explain non-obvious behavior.
  • Keep edits minimal and focused on requested API expansion.

Completion checklist

  • All requested functions implemented in mapped target file.
  • New module exported in crates/capi/src/lib.rs when applicable.
  • Basic safe-wrapper pyo3 tests added/updated.
  • Tests executed from crates/capi and passing for changed area.
  • Final response includes changed file paths and test command summary.

Example prompts this skill should handle

  • "Implement these missing functions from dictobject.h."
  • "Add setobject.h C-API functions in RustPython and include basic tests."
  • "Port the listed unicodeobject.h APIs in capi, follow existing style, and run tests from crates/capi."

© RustPython, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/rustpython-capi-expansion of RustPython/RustPython.

Open the folder on GitHubat commit 4b6ad58

Compare with similar skills

RustPython C-API Expansion next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

RustPython C-API Expansion compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
RustPython C-API Expansion this skillRustPython/RustPython22k—~831Automated safety check: PassMIT
Test Specialisttravisjneuman/.claude101—~3.7kAutomated safety check: PassMIT
Validationjosstei/maestro-orchestrate465—~2.3kAutomated safety check: PassApache-2.0
Pump Testingnirholas/pump-fun-sdk133—~706Automated safety check: PassCustom licence
Polyglot Test Agentboshi-xixixi/TraeSkill274—~1.7kAutomated safety check: PassMIT
Kedro Babysitkedro-org/kedro11k—~4kAutomated safety check: PassCustom licence

Similar skills

  • Test Specialist

    travisjneuman/.claude

    Test-writing patterns for JS/TS, Python, Go, and Rust (unit, integration, E2E, visual regression).

    101 GitHub stars~3.7k tokensUpdated today
    Testing & QAAuto-check passed
  • Validation

    josstei/maestro-orchestrate

    Cross-cutting validation methodology for verifying phase outputs and project integrity

    465 GitHub stars~2.3k tokensUpdated today
    Testing & QAAuto-check passed
  • Pump Testing

    nirholas/pump-fun-sdk

    Multi-language test infrastructure for the Pump SDK — Rust unit/integration/security/performance tests, TypeScript Jest tests, Python fuzz tests, shell test orchestration, Criterion benchmarks, and…

    133 GitHub stars~706 tokensUpdated 18 days ago
    Testing & QAAuto-check passed
  • Polyglot Test Agent

    boshi-xixixi/TraeSkill

    Generates comprehensive, workable unit tests for any programming language using a multi-agent pipeline.

    274 GitHub stars~1.7k tokensUpdated 4 mo ago
    Testing & QAAuto-check passed
  • Kedro Babysit

    kedro-org/kedro

    Run Kedro's local lint / format / type-check / tests on changed files (uses the project's pre-commit hooks, ruff, mypy, pytest, lint-imports, detect-secrets, Make targets — in the right venv), or…

    11k GitHub stars~4k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Release Skills

    nexmoe/eve

    Universal release workflow. An agent skill from nexmoe/eve.

    421 GitHub starsUsed in 3 repos~3.3k tokens
    DevelopmentAuto-check passed

More from RustPython/RustPython

  • Apple Container Test Runner

    RustPython/RustPython

    Runs RustPython tests inside a Linux container built with Apple's container CLI, so macOS users can compare Linux results with their local ones.

    22k GitHub stars~467 tokensUpdated today
    Auto-check passed
  • RustPython Stdlib Upgrade

    RustPython/RustPython

    Upgrades a Python standard library module from CPython into RustPython with update_lib, then triages and marks the tests that still fail.

    22k GitHub stars~876 tokensUpdated today
    Auto-check passed
  • Investigates a failing RustPython test by comparing it with CPython, then either fixes it or gathers the details for an incompatibility report.

    22k GitHub stars~467 tokensUpdated today
    Auto-check passed
  • Picks the next CPython standard library module ready for a RustPython upgrade, skipping modules that already have an open upgrade pull request.

    22k GitHub stars~257 tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about RustPython C-API Expansion

What does RustPython C-API Expansion do?

Implements missing CPython C-API functions in RustPython's crates/capi, mapping each header to its module with the pyo3-ffi header split. rs.rs.

When should I use RustPython C-API Expansion?

RustPython C-API Expansion fits situations like: porting missing C-API functions from a CPython header into RustPython; adding capi tests for newly implemented functions; deciding which crates/capi file a given C-API function belongs in.

How do I install RustPython C-API Expansion in Claude Code?

Run `npx skills add RustPython/RustPython --skill rustpython-capi-expansion -a claude-code`. Or copy the skill folder (.agents/skills/rustpython-capi-expansion in RustPython/RustPython) into .claude/skills/rustpython-capi-expansion in your project. Claude Code loads it when a task matches its description.

How do I install RustPython C-API Expansion in Codex?

Run `npx skills add RustPython/RustPython --skill rustpython-capi-expansion -a codex`. Or copy the skill folder (.agents/skills/rustpython-capi-expansion in RustPython/RustPython) into .agents/skills/rustpython-capi-expansion in your project. Codex loads it when a task matches its description.

Can I use RustPython C-API Expansion in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add RustPython/RustPython --skill rustpython-capi-expansion -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/rustpython-capi-expansion, .gemini/skills/rustpython-capi-expansion, .github/skills/rustpython-capi-expansion and .opencode/skills/rustpython-capi-expansion in your project.

What does RustPython C-API Expansion need to run?

SKILL.md names no scripts, command-line tools or credentials: RustPython C-API Expansion is instructions for the agent only. Our summary lists: A checkout of the RustPython repository; A Rust toolchain.

Does RustPython C-API Expansion access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is RustPython C-API Expansion safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does RustPython C-API Expansion use?

RustPython C-API Expansion is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does RustPython C-API Expansion use?

About 831 tokens (SKILL.md is roughly 3.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to RustPython C-API Expansion?

Skills that share tags, products or a category with RustPython C-API Expansion: Test Specialist (travisjneuman/.claude, 101 stars), Validation (josstei/maestro-orchestrate, 465 stars), Pump Testing (nirholas/pump-fun-sdk, 133 stars) and Polyglot Test Agent (boshi-xixixi/TraeSkill, 274 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains RustPython C-API Expansion?

RustPython (a GitHub organization) maintains it in RustPython/RustPython, which has 22,381 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on October 7, 2026.

Source: RustPython/RustPython on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.