grimoire
Install and operate Grimoire, author .spell files with full syntax coverage (including advisory decision logic), and run compile/validate/simulate/cast safely. Use when users ask to create, edit, debug, validate, simulate, execute, or explain Grimoire strategies.
What this skill does
# Grimoire CLI Skill
This skill is the base operating playbook for Grimoire.
## When To Use
Use this skill when the task includes:
- install/setup of Grimoire tooling
- creating or editing `.spell` files
- syntax questions about DSL capability
- advisory (`advise`) authoring, debugging, and replay workflows
- setup/compile/validate/simulate/cast/resume workflows
- debugging spell compile/runtime failures
## Mandatory Loading Rules
All `references/` and `docs/` paths below are relative to this skill directory (`skills/grimoire/`). These rules are **required** — they solve syntax coverage gaps that cause authoring errors.
**STOP — read this first:** Do NOT search the codebase, grep for syntax patterns, or rely on memory for DSL syntax. The reference files bundled with this skill are the single source of truth. IMMEDIATELY use the Read tool on the files listed below before writing or editing any spell content.
1. For any `.spell` authoring/editing task — IMMEDIATELY read these files using the Read tool before doing anything else:
- `references/syntax-capabilities.md`
- `references/authoring-workflow.md`
2. For CLI flag details — IMMEDIATELY read using the Read tool:
- `references/cli-quick-reference.md`
3. For any advisory task (`advise`, `advisors`, replay) — IMMEDIATELY read using the Read tool:
- `docs/how-to/use-advisory-decisions.md`
- `docs/explanation/advisory-decision-flow.md`
4. For local fork preview workflows — IMMEDIATELY read using the Read tool:
- `references/anvil-cheatsheet.md`
- `docs/how-to/simulate-on-anvil-fork.md`
5. For wallet setup and execution key flows — IMMEDIATELY read using the Read tool:
- `docs/how-to/use-wallet-commands-end-to-end.md`
6. For RPC/signer/transaction diagnostics — IMMEDIATELY read using the Read tool:
- `references/cast-cheatsheet.md`
## Installation Resolution
Select the first working invocation and reuse it for the session.
1. Global:
- `npm i -g @grimoirelabs/cli`
- command prefix: `grimoire`
2. No-install:
- command prefix: `npx -y @grimoirelabs/cli`
3. Repo-local:
- command prefix: `bun run packages/cli/src/index.ts --`
If one path fails, move to the next path automatically.
If `grimoire venue doctor ...` fails with `Unknown venue adapter "doctor"`, prefer repo-local invocation (`bun run packages/cli/src/index.ts`) or upgrade global CLI.
When using repo-local Bun execution, always keep the trailing `--` so Bun forwards flags to Grimoire instead of consuming them.
## Fast Start (Immediate Success Path)
Use this sequence before writing custom spells:
1. `<grimoire-cmd> --help`
2. `<grimoire-cmd> setup` (guided interactive execute onboarding)
3. `<grimoire-cmd> validate spells/compute-only.spell`
4. `<grimoire-cmd> simulate spells/compute-only.spell --chain 1`
If all three pass, proceed to spell authoring.
Setup security/runtime expectations:
- setup prompts for hidden passwords and never echoes input
- blank RPC input falls back to chain default public RPC
- setup may write `.grimoire/setup.env` unless `--no-save-password-env` is used
- CLI auto-loads nearest `.grimoire/setup.env` at startup without overriding existing env vars
## Authoring and Execution Policy
1. Read syntax references first (mandatory rule above).
2. Author/update spell.
3. Run `format` to canonicalize layout before validation.
4. Run `validate` (use `--strict` for advisory-heavy spells).
5. Fix errors/warnings and re-run until validation passes.
6. Run `simulate`.
7. Before venue metadata queries or value-moving runs, execute `venue doctor` for the target adapter/chain.
- Example: `<grimoire-cmd> venue doctor --adapter uniswap --chain 1 --rpc-url <rpc> --json`
8. Before value-moving runs on EVM venues, verify endpoint and signer state with Foundry Cast quickchecks (`chain-id`, `block-number`, `balance`, `nonce`).
- Do not apply Anvil/Cast checks to offchain venues such as `hyperliquid`.
9. For advisory steps intended for deterministic execution, record and then use `--advisory-replay <runId>` in dry-run/live cast.
10. If spell includes irreversible actions, require `cast --dry-run` before any live cast.
11. Ask for explicit user confirmation before live value-moving `cast`.
12. For cross-chain mode, require explicit per-chain RPC mappings:
- `--rpc-url <sourceChainId>=<url>`
- `--rpc-url <destinationChainId>=<url>`
13. For cross-chain Morpho actions, require explicit market mapping via:
- `--morpho-market-id <actionRef>=<marketId>` (repeatable), or
- `--morpho-market-map <path>`
14. For Morpho supply-only strategies, prefer `vault_deposit` / `vault_withdraw` (explicit vault address).
- If vault address is missing, list candidate vaults and require user to pick one; never auto-select.
15. For Morpho market strategies (borrow/collateral/lend), require explicit `market_id` and use explicit actions:
- `morpho_blue.supply_collateral(asset, amount, market_id)`
- `morpho_blue.withdraw_collateral(asset, amount, market_id)`
16. Use bare `0x...` address literals in action token fields; quoted address-like strings trigger `QUOTED_ADDRESS_LITERAL`.
17. For Morpho doctor readiness checks, set wallet env explicitly (`GRIMOIRE_WALLET_ADDRESS` preferred, fallback `WALLET_ADDRESS`).
18. If a cross-chain run is left waiting, continue with `resume <runId>` (use `--watch` to poll settlement).
19. Never place passwords/private keys in agent prompts or inline command assignments.
20. Prefer keystore + `--password-env` over `--private-key` for dry-run/live casts.
21. Treat `.grimoire/setup.env` as plaintext secret material: keep local-only and rotate/remove when no longer needed.
22. For commands run outside the project tree, set `GRIMOIRE_SETUP_ENV_FILE=/abs/path/to/.grimoire/setup.env` when needed.
## Command Surface (Core)
- `init`
- `setup`
- `format`
- `compile`
- `compile-all`
- `validate`
- `triggers`
- `simulate`
- `cast`
- `venues`
- `venue`
- `venue doctor`
- `history`
- `log`
- `resume`
- `wallet` (`generate`, `address`, `balance`, `import`, `wrap`, `unwrap`)
Use `references/cli-quick-reference.md` for concise command signatures and safety-critical flags.
## Runtime Behavior Model
- One runtime semantics: preview first, commit only for execute paths.
- `simulate` and `cast --dry-run` are preview-only flows.
- Live `cast` can commit irreversible actions when policy and runtime checks pass.
- `simulate` supports explicit `--rpc-url`, with precedence: `--rpc-url` -> `RPC_URL_<chainId>` -> `RPC_URL`.
- Phase 1 cross-chain execution uses two-spell orchestration (`--destination-spell`) with one logical run id and resume support.
- Use `triggers <spell>` to discover stable handler ids natively before targeted execution.
- `simulate` and `cast` support selected-trigger execution via `--trigger-id`, `--trigger-index`, and legacy `--trigger`.
- For multi-handler spells, prefer `--trigger-id`; `--trigger` is label-based and can be ambiguous.
- Cross-chain `simulate` / `cast` must forward the same selected trigger into per-chain execution.
- In `--json` mode, parse stdout only; progress and spinner output can still appear on stderr.
## Query Functions (price / balance / apy / metric)
**Always prefer query functions over advisory for structured data fetching.** These are deterministic, fast, and don't require LLM calls.
- `price(BASE, QUOTE[, SOURCE])` — live token price via query provider (requires Alchemy RPC URL)
- `balance(ASSET[, ADDRESS])` — on-chain token balance via RPC (any RPC URL)
- `apy(VENUE, ASSET[, SELECTOR])` — venue-backed APY surface (for example Aave and Morpho)
- `metric(SURFACE, VENUE[, ASSET[, SELECTOR]])` — generic protocol metric surface
- Selector guidance:
- market/vault id selector: `apy(morpho, USDC, "wbtc-usdc-86")`
- vault selector (Morpho): `metric("vault_net_apy", morpho, USDC, "vault=0xVaultAddress")`
- Morpho `vault_apy` / `vault_net_apy` require explicit selector; do not rely on implicit defaults.
- key/value selector: `metric("Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.