Skip to content

docs: add preflight template, shell join guide, and --resume gotcha#17

Merged
khaliqgant merged 1 commit intomainfrom
docs/skill-preflight-shell-resume
Apr 23, 2026
Merged

docs: add preflight template, shell join guide, and --resume gotcha#17
khaliqgant merged 1 commit intomainfrom
docs/skill-preflight-shell-resume

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

@khaliqgant khaliqgant commented Apr 13, 2026

Summary

Adds three new subsections to the Failure Prevention area of the writing-agent-relay-workflows skill. All three are distilled from debugging sessions where each papercut cost 20+ minutes of retries and all three are currently unwritten anywhere.

Sections added

2b. Standard preflight template for resumable workflows

The allow-list pattern for files the workflow owns (always including package-lock.json plus every file the edit steps will rewrite), with:

  • Full-line grep matching via grep -vE "^(...)$" to avoid substring bleed across unrelated files
  • || true on the grep to survive set -e when the result is empty
  • Escaping dots in regex paths (four backslashes in JS template literals)
  • Checking the staging area separately from the working tree
  • Early gh auth status check

Prevents the "preflight fails on my own dirty file" loop that happens on every resume after a partial run.

2c. Picking the right .join() for multi-line shell commands

When to use .join(' && ') vs .join('\\n'), and why heredocs and && joining are fundamentally incompatible (results in shell syntax errors when the join inserts && between heredoc body lines).

Also covers the printf + mktemp pattern that sidesteps the entire class of nested-heredoc bugs for commit messages and PR bodies (git commit -F + gh pr create --body-file instead of -m "$(cat <<EOF ...)").

7a. --resume vs --start-from when fixing a buggy step

Counterintuitive but critical:

  • --resume replays the workflow config stored in the run's DB record. It IGNORES file edits. Useful for transient failures, broken for fixing bugs in step definitions.
  • --start-from <step> --previous-run-id <id> reads the fresh workflow file. Use this after any edit to the workflow.

Both flags share the same cache layer, so --start-from still avoids re-running expensive upstream agent steps.

Why this matters

Three separate sessions this week hit each of these papercuts at least once. The preflight one has hit four times. Each one is individually survivable but collectively they eat hours of retries. Documenting them in the skill means the next agent (or the next me) doesn't have to re-discover them from scratch.

Test plan

  • Markdown renders cleanly, links are internal-only
  • Code blocks are copy-pasteable (no template-literal traps inside them)
  • New subsections flow naturally after their adjacent existing ones (2a, 7)

🤖 Generated with Claude Code


Open with Devin

Three new subsections in the Failure Prevention area, all distilled from
debugging sessions where each papercut cost 20+ minutes of retries:

- 2b. Standard preflight template — the allow-list pattern for files the
  workflow owns (package-lock.json plus every file the edit steps will
  rewrite), with full-line grep matching, |+ true against set -e, and the
  quoted-dot escaping gotcha. Prevents the "preflight fails on my own
  dirty file" loop.

- 2c. Picking the right .join() for multi-line shell commands — when to
  use .join(' && ') vs .join('\\n'), why heredocs cannot be joined with
  '&&' (results in shell syntax errors), and the printf + mktemp pattern
  that sidesteps the entire class of nested-heredoc bugs for commit
  messages and PR bodies.

- 7a. --resume vs --start-from when fixing a buggy step — counterintuitive
  but critical: --resume replays the config stored in the run's DB record
  and IGNORES file edits. --start-from reads the fresh file. If you
  edited the workflow to fix the failing step, always use --start-from,
  never --resume.

Each subsection includes copy-pasteable templates, concrete failure
modes, and links to the surrounding guidance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@khaliqgant khaliqgant merged commit f872c56 into main Apr 23, 2026
@khaliqgant khaliqgant deleted the docs/skill-preflight-shell-resume branch April 23, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant