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.

Good fit Use it to configure session hooks, pre-commit and pre-push checks, test and coverage checks, integration tests, and security scans.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/obsidian-owl/specwright/sw-guard
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.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sw-guard

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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. A grade says what 26 rules found in the file — not that it is safe.
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.5 $0.00013 $0.00581
Sonnet 5.5 $0.00007 $0.00290
Haiku 4.5 $0.00003 $0.00145

Measured 1mo ago against content hash 6f371a081c18, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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. 1mo 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 (10 stars, last pushed 6mo ago), licensed MIT. It adds 33 tokens to every session and 1,452 once invoked, about $0.0001 per session on Opus 5.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

bmad-testarch-ci

Scaffold CI/CD quality pipeline with test execution. Use when the user says "lets setup CI pipeline" or "I want to create quality gates".

PabloLION/bmad-plugin · 36 tokens

integration-e2e-testing

Defines integration/E2E skeleton annotations, lane and file contracts, and route-parity review criteria. Use when generating or consuming test skeletons or reviewing shared mutation routes.

shinpr/claude-code-workflows · 40 tokens

brooks-sweep

Full-sweep mode: runs a unified analysis across all quality dimensions — code decay, architecture, tech debt, and test quality — then applies fixes directly to the codebase. Safe changes are auto-applied; risky changes are confirmed before execution. Drawing on twelve classic engineering books. Triggers when: user…

hyhmrright/brooks-lint · 178 tokens

brooks-test

Test quality review drawing on twelve classic engineering books — with primary focus on xUnit Test Patterns, The Art of Unit Testing, How Google Tests Software, and Working Effectively with Legacy Code — that diagnoses structural problems in an existing test suite: brittleness, mock abuse, coverage illusions, slow…

hyhmrright/brooks-lint · 161 tokens

recipe-add-integration-tests

Add integration/E2E tests to existing codebase using Design Docs.

shinpr/claude-code-workflows · 19 tokens

testing-principles

Language-agnostic testing principles for choosing which tests a change needs, test quality, and proof ownership, with frontend and browser E2E implementation references. Use when writing tests, deciding test scope, or reviewing test quality.

shinpr/claude-code-workflows · 50 tokens