Core behavioral rules and skills for NanoClaw personal assistant agents. Always-on rules for communication, verification, memory, and formatting.
77
97%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
High
Do not use without reviewing
import importlib.util
from pathlib import Path
import pytest
REPO_ROOT = Path(__file__).resolve().parents[1]
def _load(name: str, relpath: str):
"""Load a hyphenated-filename Python script as a module.
Tile scripts use kebab-case filenames (e.g. `query-message-history.py`)
that aren't valid Python module identifiers, so they can't be
imported normally. Each call returns a fresh module instance so
tests that monkeypatch module-level constants don't leak state
across tests."""
path = REPO_ROOT / relpath
# Most fixture misconfigurations are bad relpaths. `spec_from_file_location`
# generally returns a non-None spec/loader even for nonexistent files —
# the failure only shows up later inside `exec_module` as `FileNotFoundError`
# / `OSError`. Check existence up front for the common case, keep the
# spec/loader guard for the unusual one (custom loaders that return None),
# and re-raise loader-time OSErrors as `ImportError` so the test report
# names which fixture is misconfigured at a glance.
if not path.is_file():
raise ImportError(f"Could not load module {name!r} from {path}")
spec = importlib.util.spec_from_file_location(name, path)
if spec is None or spec.loader is None:
raise ImportError(f"Could not load module {name!r} from {path}")
module = importlib.util.module_from_spec(spec)
try:
spec.loader.exec_module(module)
except OSError as exc:
raise ImportError(f"Could not load module {name!r} from {path}") from exc
return module
@pytest.fixture
def query_message_history():
"""Fresh-loaded module under test for the query-history skill's
messages.db keyword/sender query helper. Per-test reload so tests
that monkeypatch env or module-level constants don't leak state
across tests."""
return _load(
"query_message_history_under_test",
"skills/query-history/scripts/query-message-history.py",
)
@pytest.fixture
def now_vs_deadline():
"""Fresh-loaded module under test for the now-vs-deadline skill's
deadline-comparison helper. The module exposes `compare(now,
deadline)` and `parse_deadline(str)` as pure functions so tests can
pin `now` and assert deterministic past/future output. Per-test
reload matches the pattern above."""
return _load(
"now_vs_deadline_under_test",
"skills/now-vs-deadline/scripts/now-vs-deadline.py",
).github
rules
skills
now-vs-deadline
scripts
query-history