JordanGunn/nunchuck / skills/sniff/sniff-abusers
sniff-abusers
VerifiedDetect object-oriented abusers smells (Switch Statements) using deterministic heuristics and append findings to `.sniff/findings.jsonl`.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 583 B |
| references/00_ROUTER.md | markdown | 522 B |
| references/01_SUMMARY.md | markdown | 669 B |
| references/02_TRIGGERS.md | markdown | 282 B |
| references/03_ALWAYS.md | markdown | 269 B |
| references/04_NEVER.md | markdown | 221 B |
| references/05_PROCEDURE.md | markdown | 363 B |
| references/06_FAILURES.md | markdown | 268 B |
| scripts/include/sniff_common.py | script | 5.2 KB |
| scripts/include/sniff_scan.py | script | 12.4 KB |
| scripts/include/sniff_scan_cli.py | script | 3.3 KB |
| scripts/skill.ps1 | script | 1.4 KB |
| scripts/skill.shexecutable | script | 1.2 KB |
scripts/include/sniff_scan_cli.py
View on GitHubfrom __future__ import annotations
import argparse
import subprocess
import sys
from pathlib import Path
from typing import Any
def _repo_root() -> Path:
proc = subprocess.run(
["git", "rev-parse", "--show-toplevel"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
check=False,
)
if proc.returncode == 0:
p = proc.stdout.decode("utf-8", errors="replace").strip()
if p:
return Path(p)
return Path.cwd()
def _parse_thresholds(items: list[str] | None) -> dict[str, Any]:
out: dict[str, Any] = {}
if not items:
return out
for it in items:
if "=" not in it:
continue
k, v = it.split("=", 1)
k = k.strip()
v = v.strip()
if not k:
continue
try:
out[k] = int(v)
except Exception:
out[k] = v
return out
def cmd_help() -> int:
print("sniff-abusers commands:")
print(" help")
print(" validate")
print(" scan [--threshold k=v]...")
print(" clean")
return 0
def cmd_validate() -> int:
repo_root = _repo_root()
local = Path(__file__).resolve().parent
if not (local / "sniff_scan.py").exists():
print(f"error: missing implementation at {local}", file=sys.stderr)
return 1
if not (repo_root / ".git").exists():
print("error: not a git repository (missing .git)", file=sys.stderr)
return 1
print("ok: sniff-abusers cli is runnable")
return 0
def cmd_scan(args: argparse.Namespace) -> int:
repo_root = _repo_root()
from sniff_scan import scan_group
thresholds = _parse_thresholds(args.threshold)
n = scan_group(repo_root, "oo_abusers", thresholds=thresholds)
print(f"ok: appended {n} new finding(s)")
return 0
def cmd_clean() -> int:
repo_root = _repo_root()
sniff_dir = repo_root / ".sniff"
for p in [sniff_dir / "index.json", sniff_dir / "state.json"]:
try:
if p.exists():
p.unlink()
except Exception:
pass
cache = sniff_dir / "cache"
if cache.exists() and cache.is_dir():
for child in sorted(cache.rglob("*"), reverse=True):
try:
if child.is_file():
child.unlink()
elif child.is_dir():
child.rmdir()
except Exception:
pass
try:
cache.rmdir()
except Exception:
pass
print("ok: cleaned derived .sniff artifacts (index/state/cache)")
return 0
def main(argv: list[str]) -> int:
parser = argparse.ArgumentParser(add_help=False)
sub = parser.add_subparsers(dest="cmd")
sub.add_parser("help")
sub.add_parser("validate")
p_scan = sub.add_parser("scan")
p_scan.add_argument("--threshold", action="append", default=[], help="override threshold, e.g. switch_keyword_count=20")
sub.add_parser("clean")
ns = parser.parse_args(argv[1:] if len(argv) > 1 else [])
cmd = ns.cmd or "help"
if cmd == "help":
return cmd_help()
if cmd == "validate":
return cmd_validate()
if cmd == "scan":
return cmd_scan(ns)
if cmd == "clean":
return cmd_clean()
print(f"error: unknown command '{cmd}'", file=sys.stderr)
return 1
if __name__ == "__main__":
raise SystemExit(main(sys.argv))
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |