Skip to content

Thirteen Claude skills that run an Instagram account: Reels off 26 scored hook formulas, a viral research skill, a caption linter, and a humanizer. Free, MIT.

Python

Restore sentence capitals after a deleted opener

Jake Schincariold03c56bb598b
diff --git a/skills/ig-human/humanize.py b/skills/ig-human/humanize.py
index 6356d62..897e28c 100755
--- a/skills/ig-human/humanize.py
+++ b/skills/ig-human/humanize.py
@@ -189,11 +189,27 @@ def scan_structures(text, lex):
return flags
+def restore_capitals(original, text):
+ """Deleting an opener leaves the next word lower case.
+
+ Only fix it for writers who capitalise their sentences in the first place:
+ a deliberately lower-case voice is a style, not an artefact, and shouting
+ over it would be exactly the kind of thing this script exists to stop.
+ """
+ starts = re.findall(r"(?:^|[.!?]\s+|\n)\s*([A-Za-z])", original)
+ if not starts or sum(1 for c in starts if c.isupper()) * 2 < len(starts):
+ return text
+ return re.sub(r"(?:^|(?<=[.!?] )|(?<=[.!?]\n)|(?<=\n))\s*([a-z])",
+ lambda m: m.group(0)[:-1] + m.group(1).upper(), text)
+
+
def humanize(text, lex):
+ raw_for_case = text
text, urls = protect_urls(text)
text, inv = pass_invisible(text, lex)
text, typo = pass_typographic(text, lex)
text, lexi = pass_lexical(text, lex)
+ text = restore_capitals(raw_for_case, text)
text = restore_urls(text, urls)
return text.strip() + "\n", {
"invisible": inv,