Skip to content

Generate one prompts/ file per Session prompt, checked by the golden-file test - #184

Merged
JacobStephens2 merged 8 commits into
mainfrom
issue-177
Sep 30, 2026
Merged

JacobStephens2 merged 8 commits into
mainfrom
issue-177

Conversation

@JacobStephens2

Copy link
Copy Markdown
Owner

Summary

Every Session prompt is now checked in as Markdown under prompts/. The same golden-file test that keeps the Prompts and skills page in sync renders these files.

 prompts()                          # one list, shared
   #<sentinel> → #<n>               # now applied here, for both outputs
 tests (cargo test prompts_page)
   prompts_page_shows_what_the_binary_sends     # site fragment
+  prompt_files_show_what_the_binary_sends      # prompts/*.md
+    missing / differs → names file + line diff
+    stale              → names file
+    UPDATE_PROMPTS=1   → writes all, deletes stale
prompts/
├── fresh.md  continuation.md  continuation-pr.md  spec-review.md
├── conflict-repair.md  foreign-conflict-repair.md  review-repair.md
└── ci-fix-repair.md  resume.md

Each file contains a generated-from note, # Title, the when sentence, and the text inside a fence longer than any backtick run in it. UPDATE_PROMPTS_PAGE is renamed to UPDATE_PROMPTS, with no alias. AGENTS.md and README.md are updated to match. prompts/ is left out of the crate, and the test skips when prompts/ is absent.

Evidence

  • Before: the prompts/ directory is empty (a resume.md removed and a stray.md added gives the same result):
    prompts/resume.md is missing:
        1 + <!-- Generated by src/prompts_page.rs ... -->
        ...
    prompts/stray.md is stale: no prompt produces it
    Regenerate them with: UPDATE_PROMPTS=1 cargo test prompts_page
    
    After: UPDATE_PROMPTS=1 cargo test prompts_page wrote all nine files and deleted stray.md. Running it a second time left git status unchanged. The full cargo test passes and cargo clippy --all-targets is clean.
  • New unit tests:
    • a_fence_is_longer_than_any_run_of_backticks_in_the_text
    • a_prompt_file_carries_the_title_the_when_and_the_fenced_text
    • checking_prompts_names_each_missing_differing_and_stale_file: a missing file, a changed file, a stray file and a stray directory are all reported; regenerating clears every one.

Merge Danger

Door: two-way

Only test code, docs and generated files change. The code that builds and sends Session prompts is untouched.

Blast Radius: contributors

Anyone with UPDATE_PROMPTS_PAGE in a script or in muscle memory must switch to UPDATE_PROMPTS.

Unaddressed findings

Standards

  • Prompt file name derived from the id's prompt- prefix: the spec defines file names by the page's entry ids, and the ids are also the page anchors, so a separate name field would duplicate them.
  • The two golden-file tests have the same shape: there are only two, and extracting a shared helper now would be premature.
  • The tests call internal helpers (fence, markdown, check_prompt_files) directly: the codebase-design skill permits internal seams used by the module's own tests.
  • markdown is a generic name: it is private to a small test-only module, where it reads clearly.

Spec

  • A stale file's message has no line diff: the file should be deleted, not edited, so the message names it and gives the regenerate command instead.
  • The check is a separate test rather than part of the page test: it sits in the same module, so cargo test prompts_page runs both. Keeping them apart lets the page and prompts/ skip independently when either is absent.

Closes #177

🤖 Generated with Claude Code

JacobStephens2 and others added 8 commits September 30, 2026 12:35
…le test

The prompts_page test now also renders each prompt as Markdown in
prompts/ and fails, with a diff, on a missing, differing or stale file.
UPDATE_PROMPTS replaces UPDATE_PROMPTS_PAGE and regenerates both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e note

The prompts/ note and AGENTS.md now say the titles and when sentences
come from src/prompts_page.rs. Regenerating also deletes a stale
directory in prompts/ rather than panicking on it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JacobStephens2
JacobStephens2 merged commit 0d6477b into main Sep 30, 2026
13 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-177 branch September 30, 2026 13:58
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.

Generate one prompts/ file per Session prompt, checked by the golden-file test

1 participant