fallback-compatibility

fallback-compatibility is a skill for Claude Code from jimmc414/claude-code-plugin-marketplace. It costs 24 tokens per session (543 once invoked), scanned A, original, MIT.

A Python coding pattern for supporting different Python versions and optional packages. It tries a preferred feature or package and uses a simpler alternative when it is unavailable.

In plain words
What is it for?
Adding compatibility imports, detecting optional packages, and providing fallback behavior when newer features or libraries are missing.
Why use it?
It helps code keep working when users have different Python versions or do not have optional dependencies installed.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the norvig-patterns plugin — 54 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/jimmc414/claude-code-plugin-marketplace/fallback-compatibility
Any agent
npx skills add jimmc414/claude-code-plugin-marketplace --skill fallback-compatibility
Clone the repo
git clone --depth 1 https://github.com/jimmc414/claude-code-plugin-marketplace

Made for: Claude Code.

Or install norvig-patterns, the plugin that ships this one along with the rest of its 54 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fallback-compatibility

README.md
[![agentmods](https://agentmods.dev/badge/skills/jimmc414/claude-code-plugin-marketplace/fallback-compatibility.svg)](https://agentmods.dev/skills/jimmc414/claude-code-plugin-marketplace/fallback-compatibility)
Your own site
<a href="https://agentmods.dev/skills/jimmc414/claude-code-plugin-marketplace/fallback-compatibility"><img src="https://agentmods.dev/badge/skills/jimmc414/claude-code-plugin-marketplace/fallback-compatibility.svg" alt="Measured on agentmods" height="20"></a>
Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 543 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00024 $0.00543
Opus 5 $0.00012 $0.00271
Sonnet 5 $0.00005 $0.00109
Haiku 4.5 $0.00002 $0.00054

Measured 6d ago against content hash c55d3dd7b8b3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

fallback-compatibility scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/norvig-patterns/skills/fallback-compatibility/SKILL.md · 98 lines

How it starts

The opening of the file, as written. The whole thing — 98 lines — stays where its author put it; the contents beside it link to each section on GitHub.

fallback-compatibility

When to Use

  • Supporting multiple Python versions
  • Optional dependency handling
  • Feature detection
  • Graceful degradation

When NOT to Use

  • Single Python version target
  • Required dependency (should fail if missing)
  • Over-engineering simple code

The Pattern

Try preferred import/feature, fall back to alternative.

# Python version compatibility
try:
    from functools import cache
except ImportError:
    from functools import lru_cache
    cache = lru_cache(None)

# Optional dependency
try:
    import numpy as np
    HAS_NUMPY = True
except ImportError:
    HAS_NUMPY = False

def process(data):
    if HAS_NUMPY:
        return np.array(data).mean()
    else:
        return sum(data) / len(data)

Example (from pytudes)

# beal.py - math.gcd location changed between versions
try:
    from math import gcd      # Python 3.5+
except ImportError:
    from fractions import gcd # Python 2.7 and early 3.x

# ngrams.py - use available modules
try:
    from functools import cache
except ImportError:
    from functools import lru_cache
    def cache(func):
        return lru_cache(None)(func)

# Pattern for conditional features
try:
    # Python 3.10+ pattern matching
    def dispatch(x):
        match x:
            case int(): return handle_int(x)
            case str(): return handle_str(x)
            case _: return handle_other(x)
except SyntaxError:
    # Fallback for older Python
    def dispatch(x):
        if isinstance(x, int):
            return handle_int(x)
        elif isinstance(x, str):
            return handle_str(x)
        else:
            return handle_other(x)

# Graceful feature degradation
try:
    import matplotlib.pyplot as plt
    def plot(data):
        plt.plot(data)
        plt.show()
except ImportError:
    def plot(data):
        print("Plotting requires matplotlib")
        print(f"Data: {data[:10]}...")

Key Principles

  1. Try modern first: Prefer newer, better APIs
  2. ImportError for missing: Standard exception for imports
  3. Create compatible API: Wrapper that works either way
  4. Flag for optional: HAS_FEATURE pattern
  5. Fail gracefully: Warn, don't crash

Read the full file on GitHub · 98 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 98 lines · 24 tokens per session scan A c55d3dd7b8b3

Subscribe to this mod's changes

fallback-compatibility is a skill published in the GitHub repository jimmc414/claude-code-plugin-marketplace (4 stars, last pushed yesterday), licensed MIT. It adds 24 tokens to every session and 543 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.