An opinionated agent skill built for Matt Pocock's skills ecosystem. Designed for AI-native engineering (Vibe Coding) to eliminate Context Drift and enforce final consistency across your project's knowledge base.
AI coding agents (like Claude Code, Cursor, Cline, or Roo Code) can refactor and churn out code at lightning speed. However, they leave local documentation, architecture logs, and project memories behind.
When your .claude/ or .cursor/ reference markdown files become stale, the very next AI session reads out-of-date context and generates broken, regression-prone code. Your documentation and your runtime code fall out of sync.
context-anchor solves this by forcing the AI to act as a strict Compliance & Code-Doc Alignment Auditor right after a heavy coding sprint. It forces the agent to inspect its own runtime changes (git diff), lock down the project glossary, and recursively sync every markdown asset to match the absolute reality of the codebase.
Manage it elegantly as a project dependency using Matt Pocock's declarative package manager workflow.
- In your project's root directory, create or update a
skills.jsonfile:
{
"skills": [
"nicecp/context-anchor"
]
}
- Run the official installer via your terminal to download and lock the version:
npx skills
This will automatically pull context-anchor.md into your local .claude/skills/ and .cursor/skills/ directories while generating a skills-lock.json file to keep your team or future AI agents completely aligned on the exact same skill commit.
Once installed, your IDE's native AI agent will automatically index the skill. After any major coding implementation, refactoring session, or database schema change, simply type one of the following short commands into your AI chat box:
You:
/anchor(or/audit)
When triggered, the AI execution flow pivots into a strict verification machine:
[Your Code Changes (Git Diff)]
│
▼
1. RUNTIME AUDIT ────► (Checks Schema DDLs, units, constraints & boundary edge cases)
│
▼
2. GLOSSARY ENFORCE ──► (Prevents synonym fragmentation, updates central nomenclature)
│
▼
3. KNOWLEDGE SYNC ───► (Rewrites .claude/ or .cursor/ docs to mirror source code)
│
▼
[Output: Doc-Compliance Divergence Report]
When the protocol finishes, your AI agent will present a structured summary so you know exactly what changed under the hood:
- Database Schema: Detected new migration adding
user_profiles. Verified composite unique indexuk_user_tenant_idis correctly implemented in DDL. - Edge Defense: Confirmed the authentication state machine successfully implemented a Token Expiry Grace Period to prevent abrupt streaming disconnections during active sessions.
-
Idempotency_Key: Locked definition to denote the unique UUIDv4 string passed in theX-Idempotency-Keyheader for order placement. -
Graceful_Shutdown_Timeout: Added terminology mapped to the system level process signal handling ($SIGTERM \rightarrow 30s$ buffer).
| Target Document | Action | Sync Details |
|---|---|---|
memory/database.md |
📝 Updated | Synced new user profile table layouts, constraints, and field annotations. |
memory/api-endpoints.md |
📝 Updated | Mapped newly created v2 REST billing endpoints and retired legacy v1 routes. |
mcp/third-party-service.md |
❌ Deprecated | Marked as obsolete due to full migration to the in-house internal service. |
- Rate-Limiting: The newly introduced webhooks retry mechanism relies on exponential backoff. Watch out for message queues clogging under cluster peak traffic.
- Run it Before Committing: Treat
/anchoras your AI pre-commit hook. Never merge a feature branch without letting the agent sync its memory assets first. - Avoid Manual Doc Edits: Let the code drive the documentation. Write your code, implement your types/schemas, and let
context-anchorpropagate those realities back to your markdown specs. - Glossary Rigidity: If your agent starts hallucinating or using colloquial variable names, run
/anchorimmediately to snap its linguistic focus back to the project standard.
MIT License. Feel free to use, modify, and contribute to keeping AI context pinned down to reality!