oliverweissl/context-garden / skills/weeder
weeder
VerifiedMeasure and reduce a Skill's token footprint (always-loaded description + on-trigger SKILL.md body) without regressing routing accuracy or losing instructions. Use when a SKILL.md feels oversized, repeats rules, or has a vague description that might mis-route.
| File | Kind | Size |
|---|---|---|
| .gitignore | other | 32 B |
| SKILL.md | skill md | 3.1 KB |
| agents/weeder.md | markdown | 1.2 KB |
| bin/weederexecutable | script | 292 B |
| references/classification.md | markdown | 4.9 KB |
| references/llm-assist.md | markdown | 2.1 KB |
| references/routing-heuristic.md | markdown | 4.1 KB |
| scripts/cg_mode.py | script | 5.4 KB |
| scripts/we_apply_suggestion.py | script | 5.7 KB |
| scripts/we_audit.py | script | 5.6 KB |
| scripts/we_config.py | script | 2.5 KB |
| scripts/we_constraints.py | script | 5.1 KB |
| scripts/we_dupes.py | script | 6.1 KB |
| scripts/we_filler.py | script | 4.9 KB |
| scripts/we_optimize.py | script | 4.3 KB |
| scripts/we_parse.py | script | 5.0 KB |
| scripts/we_routing.py | script | 4.5 KB |
| scripts/we_suggest.py | script | 3.8 KB |
| scripts/we_text.py | script | 2.1 KB |
| scripts/we_tokens.py | script | 4.1 KB |
| scripts/weeder.pyexecutable | script | 12.0 KB |
| tests/fixtures/answer_lot.json | config | 875 B |
| tests/fixtures/filler_sentences.json | config | 2.6 KB |
| tests/fixtures/routing_examples.json | config | 489 B |
| tests/smoke_test.shexecutable | script | 14.3 KB |
scripts/we_text.py
View on GitHub"""Shared markdown-aware text cleaning for duplicate/filler detection.
Code fences and heading/list markers have no terminal punctuation, so left in
they glue onto adjacent sentences and repeated usage examples look like
"the same rule repeated five times".
"""
from __future__ import annotations
import re
_CODE_FENCE_RE = re.compile(r"```.*?```", re.DOTALL)
_INLINE_CODE_RE = re.compile(r"`[^`\n]*`")
_HEADING_LINE_RE = re.compile(r"^\s*#{1,6}\s+.*$", re.MULTILINE)
_LIST_MARKER_RE = re.compile(r"^\s*(?:[-*]|\d+\.)\s+", re.MULTILINE)
_SENTENCE_RE = re.compile(r"(?<=[.!?])\s+")
def strip_code(text: str) -> str:
text = _CODE_FENCE_RE.sub(" ", text)
text = _INLINE_CODE_RE.sub(" ", text)
return text
def strip_markdown_structure(text: str) -> str:
"""Code blocks + heading lines + leading list markers removed, safe to
feed to a sentence splitter without structural elements gluing onto
adjacent prose."""
text = strip_code(text)
text = _HEADING_LINE_RE.sub("", text)
text = _LIST_MARKER_RE.sub("", text)
return text
def split_into_sentences(text: str) -> list[str]:
cleaned = strip_markdown_structure(text).replace("\n", " ")
return [s.strip() for s in _SENTENCE_RE.split(cleaned) if s.strip()]
_BOUNDARY = "\x00"
def split_into_original_sentences(text: str) -> list[str]:
"""Like split_into_sentences, but each sentence is a verbatim span of
`text` (inline code kept; only newlines flattened): code blocks, heading
lines and list markers become sentence *boundaries* instead of being
deleted mid-span. Duplicate-group members must be findable in the
original file by apply-suggestion -- a sentence with its `inline code`
stripped is not. Callers compute similarity on strip_code(sentence)."""
marked = _CODE_FENCE_RE.sub(_BOUNDARY, text)
marked = _HEADING_LINE_RE.sub(_BOUNDARY, marked)
marked = _LIST_MARKER_RE.sub(_BOUNDARY, marked)
out = []
for block in marked.split(_BOUNDARY):
out.extend(s.strip() for s in _SENTENCE_RE.split(block.replace("\n", " ")) if s.strip())
return out
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |