mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-19 10:52:28 +08:00
docs+test: SKILL authoring guidance + regression tests
Adds "Writing SKILL templates" section to CLAUDE.md explaining that templates are prompts, not scripts. Adds validation test catching hardcoded 'main' in git commands, and resolver content test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
17
CLAUDE.md
17
CLAUDE.md
@@ -64,6 +64,23 @@ SKILL.md files are **generated** from `.tmpl` templates. To update docs:
|
||||
To add a new browse command: add it to `browse/src/commands.ts` and rebuild.
|
||||
To add a snapshot flag: add it to `SNAPSHOT_FLAGS` in `browse/src/snapshot.ts` and rebuild.
|
||||
|
||||
## Writing SKILL templates
|
||||
|
||||
SKILL.md.tmpl files are **prompt templates read by Claude**, not bash scripts.
|
||||
Each bash code block runs in a separate shell — variables do not persist between blocks.
|
||||
|
||||
Rules:
|
||||
- **Use natural language for logic and state.** Don't use shell variables to pass
|
||||
state between code blocks. Instead, tell Claude what to remember and reference
|
||||
it in prose (e.g., "the base branch detected in Step 0").
|
||||
- **Don't hardcode branch names.** Detect `main`/`master`/etc dynamically via
|
||||
`gh pr view` or `gh repo view`. Use `{{BASE_BRANCH_DETECT}}` for PR-targeting
|
||||
skills. Use "the base branch" in prose, `<base>` in code block placeholders.
|
||||
- **Keep bash blocks self-contained.** Each code block should work independently.
|
||||
If a block needs context from a previous step, restate it in the prose above.
|
||||
- **Express conditionals as English.** Instead of nested `if/elif/else` in bash,
|
||||
write numbered decision steps: "1. If X, do Y. 2. Otherwise, do Z."
|
||||
|
||||
## Browser interaction
|
||||
|
||||
When you need to interact with a browser (QA, dogfooding, cookie setup), use the
|
||||
|
||||
Reference in New Issue
Block a user