Agent skill

Add Python Function

by microbus-io in microbus-io/fabric

TRIGGER when user asks to add a Python-backed function endpoint to an existing Python-backed microservice.

Apache-2.0Auto-check passedBackend & APIs

Install Add Python Function

skills CLI
$ npx skills add microbus-io/fabric --skill add-python-function -a claude-code

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

GitHub CLI
$ gh skill install microbus-io/fabric add-python-function --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/microbus-io/fabric.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/python/add-python-function .claude/skills/add-python-function && 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
add-python-function
GitHub stars
172
Token cost
~1.3k tokens
SKILL.md length
500 words
Files
1
Skills in repo
33
Repo updated
First seen
Licence
Apache-2.0

At a glance

TRIGGER when user asks to add a Python-backed function endpoint to an existing Python-backed microservice.

  • Works in 6 steps: Verify the Microservice Is Python-Backed → Determine the Go Signature → Run add-function with Manual +… → …
  • User asks to add a Python-backed function endpoint to an existing Python-backed microservice
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Tasks that involve Microservices

What it does

Add Python Function is an agent skill from microbus-io/fabric. TRIGGER when user asks to add a Python-backed function endpoint to an existing Python-backed microservice.

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Microservices. It works with Python. The repository describes itself as: Microbus is the only fabric where every agentic workflow runs on a true microservice substrate - giving your workflows security, scale, observability, and prompt-driven authoring. The licence is Apache-2.0.

When your agent uses it

  • User asks to add a Python-backed function endpoint to an existing Python-backed microservice
  • Tasks that involve Microservices

Example prompts

  • “/add-python-function”

Requirements

  • Python 3

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Verify the Microservice Is Python-Backed
  2. Determine the Go Signature
  3. Run add-function with Manual + Tags("python")
  4. Replace the Handler Body with svc.venv.CallAndAwait
  5. Add the Python Function to service.py
  6. Housekeeping

What it can do on your machine

Read from SKILL.md and the folder at commit fb98098. 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 (its code samples are go and python).

    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

Add Python Function loads about 1.3k tokens when it runs. Until then it costs about 32 tokens; SKILL.md has 500 words of instructions outside code blocks.

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

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 microbus-io/fabric at commit fb98098, republished under its Apache-2.0 licence (© microbus-io). 500 words, ~1,306 tokens.

Download SKILL.mdSave it as .claude/skills/add-python-function/SKILL.md (or your agent's skills folder).
name
add-python-function
description
TRIGGER when user asks to add a Python-backed function endpoint to an existing Python-backed microservice.

CRITICAL: Read .claude/rules/python.txt before proceeding. It explains the Go-Python boundary, the manual-subscription pattern, args/result conventions, and how the in-process pyvenv module is wired into the microservice.

CRITICAL: Do NOT explore or analyze other microservices unless explicitly instructed to do so. The instructions in this skill are self-contained to this microservice.

Workflow

Copy this checklist and track your progress:

Adding a Python-backed function endpoint:
- [ ] Step 1: Verify the microservice is Python-backed
- [ ] Step 2: Determine the Go signature
- [ ] Step 3: Run add-function with Manual + Tags("python")
- [ ] Step 4: Replace the handler body with svc.venv.CallAndAwait
- [ ] Step 5: Add the Python function to service.py
- [ ] Step 6: Housekeeping
Step 1: Verify the Microservice Is Python-Backed

The microservice must already have python.go and a service.py at its root. If not, run add-python-microservice first (it works both for fresh microservices and for extending an existing one without overwriting business logic).

Step 2: Determine the Go Signature

Determine the Go signature of the function endpoint. The constraints from add-function apply (typed inputs and outputs, ctx context.Context first, err error last, etc.).

go
func MyFunction(ctx context.Context, input1 string, input2 int) (output1 float64, err error)

Python sees the inputs as a dict keyed by the field names in MyFunctionIn (driven by their json:"..." tags). The dict is passed to a Python function whose signature mirrors the Go one (excluding ctx).

Step 3: Run add-function with Manual + Tags("python")

Run the add-function skill, with these overrides applied as you reach each of its steps:

  • Step 7 (Declare the Endpoint in definition.go): add Manual: true and Tags: []string{"python"} to the define.Function var, so the endpoint is registered as a manual subscription tagged python and stays off the bus until the venv liveness callback activates the python-tagged group when Python is ready:

    go
    var MyFunction = define.Function{ // MARKER: MyFunction
        Host: Hostname, Method: "ANY", Route: "/my-function",
        Manual: true, Tags: []string{"python"},
        In: MyFunctionIn{}, Out: MyFunctionOut{},
    }
  • Step 8 (Generate the Boilerplate): run normally. genservice emits the sub.Manual() and sub.Tag("python") wiring into the generated intermediate.go, and scaffolds the handler stub in service.go and the test in service_test.go.

  • Step 9 (Implement the Logic in service.go): skip. Step 4 below replaces the generated stub's body.

  • Step 10 (Test the Function): run normally, then add a one-line opt-in HINT immediately after the app.RunInTest(t) line so a future reader can switch the test from mock-only to real-Python without hunting through docs:

    go
    app.RunInTest(t)
    
    // HINT: Uncomment to spin up real Python and exercise actual execution (slow on first run)
    // svc.StartPyVenv(ctx)
  • Step 11 (Housekeeping): skip; housekeeping runs once at the end of this skill instead.

When add-function finishes, return here for Step 4.

Show full SKILL.md (167 more words)Show less
Step 4: Replace the Handler Body with svc.venv.CallAndAwait

In service.go, replace the handler body that add-function left as a stub with a delegation to svc.venv.CallAndAwait. Pass MyFunctionIn directly as args (its json:"..." tags drive the wire format the Python function sees as a dict); the result is unmarshaled into the typed MyFunctionOut.

go
func (svc *Service) MyFunction(ctx context.Context, input1 string, input2 int) (output1 float64, err error) { // MARKER: MyFunction
    if svc.venv == nil || !svc.venv.Ready() {
        return 0, errors.New("venv not ready", http.StatusServiceUnavailable)
    }
    in := myserviceapi.MyFunctionIn{
        Input1: input1,
        Input2: input2,
    }
    var out myserviceapi.MyFunctionOut
    err = svc.venv.CallAndAwait(ctx, "my_function", in, &out)
    if err != nil {
        return 0, errors.Trace(err)
    }
    return out.Output1, nil
}

CallAndAwait is the synchronous shorthand: it does Call (which returns a callID and the Python work starts running) followed by Await(ctx, callID, &out) on the same goroutine. For a function endpoint the caller's ctx is the call's deadline; if it expires, the Python work keeps running until completion and the result eventually ages out of the cache.

Step 5: Add the Python Function to service.py

Append a Python function to service.py (at the microservice's root) whose name is the snake_case form of the Go function name, accepting a dict and returning a dict. The docstring is the same description text as the function's godoc on the Go side.

python
def my_function(args):  # MARKER: MyFunction
    """MyFunction does X."""
    input1 = args["input1"]
    input2 = args["input2"]
    # ... compute ...
    return {"output1": 42.0}
Step 6: Housekeeping

Follow the housekeeping skill.

© microbus-io, Apache-2.0. 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 .claude/skills/python/add-python-function of microbus-io/fabric.

Open the folder on GitHubat commit fb98098

Compare with similar skills

Add Python Function 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.

Add Python Function compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Add Python Function this skillmicrobus-io/fabric172—~1.3kAutomated safety check: PassApache-2.0
AWS Serverless Edazxkane/aws-skills3674 repos~3.2kAutomated safety check: PassMIT
Temporal Developerlatitude-dev/latitude-llm4.7k—~1.5kAutomated safety check: PassMIT
K8e Sandboxxiaods/k8e499—~6kAutomated safety check: PassApache-2.0
Temporal Developertemporalio/skill-temporal-developer230—~2.5kAutomated safety check: PassMIT
Intrinsic Core Service Authoringintrinsic-ai/intrinsic-core552—~2.2kAutomated safety check: PassApache-2.0

Similar skills

  • AWS Serverless Eda

    zxkane/aws-skills

    AWS serverless and event-driven architecture expert based on Well-Architected Framework.

    367 GitHub starsUsed in 4 repos~3.2k tokens
    Backend & APIsAuto-check passed
  • Temporal Developer

    latitude-dev/latitude-llm

    This skill should be used when the user asks to "create a Temporal workflow", "write a Temporal activity", "debug stuck workflow", "fix non-determinism error", "Temporal Python", "Temporal…

    4.7k GitHub stars~1.5k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • K8e Sandbox

    xiaods/k8e

    Run a goal end to end inside an isolated K8E sandbox pod (gVisor / Kata / Firecracker) instead of on the host: exec bash / Python / Node / TypeScript, install packages, move files in and out, reuse…

    499 GitHub stars~6k tokensUpdated 9 days ago
    Backend & APIsAuto-check passed
  • Temporal Developer

    temporalio/skill-temporal-developer

    Official

    Develop, debug, and manage Temporal applications across Python, TypeScript, Go, Java, .NET, Ruby, and Rust.

    230 GitHub stars~2.5k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Intrinsic Core Service Authoring

    intrinsic-ai/intrinsic-core

    Intrinsic Core microservice authoring, ServiceManifest definitions (realspec vs simspec), RuntimeContext port bindings (gRPC port 1 vs HTTP port 7), SIGTERM lifecycle handling, and .binpb sideloading.

    552 GitHub stars~2.2k tokensUpdated today
    Backend & APIsAuto-check passed
  • Fastapi Pro

    davila7/claude-code-templates

    Build high-performance async APIs with FastAPI, SQLAlchemy 2.0, and Pydantic V2.

    32k GitHub starsUsed in 7 repos~1.6k tokens
    Backend & APIsAuto-check passed

More from microbus-io/fabric

All 33 skills in this repo
  • Add Config

    microbus-io/fabric

    TRIGGER when user asks to add or modify a configuration property or setting, or to make a value configurable.

    172 GitHub stars~2.3k tokensUpdated 9 days ago
    Auto-check passed
  • Add Function

    microbus-io/fabric

    TRIGGER when user asks to add, create, or modify an API endpoint, function, or RPC, or a route that accepts typed arguments and returns typed results.

    172 GitHub stars~2.4k tokensUpdated 9 days ago
    Auto-check passed
  • Add Inbound Event

    microbus-io/fabric

    TRIGGER when user asks to listen for, subscribe to, or handle an event emitted by another microservice.

    172 GitHub stars~1.4k tokensUpdated 9 days ago
    Auto-check passed
  • Add Metric

    microbus-io/fabric

    TRIGGER when user asks to add or modify a metric, counter, gauge, or histogram, or to track/measure an operation.

    172 GitHub stars~1.5k tokensUpdated 9 days ago
    Auto-check passed
  • Add Outbound Event

    microbus-io/fabric

    TRIGGER when user asks to fire, emit, or publish an event that other microservices can subscribe to.

    172 GitHub stars~1.7k tokensUpdated 9 days ago
    Auto-check passed
  • Add Python Microservice

    microbus-io/fabric

    TRIGGER when user asks to create a microservice that calls Python, runs ML inference, or uses Python libraries (PyTorch, pandas, sentence-transformers, numpy) for its core compute.

    172 GitHub stars~1.1k tokensUpdated 9 days ago
    Auto-check passed

Works with

Categories

Questions about Add Python Function

What does Add Python Function do?

TRIGGER when user asks to add a Python-backed function endpoint to an existing Python-backed microservice. Add Python Function is an agent skill from microbus-io/fabric. TRIGGER when user asks to add a Python-backed function endpoint to an existing Python-backed microservice.

When should I use Add Python Function?

Add Python Function fits situations like: user asks to add a Python-backed function endpoint to an existing Python-backed microservice; tasks that involve Microservices.

How do I install Add Python Function in Claude Code?

Run `npx skills add microbus-io/fabric --skill add-python-function -a claude-code`. Or copy the skill folder (.claude/skills/python/add-python-function in microbus-io/fabric) into .claude/skills/add-python-function in your project. Claude Code loads it when a task matches its description.

How do I install Add Python Function in Codex?

Run `npx skills add microbus-io/fabric --skill add-python-function -a codex`. Or copy the skill folder (.claude/skills/python/add-python-function in microbus-io/fabric) into .agents/skills/add-python-function in your project. Codex loads it when a task matches its description.

Can I use Add Python Function 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 microbus-io/fabric --skill add-python-function -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/add-python-function, .gemini/skills/add-python-function, .github/skills/add-python-function and .opencode/skills/add-python-function in your project.

What does Add Python Function need to run?

SKILL.md names no scripts, command-line tools or credentials: Add Python Function is instructions for the agent only. Our summary lists: Python 3.

Does Add Python Function 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 Add Python Function 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 Add Python Function use?

Add Python Function is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Add Python Function use?

About 1.3k tokens (SKILL.md is roughly 5.2k 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 Add Python Function?

Skills that share tags, products or a category with Add Python Function: AWS Serverless Eda (zxkane/aws-skills, 367 stars), Temporal Developer (latitude-dev/latitude-llm, 4.7k stars), K8e Sandbox (xiaods/k8e, 499 stars) and Temporal Developer (temporalio/skill-temporal-developer, 230 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Add Python Function?

microbus-io (a GitHub organization) maintains it in microbus-io/fabric, which has 172 GitHub stars. The repository holds 33 skills in this directory. The repository was last updated on September 28, 2026.

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