Skip to content

majdghithan/agent-skills / skills/lahja

Arabic dialects (لهجة) writing skill - write or rewrite Arabic in a specific spoken dialect with correct dialect GRAMMAR, not just sample words. Covers negation, future and aspect markers, demonstratives, question words, spelling habits, MSA leaks to remove, and how English tech terms sit inside dialect text. Covers Levantine (Palestinian-anchored), Egyptian, Gulf, Iraqi, Maghrebi (Moroccan, Algerian, Tunisian), Libyan, Sudanese, and Yemeni. Use when the user asks to write "بالعامية", "باللهجة الفلسطينية/الشامية/المصرية/الخليجية/العراقية/المغربية/الليبية/السودانية/اليمنية", "in Levantine/Palestinian/Egyptian/Gulf/Khaleeji/Iraqi/Moroccan/Libyan/Sudanese/Yemeni Arabic or Darija", "make this sound less formal/less translated", "convert فصحى to عامية", or writes to you in a dialect and wants dialect output (social posts, chat/WhatsApp copy, casual product copy, scripts). Built on the fasih method by Maher El Gamil. Works standalone; if the separate fasih skill is also available, invoke it for editorial quality while lahja owns the dialect forms. Do NOT use for formal MSA writing, legal/government/medical text, literal translation, or when no dialect is wanted.

FileKindSize
SKILL.mdskill md12.2 KB
references/egyptian.mdmarkdown11.1 KB
references/gulf.mdmarkdown12.0 KB
references/iraqi.mdmarkdown12.5 KB
references/levantine.mdmarkdown16.0 KB
references/libyan.mdmarkdown13.2 KB
references/maghrebi.mdmarkdown15.6 KB
references/sudanese.mdmarkdown11.5 KB
references/yemeni.mdmarkdown12.8 KB
scripts/check_output.pyscript3.7 KB
scripts/check_skill.pyscript4.1 KB

scripts/check_output.py

View on GitHub
#!/usr/bin/env python3
"""Check a piece of dialect Arabic before delivering it.

    python3 scripts/check_output.py <dialect> <file>
    cat draft.txt | python3 scripts/check_output.py levantine -

Reports three things, all read live from the guides so they never drift:
  1. MSA leaks  - forms the target guide's leak table says to remove.
  2. Dialect mixing - markers SKILL.md assigns to a DIFFERENT dialect.
  3. Spelling   - tanween, short vowels, em-dashes.

It flags candidates; the writer decides. Exit code 1 if anything is flagged.
"""
import pathlib, re, sys

ROOT = pathlib.Path(__file__).resolve().parent.parent
AR = r"[ء-يٱ-ۓ]"          # letters only, no diacritics
TANWEEN = "ًٌٍ"                 # ـً ـٌ ـٍ
HARAKAT = "َُِْ"           # fatha damma kasra sukun


def tokens(cell):
    """Arabic forms in a table cell, minus glosses and punctuation."""
    cell = re.sub(r"\([^)]*\)", " ", cell)
    out = []
    for raw in re.split(r"[/،,]| or ", cell):
        t = "".join(re.findall(AR + r"+|\s", raw)).strip()
        t = re.sub(r"\s+", " ", t)
        if len(t.replace(" ", "")) >= 2:
            out.append(t)
    return out


NOISY = {"\u0644\u0627", "\u0645\u0627"}  # bare laa / maa: core dialect negators, not leaks on their own


def leaks_for(guide):
    """Left column of the guide's 'MSA leaks' table."""
    text = (ROOT / "references" / f"{guide}.md").read_text()
    block = re.search(r"#+ .*leaks.*?\n(.*?)(?=\n#+ |\Z)", text, re.S | re.I)
    found = []
    if block:
        for row in block.group(1).splitlines():
            if row.startswith("|") and "---" not in row:
                first = row.strip().strip("|").split("|")[0]
                found += tokens(first)
    return sorted(set(found) - NOISY, key=len, reverse=True)


def markers():
    """SKILL.md marker table -> {dialect: [forms]}, minus the shared ones."""
    skill = (ROOT / "SKILL.md").read_text()
    block = re.search(r"\| Dialect \| Markers \|\n\s*\|[-| ]+\|\n((?:\s*\|.*\|\n)+)", skill)
    table = {}
    if block:
        for row in block.group(1).strip().splitlines():
            cells = [c.strip() for c in row.strip().strip("|").split("|")]
            table[cells[0].lower()] = tokens(cells[1])
    return table


def hits(form, text):
    return re.search(rf"(^|\W){re.escape(form)}(\W|$)", text) is not None


def main():
    if len(sys.argv) != 3:
        sys.exit(__doc__)
    dialect, path = sys.argv[1].lower(), sys.argv[2]
    guides = {p.stem for p in (ROOT / "references").glob("*.md")}
    if dialect not in guides:
        sys.exit(f"unknown dialect '{dialect}'. one of: {', '.join(sorted(guides))}")

    text = sys.stdin.read() if path == "-" else pathlib.Path(path).read_text()
    flags = []

    for form in leaks_for(dialect):
        if hits(form, text):
            flags.append(f"MSA leak: '{form}' - see the leak table in {dialect}.md")

    table = markers()
    mine = set(table.get(dialect, []))
    for other, forms in table.items():
        if other == dialect:
            continue
        for form in forms:
            if form not in mine and hits(form, text):
                flags.append(f"dialect mixing: '{form}' belongs to {other}, not {dialect}")

    if any(c in text for c in TANWEEN):
        flags.append("spelling: tanween in dialect text")
    if any(c in text for c in HARAKAT):
        flags.append("spelling: short-vowel marks in dialect text")
    if chr(0x2014) in text or chr(0x2013) in text:
        flags.append("spelling: em/en dash")

    if not flags:
        print(f"clean for {dialect}")
        return
    print(f"{len(flags)} thing(s) to look at for {dialect}:")
    for f in dict.fromkeys(flags):
        print(" -", f)
    sys.exit(1)


if __name__ == "__main__":
    main()
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: 471kUpdated Claude CodeCodexVerifiedInstall
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: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 availableStars: 322kUpdated Claude CodeCodexVerifiedInstall