hawkingrei/tidb-dev-prompt/context-management
Claude Code and agent skill by hawkingrei/tidb-dev-prompt
- community
Checking that the SKILL.md file is still in the repository.
Use for projects, tasks, or code that involve context engineering and context management for AI agents: keep prompt prefixes stable for KV-cache, use append-only context, prefer tool masking over tool removal, offload large observations into filesystem memory, recite goals/todos to control attention, preserve errors for recovery, and avoid few-shot pattern lock-in. Use when building or debugging agent loops, prompt/context schemas, memory strategies, or tool-availability policies.
Install
npx vskill@latest install hawkingrei/tidb-dev-prompt/context-managementSKILL.md
The same SKILL.md was published earlier as hawkingrei/tidb-dev-prompt/context-management.
Context Management Skill
Design and operate agent context so it is fast, cheap, stable, and robust over long tool-using loops. Use a two-layer model: 1) Global context (stable, cross-project, rarely edited; e.g. ~/.codex/) 2) Local context (project-specific, frequently updated; lives in repo)
Workflow
- Separate global vs local context
- Global: invariant rules, assembly templates, stable checklists.
- Local: project goals, current state, logs, errors, and per-run artifacts.
- Prefer read-only access to global context during runs; update it only by explicit request.
- Ensure project
.gitignoreincludes.cache/(keep.cache/.gitkeepif you want the directory tracked).
- Define the invariant prefix
- Keep system/developer prompt prefixes stable across turns and sessions.
- Avoid timestamps, run IDs, random salts, or non-deterministic serialization in the prefix.
- Keep tool definitions stable; avoid dynamic add/remove mid-episode.
- Make context append-only
- Never rewrite or "clean up" earlier actions/observations; only append corrections.
- Ensure deterministic ordering for any serialized data you add to context (stable key order, stable formatting).
- Constrain actions without editing tool definitions
- Prefer masking/forcing at decode time if you own the runtime.
- If you only control prompts, keep tool definitions unchanged and append an
Allowed actionsblock near the end of the context to gate behavior. - Group tool names with consistent prefixes (e.g.,
browser_*,shell_*) so you can constrain by group.
- Use the filesystem as external memory
- Store large observations (pages, logs, diffs, stack traces, CSVs) in files, not in the prompt.
- Keep context compression reversible: retain pointers (file paths, URLs, IDs) so content can be reloaded on demand.
- Put only a short summary + pointer in the model context.
- Prefer per-run directories to avoid file contention (e.g.
.cache/context/run/YYYYMMDD-HHMM/).
- Recite goals to control attention
- Maintain a
todo.md(or equivalent) and rewrite it as the task progresses. - Re-state the current objective and "next action" near the end of the context before each decision step.
- Preserve errors
- Keep failed attempts and error outputs visible in context (or in files referenced from context).
- Add a short postmortem note: "what failed / why / what to try next".
- Avoid few-shot pattern lock-in
- Do not let the context become a long chain of near-identical action/observation pairs.
- Introduce controlled variation in formatting/wording/order in the late (non-cached) part of context to break brittle imitation, while keeping the prefix stable.
- Concurrency safety
- Use a single-writer rule for local context files.
- Use a lock file (e.g.
.cache/context/.lock) when writing shared local files. - Prefer append-only logs and run-scoped subdirectories to avoid merge conflicts.
Deliverables
- A compact "context contract" describing what is stable vs dynamic.
- A filesystem memory layout (folders + key files) that the agent reads/writes.
- A prompt assembly template for each agent step (decision, tool-call, user-response).
References
- Templates:
context-management/references/templates.md - Context contract:
context-management/references/context_contract.md - Errors template:
context-management/references/errors.md - Checklists:
context-management/references/checklists.md
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcontext-management/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hawkingrei/tidb-dev-prompt/context-management)