|
| 1 | +--- |
| 2 | +name: rebuild-test |
| 3 | +description: Enforces rebuild and test workflow after code changes. Triggers when Claude edits Rust files under programs/, TypeScript files under sdk/, or test files under tests/. Reminds Claude to run ./rebuild.sh and anchor test --skip-build. |
| 4 | +user-invocable: true |
| 5 | +argument-hint: "[test-filter]" |
| 6 | +--- |
| 7 | + |
| 8 | +# Rebuild & Test Enforcement |
| 9 | + |
| 10 | +## When manually invoked (`/enforce-rebuild-test`) |
| 11 | +Immediately run: |
| 12 | +1. `./rebuild.sh` |
| 13 | +2. `anchor test --skip-build` |
| 14 | + |
| 15 | +If an argument is provided (e.g., `/enforce-rebuild-test completeLaunch`), use it to run only matching tests. |
| 16 | + |
| 17 | +## When auto-triggered after code changes |
| 18 | +After making code changes, you MUST follow this workflow before considering the task complete: |
| 19 | + |
| 20 | +## When Rust code under `programs/` is edited: |
| 21 | +1. Run `./rebuild.sh` — this rebuilds all programs, regenerates the SDK types, and lints. |
| 22 | +2. Run the relevant tests with `anchor test --skip-build`. |
| 23 | + |
| 24 | +## When TypeScript code under `sdk/` is edited: |
| 25 | +1. Run `./rebuild.sh` to rebuild the SDK and lint. |
| 26 | +2. Run the relevant tests with `anchor test --skip-build`. |
| 27 | + |
| 28 | +## When test files under `tests/` are edited: |
| 29 | +1. If you also edited program or SDK code, run `./rebuild.sh` first. |
| 30 | +2. Run the relevant tests with `anchor test --skip-build`. |
| 31 | + |
| 32 | +## Rules |
| 33 | +- NEVER skip `./rebuild.sh` after editing Rust or SDK code. Tests will run against stale artifacts otherwise. |
| 34 | +- NEVER consider a task complete without running tests, unless the user explicitly says to skip them. |
| 35 | +- If a rebuild or test fails, fix the issue and re-run. Do not leave the user with broken code. |
| 36 | +- When running tests during development, add `.only` to the specific `describe`/`it` block you're working on for faster feedback. Remove `.only` before finishing. |
0 commit comments