ワンクリックで
fallback-compatibility
For cross-version support: try/except imports, optional dependencies, graceful degradation across Python versions.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
For cross-version support: try/except imports, optional dependencies, graceful degradation across Python versions.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Conducts iterative deep research on any topic using web search, progressive exploration, and structured synthesis. Use when asked for comprehensive research, deep investigation, thorough analysis, or multi-source exploration of any topic. Triggers: research, investigate, deep dive, comprehensive analysis, explore thoroughly, find everything about.
For cross-cutting concerns: add behavior without modifying functions, caching, timing, logging, validation wrappers.
For performance work: measure before changing, profile to find bottlenecks, compare before and after.
For symbolic computation: ASTs, mathematical expressions, code that manipulates code structure, expression transformations.
For ordered processing: A* search, Dijkstra, event simulation, task scheduling. Efficient min/max extraction with heap-based queue.
For dynamic programming: overlapping subproblems, recursive solutions with repeated computations, memoization to avoid redundant work.
| name | fallback-compatibility |
| description | For cross-version support: try/except imports, optional dependencies, graceful degradation across Python versions. |
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)
# 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]}...")
HAS_FEATURE pattern