Reads one Google Doc and writes three new documents from it: a study guide, a ten-minute briefing and a dated timeline.

UsesClaudeGoogle Docs

Turn one document into a study guide, a briefing and a timeline

ValuesSet sourceDocumentLink to blank.Set sourceDocumentLink to blank.
ValuesSet studyPackName to blank.Set studyPackName to blank.
TextTrim studyPackName and save it as packName.Trim studyPackName and save it as packName.
TextTrim sourceDocumentLink and save it as sourceLink.Trim sourceDocumentLink and save it as sourceLink.
ValuesSet sourceDocumentId to sourceLink.Set sourceDocumentId to sourceLink.
Decisions & LoopsIf sourceLink starts with http (ignoring case)If sourceLink starts with http (ignoring case)
Yes
Decisions & LoopsIf sourceLink doesn't contain /d/If sourceLink doesn't contain /d/
Yes
Decisions & LoopsStop and report a problem: The 'sourceDocumentLink' step is a web address but not a Google Docs one, so there is no document to read. A Docs link contains '/d/' - for example https://docs.google.com/document/d/1AbCdEf/edit.Stop and report a problem: The 'sourceDocumentLink' step is a web address but not a Google Docs one, so there is no document to read. A Docs link contains '/d/' - for example https://docs.google.com/document/d/1AbCdEf/edit.
No
No steps
ListsGet the first item of the last item of sourceLink split by /d/ split by / and save it as sourceDocumentId.Get the first item of the last item of sourceLink split by /d/ split by / and save it as sourceDocumentId.
No
No steps
Decisions & LoopsIf sourceDocumentId is emptyIf sourceDocumentId is empty
Yes
Decisions & LoopsStop and report a problem: No document id could be read out of the 'sourceDocumentLink' step. Paste the whole link from your browser address bar.Stop and report a problem: No document id could be read out of the 'sourceDocumentLink' step. Paste the whole link from your browser address bar.
No
No steps
ValuesSet sourceText to blank.Set sourceText to blank.
Decisions & LoopsIf a step below fails, save the error as readErrorIf a step below fails, save the error as readError
Try
Google DocsGoogle DocsRead sourceDocumentId. Save it as readResult.Read sourceDocumentId. Save it as readResult.
TextTrim readResult.text and save it as sourceText.Trim readResult.text and save it as sourceText.
On error
Decisions & LoopsStop and report a problem: Could not read that document. Check the 'sourceDocumentLink' step points at a Google Doc your connected account can open. The reason given was: readError.message.Stop and report a problem: Could not read that document. Check the 'sourceDocumentLink' step points at a Google Doc your connected account can open. The reason given was: readError.message.
Decisions & LoopsIf sourceText is emptyIf sourceText is empty
Yes
Decisions & LoopsStop and report a problem: That document has no text in it, so there is nothing to study. Check the 'sourceDocumentLink' step points at the right document.Stop and report a problem: That document has no text in it, so there is nothing to study. Check the 'sourceDocumentLink' step points at the right document.
No
No steps
ValuesSet documentBlock to Set documentBlock to DOCUMENT STARTS sourceText truncated to 40000 characters (keeping words whole) DOCUMENT ENDS.
ValuesSet studyGuidePrompt to You are writing from ONE source document, which is reproduced in full below.Set studyGuidePrompt to You are writing from ONE source document, which is reproduced in full below. Every statement you write must be supported by that text and by nothing else. Do not add background knowledge. Do not add a name, a date, a figure, an event or a claim that is not in the text. Where the document does not cover something, write that the document does not say. Do not guess and do not fill gaps. Write plain text. Do not use markdown, asterisks or hash marks. Task: write a study guide for the document. Use exactly these five sections, each introduced by its name on its own line: SUMMARY KEY IDEAS KEY TERMS AND WHAT THE DOCUMENT SAYS THEY MEAN QUESTIONS TO TEST YOURSELF WHAT THIS DOCUMENT DOES NOT COVER Define a term only if the document defines it. Every question must be answerable from the document alone.@documentBlock.
ValuesSet studyGuideText to blank.Set studyGuideText to blank.
Decisions & LoopsIf a step below fails, save the error as studyGuideErrorIf a step below fails, save the error as studyGuideError
Try
ClaudeClaudeAsk Claude: studyGuidePrompt. Save it as studyGuideReply.Ask Claude: studyGuidePrompt. Save it as studyGuideReply. Maximum response length: 3000
TextTrim studyGuideReply.response_text and save it as studyGuideText.Trim studyGuideReply.response_text and save it as studyGuideText.
On error
ValuesChange studyGuideText to blank.Change studyGuideText to blank.
ValuesSet briefingPrompt to You are writing from ONE source document, which is reproduced in full below.Set briefingPrompt to You are writing from ONE source document, which is reproduced in full below. Every statement you write must be supported by that text and by nothing else. Do not add background knowledge. Do not add a name, a date, a figure, an event or a claim that is not in the text. Where the document does not cover something, write that the document does not say. Do not guess and do not fill gaps. Write plain text. Do not use markdown, asterisks or hash marks. Task: write a briefing for someone who has ten minutes and has not read the document. Use exactly these four sections, each introduced by its name on its own line: WHAT THIS IS WHAT IT SAYS WHAT IT ASKS FOR OR DECIDES QUESTIONS THE DOCUMENT LEAVES OPEN Keep it under 400 words. Attribute every point to the document rather than asserting it as general fact.@documentBlock.
ValuesSet briefingText to blank.Set briefingText to blank.
Decisions & LoopsIf a step below fails, save the error as briefingErrorIf a step below fails, save the error as briefingError
Try
ClaudeClaudeAsk Claude: briefingPrompt. Save it as briefingReply.Ask Claude: briefingPrompt. Save it as briefingReply. Maximum response length: 1500
TextTrim briefingReply.response_text and save it as briefingText.Trim briefingReply.response_text and save it as briefingText.
On error
ValuesChange briefingText to blank.Change briefingText to blank.
ValuesSet timelinePrompt to You are writing from ONE source document, which is reproduced in full below.Set timelinePrompt to You are writing from ONE source document, which is reproduced in full below. Every statement you write must be supported by that text and by nothing else. Do not add background knowledge. Do not add a name, a date, a figure, an event or a claim that is not in the text. Where the document does not cover something, write that the document does not say. Do not guess and do not fill gaps. Write plain text. Do not use markdown, asterisks or hash marks. Task: list every dated event the document states, earliest first. Write one event per line in exactly this format, with a vertical bar between the two parts: date exactly as written in the document | what happened, in one short sentence Copy the date text character for character from the document. Do not reformat it, do not complete a partial date, do not convert it to another calendar or style, and do not work out a date the document does not state. Write no heading, no numbering and no commentary - only the event lines. If the document states no dates at all, reply with exactly this one line and nothing else: NO DATES IN THIS DOCUMENT@documentBlock.
ValuesSet timelineText to blank.Set timelineText to blank.
Decisions & LoopsIf a step below fails, save the error as timelineErrorIf a step below fails, save the error as timelineError
Try
ClaudeClaudeAsk Claude: timelinePrompt. Save it as timelineReply.Ask Claude: timelinePrompt. Save it as timelineReply. Maximum response length: 2000
TextTrim timelineReply.response_text and save it as timelineText.Trim timelineReply.response_text and save it as timelineText.
On error
ValuesChange timelineText to blank.Change timelineText to blank.
Decisions & LoopsIf studyGuideText is empty or briefingText is empty or timelineText is emptyIf studyGuideText is empty or briefingText is empty or timelineText is empty
Yes
Decisions & LoopsStop and report a problem: One of the three drafts came back empty, so nothing has been created. Run it again; if it keeps happening the document may be too long to work through in one pass.Stop and report a problem: One of the three drafts came back empty, so nothing has been created. Run it again; if it keeps happening the document may be too long to work through in one pass.
No
No steps
ValuesSet timelineEvents to an empty list.Set timelineEvents to an empty list.
ValuesSet untraceableDates to an empty list.Set untraceableDates to an empty list.
TextCheck whether timelineText contains NO DATES IN THIS DOCUMENT (ignoring case) and save it as sourceStatesNoDates.Check whether timelineText contains NO DATES IN THIS DOCUMENT (ignoring case) and save it as sourceStatesNoDates.
Decisions & LoopsIf sourceStatesNoDates is noIf sourceStatesNoDates is no
Yes
Decisions & LoopsFor each timelineLine in timelineText split by a new line:For each timelineLine in timelineText split by a new line:
Text Trim timelineLine and save it as entry. Trim timelineLine and save it as entry.
Decisions & Loops If entry isn't empty and entry contains | If entry isn't empty and entry contains |
Yes
TextTrim the first item of entry split by | and save it as dateText.Trim the first item of entry split by | and save it as dateText.
TextTrim the last item of entry split by | and save it as eventText.Trim the last item of entry split by | and save it as eventText.
Decisions & LoopsIf dateText isn't empty and eventText isn't emptyIf dateText isn't empty and eventText isn't empty
Yes
Decisions & LoopsIf sourceText contains dateText (ignoring case)If sourceText contains dateText (ignoring case)
Yes
ListsAdd dateText - eventText to the end of timelineEvents and save it as timelineEvents.Add dateText - eventText to the end of timelineEvents and save it as timelineEvents.
No
ListsAdd dateText to the end of untraceableDates and save it as untraceableDates.Add dateText to the end of untraceableDates and save it as untraceableDates.
No
No steps
No
No steps
No
No steps
ListsCount the items in untraceableDates and save it as droppedCount.Count the items in untraceableDates and save it as droppedCount.
ListsCount the items in timelineEvents and save it as tracedCount.Count the items in timelineEvents and save it as tracedCount.
ValuesSet sourceCredit to Set sourceCredit to Written from one source document only: sourceLink Drafted on today's date. Check anything you rely on against the source.
TextTrim the document id from the Google Docs “Create document” step and save it as studyGuideId.Trim the document id from the Google Docs “Create document” step and save it as studyGuideId.
Google DocsGoogle DocsAdd the heading 'Study guide: packName' to studyGuideId.Add the heading 'Study guide: packName' to studyGuideId.
Google DocsGoogle DocsAdd text to studyGuideId.Add text to studyGuideId.studyGuideText plus sourceCredit
TextTrim the document id from the Google Docs “Create document” step and save it as briefingId.Trim the document id from the Google Docs “Create document” step and save it as briefingId.
Google DocsGoogle DocsAdd the heading 'Briefing: packName' to briefingId.Add the heading 'Briefing: packName' to briefingId.
Google DocsGoogle DocsAdd text to briefingId.Add text to briefingId.briefingText plus sourceCredit
TextTrim the document id from the Google Docs “Create document” step and save it as timelineId.Trim the document id from the Google Docs “Create document” step and save it as timelineId.
Google DocsGoogle DocsAdd the heading 'Timeline: packName' to timelineId.Add the heading 'Timeline: packName' to timelineId.
Decisions & LoopsIf tracedCount is greater than 0If tracedCount is greater than 0
Yes
Google DocsGoogle DocsAdd a bulleted list to timelineId.Add a bulleted list to timelineId.
Else if @sourceStatesNoDates is yes
Google DocsGoogle DocsAdd text to timelineId.Add text to timelineId.The source document does not state any dates, so there is no timeline to build from it. Nothing has been invented to fill this page.
Otherwise
Google DocsGoogle DocsAdd text to timelineId.Add text to timelineId.No dated entry in the draft could be matched back to the wording of the source document, so nothing has been written here. Inventing a sequence would be worse than leaving this page empty.
ValuesSet timelineCredit to sourceCredit.Set timelineCredit to sourceCredit.
Decisions & LoopsIf droppedCount is greater than 0If droppedCount is greater than 0
Yes
ValuesChange timelineCredit to sourceCreditChange timelineCredit to sourceCredit Left out of this timeline: droppedCount entry or entries whose date does not appear in the source document, so they could not be traced back to it. The dates dropped were: untraceableDates joined by ; .
No
No steps
Google DocsGoogle DocsAdd text to timelineId.Add text to timelineId.timelineCredit
ValuesShow in the output: Made three documents from sourceLink: a study guide, a briefing, and a timeline holding tracedCount traced event(s) with droppedCount untraceable entry or entries left out.Show in the output: Made three documents from sourceLink: a study guide, a briefing, and a timeline holding tracedCount traced event(s) with droppedCount untraceable entry or entries left out.