Automation + skills / Her Mind & Wellness
Expert-reviewed article writer.
A clinic’s guides have to be right, sourced and approved by the clinician before anyone reads them. This drafts them for her: it picks questions the library has not answered yet, reads real sources, writes in the practice’s voice, and checks the draft before her time is spent. She reviews once, by reading it or by listening to its podcast version, and publishes. It never publishes on its own.
BeforeA blank page, twelve open tabs, and an article the expert has no time to write or check.
AfterA sourced draft written to be read and heard, checked before the expert reviews it once.
What it is worthA steady library with every claim sourced, and one review per article by reading or listening. Instead of writing every guide yourself, or paying a ghostwriter whose claims you then have to verify.
Counted from the practice’s repository on November 20, 2026. Read them at hermindandwellness.com/learn ↗. Every guide is also a podcast episode: Articles into a podcast ›
The sample article above is made up.
How to use it
- Copy the skill into your AI (Claude, ChatGPT, Gemini) and add your rules: who reviews, what you offer, what you never claim.
- Give it your list of existing articles and ask for the next few. It drafts each with sources and notes for your reviewer.
- Run check_article.py on each draft and fix what it lists. Then the expert reads it, or listens to its podcast version, and approves.
- Publish only what the expert approved. Turn it into a podcast with the Articles into a podcast skill.
Where it helps most
- Clinics and practices whose patient education must be approved by a licensed professional.
- Engineering, legal and finance firms that want client guides with sources, without ghost-written claims.
- Any expert who wants a steady library of useful articles but has no time to draft them.
Free to take
Build your own.
Copy the skill, paste it into your own AI, and say what you want different. How to use a skill, step by step ›
Get the skillThe instructions your AI follows. Works in Claude, ChatGPT, Gemini or any other
---
name: expert-reviewed-article-writer
description: Write patient- or customer-education articles that an expert reviews before they go live: pick topics that don't repeat, research real sources, write in the house voice and for listening, and hand over drafts with review notes. Use for "write our next articles" for a clinic, practice or expert business.
---
# Expert-reviewed article writer
You write drafts. A named expert (clinician, engineer, lawyer…) reviews and publishes. Never publish, never say something was reviewed when it wasn't.
## 1. Before writing
- Ask for, or read, the business's rules: who the expert is and their exact credentials, services they do and don't offer, where they work, prices or offers that must stay exact, the house voice, and claims that are never allowed.
- List the existing articles (titles and topics). Don't repeat one; build on it instead.
- Choose topics people actually search for: "is it normal…", "when should I…", "what should I ask…". One clear question per article.
## 2. Research
- Every factual claim needs a source you have just read: government and standards bodies, professional associations, product labels, peer-reviewed reviews. Never cite from memory.
- Cite inline as [1], [2]… in the order of the article's source list. 3 to 6 sources is typical.
- For anything with risk (medicines, money, safety): no doses, no personal instructions, no promises of outcomes.
## 3. Write
- Warm, plain, a little wry when it helps. "You", short paragraphs, 400 to 750 words, 5 to 8 sections.
- Title: the reader's own question or feeling. Description: one or two sentences on what the article answers.
- Headings short: a question or a clear statement.
- Invented examples are fine, labeled in your notes as invented. Never real customers or patients, never the expert's private life.
- End with when to get help and what to bring or ask, not a sales pitch.
- Write for the ear too, because the article can become a podcast word for word: spell out abbreviations once, no web addresses read aloud, no tables, no "see above", no symbol-heavy text, list items as full phrases.
## 4. Hand over
Save each draft as JSON:
{"id": "kebab-case", "title": "…", "description": "…", "status": "draft", "sources": [{"id": "…", "title": "…", "organization": "…", "url": "https://…"}], "sections": [{"heading": "…", "paragraphs": ["… [1]"], "bullets": ["optional"]}], "review_notes": ["…"]}
In review_notes: where the topic came from, which examples are invented, which claims to check hardest, and "Not yet reviewed by <expert>."
Then check it. If you can run code, use check_article.py from https://sghadimi.com/work/article-writer/ (one Python file, MIT license): `python3 check_article.py draft.json rules.json`, where rules.json lists phrases the business never allows. Fix everything under "fix" and read the "notes". If you cannot run code, check by hand: every [n] has a source, every source is cited, every number has a source, no web addresses or symbols in the text, and every abbreviation is spelled out once.
Read every draft once more as a listener. Then tell the owner what was written and what the expert should check first.
Get the code3 files, exactly as they run on this site · free under the MIT license
check_article.py is the pre-review check, with a made-up sample draft to try it on: python3 check_article.py selftest, then python3 check_article.py sample-draft.json. The practice's own pipeline, built into its private dashboard, stays private; this is the same method.
check_article.py (sources, claims, listening, your rules)172 lines
"""Check an article draft before an expert reviews it, and before it becomes a podcast.
python3 check_article.py draft.json [rules.json]
python3 check_article.py selftest
draft.json (what the writer skill saves):
{"id", "title", "description", "status": "draft",
"sources": [{"id", "title", "organization", "url"}],
"sections": [{"heading", "paragraphs": ["... [1]"], "bullets": [...]}],
"review_notes": [...]}
rules.json (optional, your business's own limits):
{"never_say": ["guaranteed", "cure"], "must_say": ["988"], "words": [400, 750]}
It reports, in plain words:
- shape: title and description lengths, 5-8 sections, word count, status still "draft"
- sources: every [n] points to a source, every source is cited, every link is https
- sentences with a number, percent or "study" but no [n] on them (likely unsourced claims)
- listening: web addresses, symbols, tables or "see above"; very long sentences;
abbreviations used before they are spelled out once
- your rules: phrases you never allow, lines that must appear
- review notes present, and saying it has not been reviewed yet
Exit code 0 = ready for the expert; 1 = fix the listed items first.
Free to use (MIT). Built for the Her Mind & Wellness guides by Shahrouz Ghadimi.
"""
import json
import re
import sys
DEFAULT = {'never_say': ['guaranteed', 'cure', 'miracle', 'risk-free', '100% safe'],
'must_say': [], 'words': [400, 750]}
CITE = re.compile(r'\[(\d+(?:\s*[,–-]\s*\d+)*)\]')
ABBR = re.compile(r'\b([A-Z]{2,6})s?\b')
COMMON = {'US', 'USA', 'OK', 'TV', 'AM', 'PM', 'ID', 'FAQ', 'AI'}
def sentences(text):
return [s for s in re.split(r'(?<=[.!?])\s+(?=[A-Z0-9“"(])', text) if s.strip()]
def numbers(ref):
out = set()
for part in re.split(r'\s*,\s*', ref):
if re.search(r'[–-]', part):
a, b = [int(x) for x in re.split(r'\s*[–-]\s*', part)]
out |= set(range(a, b + 1))
else:
out.add(int(part))
return out
def check(draft, rules=None):
rules = {**DEFAULT, **(rules or {})}
fix, note = [], []
title, desc = draft.get('title', ''), draft.get('description', '')
if not 10 <= len(title) <= 110:
fix.append(f'Title is {len(title)} characters; keep it 10 to 110.')
if not 40 <= len(desc) <= 210:
fix.append(f'Description is {len(desc)} characters; keep it 40 to 210.')
if draft.get('status') != 'draft':
fix.append('Status must stay "draft" until the expert approves it.')
sections = draft.get('sections') or []
if not 5 <= len(sections) <= 8:
note.append(f'{len(sections)} sections; 5 to 8 usually reads best.')
body = []
for s in sections:
if not s.get('heading', '').strip():
fix.append('A section has no heading.')
elif len(s['heading']) > 80:
note.append(f'Long heading (spoken by the co-host): "{s["heading"][:60]}…"')
if not s.get('paragraphs') and not s.get('bullets'):
fix.append(f'Section "{s.get("heading", "?")}" is empty.')
body += s.get('paragraphs', []) + s.get('bullets', [])
text = ' '.join(body)
words = len(CITE.sub('', text).split())
lo, hi = rules['words']
if not lo <= words <= hi:
note.append(f'{words} words; aim for {lo} to {hi} (about 3 to 6 minutes as a podcast).')
sources = draft.get('sources') or []
cited = set()
for ref in CITE.findall(text):
cited |= numbers(ref)
for n in sorted(cited):
if not 1 <= n <= len(sources):
fix.append(f'[{n}] points to no source (there are {len(sources)}).')
for i, s in enumerate(sources, 1):
if i not in cited:
fix.append(f'Source {i} ("{s.get("title", "?")}") is never cited.')
if not str(s.get('url', '')).startswith('https://'):
fix.append(f'Source {i} needs an https link.')
if not sources:
fix.append('No sources. Every factual claim needs one.')
for p in body:
for s in sentences(p):
plain = re.sub(r'\b(911|988)\b|\b\d{1,2}:\d{2}\b|\b(19|20)\d{2}\b', '', s)
if re.search(r'\d|percent|%|\bstud(?:y|ies)\b|\bresearch\b|\bapproved\b', plain, re.I) and not CITE.search(s):
note.append(f'Claim with no [n]: "{s[:90]}"')
if len(s.split()) > 35:
note.append(f'Long sentence ({len(s.split())} words) is hard to follow out loud: "{s[:70]}…"')
if re.search(r'https?://|www\.', text):
fix.append('A web address is in the text; it would be read aloud. Put links in the sources.')
if re.search(r'see (above|below)|click|\|', text, re.I):
fix.append('"See above", "click" or a table does not work when heard.')
if re.search(r'[≥≤/&]', CITE.sub('', text)):
note.append('Symbols (≥, ≤, /, &) read badly aloud; use words.')
seen = set()
full = title + ' ' + desc + ' ' + text
for m in ABBR.finditer(full):
ab = m.group(1)
if ab in COMMON or ab in seen:
continue
seen.add(ab)
before = full[:m.start()]
if not re.search(r'\(\s*' + ab + r'[\w-]*\s*\)', full[:m.end() + 6]) and ab not in before:
note.append(f'"{ab}": spell it out the first time, e.g. "full name ({ab})".')
low = full.lower()
for phrase in rules['never_say']:
for m in re.finditer(re.escape(phrase.lower()), low):
if re.search(r"\b(not|no|never|isn't|aren't)\b(\s+\S+){0,3}\s*$", low[max(0, m.start() - 40):m.start()]):
note.append(f'"{phrase}" appears in a negative ("not a {phrase}…"); fine, but check the tone.')
else:
fix.append(f'Uses "{phrase}", which your rules never allow.')
break
for phrase in rules['must_say']:
if phrase.lower() not in low:
fix.append(f'Missing "{phrase}", which your rules require.')
notes = draft.get('review_notes') or []
if not notes:
fix.append('Add review notes for the expert: topic origin, invented examples, claims to check hardest.')
elif not any('not yet reviewed' in n.lower() or 'no review' in n.lower() for n in notes):
note.append('Say in the review notes that it has not been reviewed yet.')
return {'ready_for_review': not fix, 'words': words, 'sources': len(sources), 'fix': fix, 'notes': note}
def selftest():
good = {'id': 'x', 'title': 'Rest stopped helping. Now what?', 'status': 'draft',
'description': 'When a long weekend no longer resets you, here is what to notice and what to ask.',
'sources': [{'title': 'Fact page', 'url': 'https://example.org/a'}, {'title': 'Guide', 'url': 'https://example.org/b'}],
'sections': [{'heading': f'Part {i}', 'paragraphs': ['Sleep that never feels restful is worth a conversation. [1]',
'Write down when it started and what makes it better or worse. [2]']}
for i in range(5)],
'review_notes': ['Invented example in part 1.', 'Not yet reviewed by the clinician.']}
r = check(good, {'words': [20, 750]})
assert r['ready_for_review'], r
bad = json.loads(json.dumps(good))
bad['sections'][0]['paragraphs'].append('See https://example.org for the guaranteed fix [3].')
bad['status'] = 'live'
r = check(bad, {'words': [20, 750]})
for want in ('points to no source', 'web address', 'guaranteed', 'Status'):
assert any(want in f for f in r['fix']), (want, r['fix'])
unsourced = json.loads(json.dumps(good))
unsourced['sections'][1]['paragraphs'].append('About 40 percent of adults report this.')
assert any('no [n]' in n for n in check(unsourced, {'words': [20, 750]})['notes'])
print('selftest passed')
if __name__ == '__main__':
if sys.argv[1:] == ['selftest']:
selftest()
elif len(sys.argv) in (2, 3):
result = check(json.load(open(sys.argv[1])), json.load(open(sys.argv[2])) if len(sys.argv) == 3 else None)
print(json.dumps(result, indent=2, ensure_ascii=False))
sys.exit(0 if result['ready_for_review'] else 1)
else:
sys.exit(__doc__)
sample-draft.json (the made-up article in the explainer)25 lines
{
"id": "rest-stopped-helping",
"title": "Rest stopped helping. Now what?",
"description": "When a long weekend no longer resets you, it is worth asking what else is going on. What to notice, and what to bring to a visit.",
"status": "draft",
"sources": [
{"id": "fact-page", "title": "Fatigue: when to see a doctor (sample)", "organization": "A national health institute (made up)", "url": "https://example.org/fatigue"},
{"id": "visit-guide", "title": "Preparing for an appointment (sample)", "organization": "A professional association (made up)", "url": "https://example.org/visit"},
{"id": "review", "title": "Persistent tiredness in adults: a review (sample)", "organization": "A peer-reviewed journal (made up)", "url": "https://example.org/review"}
],
"sections": [
{"heading": "The weekend did not fix it", "paragraphs": ["You slept in. You skipped the errands. On Monday morning you feel exactly as tired as you did on Friday.", "That happens to everyone once in a while. When it keeps happening, it is worth a closer look."]},
{"heading": "Is it tiredness, or something more?", "paragraphs": ["Tiredness that lasts for weeks and does not lift with rest can have many causes, from sleep problems to medical conditions to low mood. [1]", "Noticing the pattern is more useful than guessing the cause."]},
{"heading": "What to notice for two weeks", "paragraphs": ["A short daily note helps a clinician see what you see. [2]"], "bullets": ["When you went to sleep and woke up", "How rested you felt, from one to ten", "What you stopped enjoying, if anything", "Anything new: a medicine, a schedule change, a loss"]},
{"heading": "Why it is not just in your head", "paragraphs": ["Long-lasting fatigue is common, and it is real, whatever its cause. [3]", "Asking about it is not complaining. It is giving someone the information they need to help."]},
{"heading": "When to ask for help sooner", "paragraphs": ["Do not wait for two weeks of notes if the tiredness comes with chest pain, trouble breathing, or thoughts of not wanting to be here. Call your local emergency number or a crisis line right away. [1]"]},
{"heading": "What to bring to the visit", "paragraphs": ["Bring your notes, a list of your medicines, and the one question you most want answered. Say it first, so it does not get lost at the end. [2]"]}
],
"review_notes": [
"The Monday-morning scene is invented, not a patient story.",
"Check the emergency wording against your own safety text.",
"Not yet reviewed by the clinician."
]
}
flow.js (the step-by-step explainer on this page)175 lines
// How an expert-reviewed article gets written: six stations, one sample article (invented), one step at a time.
// Plays once and holds on each station; Next/Back, the station buttons and the arrow keys move by hand.
(() => {
const root = document.getElementById('rf');
if (!root) return;
const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const icons = {
check: '<path d="M4 6h10M4 11h10M4 16h6"/><path d="m14 16 3 3 5-6"/>',
review: '<path d="M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12z"/><circle cx="12" cy="12" r="2.8"/>',
topic: '<circle cx="11" cy="11" r="6.5"/><path d="m16 16 4.5 4.5"/><path d="M11 8.5v5M8.5 11h5"/>',
research: '<path d="M5 4h10l4 4v12H5z"/><path d="M15 4v4h4M8 12h8M8 15.5h8M8 9h4"/>',
write: '<path d="M4 20h4L19 9l-4-4L4 16z"/><path d="m13.5 6.5 4 4"/>',
script: '<rect x="3" y="5" width="8" height="6" rx="2"/><rect x="13" y="13" width="8" height="6" rx="2"/><path d="M7 11v3l3-3M17 13v-3l-3 3"/>',
match: '<path d="M4 12h6M14 12h6"/><path d="M7 8l-3 4 3 4M17 8l3 4-3 4"/><circle cx="12" cy="12" r="1.6"/>',
live: '<path d="M4 12a8 8 0 0 1 16 0"/><path d="M7.5 12a4.5 4.5 0 0 1 9 0"/><circle cx="12" cy="12" r="1.5"/><path d="M12 13.5V20"/>'
};
const steps = [
{ key: 'topic', label: 'Topic', title: 'A question people actually ask',
text: 'It lists every article you already have, then picks questions people search for that you have not answered yet.',
points: ['Checks the existing library first, so nothing repeats',
'Fits what the practice really offers, nothing it doesn’t',
'One clear question per article'],
scene: () => `
<div class="term">
<div class="l m" data-in>85 articles in the library · 0 on this question</div>
<div class="l" data-in> ✓ "When to ask for help with worry"</div>
<div class="l" data-in> ✓ "Antidepressant follow-up questions"</div>
<div class="l" data-in> <span class="c">new</span> "Rest stopped helping. Now what?"</div>
<div class="l m" data-in>fits: adults · Texas · in person or telehealth</div>
<div class="l" data-in><span class="y">Draft this one</span> <span class="caret"></span></div>
</div>` },
{ key: 'research', label: 'Research', title: 'Every claim has a source it actually read',
text: 'It reads current pages from government and professional bodies, and cites them inline as [1], [2].',
points: ['National health institutes, drug labels, professional associations',
'No doses, no personal instructions, no promises',
'The expert gets the numbered list to check against'],
scene: () => `
<div class="chip-src" data-in><i>1</i><span><b>National institute fact page</b><small>symptoms and when to seek care</small></span></div>
<div class="chip-src" data-in><i>2</i><span><b>Professional association guide</b><small>what an evaluation covers</small></span></div>
<div class="chip-src" data-in><i>3</i><span><b>Peer-reviewed review</b><small>what the studies found</small></span></div>
<div class="flow-arrow" data-in></div>
<div class="folder" data-in><b>Sources</b><span class="count">3</span>read today</div>
<div class="rules" data-in><span>HTTPS only</span><span>read, not remembered</span><span>numbered in order</span></div>` },
{ key: 'write', label: 'Write', title: 'Written to be read, and heard',
text: 'Warm, plain, a little wry. Short paragraphs, and sentences that sound right out loud, because the podcast will say every one.',
points: ['Abbreviations spelled out once; no web addresses read aloud',
'Invented examples labeled as invented for the reviewer',
'Saved as a draft. It never publishes itself'],
scene: () => `
<div class="web">
<div class="bar"><i></i><i></i><i></i><span>Studio · Draft</span></div>
<div class="note" data-in>Not yet reviewed by the clinician</div>
<div class="hd"><b>Rest stopped helping. Now what?</b><span class="st">Draft</span></div>
<div class="meta" data-in>When a long weekend no longer resets you, it is worth asking what else is going on. [1]</div>
<table><tbody>
<tr data-in><td>Heading</td><td>Is it tiredness, or something more?</td><td>✓</td></tr>
<tr data-in><td>Heading</td><td>What to bring to the visit</td><td>✓</td></tr>
<tr data-in><td>Sources</td><td>3 numbered</td><td>✓</td></tr>
</tbody></table>
<div class="you" data-in>Review notes for the expert attached</div>
</div>` },
{ key: 'check', label: 'Check', title: 'Checked before anyone’s time is spent',
text: 'A small free checker reads the draft the way a careful editor would, and lists what to fix before the expert sees it.',
points: ['Every [n] points to a real source, and every source is used',
'Numbers and “studies say” without a source are flagged',
'Web addresses, symbols and long sentences that would sound wrong aloud'],
scene: () => `
<div class="term">
<div class="l m" data-in>$ python3 check_article.py draft.json</div>
<div class="l" data-in> <span class="g">✓</span> 6 sections · 520 words · 3 sources, all cited</div>
<div class="l" data-in> <span class="y">!</span> claim with no [n]: "About 40 percent…"</div>
<div class="l" data-in> <span class="y">!</span> "CBT": spell it out the first time</div>
<div class="l" data-in> <span class="g">✓</span> still a draft · review notes present</div>
<div class="l" data-in><span class="c">fix 2 notes, then hand to the expert</span> <span class="caret"></span></div>
</div>` },
{ key: 'review', label: 'Review', title: 'The expert reviews once: read it, or listen',
text: 'The draft opens in the review screen with its podcast version beside it. The expert reads the article or plays the episode, ticks one box, and publishes.',
points: ['The podcast is the article word for word, so one review covers both',
'A match rating shows before they start; below 100% they must listen',
'Nothing goes live without that one confirmation'],
scene: () => `
<div class="fields">
<div class="f-cat" data-in><small>Podcast version</small><b>100% match</b><small>every sentence is the article’s, in order</small></div>
<div class="f-date" data-in><small>Confirmed by</small><b>☑ Read the article ☐ Listened</b><small>either one is enough at 100%</small></div>
<div class="f-tot" data-in><small>Then</small><b>Publish</b><small>article and episode go live together</small></div>
</div>` },
{ key: 'live', label: 'Live', title: 'Live, and heard as well as read',
text: 'The guide goes up with its sources and a Listen button that plays its podcast episode. The next round starts from a library that knows what it already has.',
points: ['Sources listed under the article, numbered as cited',
'The episode is on the podcast page and in the feed',
'Next round: new questions, nothing repeated'],
scene: () => `
<div class="done-list">
<div class="first" data-in><i>✓</i><span><b>Reviewed by the expert</b><small>reading or listening, one confirmation</small></span></div>
<div data-in><i>✓</i><span><b>Guide published</b><small>with its numbered sources</small></span></div>
<div data-in><i>✓</i><span><b>Listen button plays its episode</b><small>word for word, two AI voices</small></span></div>
<div data-in><i>✓</i><span><b>Added to the library list</b><small>so the next round won’t repeat it</small></span></div>
</div>` }
];
root.innerHTML = `
<div class="rf-head"><h2>How it works<span class="gold">.</span></h2><p>One article’s trip, from a question to a reviewed, published guide</p></div>
<div class="rf-rail">
<ol class="rf-track">${steps.map((s, i) => `<li class="rf-st" data-i="${i}"><button type="button" aria-label="${i + 1}. ${s.label}"><svg viewBox="0 0 24 24" aria-hidden="true">${icons[s.key]}</svg></button><span>${s.label}</span></li>`).join('')}
<li class="rf-fill" aria-hidden="true"></li><li class="rf-token" aria-hidden="true"></li></ol>
</div>
<div class="rf-stage" aria-live="polite"><div class="rf-copy"></div><div class="rf-scene"></div></div>
<div class="rf-ctl">
<button type="button" class="rf-back">Back</button>
<button type="button" class="rf-play">Play</button>
<button type="button" class="rf-next">Next</button>
<button type="button" class="rf-replay">Replay</button>
<span class="rf-where"></span>
</div>`;
const st = [...root.querySelectorAll('.rf-st')];
const copy = root.querySelector('.rf-copy');
const scene = root.querySelector('.rf-scene');
const fill = root.querySelector('.rf-fill');
const token = root.querySelector('.rf-token');
const track = root.querySelector('.rf-track');
const play = root.querySelector('.rf-play');
const where = root.querySelector('.rf-where');
let i = 0, playing = false, timers = [];
const clear = () => { timers.forEach(clearTimeout); timers = []; };
const later = (ms, fn) => timers.push(setTimeout(fn, ms));
function place() {
const a = st[0].getBoundingClientRect(), b = st[i].getBoundingClientRect(), t = track.getBoundingClientRect();
const x0 = a.left + a.width / 2 - t.left, x = b.left + b.width / 2 - t.left;
fill.style.setProperty('width', `${Math.max(0, x - x0)}px`);
token.style.setProperty('left', `${x}px`);
}
function show(n, auto) {
clear();
i = Math.max(0, Math.min(steps.length - 1, n));
const s = steps[i];
st.forEach((el, k) => { el.classList.toggle('now', k === i); el.classList.toggle('done', k < i); });
st.forEach((el, k) => el.querySelector('button').setAttribute('aria-current', k === i ? 'step' : 'false'));
copy.innerHTML = `<p class="rf-n">Step ${i + 1} of ${steps.length}</p><h3>${s.title}</h3><p>${s.text}</p><ul>${s.points.map(p => `<li>${p}</li>`).join('')}</ul>`;
scene.innerHTML = s.scene();
where.textContent = `${i + 1} / ${steps.length} · ${s.label}`;
place();
const parts = [...scene.querySelectorAll('[data-in]')];
if (reduce) parts.forEach(p => p.classList.add('in'));
else parts.forEach((p, k) => later(250 + k * 520, () => p.classList.add('in')));
const length = reduce ? 0 : 250 + parts.length * 520;
if (auto && playing) later(length + 2600, () => (i < steps.length - 1 ? show(i + 1, true) : stop()));
}
function start() { playing = true; play.textContent = 'Pause'; if (i === steps.length - 1) show(0, true); else show(i, true); }
function stop() { playing = false; play.textContent = 'Play'; clear(); scene.querySelectorAll('[data-in]').forEach(p => p.classList.add('in')); }
play.addEventListener('click', () => (playing ? stop() : start()));
root.querySelector('.rf-next').addEventListener('click', () => { stop(); show(i + 1); });
root.querySelector('.rf-back').addEventListener('click', () => { stop(); show(i - 1); });
root.querySelector('.rf-replay').addEventListener('click', () => { playing = true; play.textContent = 'Pause'; show(0, true); });
st.forEach((el, k) => el.querySelector('button').addEventListener('click', () => { stop(); show(k); }));
root.addEventListener('keydown', e => {
if (e.key === 'ArrowRight') { stop(); show(i + 1); e.preventDefault(); }
if (e.key === 'ArrowLeft') { stop(); show(i - 1); e.preventDefault(); }
});
window.addEventListener('resize', place);
show(0);
if (!reduce && 'IntersectionObserver' in window) {
const io = new IntersectionObserver(es => {
if (es.some(e => e.isIntersecting)) { io.disconnect(); if (!playing) start(); }
}, { threshold: 0.45 });
io.observe(root);
}
})();
Want a workflow like this inside your business?
The skill above is free and yours to adapt. If you would rather have it built around your own inbox, forms and files, tested, and handed over, I do that for a fixed price agreed up front. The first call is free.