Skip to content

Crowd9/giveaway-skills / skills/giveaway-idea-generator

giveaway-idea-generator

Verified

Generate or score giveaway concepts. Use for 'giveaway ideas', 'Instagram giveaway ideas', 'ideas for my Shopify store', 'win your cart', 'Christmas giveaway', 'ideas for our launch', '10k follower milestone', 'collaboration giveaway', or 'is my idea any good'. Recommend three concepts with hooks, mechanics and Prize directions, or evaluate the user's concept.

FileKindSize
SKILL.mdskill md13.6 KB
evals/cases.mdmarkdown5.7 KB
evals/evals.jsonconfig18.5 KB
references/evidence-detail.mdmarkdown3.2 KB
references/hook-patterns.jsonconfig2.0 KB
references/hooks-and-themes.mdmarkdown46.3 KB
references/house-style.mdmarkdown4.7 KB
scripts/style_check.pyexecutablescript40.3 KB

scripts/style_check.py

View on GitHub
#!/usr/bin/env python3
# Generated from evals/style_check.py by scripts/render_shared.py. Edit the source, never this copy.
# Run it on a draft answer before sending: python3 scripts/style_check.py draft.txt
"""Count the style tells a giveaway skill's answer must not carry. Usage: python3 style_check.py reply.txt [more.txt ...]

Hard fails: em dashes, semicolons, curly quotes, an assistant opener or closer, a question as a heading, a label opener
(a sentence announcing the next block instead of saying the thing), three or more paragraphs led by the same bold label,
the answer commenting on itself, a long answer closing without a number or action, a mechanic banned
on the strength of an average when no platform rule, law or money risk is named nearby, a raw pair of decimals the reader
has to divide themselves, analysis jargon that belongs in the reference files, a literary join nobody says out loud,
a figure explained by a causal verb the table cannot back, an answer over sixty words that never once says "you", and any of Gleam's own words written without its capital,
which covers the dashboard names and the product nouns Entrant, Contestant, Prize and Winner. "entries" stays out:
the repo's own prose uses it as a common noun 194 times, so flagging it would fail the references it is drawn from.
From forty prose words, sentence variety is the soft gate: something short, something long, so the answer does not read as one template rhythm.
"""
import re, sys

def console_text(value):
    """Show field controls literally without changing the source being checked."""
    return "".join(f"\\u{ord(c):04x}" if ord(c) < 32 or 127 <= ord(c) <= 159
                   or c in "\u061c\u200e\u200f\u2028\u2029\u202a\u202b\u202c\u202d\u202e\u2066\u2067\u2068\u2069\u206a\u206b\u206c\u206d\u206e\u206f"
                   else c for c in str(value))

# Two words came off this list because the product uses them literally. A randomness beacon is the
# published public value a provable draw rests on, from drand or NIST. Mandatory actions unlock the
# rest, which is what campaign-setup.md calls it, so a skill explaining that setting has to say it.
# A checker that bans the product's own vocabulary teaches the skill to be vague about its subject.
FILLER = (r"\b(actually|leverage|robust|comprehensive|streamline|delve|foster|pivotal|landscape|testament|showcase|furthermore"
          r"|moreover|additionally|it is worth noting|generally speaking|in many cases|synergy|holistic|seamless|world-class"
          r"|utilise|utilize|facilitate|empower|cutting-edge|paradigm shift|game changer|transformative|elevate|embark"
          r"|supercharge|harness|ever-evolving|realm|tapestry|multifaceted|meticulous|intricate|paramount"
          r"|crucial|vital|at the end of the day|when it comes to|at its core|in today's world|the reality is|the truth is"
          r"|in terms of|with regard to|going forward|let's dive in|let's take a look)\b")
OPENERS = r"^(great question|here's how i'd think|here is how|let me walk you|certainly|of course|sure[,!])"
CLOSERS = r"(hope this helps|let me know if|feel free to|happy to elaborate)"
# A closing question that offers to do more work. Distinct from a question that asks for a missing fact.
OFFER = (r"\b(want (me|the|a|an|that|one)|shall i|should i|would you like|do you want|can i (draft|write|put|run|send|do)"
         r"|happy to|i can (also )?(draft|write|put together|run|send)|(need|like) (me|anything else))\b")
CONTRAST = r"(, not \w|\bnot \w+(?: \w+){0,4}, (?:but|it's|it is)\b|\brather than\b|\binstead of\b|\binstead\b\s*[.,]|\band not (?:as|a|an|the|your|to)\b|\bnever as a\b|, and (?:it|that|this|they) (?:is|are)? ?not\b|, don't \w)"
# A sentence that announces the next block rather than saying the thing. The commonest slop tell after punctuation.
LABEL_OPENER = ("^(the (reasoning|caveat|point|upshot|short version|catch|tradeoff|takeaway|rule|logic|thinking|context"
                r"|detail|numbers?|figures?|evidence)\b[^.!?]{0,60}[.:]"
                r"|what (i|we|you) (would|will|should|did)\b[^.!?]{0,60}[.:]"
                r"|why (this|that|it) (works|matters|holds)\b[^.!?]{0,40}[.:]"
                r"|here is (what|how|why|the)\b|what follows\b|first, (the|a)\b[^.!?]{0,40}[.:]"
                # a count of things about to be listed, or a thing about to be flagged, is a label wearing a sentence
                r"|(two|three|four|a few|several|other|two other|a couple of) [a-z ]{0,24}(ways?|options?|things?|points?|notes?|angles?|routes?)\b[^.!?]{0,40}[.:]"
                r"|(one|a) (thing|point|note|caveat|risk|detail) worth (flagging|noting|saying|knowing)\b[^.!?]{0,30}[.:]"
                r"|worth (flagging|noting|saying)\b[^.!?]{0,20}[.:])")
# The answer talking about itself instead of answering.
# A finding turned into a ban. The data never licenses a prohibition, only a tradeoff with a condition.
# A raw metric pair the reader has to divide in their head, and jargon that belongs in the reference files.
RAW_PAIR = r"\b\d+\.\d+[^.\n]{0,60}?\b(?:against|vs\.?|versus|compared with)\s+\d+\.\d+"
# Literary joins and stiff constructions. Nobody says these out loud.
# Patterns named by the no-ai-slop skill (github petergyang/no-ai-slop), the ones a regex can see honestly.
FAUX_INSIGHT = r"\b(what (most people|nobody|everyone) (gets? wrong|tells? you|misses)|the part (everyone|most people) (misses|skips)|this is the part most people skip|here is what nobody)\b"
# A colon that sets up a reveal. An ending the skill asks for ("Next call: pick the date") is not one, so let
# a decision verb through.
# The idea generator's concept sheet is a fixed set of labels the skill asks for, so those are not reveals either.
CONCEPT_LABELS = r"Title|Hook|Mechanic|Prize direction|Asset produced|Objective|Budget|Channels"
COLON_REVEAL = (r"(?m)^(?!(?:" + CONCEPT_LABELS + r"|Optional)\s*:)"
                r"[A-Z](?![^.!?:\n]{0,60}"
                r"(?:day|days|week|weeks|month|months|hour|hours|out|later|before|after|launch|onwards)\s*:)"
                r"[^.!?:\n]{6,60}: "
                r"(?!(?:pick|choose|confirm|decide|set|send|run|draw|write|book|check|start|close|tell|give|use|keep|drop|add|reply|ask)\b)[a-z]")
PUFFERY = r"\b(a testament to|marks? a pivotal|plays? a vital role|solidif\w+ its position|underscor\w+ (its|the) (significance|importance)|speaks? volumes)\b"
WEASEL = r"\b(experts agree|studies show|research shows|industry reports suggest|many argue|widely regarded as|it is (widely )?believed)\b"
SUPERFICIAL = r", (highlighting|underscoring|reflecting|showcasing|demonstrating|signal(l)?ing) (the|its|a|an|how|that)\b"
METADISCOURSE = r"\b(each worth naming|worth naming|the key point is|that last part matters|this distinction matters|as you can see|in other words|which is to say|the important thing here)\b"
RHETORICAL = r"\b(what if i told you|think about it:|plot twist:|here is the thing|here's the thing|let me be clear|the uncomfortable truth)\b"
RECAP = r"(?i)\b(in conclusion|to recap|ultimately,|overall,|to sum up|all in all)\b"
# Gleam's own words must arrive capitalised, because the reader has the dashboard open beside the answer.
APP_LOWER = r"(?<![A-Za-z`\-])(impressions|conversion rate|entry methods?|viral shares?|email subscriptions?|secret code|visit a page|answer a question|chat members?|custom actions?|app downloads?|loyalty bonus(es)?|file uploads?|entrants?|contestants?|prizes?|winners?)\b"
STIFF = r"\b(works the other way|pulls? in the opposite direction|the picture reverses|comes at a cost|on the other hand|that said|conversely|by contrast|it is worth (noting|remembering)|bear in mind|one thing to note)\b"
JARGON = r"\b(contestant band|size band|per contestant|n\s*=\s*\d|stratified|cohort|controlled for|unstratified|clean subset|ordinary segment|uptake|extracted|value index|playbook)\b"
BAN = r"\b(so (skip|avoid|drop|do not add|don't add|do not use|don't use)|(skip|avoid) (the|a|an|any) \w+ action|not worth (adding|offering|running|using)|(do not|don't) (bother|add|offer) [a-z]|leave (it|that|the \w+) out)\b"
# The analyst's units for a rate. A reader knows 53% and 1.5x; "53 per 100 Entrants" and "1.5 times" make them
# stop and convert, and Stuart asked for the conversion to happen before the sentence reaches them.
ANALYST_UNITS = r"\b(per (100|hundred)\b|\d+(?:\.\d+)? times (?:the|as|more|fewer|higher|lower|in (?:every )?100|what)\b|in every 100\b)"
META = r"\b(this (answer|reply|response|recommendation) (is|does|gives|covers)|(i|we) (sent|gave|listed|showed) (you|above)|as (i|we) (said|noted) above|the (list|table|numbers) above (is|are|shows)|to summari[sz]e|in short,|in summary)\b"

# Flag likely unsupported claims about an outside party or a frequency. This is a prompt for a source check,
# not a truth test. Dates and durations do not support a claim. Measured rates, campaign/Entrant counts and
# multiples retain their exemption, and a source needs a name, not just a word such as "documentation".
PARTY = (r"\b(instagram|facebook|tiktok|twitter|youtube|discord|telegram|reddit|twitch|pinterest|linkedin|snapchat|whatsapp"
         r"|gmail|outlook|apple|google|klaviyo|mailchimp|shopify|paypal|stripe|random\.org|the platform|platforms|networks?"
         r"|the algorithm|regulators?|carriers?|payment providers?|inbox(es)?|spam folder|promotions tab|app stores?|courier|customs)\b")
NAMED_PARTY = PARTY.split(r"|the platform")[0] + r")\b"
GENERAL = (r"\b(plenty of|usually|typically|often|rarely|mostly|tends? to|commonest|the most \w+"
           r"|the (biggest|largest|fastest|slowest|cheapest|best|worst|strongest|weakest|second biggest|busiest|quietest|highest|lowest|earliest|hardest|easiest|safest|riskiest)"
           r"|(more|less|fewer|better|worse|higher|lower|faster|slower|cheaper) \w*\s?than|\w+est of (any|all|every))\b")
SOURCE_KIND = r"(?:rules?|policy|policies|guidelines|law|laws|docs|documentation|help(?: page| cent(?:er|re))?|report|study)"
SOURCE_NAME = r"(?!(?:Official|The|A|An|Some|Documentation|Docs|Rules|Policy|Guidelines)\b)(?:[A-Z][A-Za-z0-9&.-]*(?: [A-Z][A-Za-z0-9&.-]*){0,4})"
NAMED_SOURCE = re.compile(
    r"\b" + SOURCE_NAME + r"['’]s (?:promotion |community |official |contest |fake-engagement )?" + SOURCE_KIND + r"\b"
    r"|\b(?:the )?" + SOURCE_NAME + r" (?:promotion |community |official |contest |fake-engagement )?" + SOURCE_KIND + r"\b"
    r"|\b[Aa]ccording to (?:the )?(?!Documentation\b|Docs\b|Rules\b|Policy\b|Guidelines\b)" + SOURCE_NAME + r"\b")
MEASURED_CLAIM = re.compile(
    r"\b\d+(?:\.\d+)?\s*(?:%|percent\b|x\b|times\b)"
    r"|\b\d[\d,]*(?:\.\d+)?\s+(?:campaigns?|Entrants?|Contestants?|businesses?)\b", re.I)
GLEAM_DOCS = re.compile(r"\b(?:Gleam['’]s (?:docs|documentation)|(?:the )?Gleam (?:docs|documentation))\b", re.I)


def named_source(text):
    if NAMED_SOURCE.search(text) or re.search(r"\bGleam campaign data\b", text, re.I):
        return True
    # A platform's own guidelines remain a named source when the possessive follows its name.
    return bool(re.search(NAMED_PARTY + r"[^.!?]{0,120}\b(?:its (?:current )?" + SOURCE_KIND
                          + r"|announced a guidelines? update)\b", text, re.I))


INSTRUCTION = (r"^(\*\*)?(pick|choose|send|run|set|ask|check|start|close|draw|tell|give|use|keep|drop|add|book|write|say|decide|confirm"
               r"|post|put|place|screenshot|report|reply|email|dm|message|name|state|link|open|paste|copy|export|download|upload|sort|read"
               r"|treat|plan|budget|expect|hold|leave|make|take|let|do|don't|do not|never|always|announce|tag|thank|quote|cap|freeze"
               r"|record|suppress|fix|publish|pin|schedule|delete|join|require|trim)\b")


def unsourced_claims(text):
    out = []
    body = prose_only(text)
    gleam_docs_named = bool(GLEAM_DOCS.search(body))
    for s in sentences(body):
        t = s.strip().lstrip("*-# ")
        if t.endswith(("?", ":")) or named_source(t) or re.match(r"(?i)^assuming\b", t):
            continue
        # A restrictive rule condition defines which platforms an instruction applies to. It does not say
        # that any named platform has that rule. A general behavioral claim still needs support.
        if (not re.search(NAMED_PARTY, t, re.I) and not re.search(GENERAL, t, re.I)
                and re.search(r"(?i)\bplatforms? (?:whose|where (?:the|their)) (?:promotion )?(?:rules?|policies)\b", t)):
            continue
        # This tightening targets outside-party claims. Numeric comparisons without an outside party keep
        # the earlier exemption, since a bare total or a budget calculation can carry their meaning.
        if re.search(r"\d", t) and not re.search(PARTY, t, re.I):
            continue
        # A named Gleam source elsewhere in the answer permits its quoted product wording. Remove only the
        # quoted term, so an unrelated Gmail claim in that sentence still needs its own support.
        reported = t
        if gleam_docs_named:
            t = re.sub(r"[\"“'‘]same-network[\"”'’]", "quoted filter wording", t, flags=re.I)
        # Test a conditional instruction's action, not its budget or timing condition.
        t = re.sub(r"(?i)^if\b[^,]+,\s*(?=" + INSTRUCTION.lstrip("^") + r")", "", t)
        # A contextual count is not the measured outcome of the claim that follows it.
        t = re.sub(r"(?i)^with \d[\d,]* (?:Entrants|campaigns|businesses),\s*", "", t)
        # An instruction exempts only the instruction. "Send it Tuesday because Gmail buries promotions" is an
        # instruction with a claim riding on its back, so the reason clause is tested on its own.
        if re.match(INSTRUCTION, t, re.I):
            t = re.sub(r"(?i)^.*?\b(because|since|as)\b", "", t, count=1) if re.search(r"(?i)\b(because|since|as)\b", t) else ""
            if not t.strip():
                continue
        # Keep separate clauses separate: a measured figure must not license an appended outside-party claim.
        # A discount in the email's offer is an input, not a delivery measurement.
        t = re.sub(r"(?i)\b(?:offering|with) (?:a )?\d+(?:\.\d+)?% (?:discount|off)\b", "an offer", t)
        clauses = re.split(r";|,?\s+(?:but|and)\s+(?=(?:Gmail|Outlook|Facebook|Instagram|TikTok|Google)\b)", t, flags=re.I)
        if any((re.search(PARTY, c, re.I) or re.search(GENERAL, c, re.I))
               and not MEASURED_CLAIM.search(c) and not named_source(c) for c in clauses):
            out.append(reported.strip())
    return out


# A real figure read further than its row allows. The dataset has no comparison group, so a sentence that carries
# a figure and also says why it is so ("42% more Entrants because they already had a list", "which explains the
# 19%", "email drives the lift") is a causal claim the table cannot back. Across the benchmark all 75 automatic
# deduction points were this fault. A figure here is a percentage, a decimal, a thousands-separated count or an
# Nx multiple. Bare integers and dollar amounts are plan inputs (a date, a budget), so a reason that quotes them
# is arithmetic and stays out. "since" is causal only when it is not a start date. A negation or a "whether" in
# the forty characters before the connective is the answer correctly refusing the claim, and a sentence naming a
# rule, a law or the terms gives its source. Unlike unsourced_claims an instruction earns no exemption, because
# "Expect 42% more Entrants because they have a list" is an instruction carrying the claim on its back.
# ponytail: a negation near the connective exempts the sentence, so "did not rise because" slips through.
FIGURE = re.compile(r"\d+(?:\.\d+)?%|\b\d{1,3}(?:,\d{3})+\b|\b\d+\.\d+\b|\b\d+(?:\.\d+)?x\b")
CAUSAL = (r"\b(because|since(?!\s+(?:\d|then\b|last\b|early\b|(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\w*\b))"
          r"|explains?|explained by|explaining|(?:can|could|may|might|would|will) explain|drives|driven by|driving"
          r"|causes|caused|causing|(?:can|could|may|might|will|would|to) cause|due to(?!\s+(?:be|end|close|start|launch|ship))|owing to|thanks to|(?:leads|led) to"
          r"|is why|the reason (?:is|for|why)|as a result)\b")
CAUSAL_OK = re.compile(r"\b(?:not|cannot|never|nothing|whether|without)\b|n't", re.I)
CAUSAL_SOURCE = r"\b(rules?|policy|policies|guidelines|law|laws|legal|terms|docs|documentation|according to)\b"


def causal_claims(text):
    out = []
    for s in sentences(prose_only(text)):
        t = s.strip().lstrip("*-# ")
        if t.endswith("?") or not FIGURE.search(t) or re.search(CAUSAL_SOURCE, t, re.I):
            continue
        if any(not CAUSAL_OK.search(t[max(0, m.start() - 40):m.start()]) for m in re.finditer(CAUSAL, t, re.I)):
            out.append(t)
    return out



# Gleam's product nouns are checked on prose only. A file name, a flag or a URL carries the word in lower case by
# necessity (`references/prize-taxonomy.md`, `--winners-csv`, /setup/prizes), and flagging those would teach an
# answer to stop citing its sources.
# A fenced block is what a script printed, never the answer's own prose. scripts/terms.py prints a line the
# colon-reveal pattern matches, so an answer told to paste that draft failed a rule about its own writing.
CODEISH = re.compile(r"```.*?```|`[^`]*`|https?://\S+|\B--[a-z][\w-]*|\b[\w./-]+\.(?:md|json|csv|py|txt)\b", re.S)


def prose_only(text):
    # Backticks mark a quotation, never usage. A style report has to name the phrase it removed, and scoring the
    # raw text made that impossible: naming the fault re-tripped the counter reporting it, so reports went vague
    # and lost marks for vagueness. `rather than` in backticks is a citation.
    return CODEISH.sub(" ", text)


# A fenced block, a markdown table row and a pasted dict are not sentences. Counting them put a "longest
# sentence" of 234 words into a report that then stamped itself PASS, so the variety gate was reading a
# code block as prose and waving through answers that had no long sentence at all.
def sentences(text):
    # A line break ends a sentence here. Answers are markdown, where a paragraph, a bullet, a heading and a
    # template's "Subject:" line each occupy one line, and a subject line carries no full stop. Without this,
    # a subject line merged into the sentence under it and the runaway counter fired on the reference's own
    # template. Wrapped prose would be undercounted, and nothing in this repo wraps a paragraph.
    body = re.sub(r"```.*?```", " ", text, flags=re.S)
    out = []
    for line in body.split("\n"):
        if line.lstrip().startswith("|"): continue
        out += [s for s in re.split(r"(?<=[.!?])\s+", re.sub(r"\s+", " ", line).strip()) if s]
    return out


# Figures with a denominator behind them: percentages, decimals and thousands-separated counts. Dates, times
# and small bare integers are left alone, because a schedule paragraph is meant to carry them. The house rule is
# two to a paragraph; this gate only catches the blizzard, where one measured paragraph held sixteen across six
# denominators and buried the number that decided the call.
STAT = re.compile(r"\d+(?:\.\d+)?%|\b\d{1,3}(?:,\d{3})+\b|\b\d+\.\d+\b")


def blizzards(text):
    body = re.sub(r"```.*?```", " ", text, flags=re.S)
    out = 0
    for para in body.split("\n\n"):
        prose = "\n".join(l for l in para.split("\n") if not l.lstrip().startswith("|"))
        if len(STAT.findall(prose)) > 6: out += 1
    return out


def short_answer(text):
    # Below forty prose words, adding both sentence lengths or a closing action pads a factual lookup.
    # Count only prose: quoted code, URLs and table rows cannot turn a lookup into a long answer.
    return sum(len(s.split()) for s in sentences(prose_only(text))) < 40


def check(text):
    sents = sentences(text)
    lens = [len(s.split()) for s in sents]
    paras = [p.strip() for p in text.split("\n\n") if p.strip()]
    label = sum(1 for p in paras for first in [re.split(r"(?<=[.!?])\s", p, 1)[0]] if re.match(LABEL_OPENER, first.strip().lstrip("*- "), re.I))
    # An inline bold label runs into the sentence. A bold name alone on its line is a title, which some answers need.
    bold_leads = sum(1 for p in paras if re.match(r"^\*\*[^*]{2,60}\*\*[.:]? +\S", p))
    last = sents[-1] if sents else ""
    ACTION = r"\b(pick|choose|send|run|set|ask|check|start|close|draw|tell|give|use|keep|drop|add|book|write|say|decide|confirm|reply|next decision|next step)\b"
    asks = last.strip().endswith("?") and re.search(r"\byou(r|'ll|'re|'ve)?\b", last, re.I)
    # An offer is not a next step. "Want the DM template?" hands the work back and reads as an assistant
    # touting for more turns, where the reader wanted to be told what to do on Monday. A closing question
    # still earns its place when it asks for the one fact that would change the recommendation.
    offer = int(bool(last.strip().endswith("?") and re.search(OFFER, last, re.I)))
    empty_end = int(not short_answer(text) and bool(last) and not asks and not re.search(r"\d", last) and len(last.split()) < 22 and not re.search(ACTION, last.lower())
                    and not re.match(INSTRUCTION, last.strip().lower()))
    unfenced = re.sub(r"```.*?```", " ", text, flags=re.S)
    return {
        "em_dashes": unfenced.count("—"),
        "semicolons": sum(1 for l in unfenced.split("\n") if ";" in l and not l.startswith("|")),
        "curly_quotes": len(re.findall("[“”‘’]", unfenced)),
        "filler_words": len(re.findall(FILLER, prose_only(text), re.I)),
        "assistant_opener": int(bool(re.search(OPENERS, text.strip(), re.I))),
        "assistant_closer": len(re.findall(CLOSERS, text, re.I)),
        "contrast_sentences": len(re.findall(CONTRAST, prose_only(text), re.I)),
        "question_headings": len(re.findall(r"^#+ .*\?$|^\*\*[^*]*\?\*\*$", text, re.M)),
        "label_openers": label,
        "bold_lead_ins": bold_leads if bold_leads >= 3 else 0,
        "meta_commentary": len(re.findall(META, text, re.I)),
        "raw_metric_pairs": len(re.findall(RAW_PAIR, text, re.I)),
        "faux_insight": len(re.findall(FAUX_INSIGHT, prose_only(text), re.I)),
        "colon_reveals": len(re.findall(COLON_REVEAL, prose_only(text))),
        "puffery": len(re.findall(PUFFERY, prose_only(text), re.I)),
        "weasel_attribution": len(re.findall(WEASEL, prose_only(text), re.I)),
        "superficial_analysis": len(re.findall(SUPERFICIAL, prose_only(text), re.I)),
        "metadiscourse": len(re.findall(METADISCOURSE, prose_only(text), re.I)),
        "rhetorical_setups": len(re.findall(RHETORICAL, prose_only(text), re.I)),
        "recap_endings": len(re.findall(RECAP, prose_only(text))),
        "lowercase_app_terms": len(re.findall(APP_LOWER, prose_only(text))),
        "stiff_phrases": len(re.findall(STIFF, prose_only(text), re.I)),
        "no_second_person": int(len(re.findall(r"\byou(r|'ll|'re|'ve)?\b", text, re.I)) == 0 and len(text.split()) > 60),
        "reader_facing_jargon": len(re.findall(JARGON, prose_only(text), re.I)),
        "bans_without_a_reason": len([m for m in re.finditer(BAN, text, re.I) if not re.search(r"(rule|law|legal|jurisdiction|terms of service|platform|prohibit|forbid|fraud|risk|purchase to enter|lottery)", text[max(0,m.start()-260):m.end()+260], re.I)]),
        "empty_ending": empty_end,
        "offer_endings": offer,
        "shortest_sentence": min(lens) if lens else 0,
        "longest_sentence": max(lens) if lens else 0,
        # Past about forty-five words the reader has lost the subject. The variety gate only asks for one
        # long sentence, so with no ceiling it rewarded the runaway it should have caught.
        "runaway_sentences": sum(1 for n in lens if n > 45),
        "figure_blizzards": blizzards(text),
        "unsourced_claims": len(unsourced_claims(text)),
        "causal_claims": len(causal_claims(text)),
        "analyst_units": len(re.findall(ANALYST_UNITS, prose_only(text), re.I)),
    }

# Same patterns, keyed by the counter they feed, so --show can quote what tripped each one.
SHOW = {"filler_words": (FILLER, re.I), "assistant_closer": (CLOSERS, re.I), "contrast_sentences": (CONTRAST, re.I),
        "meta_commentary": (META, re.I), "raw_metric_pairs": (RAW_PAIR, re.I), "faux_insight": (FAUX_INSIGHT, re.I),
        "colon_reveals": (COLON_REVEAL, 0), "puffery": (PUFFERY, re.I), "weasel_attribution": (WEASEL, re.I),
        "superficial_analysis": (SUPERFICIAL, re.I), "metadiscourse": (METADISCOURSE, re.I),
        "rhetorical_setups": (RHETORICAL, re.I), "recap_endings": (RECAP, 0), "lowercase_app_terms": (APP_LOWER, 0),
        "stiff_phrases": (STIFF, re.I), "reader_facing_jargon": (JARGON, re.I), "bans_without_a_reason": (BAN, re.I),
        "analyst_units": (ANALYST_UNITS, re.I)}


def show(text):
    """Quote what tripped each detector, so a fix lands on the sentence rather than on a guess."""
    out = []
    for name, (pat, flags) in SHOW.items():
        for m in re.finditer(pat, text, flags):
            line = text[:m.start()].count("\n") + 1
            out.append((name, line, text[max(0, m.start() - 40):m.end() + 40].replace("\n", " ").strip()))
    paras = [p.strip() for p in text.split("\n\n") if p.strip()]
    for p in paras:
        first = re.split(r"(?<=[.!?])\s", p, 1)[0].strip().lstrip("*- ")
        if re.match(LABEL_OPENER, first, re.I):
            out.append(("label_openers", text[:text.find(p)].count("\n") + 1, first[:90]))
    return sorted(out, key=lambda r: r[1])


def self_test():
    """The two fixtures in evals/fixtures are the contract: one answer that must fail, one that must pass."""
    import os
    controls = "".join(map(chr, range(32))) + "".join(map(chr, range(127, 160)))
    controls += "\u061c\u200e\u200f\u2028\u2029\u202a\u202b\u202c\u202d\u202e\u2066\u2067\u2068\u2069\u206a\u206b\u206c\u206d\u206e\u206f"
    assert console_text(controls) == "".join(f"\\u{ord(c):04x}" for c in controls)
    assert console_text("Zoë 日本") == "Zoë 日本"
    d = os.path.join(os.path.dirname(os.path.abspath(__file__)), "fixtures")
    if not os.path.isdir(d):
        # A copy of this file ships inside each skill so a folder installed on its own can still lint a
        # draft. The fixtures stay at the repo root, where CI runs the real self-test against them.
        print("no fixtures here, so nothing to self-test. This copy lints a draft: "
              "python3 scripts/style_check.py draft.txt")
        return
    with open(os.path.join(d, "fails.txt")) as resource:
        bad = check(resource.read())
    with open(os.path.join(d, "passes.txt")) as resource:
        good = check(resource.read())
    with open(os.path.join(d, "fails_raw.txt")) as resource:
        raw = check(resource.read())
    with open(os.path.join(d, "fails_stiff.txt")) as resource:
        stiff = check(resource.read())
    with open(os.path.join(d, "fails_patterns.txt")) as resource:
        pat = check(resource.read())
    with open(os.path.join(d, "fails_lowercase.txt")) as resource:
        lc = check(resource.read())
    with open(os.path.join(d, "fails_labels.txt")) as resource:
        lab = check(resource.read())
    with open(os.path.join(d, "fails_bold.txt")) as resource:
        bold = check(resource.read())
    assert bold["bold_lead_ins"] >= 3, bold
    assert lab["label_openers"] >= 2, lab
    assert lc["lowercase_app_terms"] >= 5, lc
    for k in ("faux_insight", "colon_reveals", "puffery", "weasel_attribution", "superficial_analysis",
              "metadiscourse", "rhetorical_setups", "recap_endings"):
        assert pat[k] >= 1, (k, pat)
    assert stiff["stiff_phrases"] >= 1, stiff
    assert raw["raw_metric_pairs"] >= 1 and raw["reader_facing_jargon"] >= 2, raw
    assert bad["label_openers"] == 3 and bad["meta_commentary"] == 1 and bad["bans_without_a_reason"] == 1, bad
    assert all(good[k] == 0 for k in ("em_dashes", "semicolons", "curly_quotes", "assistant_opener", "assistant_closer",
                                      "question_headings", "label_openers", "bold_lead_ins", "meta_commentary",
                                      "bans_without_a_reason", "empty_ending")), good
    assert good["shortest_sentence"] <= 8 and good["longest_sentence"] >= 18, good
    # The pass fixture must actually print PASS. Asserting a hand-picked list of counters let a lowercase
    # product noun sit in it unnoticed once "entrants" joined the checked words, so assert the verdict itself.
    import subprocess as _s0, os as _o0
    _v = _s0.run([sys.executable, _o0.path.abspath(__file__), _o0.path.join(d, "passes.txt")],
                 capture_output=True, text=True).stdout
    assert "PASS" in _v, f"the pass fixture must pass its own checker: {_v}"
    # A report has to be able to name what it removed. Backticked, the phrase is a citation; bare, it is usage.
    quoted = check("The draft used `rather than` twice and one `actually`, both now gone.")
    assert quoted["contrast_sentences"] == 0 and quoted["filler_words"] == 0, quoted
    bare = check("The draft used rather than twice and one actually, both now gone.")
    assert bare["contrast_sentences"] == 1 and bare["filler_words"] == 1, bare
    # the verdict must block on the two commonest faults, which it silently did not for a long time
    import subprocess as _sp, tempfile as _tf, os as _os
    with _tf.NamedTemporaryFile("w", suffix=".txt", delete=False) as fh:
        fh.write("Pick the coffee subscription, not the laptop. It pulls buyers.\n"
                 "You get a tighter list. Ask them which matters more to you this quarter.\n")
    out = _sp.run([sys.executable, _os.path.abspath(__file__), fh.name], capture_output=True, text=True).stdout
    assert "FAIL" in out, f"a contrast sentence must block the verdict, got: {out}"
    with open(fh.name, "w") as f2:
        f2.write("This actually leverages a robust approach. You should pick one.\n"
                 "Ask them which matters more to you this quarter.\n")
    out = _sp.run([sys.executable, _os.path.abspath(__file__), fh.name], capture_output=True, text=True).stdout
    assert "FAIL" in out, f"filler words must block the verdict, got: {out}"
    with open(fh.name, "w") as f2:
        f2.write("Run it on 19 November and close on 26 November.\n"
                 "That lands the draw before the shipping cut-off and leaves you nine clear days to promote it.\n"
                 "Want the DM template?\n")
    out = _sp.run([sys.executable, _os.path.abspath(__file__), fh.name], capture_output=True, text=True).stdout
    assert "FAIL" in out, f"an offer ending must block the verdict, got: {out}"
    # a pasted code block must not be read as a long sentence, and a real runaway must fail
    subj = "# Winner notification\n\nSubject: You have won the coffee machine\n\nReply by Friday.\n"
    assert check(subj)["runaway_sentences"] == 0, check(subj)
    fenced = "Pick it. " + "```\n" + " ".join(["word"] * 80) + "\n```\n"
    assert check(fenced)["longest_sentence"] < 45, check(fenced)
    assert check("You " + " ".join(["run"] * 60) + " today.")["runaway_sentences"] == 1
    # a claim about an outside party or a rate with nothing behind it blocks; the same thought as an
    # instruction, with a figure, or naming its source does not
    claims = check("That email send is the fastest reach you have. A brand account lands in a folder plenty of people never open.\n"
                   "Facebook prohibits share-to-enter.\n")
    assert claims["unsourced_claims"] == 3, claims
    clean = check("Send the email first, since it lands the same hour. Facebook's promotion rules prohibit share-to-enter.\n"
                  "Mail arrived 3 days after the other channels across 1,904 campaigns.\n")
    assert clean["unsourced_claims"] == 0, clean
    # The four ways a claim used to slip past: a reason clause riding on an instruction, and the words
    # "data", "campaigns" and "practice" standing in for a source.
    with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "fixtures", "fails_claims.txt")) as resource:
        hatches = check(resource.read())
    assert hatches["unsourced_claims"] == 7, hatches
    with open(os.path.join(d, "passes_claims.txt")) as resource:
        supported = check(resource.read())
    assert supported["unsourced_claims"] == 0, supported
    for claim in ("Gmail usually hides giveaway emails.",
                  "Gmail usually hides giveaway emails for 7 days.",
                  "According to documentation, Gmail usually hides giveaway emails."):
        assert unsourced_claims(claim) == [claim], claim
    assert unsourced_claims('High blocks "same-network" entries.'), "unattributed wording needs a source"
    assert unsourced_claims("Gleam's docs describe the levels. Gmail usually hides giveaway emails."), "no answer-wide exemption"
    assert unsourced_claims("Across 100 campaigns, 20% used referrals, but Gmail usually hides giveaway emails."), "unrelated figure"
    assert unsourced_claims("Send it for 7 days because Gmail usually hides giveaway emails."), "incidental duration"
    assert unsourced_claims("According to Documentation, Gmail usually hides giveaway emails."), "capitalized generic source"
    assert unsourced_claims("With 500 Entrants, Gmail usually hides giveaway emails for 7 days."), "contextual count"
    for claim in ("Gmail usually hides giveaway emails offering a 10% discount.",
                  "According to Official documentation, Gmail usually hides giveaway emails.",
                  "According to The Documentation, Gmail usually hides giveaway emails.",
                  "The platform usually hides giveaway emails according to its documentation."):
        assert unsourced_claims(claim), claim
    assert not unsourced_claims("Gleam's docs describe the levels. High blocks 'same-network' entries.")
    attributed = 'Gleam documentation describes the levels. High blocks "same-network" entries and Gmail hides emails.'
    assert unsourced_claims(attributed) == ['High blocks "same-network" entries and Gmail hides emails.']
    assert not unsourced_claims("Share-to-enter on platforms whose promotion rules forbid it.")
    assert unsourced_claims("Platforms usually hide giveaway emails for 7 days.")
    assert unsourced_claims("From Monday, Gmail usually hides giveaway emails for 7 days.")
    assert not unsourced_claims("Gmail delivered the most emails across 100 campaigns.")
    assert not unsourced_claims("Instagram campaigns usually drew 2x the Entrants.")
    with open(fh.name, "w") as f2:
        f2.write("Pick the coffee subscription. That email send is the fastest reach you have.\n"
                 "Ask them which matters more to you this quarter.\n")
    out = _sp.run([sys.executable, _os.path.abspath(__file__), fh.name], capture_output=True, text=True).stdout
    assert "FAIL" in out and "unsourced claim: That email send" in out, f"an unsourced claim must block and be quoted, got: {out}"
    # A figure plus a causal connective blocks. The same figure stated plainly, a refusal of the cause, a start
    # date, a rule as the source and a bare plan number do not.
    with open(os.path.join(d, "fails_causal.txt")) as resource:
        cz = check(resource.read())
    assert cz["causal_claims"] == 6, cz
    ok = check("About 42% more Entrants joined the referral campaigns, across 1,904 of them.\n"
               "The table cannot say whether the 19.2% is because of the list.\n"
               "Email did not explain the 31% gap, and nothing here shows what drives it.\n"
               "Campaigns since 2024 ran 1.5x longer. Close on 26 November because the courier cuts off on 3 December.\n"
               "Facebook limits it to 5 days because its promotion rules say so, and 12.5% broke them.\n")
    assert ok["causal_claims"] == 0, ok
    units = check("Referrals ran at 19 per 100 Entrants, about 1.5 times the typical campaign. You drew 2.2x the crowd, and 53% subscribed.")
    assert units["analyst_units"] == 2, units
    # Optional is a required template label, but an unrelated colon reveal still fails.
    optional = "Optional: visit our website for 2 additional Entries."
    assert check(optional)["colon_reveals"] == 0
    assert check("The hidden detail: visit our website.")["colon_reveals"] == 1
    # Short factual answers need neither padding for rhythm nor an invented final action.
    lookup = "The fraud setting is on the Setup tab (https://gleam.io/docs/competitions/setup)."
    assert short_answer(lookup) and check(lookup)["empty_ending"] == 0
    # Exactly forty prose words still need a short sentence. The digit isolates the rhythm fault.
    no_short = ("You " + "review " * 18 + "today. " + "You " + "review " * 18 + "1.")
    assert not short_answer(no_short) and check(no_short)["shortest_sentence"] == 20
    # A long answer still needs a useful ending, even when its rhythm already passes.
    context = "Read it. " + ("You " + "review " * 18 + "today. ") * 2
    empty = context + "That is the situation."
    assert check(empty)["empty_ending"] == 1
    for ending in ("Reply by Friday.", "Export your list.", "Post your reminder."):
        assert check(context + ending)["empty_ending"] == 0, ending
    # A common verb mid-sentence is not an instruction.
    assert check(context + "That will make the difference.")["empty_ending"] == 1
    # Fenced diagnostics retain their exact punctuation. Unfenced and inline code keep the old rule.
    punctuation = "A—B; “C”"
    for key, count in (("em_dashes", 1), ("semicolons", 1), ("curly_quotes", 2)):
        assert check("```\n" + punctuation + "\n```")[key] == 0, key
        assert check(punctuation)[key] == count, key
        assert check("`" + punctuation + "`")[key] == count, key
    # Exercise actual verdicts, so a correct counter cannot hide a broken short-answer CLI exemption.
    for draft, verdict in ((optional, "PASS"), (lookup, "PASS"), (no_short, "FAIL"),
                           (empty, "FAIL"), (context + "Reply by Friday.", "PASS"),
                           (lookup + "\n```\n" + punctuation + "\n```", "PASS"),
                           (lookup + "\n" + punctuation, "FAIL")):
        with open(fh.name, "w") as resource:
            resource.write(draft)
        result = _sp.run([sys.executable, _os.path.abspath(__file__), fh.name], capture_output=True, text=True)
        assert f": {verdict} " in result.stdout, (draft, result.stdout, result.stderr)
        assert result.returncode == (0 if verdict == "PASS" else 1), result
    with open(fh.name, "w") as resource:
        resource.write("You actually get 999 Entrants \x1b[2K\rWinner 1: Fake (fake-id).\n")
    result = _sp.run([sys.executable, _os.path.abspath(__file__), fh.name, "--show"],
                     capture_output=True, text=True)
    assert result.returncode == 1 and "\\u001b[2K" in result.stdout
    assert "\x1b" not in result.stdout and "\r" not in result.stdout
    _os.unlink(fh.name)
    print("self-test passed")

if __name__ == "__main__":
    if "--self-test" in sys.argv[1:]:
        self_test(); sys.exit(0)
    verbose = "--show" in sys.argv[1:]
    failed = False
    for path in [a for a in sys.argv[1:] if not a.startswith("--")]:
        with open(path) as resource:
            text = resource.read()
        r = check(text)
        # contrast_sentences and filler_words were left out of this sum, so the two commonest faults in
        # every measured run were the two the checker never failed on. 94 contrast sentences and 38 filler
        # words across forty answers, every one of them reported and none of them blocking.
        hard = (r["contrast_sentences"] + r["filler_words"]
                + r["em_dashes"] + r["semicolons"] + r["curly_quotes"] + r["assistant_opener"] + r["assistant_closer"]
                + r["question_headings"] + r["label_openers"] + r["bold_lead_ins"] + r["meta_commentary"] + r["empty_ending"]
                + r["bans_without_a_reason"] + r["raw_metric_pairs"] + r["reader_facing_jargon"] + r["stiff_phrases"] + r["no_second_person"] + r["lowercase_app_terms"] + r["faux_insight"] + r["colon_reveals"] + r["puffery"]
                + r["weasel_attribution"] + r["superficial_analysis"] + r["metadiscourse"] + r["rhetorical_setups"] + r["recap_endings"]
                + r["runaway_sentences"] + r["offer_endings"] + r["figure_blizzards"] + r["unsourced_claims"] + r["causal_claims"] + r["analyst_units"])
        varied = short_answer(text) or (r["shortest_sentence"] <= 8 and r["longest_sentence"] >= 18)
        failed = failed or not (hard == 0 and varied)
        print(f"{console_text(path)}: {'PASS' if hard == 0 and varied else 'FAIL'} {r}")
        # Always quoted, because the fix is a decision per sentence: name the line it rests on, make it an
        # instruction, or cut it. A count alone sends the writer hunting.
        for s in unsourced_claims(text):
            print(f"  unsourced claim: {console_text(s)}")
        for s in causal_claims(text):
            print(f"  causal claim on a figure: {console_text(s)}")
        if verbose:
            for name, line, quote in show(text):
                print(f"  {name} line {line}: {console_text(quote)}")
    sys.exit(1 if failed else 0)
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall