spec-lock

spec-lock is a skill for Claude Code, Codex from aegntic/cldcde. It costs 45 tokens per session (1,475 once invoked), scanned A, original, MIT.

A tool that keeps source code and specifications or documentation synchronized in both directions. After edits, it compares the change with files such as CLAUDE.md and SPEC.md and detects differences between the code and the written rules.

In plain words
What is it for?
Use it when changing code that affects requirements, API contracts, or documentation, especially to detect whether the code violates the specification or introduces behavior that the specification does not describe.
Why use it?
Code and documentation can drift apart as a project changes. It highlights conflicts and can suggest or generate documentation patches when the code and specification no longer agree.

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/aegntic/cldcde/spec-lock
Any agent
npx skills add aegntic/cldcde --skill spec-lock
Clone the repo
git clone --depth 1 https://github.com/aegntic/cldcde

Made for: Claude Code, Codex.

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 spec-lock

README.md
[![agentmods](https://agentmods.dev/badge/skills/aegntic/cldcde/spec-lock.svg)](https://agentmods.dev/skills/aegntic/cldcde/spec-lock)
Your own site
<a href="https://agentmods.dev/skills/aegntic/cldcde/spec-lock"><img src="https://agentmods.dev/badge/skills/aegntic/cldcde/spec-lock.svg" alt="Measured on agentmods" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,475 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.00045 $0.01475
Opus 5 $0.00023 $0.00737
Sonnet 5 $0.00009 $0.00295
Haiku 4.5 $0.00005 $0.00147

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

Security

Grade A, and why

spec-lock 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.

.claude/skills/spec-lock/SKILL.md · 260 lines

How it starts

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

Spec-Lock: Documentation Synchronization

Overview

Spec-Lock prevents documentation rot by maintaining bi-directional sync between code and specifications. It treats documentation as executable code that must stay synchronized with implementation.

The Problem It Solves

Documentation Rot: In agentic workflows, code evolves faster than docs. Users hate writing documentation, and agents frequently ignore old instructions.

Spec-Lock Solution: Automatic synchronization that detects drift and keeps context perfectly synced with reality.

How It Works

1. Post-Edit Analysis (PostToolUse Hook)

Every time a file is edited:

  • Analyzes semantic intent of the change
  • Compares against CLAUDE.md and SPEC.md
  • Detects drift between code and docs

2. Conflict Detection

Two scenarios trigger sync:

Scenario A: Code Drift

  • Code violates the spec (e.g., wrong auth method)
  • Plugin asks: "Revert code or update spec?"

Scenario B: Spec Evolution

  • Code introduces new logic not in spec
  • Plugin asks: "Update SPEC.md to match code?"

3. Auto-Update

Uses headless Claude to:

  • Generate documentation patches
  • Update dependent docs automatically
  • Maintain knowledge graph of dependencies

When to Use

Activate Spec-Lock when:

  • Changing API endpoints or parameters
  • Modifying authentication flows
  • Updating database schemas
  • Changing configuration values
  • Implementing new features
  • Refactoring existing code

Usage

Automatic Mode

With PostToolUse hooks:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit(*)|Write(*)",
        "command": "python3 /a0/usr/plugins/spec-lock/spec-lock.py --check"
      }
    ]
  }
}

Manual Commands

# Check a file for drift
python3 /a0/usr/plugins/spec-lock/spec-lock.py --check <file>

# Register a new dependency
python3 /a0/usr/plugins/spec-lock/spec-lock.py --register <code> <spec> [priority]

# Show sync status
python3 /a0/usr/plugins/spec-lock/spec-lock.py --status

# Force full sync
python3 /a0/usr/plugins/spec-lock/spec-lock.py --sync

Read the full file on GitHub · 260 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 · 260 lines · 45 tokens per session scan A defbe7a9c431

Subscribe to this mod's changes

spec-lock is a skill published in the GitHub repository aegntic/cldcde (11 stars, last pushed 8d ago), licensed MIT. It adds 45 tokens to every session and 1,475 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-30.

Related

Other skills, from other repositories

skill-sync-checker

Detects content drift between skill files and their source documents. Helps maintain skills that are derived from other documentation by comparing content and flagging outdated sections.

kanyun-inc/reskill · 35 tokens

hono-core

Hono ultrafast web framework fundamentals - routing, context, handlers, and response patterns for multi-runtime deployment.

bobmatnyc/claude-mpm-skills · 26 tokens

reconcile

Unified maintenance — detect drift, run security checks, cascade spec propagation, knowledge hygiene. Scoped via --scope flag. Default: consistency.

martineserios/thebrana · 30 tokens

tauri-django-react

Agents should invoke this skill for Tauri + Django + React desktop apps, especially backend lifecycle, CORS/auth, frontend integration, mandatory light/dark theming, German/English i18n, build packaging, dual desktop/web deployment, Rust commands, and platform-specific gotchas.

Firstp1ck/pi-coding-agent-forge · 63 tokens

project-readme

Use when creating, updating, reviewing, restructuring, or harmonizing a repository's project README from verified local evidence for user-oriented or developer/library-oriented readers.

Firstp1ck/pi-coding-agent-forge · 35 tokens

subagent-governance

Delegation admissibility governance for a parent orchestrator. Use when deciding whether to launch, sequence, replace, or accept one or more delegated child runs while preserving role fit, plan-backed worker contracts, one-writer isolation, bounded retry safety, and reviewer finding disposition. Covers admissibility…

Firstp1ck/pi-coding-agent-forge · 74 tokens