dry-philosophy
БесплатноБез исполняемых скриптовНе проверенDon't Repeat Yourself (DRY) and Never Reinvent the Wheel (NRtW) - core b00t principles. Use existing libraries, leverage Rust via PyO3 instead of duplicating…
Об этом скилле
What This Skill Does
The DRY philosophy is a central tenet of b00t: YEI exist to contribute ONLY new and novel meaningful work. This skill helps you:
- Identify when code is being duplicated or reinvented
- Find existing libraries instead of writing new code
- Use Rust functionality via PyO3 rather than duplicate in Python
- Contribute upstream rather than maintain private forks
- Write lean, maintainable code with minimal dependencies
When It Activates
Activate this skill when you see:
- "implement [common functionality]"
- "create a [parser/validator/client]"
- "write code to [read/parse/validate] [format]"
- Any task that sounds like it might already exist in a library
- Code that duplicates existing Rust functionality
- Multiple implementations of the same logic
Core Principles
1. DRY: Don't Repeat Yourself
AVOID writing code for functionality that exists in libraries:
❌ Anti-pattern:
# Writing custom JSON parser
def parse_json(text):
# 200 lines of parsing logic...
✅ DRY approach:
import json
data = json.loads(text)
2. NRtW: Never Reinvent the Wheel
SEARCH for existing solutions before coding:
# Search for Python packages
pip search [functionality]
# or
uv pip search [functionality]
# Check PyPI
https://pypi.org/search/?q=[functionality]
# Check Rust crates
https://crates.io/search?q=[functionality]
3. Leverage Rust via PyO3
USE Rust for heavy lifting, expose to Python:
❌ Anti-pattern:
# Duplicating Rust datum parsing in Python
def parse_datum_file(path: str) -> dict:
with open(path) as f:
toml_data = toml.load(f)
# Validation logic...
# Parsing logic...
return processed_data
✅ DRY approach:
# Use Rust via PyO3
import b00t_pyverse
datum = b00t_pyverse.load_ai_model_datum("model-name", "~/.dotfiles/_b00t_")
Why? Rust implementation already exists, is faster, type-safe, and tested.
4. Contribute Upstream
FORK and PATCH forward, don't maintain private copies:
❌ Anti-pattern:
# Copy library code into project
cp -r /path/to/library my_project/vendored/
# Make private modifications
✅ DRY approach:
# Fork the library
gh repo fork upstream/library
# Create patch
git checkout -b fix/issue-123
# Make changes
git commit -m "fix: resolve issue #123"
# Submit PR
gh pr create --upstream
# Use your fork temporarily
# pyproject.toml
dependencies = [
"library @ git+https://github.com/you/library@fix/issue-123"
]
Decision Tree
Need to implement functionality?
↓
Does it already exist in a library?
├─ YES → Use the library (DRY)
└─ NO ↓
Is it standard functionality?
├─ YES → Search harder, it probably exists
└─ NO ↓
Does similar Rust code exist in b00t?
├─ YES → Expose via PyO3 (DRY)
└─ NO ↓
Is this truly novel?
├─ YES → Implement (with tests!)
└─ NO → Reconsider: use library
Examples
Finding Libraries
Task: Parse TOML files
# Search
pip search toml
# Results: tomli, tomlkit, pytoml
# Use established: tomli (or tomllib in Python 3.11+)
Task: Make HTTP requests
# DON'T: Write custom HTTP client
# DO: Use httpx or requests
pip install httpx
Task: Validate Pydantic models
# DON'T: Write custom validation
# DO: Use Pydantic's built-in validation
from pydantic import BaseModel, field_validator
Using Rust via PyO3
b00t Pattern: Rust does heavy lifting, Python uses it.
Datum Operations
❌ Duplicate (Anti-pattern):
# b00t_j0b_py/datum_parser.py
import toml
class DatumParser:
def load_provider(self, name: str):
path = f"~/.dotfiles/_b00t_/{name}.ai.toml"
with open(os.path.expanduser(path)) as f:
data = toml.load(f)
# Validation...
# Parsing...
return data
✅ DRY (Use Rust):
# Use PyO3 bindings
import b00t_pyverse
datum = b00t_pyverse.load_ai_model_datum("model-name", "~/.dotfiles/_b00t_")
Why better?
- ✅ No duplication - single source of truth in Rust
- ✅ Type-safe - Rust ensures correctness
- ✅ Tested - Rust tests cover this
- ✅ Faster - Rust performance
- ✅ Maintainable - one codebase, not two
Environment Validation
❌ Duplicate:
def validate_provider_env(provider: str) -> bool:
# Read datum
# Parse required env vars
# Check os.environ
# Return result
✅ DRY:
import b00t_pyverse
validation = b00t_pyverse.check_provider_env("openrouter", "~/.dotfiles/_b00t_")
if not validation["available"]:
print(f"Missing: {validation['missing_env_vars']}")
Contributing Upstream
Scenario: Bug in pydantic-ai library
❌ Anti-pattern: ``
Установить dry-philosophy в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobBashWebSearchFAQ
Что делает скилл dry-philosophy?
Don't Repeat Yourself (DRY) and Never Reinvent the Wheel (NRtW) - core b00t principles. Use existing libraries, leverage Rust via PyO3 instead of duplicating logic in Python, and contribute to upstream projects rather than fork privately.
Как установить скилл dry-philosophy?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл dry-philosophy запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic