sw-guard

sw-guard is a skill for Claude Code from Obsidian-Owl/specwright. It costs 33 tokens per session (1,452 once invoked), scanned A, original, MIT.

A setup tool for project quality checks. It detects the programming tools already in use and helps configure checks for coding sessions, commits, pushes, and continuous integration (automated checks run by the repository).

In plain words
What is it for?
Use it to configure session hooks, pre-commit and pre-push checks, test and coverage checks, integration tests, and security scans.
Why use it?
It reduces the chance that broken or low-quality changes reach the repository. It also preserves existing checks when run again.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: reads .claude/ paths; names the AskUserQuestion tool; mentions Claude Code.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/obsidian-owl/specwright/sw-guard
Any agent
npx skills add Obsidian-Owl/specwright --skill sw-guard
Clone the repo
git clone --depth 1 https://github.com/Obsidian-Owl/specwright

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sw-guard

README.md
[![agentmods](https://agentmods.dev/badge/skills/obsidian-owl/specwright/sw-guard.svg)](https://agentmods.dev/skills/obsidian-owl/specwright/sw-guard)
Your own site
<a href="https://agentmods.dev/skills/obsidian-owl/specwright/sw-guard"><img src="https://agentmods.dev/badge/skills/obsidian-owl/specwright/sw-guard.svg" alt="Measured on agentmods" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,452 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00033 $0.01452
Opus 5 $0.00016 $0.00726
Sonnet 5 $0.00007 $0.00290
Haiku 4.5 $0.00003 $0.00145

Measured 5d ago against content hash 6f371a081c18, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

sw-guard scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

core/skills/sw-guard/SKILL.md · 133 lines

How it starts

The opening of the file, as written. The whole thing — 133 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Specwright Guard

Goal

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.

Inputs

  • The codebase (dependency manifests, config files, existing hooks)
  • {projectArtifactsRoot}/config.json -- project configuration (optional -- not required)
  • {projectArtifactsRoot}/CONSTITUTION.md -- practices to follow (if present)
  • Existing agent hooks, git hooks, CI workflows

Outputs

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.
  • Pre-commit hook configurations (framework chosen by user)
  • Pre-push hook configurations (test runner, coverage thresholds)
  • CI/CD workflow files (backstop checks, integration tests, security scanning)
  • {projectArtifactsRoot}/config.json -- updated with detected tool commands (if present)

Note: CONSTITUTION.md is NOT modified. Constitutional updates are the responsibility of sw-learn.

Constraints

Detection (MEDIUM freedom):

  • Follow protocols/guardrails-detection.md for the three-step detection algorithm (manifest scan, config file scan, existing guardrail scan).
  • Detection scope includes traditional tools (linters, formatters, test runners) and semantic analysis tools: ast-grep (sg), OpenGrep (opengrep), and platform LSP (Claude Code .lsp.json, Opencode built-in, cli-lsp-client standalone).
  • If {projectArtifactsRoot}/config.json exists, read commands.* fields as authoritative; supplement with detection for unconfigured dimensions.
  • If {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.
  • When Git workflow config is present or inferred, seed or migrate git.targets and git.freshness from the detected Git workflow strategy without requiring users to define a custom branch DSL.
  • Detect or confirm target-role defaults, freshness checkpoints, runtime mode as an explicit Git policy choice, and any optional work-artifact publication mode as one explicit Git policy surface.
  • Recommend project-visible for Claude-oriented installs unless the user explicitly wants git-admin runtime roots.
  • Recommend a tracked work-artifact root under .specwright/works for new interactive installs unless the user explicitly prefers clone-local-only auditable work artifacts.
  • When describing runtime policy, use the same operator vocabulary as the adapters and status surfaces: 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.
  • Keep runtime mode separately from tracked work-artifact publication and separately from clone-local runtime state.
  • Treat .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.
  • For unfamiliar stacks or niche tools, use WebSearch to identify tooling conventions.
  • Detect existing guardrails before recommending. Show delta on re-runs.

Read the full file on GitHub · 133 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 133 lines · 33 tokens per session scan A 6f371a081c18

Subscribe to this mod's changes

sw-guard is a skill published in the GitHub repository Obsidian-Owl/specwright (9 stars, last pushed 4mo ago), licensed MIT. It adds 33 tokens to every session and 1,452 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

rust-skills

Rust best practices — 179 rules across 14 categories for idiomatic, optimized Rust code.

martineserios/thebrana · 23 tokens

seed-gates

Scan a repo's package.json scripts, CI workflows, and equivalent manifests, then SUGGEST a committed .claude/tale-mode.json gate list for tale-mode's Stop-hook loop — suggestions only; this skill never writes the config unasked, never trusts it, and never arms anything. Invoke ONLY when the user explicitly asks to…

alicicek/tale-mode · 85 tokens

scheduler

Manage scheduled jobs — create, update, list, run remote agents on cron. Use when setting up recurring tasks, checking job status, or managing automation.

martineserios/thebrana · 33 tokens

guards-setup

Machine-enforced quality guards installer. Use for /hi-vibe:gate or when the user asks to 린트 설정, 타입 체크 강제, 순환의존 검사, CI 세팅, eslint/ruff/mypy 설정, complexity limit. Detects project language(s) and installs lint/type/cycle guards and optional CI — always asking before writing, always merging with existing configs.

jx-hxxx/hi-vibe · 83 tokens

claudeconf

Set up or harden a project's quality and security pipeline — git hooks, CI, tests, and pre-merge gates. Researches and pins tools that fit the project's stack instead of using fixed choices, then wires a standard-tool harness you own. Use when initializing a repo, adding CI or pre-commit checks, hardening an existing…

nikolaypaskov/claudeconf-plugin · 78 tokens

craft-infra

The Craftsman standard for production infrastructure — deployment, env/config, CI/CD, IaC, health/readiness, scaling, platform/edge rate limiting, build/release, rollback. Use WHENEVER work touches infra: deploy, CI gates, env vars, IaC, load failures, platform rate limiting, pooling runtime constraints, or production…

gul-labs/craftsman-marketplace · 142 tokens