core/skills/sw-guard/SKILL.md
Detects project stack and existing guardrails, then interactively configures deterministic quality checks across session, commit, push, and CI/CD layers.
npx skillsauth add obsidian-owl/specwright sw-guardInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Detect the project's stack and interactively configure deterministic guardrails across four enforcement layers (session, commit, push, CI/CD). Each layer is independently approvable. Existing guardrails are preserved during re-runs.
{projectArtifactsRoot}/config.json -- project configuration (optional -- not required){projectArtifactsRoot}/CONSTITUTION.md -- practices to follow (if present)When complete, user-approved guardrails are configured. Artifacts may include:
<!-- platform:claude-code -->.claude/settings.json or .claude/settings.local.json -- session-level hooks.
User chooses destination (shareable vs gitignored)..opencode/plugins/*.ts -- session-level plugin hooks.{projectArtifactsRoot}/config.json -- updated with detected tool commands (if present)Note: CONSTITUTION.md is NOT modified. Constitutional updates are the responsibility of sw-learn.
Detection (MEDIUM freedom):
protocols/guardrails-detection.md for the three-step detection algorithm
(manifest scan, config file scan, existing guardrail scan).sg), OpenGrep (opengrep), and platform LSP
(Claude Code .lsp.json, Opencode built-in, cli-lsp-client standalone).{projectArtifactsRoot}/config.json exists, read commands.* fields as authoritative;
supplement with detection for unconfigured dimensions.{projectArtifactsRoot}/config.json does not exist, rely entirely on detection.
Validate detected tools by running them (e.g., --version check). Present
standalone recommendations with explicit "detected via heuristics" labeling.git.targets and git.freshness from the detected Git workflow strategy without requiring users to define a custom branch DSL.project-visible for Claude-oriented installs unless the user explicitly wants git-admin runtime roots..specwright/works for new interactive installs unless the user explicitly prefers clone-local-only auditable work artifacts.project-visible roots under .specwright-local/
for interactive installs, git-admin roots under .git/specwright/ for
compatibility, /sw-status for the current runtime view, and /sw-adopt for
explicit same-work adoption..specwright/config.json and the anchor docs as a shared project-level
policy surface across developers and agent sessions, not as clone-local
runtime state.Gap analysis (MEDIUM freedom):
protocols/guardrails-patterns.md.Recommendation (HIGH freedom):
protocols/guardrails-patterns.md.specwright-researcher for unfamiliar stacks. If tools conflict,
present trade-offs.Configuration (LOW freedom):
{projectArtifactsRoot}/config.json with detected tool commands when the tracked
project-artifact root exists.git.runtime.mode / git.runtime.projectVisibleRoot in config separately from tracked work-artifact publication.protocols/context.md for config updates.{projectArtifactsRoot},
while Git-admin session state remains local-only under the runtime roots.Headless (LOW freedom):
protocols/headless.md for non-interactive detection and default policies.protocols/guardrails-detection.md -- three-step stack and guardrail detectionprotocols/guardrails-patterns.md -- coverage model, enforcement patterns, framework optionsprotocols/context.md -- config.json format and loadingprotocols/headless.md -- non-interactive execution detection and defaultsprotocols/delegation.md -- agent delegation for researcher| Condition | Action |
|-----------|--------|
| No dependency manifest found | Ask user about language/framework directly |
| Detected tool fails --version check | Warn user, skip that tool, ask for correct command |
| Install command fails | Show error, let user retry or skip |
| Detected tools conflict | Present trade-offs, let user choose |
| Unsupported CI platform | Warn, skip CI/CD layer |
| Compaction during config | Read config.json and external files, resume next missing item |
testing
Explicitly adopt an existing work into the current worktree after validating live ownership, stale sessions, and branch consistency.
testing
Orchestrates quality gates for the current work unit. Runs enabled gates in dependency order, produces an aggregate evidence report with gate handoff.
tools
Syncs the local repository by fetching all remotes, updating the base branch, and removing stale local branches that are not protected by live sessions or helper worktrees.
data-ai
Shows current Specwright state for this worktree, the attached work, repo-wide active works, gate results, and lock status. Supports --reset, --cleanup, and --repair {unitId}.