context-guard

Hooks and rules that keep AI coding instructions synchronized with the codebase.

In plain words
What is it for?
Use them with Claude Code for automatic checks, or use the provided verification script manually or in CI on tools without hook support.
Why use it?
They detect outdated context, warn at the end of a session, and can prevent commits when structural changes have not been reflected in the instructions.

Skill for Claude CodeCodex

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/littlebearapps/contextdocs/context-guard
Any agent
npx skills add littlebearapps/contextdocs --skill context-guard
Clone the repo
git clone --depth 1 https://github.com/littlebearapps/contextdocs

Made for: Claude Code, Codex.

Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,926 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 $0.00066 $0.01926
Opus 5 $0.00033 $0.00963
Sonnet 5 $0.00013 $0.00385
Haiku 4.5 $0.00007 $0.00193

Measured 2d ago against content hash b12b8ff9dea7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

context-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 2d 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.

.claude/skills/context-guard/SKILL.md · 138 lines

How it starts

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

Context Guard

What It Does

Hooks and a quality rule to keep AI context files in sync with the codebase. Prevents content filter errors on standard OSS files. Two-tier enforcement for context doc freshness.

Primary platform: Claude Code (full automation, 12 hook events). Other platforms with hook support — Gemini CLI (11 events), Copilot (8, preview), Cursor (4+), Cline (3) — can use adapted hooks from platforms/ packages (coming soon). For platforms without hooks (Codex CLI, OpenCode, Windsurf), use bin/context-verify.sh as a manual or CI-based alternative.

Enforcement Tiers

Tier Name Mechanism Behaviour
1 Nudge Stop hook Advisory — suggests updating context docs before session ends
2 Guard PreToolUse on git commit Blocking — prevents commits when structural files staged without context updates (exit 2)

Default: Tier 1 only. Add Tier 2 with install strict.

Components

content-filter-guard.sh (PreToolUse → Write)

  • HIGH-risk (CODE_OF_CONDUCT.md, LICENSE, SECURITY.md): blocks write, returns fetch commands for canonical URL
  • MEDIUM-risk (CHANGELOG.md, CONTRIBUTING.md): allows write, advises chunked writing
  • All other files: passes through silently

context-structural-change.sh (PostToolUse → Write|Edit)

Fires after creating/editing structural files. Reminds which context files may need updating:

  • commands/*.md, .claude/skills/*/SKILL.md, .agents/skills/*/SKILL.md → update AGENTS.md first, then CLAUDE.md, llms.txt, and any affected bridge files
  • .claude/agents/*.md, .agents/agents/*.mdAGENTS.md, llms.txt
  • .claude/rules/*.mdAGENTS.md and CLAUDE.md if rule references changed
  • Config files (package.json, pyproject.toml, etc.) → update AGENTS.md first, then only the bridge files with tool-specific command/tooling notes

If your repository uses the .agents/ layout instead of .claude/, apply the same AGENTS-first update order to the equivalent skill and agent paths above.

Read the full file on GitHub · 138 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago First seen · 138 lines · 66 tokens per session scan A b12b8ff9dea7

Subscribe to this mod's changes

context-guard is a skill published in the GitHub repository littlebearapps/contextdocs (5 stars, last pushed 1mo ago), licensed MIT. It adds 66 tokens to every session and 1,926 once invoked, about $0.0003 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

skill-creator-primer

You MUST load this skill before the skill-creator skill AND before making ANY change to, or conducting a review of ANY Agent Skill. Triggers include creating, editing, reviewing, or contributing to any part of an Agent Skill (description, frontmatter, body, references, scripts, trigger evals, conflicts, etc).

sammcj/agentic-coding · 74 tokens

llm-wiki

Use when building or maintaining a self-contained personal knowledge base (an LLM wiki) in plain markdown. Triggers: ingesting sources into a wiki, querying wiki knowledge, linting wiki health, auditing article claims against their sources, critiquing a wiki source's reasoning, superseding stale knowledge, 'add to…

sammcj/agentic-coding · 82 tokens

apply-mantel-styles

Provides guidelines for applying Mantel's brand styles to diagrams and frontend components. Use when asked to create visuals that need to align with Mantel's branding.

sammcj/agentic-coding · 37 tokens

extract-wisdom

Extract wisdom, insights, and actionable takeaways from YouTube videos, blog posts, articles, or text files. Use when asked to extract wisdom or key insights from a given content source.

sammcj/agentic-coding · 43 tokens

home-assistant

This skill should be used when helping with Home Assistant setup, including creating automations, modifying dashboards, checking entity states, debugging automations, and managing the smart home configuration. Use this for queries about HA entities, YAML automation/dashboard generation, or troubleshooting HA issues.

sammcj/agentic-coding · 57 tokens

aws-strands-agents-agentcore

Use when working with AWS Strands Agents SDK or Amazon Bedrock AgentCore platform for building AI agents. Provides architecture guidance, implementation patterns, deployment strategies, observability, quality evaluations, multi-agent orchestration, and MCP server integration.

sammcj/agentic-coding · 55 tokens