prompt-markers

Detects prompt prefix markers and injects matching behavior instructions via a UserPromptSubmit hook.

2|Updated Jul 18, 2026
One-click install
npx skills add https://github.com/Arasz/ai-badger --skill prompt-markers-arasz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prompt-markers
Source: https://github.com/Arasz/ai-badger/tree/main/features/common/skills/prompt-markers
Command: npx skills add https://github.com/Arasz/ai-badger --skill prompt-markers-arasz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Agents infer user intent from phrasing alone, which is inconsistent under long or compacted context. This Skill gives users explicit, machine-detectable one-word prefixes (like h:, f:, q:) that deterministically tell the agent how to treat the prompt that follows. ## Core Features & Use Cases - Marker detection and context injection: A stdlib-only Python UserPromptSubmit hook reads the prompt, matches a leading prefix against markers-context.json, and appends the marker's instruction text via additionalContext — preserving prompt caching by never rewriting the original prompt. - Six built-in markers: h:/hint: (validate before acting), f:/feedback: (high-priority correction with cited evidence), e:/extension: (scope widening), q:/queue: (run after current work), i:/important: (high priority), and i!: (immediate interrupt); every marker also accepts a ! importance token for interrupt-grade handling. - Audit trail and drift detection: Detected markers are recorded to a SQLite marker_state table (capped at 100 entries) when a .ai-badger directory exists, and two consecutive feedback turns trigger a consolidated-restart advisory. - Use Case: A user types f: the login test still fails with TimeoutError and the agent immediately receives injected instructions to treat it as high-priority feedback and cite the failing evidence before proposing a fix. ## Quick Start Register the user_prompt_hook.py script as a UserPromptSubmit hook in your Claude Code settings, then start any prompt with a marker like "h:" to have the matching behavior instruction injected automatically.

Frequently Asked Questions about prompt-markers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add prompt prefix markers to Claude Code?

Register the skill's user_prompt_hook.py script as a UserPromptSubmit hook in .claude/settings.json. The hook reads each prompt, matches a leading prefix like h: or f: against markers-context.json, and injects the matching instruction via additionalContext.

How do I add a new prompt marker or change its wording?

Edit markers-context.json next to SKILL.md — each entry defines the marker's prefixes and the exact instruction text injected. No code changes are needed; the hook loads definitions from that file at runtime.

Does the prompt markers hook work with other UserPromptSubmit hooks?

Yes. Claude Code runs all registered hooks for an event, so add this hook as an additional entry in the existing UserPromptSubmit array rather than replacing it. This lets it coexist with other hooks such as a session tracker.

Why is my mid-turn marker message not being detected?

UserPromptSubmit only fires when a message starts a turn. A message queued mid-turn is delivered as an attachment and never passes through the hook, so its marker is never expanded — this is a platform limitation, not a hook fault.

Does the hook rewrite or change my original prompt?

No. The hook only appends context through the additionalContext field and never prepends or rewrites the prompt. Appending preserves the conversation prefix byte-identically, which keeps prompt caching effective across turns.