/flowguard
Guard long, ambiguous, or stateful AI-agent work from drift. Use when the user asks to run or continue a multi-step task, autonomous loop, bug fix, repo change, PR readiness check, compaction handoff, resume from previous context, cost-control checkpoint, or any task likely to
$ npx -y skills add majiayu000/spellbook --skill flowguard --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/flowguard
Context preview
The summary Claude sees to decide when to auto-load this skill.
Guard long, ambiguous, or stateful AI-agent work from drift. Use when the user asks to run or continue a multi-step task, autonomous loop, bug fix, repo change, PR readiness check, compaction handoff, resume from previous context, cost-control checkpoint, or any task likely to
SKILL.md
flowguard.SKILL.mdname: flowguard
description: "Guard long, ambiguous, or stateful AI-agent work from drift. Use when the user asks to run or continue a multi-step task, autonomous loop, bug fix, repo change, PR readiness check, compaction handoff, resume from previous context, cost-control checkpoint, or any task likely to span many tool calls, files, sessions, agents, or verification gates."
Flowguard
Overview
Use this skill as the single lifecycle entrypoint for agent work that can drift, lose context, or become expensive. It routes the task, verifies current state, runs bounded execution loops, and leaves a resumable handoff.
This skill coordinates other skills; it does not replace them. Use task-specific skills such as `systematic-debugging`, `comprehensive-testing`, `codex-retrospective`, or `vibeguard` only when their trigger is clearly met.
Operating Contract
- Do not start a long autonomous loop until route, scope, and stop conditions are explicit.
- Do not treat memory, summaries, or handoffs as current truth until repo, git, files, runtime, or remote state is verified.
- Do not claim completion without fresh verification evidence from the current session.
- Do not expand scope, touch destructive surfaces, or cross file-ownership lanes without stopping to re-route.
- Re-state the primary objective and a plan of no more than five steps before major phase changes.
- Prefer one controlling checkpoint over many specialized workflow fragments when the task risk is context loss, drift, or compounding errors.
- Before commit, push, PR, merge, or applying agent-generated changes outside the already-approved scope, call `review-gate` or produce the same review pack and wait for explicit human approval.
Route First
Choose one route before editing files or running a long loop:
| Route | Use When | Action | |---|---|---| | `execute_direct` | Goal, context, constraints, and done-when are clear; scope is small or verification is cheap. | Work directly with short checkpoints. | | `plan_first` | Work spans many files, sessions, agents, architecture decisions, migrations, or risky sequencing. | Create a brief execution plan or use the relevant planning skill before edits. | | `clarify_first` | Goal, target files, constraints, done-when, destructive permission, production impact, or ownership is unclear. | Ask the smallest blocking question before continuing. |
Do not hide ambiguity inside assumptions. If a wrong assumption would cause large rewrites, production risk, data loss, credential exposure, or wasted long-loop cost, use `clarify_first`.
Startup
1. Search first for existing files, skills, plans, or prior artifacts that may already cover the task. 2. Load every applicable `AGENTS.md` for files that may be edited. 3. Run the state snapshot when working in a repo or resuming. Resolve it from the installed Flowguard skill directory, not from the target repo:
# From the installed flowguard skill directory, the directory containing this SKILL.md:
scripts/workflow_state_snapshot.sh /path/to/target/repo
When already in the target repo, pass `.` as the target to the installed script, for example `/path/to/installed/flowguard/scripts/workflow_state_snapshot.sh .`.
4. If the task continues previous work, treat memory and summaries as hints only. Verify cwd, git branch, dirty files, relevant artifacts, and runtime state before relying on them. 5. Capture the four task elements: goal, context, constraints, and done-when. If one is missing and risky, clarify.
Preflight Contract
Before substantial work, write or state the compact preflight:
route:
goal:
context:
constraints:
done_when:
out_of_scope:
verification_commands:
stop_conditions:
handoff_location:
objective_restatement:
plan_5_steps_or_less:
For short direct tasks, this can be one concise paragraph. For long tasks, make it explicit and keep it available for compaction or resume.
Execution Loop
Use a step-test-update loop:
1. Select one current step with owned files and an expected check. 2. Re-state how the step supports the primary objective. 3. Announce the edit boundary before changing files. 4. Make the smallest useful change. 5. Run focused verification for that step when feasible. 6. Record a checkpoint with changed files, command results, decisions, blockers, context audit, and next step.
Stop and re-evaluate when any condition occurs:
- The same fix fails 3 times.
- Scope expands beyond the preflight.
- Required data is missing or stale.
- A tool result conflicts with the plan.
- Tests or builds fail for reasons unrelated to the current hypothesis.
- The user sends a newer instruction that changes priority.
- Token, tool-call, wall-time, or external-cost budget is exceeded.
Failure Modes
- **Assumption drift**: the route says `execute_direct`, but new evidence shows missing goal, constraints, or done-when. Stop and re-route.
- **Summary-of-summary loss**: compaction or handoff omits modified files, decisions, or verification commands. Rebuild state from local truth before editing.
- **Stale memory**: remembered project facts conflict with current files, git, runtime, or GitHub state. Use current evidence.
- **Silent tool failure**: an empty, partial, or "close enough" tool result becomes input for later steps. Mark it as a blocker or rerun with a narrower check.
- **Parallel merge risk**: two lanes need the same writable file. Collapse to one integration owner before continuing.
Verification Gate
Do not claim completion from expectation or older output. Report fresh evidence from this session.
Pick checks from the repo, `AGENTS.md`, and changed surface. Common defaults:
| Stack | Before Completion | Before Submission | |---|---|---| | Rust | `cargo check` | `cargo test` | | TypeScript | `npx tsc --noEmit` | project test command | | Go | `go build ./...` | `go test ./...` | | Python | focused import/type/lint check if present | `pytest` |
If a check cannot run, say w
Read more
name: flowguard description: "Guard long, ambiguous, or stateful AI-agent work from drift. Use when the user asks to run or continue a multi-step task, autonomous loop, bug fix, repo change, PR readiness check, compaction handoff, resume from previous context, cost-control checkpoint, or any task likely to span many tool calls, files, sessions, agents, or verification gates."
Flowguard
Overview
Use this skill as the single lifecycle entrypoint for agent work that can drift, lose context, or become expensive. It routes the task, verifies current state, runs bounded execution loops, and leaves a resumable handoff.
This skill coordinates other skills; it does not replace them. Use task-specific skills such as `systematic-debugging`, `comprehensive-testing`, `codex-retrospective`, or `vibeguard` only when their trigger is clearly met.
Operating Contract
- Do not start a long autonomous loop until route, scope, and stop conditions are explicit.
- Do not treat memory, summaries, or handoffs as current truth until repo, git, files, runtime, or remote state is verified.
- Do not claim completion without fresh verification evidence from the current session.
- Do not expand scope, touch destructive surfaces, or cross file-ownership lanes without stopping to re-route.
- Re-state the primary objective and a plan of no more than five steps before major phase changes.
- Prefer one controlling checkpoint over many specialized workflow fragments when the task risk is context loss, drift, or compounding errors.
- Before commit, push, PR, merge, or applying agent-generated changes outside the already-approved scope, call `review-gate` or produce the same review pack and wait for explicit human approval.
Route First
Choose one route before editing files or running a long loop:
| Route | Use When | Action | |---|---|---| | `execute_direct` | Goal, context, constraints, and done-when are clear; scope is small or verification is cheap. | Work directly with short checkpoints. | | `plan_first` | Work spans many files, sessions, agents, architecture decisions, migrations, or risky sequencing. | Create a brief execution plan or use the relevant planning skill before edits. | | `clarify_first` | Goal, target files, constraints, done-when, destructive permission, production impact, or ownership is unclear. | Ask the smallest blocking question before continuing. |
Do not hide ambiguity inside assumptions. If a wrong assumption would cause large rewrites, production risk, data loss, credential exposure, or wasted long-loop cost, use `clarify_first`.
Startup
1. Search first for existing files, skills, plans, or prior artifacts that may already cover the task. 2. Load every applicable `AGENTS.md` for files that may be edited. 3. Run the state snapshot when working in a repo or resuming. Resolve it from the installed Flowguard skill directory, not from the target repo:
# From the installed flowguard skill directory, the directory containing this SKILL.md: scripts/workflow_state_snapshot.sh /path/to/target/repo
When already in the target repo, pass `.` as the target to the installed script, for example `/path/to/installed/flowguard/scripts/workflow_state_snapshot.sh .`.
4. If the task continues previous work, treat memory and summaries as hints only. Verify cwd, git branch, dirty files, relevant artifacts, and runtime state before relying on them. 5. Capture the four task elements: goal, context, constraints, and done-when. If one is missing and risky, clarify.
Preflight Contract
Before substantial work, write or state the compact preflight:
route: goal: context: constraints: done_when: out_of_scope: verification_commands: stop_conditions: handoff_location: objective_restatement: plan_5_steps_or_less:
For short direct tasks, this can be one concise paragraph. For long tasks, make it explicit and keep it available for compaction or resume.
Execution Loop
Use a step-test-update loop:
1. Select one current step with owned files and an expected check. 2. Re-state how the step supports the primary objective. 3. Announce the edit boundary before changing files. 4. Make the smallest useful change. 5. Run focused verification for that step when feasible. 6. Record a checkpoint with changed files, command results, decisions, blockers, context audit, and next step.
Stop and re-evaluate when any condition occurs:
- The same fix fails 3 times.
- Scope expands beyond the preflight.
- Required data is missing or stale.
- A tool result conflicts with the plan.
- Tests or builds fail for reasons unrelated to the current hypothesis.
- The user sends a newer instruction that changes priority.
- Token, tool-call, wall-time, or external-cost budget is exceeded.
Failure Modes
- **Assumption drift**: the route says `execute_direct`, but new evidence shows missing goal, constraints, or done-when. Stop and re-route.
- **Summary-of-summary loss**: compaction or handoff omits modified files, decisions, or verification commands. Rebuild state from local truth before editing.
- **Stale memory**: remembered project facts conflict with current files, git, runtime, or GitHub state. Use current evidence.
- **Silent tool failure**: an empty, partial, or "close enough" tool result becomes input for later steps. Mark it as a blocker or rerun with a narrower check.
- **Parallel merge risk**: two lanes need the same writable file. Collapse to one integration owner before continuing.
Verification Gate
Do not claim completion from expectation or older output. Report fresh evidence from this session.
Pick checks from the repo, `AGENTS.md`, and changed surface. Common defaults:
| Stack | Before Completion | Before Submission | |---|---|---| | Rust | `cargo check` | `cargo test` | | TypeScript | `npx tsc --noEmit` | project test command | | Go | `go build ./...` | `go test ./...` | | Python | focused import/type/lint check if present | `pytest` |
If a check cannot run, say w
Cross-runtime skills for Claude Code, Codex, and multi-agent workflows.
Repo: majiayu000/spellbook
Other skills on spellbook.
- /agentsmd-optimize
Audit AND optimize a CLAUDE.md / AGENTS.md instruction file — score it against the five high-leverage patterns, flag anti-patterns, then apply approved fixes in place. Use when the user says 优化 CLAUDE.md / 优化 AGENTS.md / optimize my agent doc / 帮我改 claudemd, or after an audit
Open skill - /agentsmd-scaffold
Generate or update repository-specific AGENTS.md instruction files from real repo evidence. Use when asked to create, design, scaffold, split, or improve root or scoped AGENTS.md files for Codex/Claude/agent workflows, especially when a repo needs directory-specific rules,
Open skill - /api-design
REST/GraphQL/gRPC API design best practices. Use when designing APIs, defining contracts, handling versioning. Covers OpenAPI 3.2, GraphQL Federation, gRPC streaming.
Open skill - /app-ui-design
Mobile app UI design expert for iOS and Android. Use when designing app interfaces, creating design systems, ensuring accessibility, or following platform guidelines. Covers Material Design 3, Human Interface Guidelines, color theory, typography, and 2025 trends.
Open skill - /app-user-story-qa
End-to-end app feature inventory and user-story testing workflow with a canonical tracker. Use when the user asks to audit every feature, derive expected behavior from code, test user journeys, or explicitly fix and retest documented UX or logistical defects.
Open skill - /architecture-foundation
Design architecture foundations before implementation. Use when asked to design or refactor architecture, choose Rust/Go crate, package, module, runtime, workflow, or service boundaries, compare mature project architecture, prevent stacked one-off PRs, audit migration debt in
Open skill

