clean-code-step-1-api-compatibility-check-mandatory-before-wr
Sub-skill of clean-code: Step 1: API Compatibility Check (MANDATORY before writing shims) (+2).
Best use case
clean-code-step-1-api-compatibility-check-mandatory-before-wr is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Sub-skill of clean-code: Step 1: API Compatibility Check (MANDATORY before writing shims) (+2).
Teams using clean-code-step-1-api-compatibility-check-mandatory-before-wr should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/step-1-api-compatibility-check-mandatory-before-wr/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How clean-code-step-1-api-compatibility-check-mandatory-before-wr Compares
| Feature / Agent | clean-code-step-1-api-compatibility-check-mandatory-before-wr | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Sub-skill of clean-code: Step 1: API Compatibility Check (MANDATORY before writing shims) (+2).
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Step 1: API Compatibility Check (MANDATORY before writing shims) (+2)
## Step 1: API Compatibility Check (MANDATORY before writing shims)
```bash
# Compare __init__ signatures: old vs canonical
python3 -c "
import inspect
from old.module import OldClass
from canonical.module import CanonicalClass
print('OLD:', inspect.signature(OldClass.__init__))
print('NEW:', inspect.signature(CanonicalClass.__init__))
"
```
Checklist before shimming any class:
- [ ] `__init__` kwarg signatures match (no removed/renamed parameters)
- [ ] Factory classmethods match (`from_geojson(path)` vs `from_geojson(path, name)`)
- [ ] All module-level attributes that tests patch exist on canonical (`HAS_RASTERIO`, `HAS_FOLIUM`)
## Step 2: Diverged API — Use Relative Imports, Do NOT Shim
If `__init__` signatures differ between old and canonical:
- **Do NOT shim the base class** — any subclass calling `super().__init__(crs=crs)` with the
old kwarg will crash at runtime with `TypeError: unexpected keyword argument`
- **Fix the subclass**: change its import to use a local relative import pointing to the
compatible (old) class; shim only the unaffected modules (core/, io/, integrations/)
```python
# WRONG: shim breaks subclass calling super().__init__(crs=crs)
# specialized/gis/layers/feature_layer.py (shim)
from digitalmodel.gis.layers.feature_layer import FeatureLayer # canonical dropped crs kwarg
# CORRECT: keep old feature_layer.py as-is; fix the subclass import
# specialized/gis/layers/well_layer.py
from .feature_layer import FeatureLayer # relative → uses local compatible class
```
## Step 3: Re-export Patch-Target Attributes
Tests that use `unittest.mock.patch.object(module, "HAS_X", ...)` require `HAS_X` to exist
as a module-level attribute on the shim module. Shims must re-export these flags:
```python
# WRONG: shim omits the flag
from digitalmodel.gis.io.geotiff_handler import GeoTIFFHandler # noqa: F401
# → patch.object(geotiff_handler, "HAS_RASTERIO", False) raises AttributeError
# CORRECT: re-export flag alongside the class
from digitalmodel.gis.io.geotiff_handler import GeoTIFFHandler, HAS_RASTERIO # noqa: F401
__all__ = ['GeoTIFFHandler', 'HAS_RASTERIO']
```
---Related Skills
mnt-analysis-cleanup
Survey, classify, and clean up `/mnt/local-analysis/` (or any sibling-to-workspace-hub directory holding orphan worktrees, codex-burn artifacts, agent log accumulations, and outer-clone duplicates) without losing useful code/work. Surfaces a tiered approval menu rather than baking decisions; defers all destructive ops until user confirms.
pre-completion-cleanup-audit
Audit and dispose of session residue (orphan files, scratch dirs, sibling-repo state, locks, trash-stages) BEFORE claiming a task complete. Required gate before any agent says "all done", "task complete", or hands work back to user/orchestrator.
worktree-pre-push-bypass-for-tier1-checks
Handle workspace-hub integration-branch pushes from isolated git worktrees when the pre-push hook incorrectly assumes sibling tier-1 repos exist under the worktree path.
verify-Codex-run-commit-vs-working-tree-before-closing
After a Codex implementation run, verify the claimed file set against the actual commit and working tree before treating the issue as fully complete.
git-worktree-cleanup-at-scale
Identify and remove stale git worktrees blocking branch deletion in multi-repo environments
git-worktree-cleanup-and-branch-reconciliation
Systematic process for cleaning up stale git worktrees, resolving merge conflicts in diverged branches, and reconciling branch state across multiple repositories.
git-worktree-cleanup-and-branch-hygiene
Systematic approach to cleaning up stale git worktrees, orphan branches, and branch hygiene at scale across multiple repos
git-blob-size-filter-cleanup
Strip oversized blobs from unpushed commits using git filter-branch when GitHub's 100 MB limit blocks push
clean-worktree-integration-from-dirty-main
Land validated issue work from isolated worktrees when the main checkout is dirty by creating a fresh integration worktree, cherry-picking only implementation commits, re-running combined validation, and preparing push/closeout artifacts.
clean-code
Clean code enforcement for workspace-hub Python repos: file/function size limits, God Object detection, naming rules, dead code removal, and refactor decision guidance. Consult before writing new modules or accepting large files.
live-writer-branch-cleanup-guard
Guardrails for multi-repo sync and branch cleanup when workspace-hub or another shared repo has active writer sessions, worktree-backed branches, or unrelated-history branches.
full-branch-cleanup-and-worktree-hygiene
Track all dirty/untracked workspace-hub changes, merge stale branches into main, clean remote/local branches, and remove stale worktrees while preserving tracked nested gitlinks.