sw-guard
Detects project stack and existing guardrails, then interactively configures deterministic quality checks across session, commit, push, and CI/CD layers.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Detects project stack and existing guardrails, then interactively configures deterministic quality checks across session, commit, push, and CI/CD layers.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Specwright health check. Validates shared config, anchor docs, workflow and session state, commands, gates, and hooks. May backfill shipped PR metadata when it can prove the mapping safely.
Initializes Specwright in a project. Detects stack, asks about practices, creates constitution and charter, configures quality gates and hooks.
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}.
Periodic codebase health check. Analyzes architecture, complexity, consistency, and debt across the full codebase. Produces persistent findings in AUDIT.md.
TDD implementation of one work unit. Delegates test writing to the tester agent and implementation to the executor agent. Commits per task.
Captures patterns and learnings from the current work unit. Reviews build failures, gate findings, and architecture decisions. Applies objective promotion criteria autonomously — patterns.md is the artifact.
| name | sw-guard |
| description | Detects project stack and existing guardrails, then interactively configures deterministic quality checks across session, commit, push, and CI/CD layers. |
| argument-hint | |
| allowed-tools | ["Read","Write","Edit","Bash","Glob","Grep","WebSearch","AskUserQuestion","Task"] |
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:
.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 |