This skill helps you discover code patterns before writing new code, enabling reuse, consistency, and cleaner architectures across projects.
npx playbooks add skill gigaverse-app/skillet --skill pythonista-patterning
Before writing ANY new code, actively search for existing patterns and reuse opportunities.
Duplicating code with subtle variations is one of the most damaging things you can do to a codebase.
# In Claude Code, use the Grep tool instead of bash grep:
# pattern="similar_function" path="src/"
# Check sibling files in same directory
ls src/services/
# Look at parallel structures
# If writing campaign_api.py, check drip_api.py, prompt_api.py
# campaign_api.py
async def update_campaign(handle: str, campaign: Campaign):
if campaign.version == 0:
current = await collection.find_one({"handle": handle})
next_version = (current["campaign"]["version"] + 1) if current else 1
campaign.version = next_version
# drip_api.py - DUPLICATE with subtle variation!
async def update_drip(handle: str, drip: Drip):
if drip.version == 0:
current = await collection.find_one({"handle": handle})
next_version = (current["drip"]["version"] + 1) if current else 1
drip.version = next_version
# Creating a generic "VersionedEntityManager" for only 2 entities
class VersionedEntityManager(ABC, Generic[T]):
# 50+ lines of generic infrastructure for 2 use cases
# Simple, focused helper
async def auto_increment_version(
collection, handle: str, field_name: str, entity: VersionedEntity
) -> VersionedEntity:
"""Auto-increment version using version=0 sentinel."""
if entity.version == 0:
current = await collection.find_one({"handle": handle})
current_version = current.get(field_name, {}).get("version", 0) if current else 0
entity.version = current_version + 1
return entity
# Usage
campaign = await auto_increment_version(collection, handle, "campaign", campaign)
drip = await auto_increment_version(collection, handle, "drip", drip)
NEVER duplicate validation that already exists in lower layers.
# WRONG - Service layer blocks API
async def _create_item(self, name, item):
versions = await api.list_versions(id) # Checking what API handles!
if versions:
raise ValueError(f"Already exists")
# CORRECT - Service layer trusts API
async def _create_item(self, name, item):
validate_name(name) # Only validate what service should
return await api.create_item(item) # Let API handle versioning
Before writing new code:
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.