Agents Best Practices
DenisSergeevitch/agents-best-practices
A skill your agent uses when designing, generating an MVP blueprint for, auditing, troubleshooting, refactoring, or explaining an agentic harness for any domain.
Guides changes to the cursor-byok server so provider conversation history stays append-only and each turn's history remains an exact prefix of the next, protecting prefix caches.
$ npx skills add leookun/cursor-byok --skill cursor-prefix-stability -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install leookun/cursor-byok cursor-prefix-stability --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/leookun/cursor-byok.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/cursor-prefix-stability .claude/skills/cursor-prefix-stability && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "cursor-prefix-stability" agent skill from https://github.com/leookun/cursor-byok/tree/main/.agents/skills/cursor-prefix-stability into .claude/skills/cursor-prefix-stability/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cursor-prefix-stability", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/leookun/cursor-byok/tree/main/.agents/skills/cursor-prefix-stabilityType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add leookun/cursor-byok --skill cursor-prefix-stability -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install leookun/cursor-byok cursor-prefix-stability --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/leookun/cursor-byok.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/cursor-prefix-stability .agents/skills/cursor-prefix-stability && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "cursor-prefix-stability" agent skill from https://github.com/leookun/cursor-byok/tree/main/.agents/skills/cursor-prefix-stability into .agents/skills/cursor-prefix-stability/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cursor-prefix-stability", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add leookun/cursor-byok --skill cursor-prefix-stability -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install leookun/cursor-byok cursor-prefix-stability --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/leookun/cursor-byok.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/cursor-prefix-stability .cursor/skills/cursor-prefix-stability && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "cursor-prefix-stability" agent skill from https://github.com/leookun/cursor-byok/tree/main/.agents/skills/cursor-prefix-stability into .cursor/skills/cursor-prefix-stability/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cursor-prefix-stability", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/leookun/cursor-byok.git --path .agents/skills/cursor-prefix-stability--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add leookun/cursor-byok --skill cursor-prefix-stability -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install leookun/cursor-byok cursor-prefix-stability --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/leookun/cursor-byok.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/cursor-prefix-stability .gemini/skills/cursor-prefix-stability && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "cursor-prefix-stability" agent skill from https://github.com/leookun/cursor-byok/tree/main/.agents/skills/cursor-prefix-stability into .gemini/skills/cursor-prefix-stability/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cursor-prefix-stability", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install leookun/cursor-byok cursor-prefix-stabilityInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add leookun/cursor-byok --skill cursor-prefix-stability -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/leookun/cursor-byok.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/cursor-prefix-stability .github/skills/cursor-prefix-stability && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "cursor-prefix-stability" agent skill from https://github.com/leookun/cursor-byok/tree/main/.agents/skills/cursor-prefix-stability into .github/skills/cursor-prefix-stability/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cursor-prefix-stability", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add leookun/cursor-byok --skill cursor-prefix-stability -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install leookun/cursor-byok cursor-prefix-stability --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/leookun/cursor-byok.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/cursor-prefix-stability .opencode/skills/cursor-prefix-stability && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "cursor-prefix-stability" agent skill from https://github.com/leookun/cursor-byok/tree/main/.agents/skills/cursor-prefix-stability into .opencode/skills/cursor-prefix-stability/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cursor-prefix-stability", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
cursor-prefix-stabilityGuides changes to the cursor-byok server so provider conversation history stays append-only and each turn's history remains an exact prefix of the next, protecting prefix caches.
A rulebook for implementing and reviewing how cursor-byok projects a Cursor conversation into provider history. The central rule is to keep the longest valid provider prefix across turns and to treat provider-visible history as an append-only log unless an explicit compaction replaces it. Stability is solved once in the provider-independent conversation layers, before dispatch to OpenAI Responses, OpenAI Chat, Anthropic or another provider, and not separately in each adapter.
The listed invariants say that without compaction, turn N's history must be an exact structural prefix of turn N+1, the instructions and tool prefix stay byte-stable, and per-turn runtime content such as the query and open files stays apart from stable request context. Rules, skills, subagents, environment and MCP metadata are projected as a request-context message that is appended only when its compiled content changes, compared by content so that a change from A to B and back to A appends again while retries stay idempotent. Checkpoint hydration after a restart and automatic compaction as an explicit prefix reset are covered too.
Read from SKILL.md and the folder at commit 7ee68c2. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
cargoFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Cursor BYOK Prefix Stability loads about 1.3k tokens when it runs. Until then it costs about 79 tokens; SKILL.md has 537 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from leookun/cursor-byok at commit 7ee68c2, republished under its MIT licence (© leookun). 537 words, ~1,291 tokens.
.claude/skills/cursor-prefix-stability/SKILL.md (or your agent's skills folder).Preserve the longest valid provider prefix across turns. Treat provider-visible history as an append-only log unless an explicit compaction operation replaces it.
Keep the invariant in the provider-independent conversation layers:
server/
├── prompt/cursor/*/runtime.md Per-turn runtime content
├── src/cursor/request/ Request context and runtime compilation
├── src/cursor/projection/ Canonical ↔ Cursor checkpoint projection
├── src/cursor/checkpoint/ Stable roots, turns, and hydration
├── src/run/ Provider-independent model history
└── src/provider/ Provider-specific serialization onlyDo not solve prefix instability independently in each provider adapter. Produce one stable canonical history before dispatching to OpenAI Responses, OpenAI Chat, Anthropic, or another provider.
PromptSpec.instructions and the stable tool prefix byte-stable when their inputs have not changed. Deterministic ordering is required; do not use unordered iteration in provider-visible output.request-context:* message:A → B → A appends the final A again while retries of the same event remain idempotent.request-context:* wire identity through checkpoint encoding and hydration. Deduplication must still work after process restart or conversation resume.Before editing, trace the whole path that applies:
AgentRunRequest
→ request context hydration/compilation
→ CanonicalMessage identity and persistence
→ checkpoint encode/decode
→ projected ModelRequest history
→ provider serializationDetermine which data is conversation-level and which is turn-level. If a proposed change moves or rewrites an earlier provider-visible value, redesign it as a new append-only event unless the operation is explicitly compaction.
Use TDD for changes in this path. Start with a failing behavioral test, then implement the smallest provider-independent change.
Cover the affected behavior with structural assertions, not token-count estimates alone:
request-context:* message exists.A → B → A: three distinct context events are retained in order.Run focused tests first, then the relevant server suites:
cargo test --lib
cargo test --test runtime_modes
cargo test --test prefix_stability
cargo test --test checkpoint_recovery
cargo test --test compaction
cargo clippy --lib -- -D warnings
cargo fmt --all -- --checkDo not repair unrelated dirty-worktree failures while validating. Report them separately.
© leookun, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/cursor-prefix-stability of leookun/cursor-byok.
Open the folder on GitHubat commit 7ee68c2
Cursor BYOK Prefix Stability next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Cursor BYOK Prefix Stability this skillleookun/cursor-byok | 3.2k | — | ~1.3k | Automated safety check: Pass | MIT | |
| Agents Best PracticesDenisSergeevitch/agents-best-practices | 2.4k | — | ~7.4k | Automated safety check: Pass | MIT | |
| Using Ccproxy Inspectorstarbaser/ccproxy | 350 | — | ~2.7k | Automated safety check: Pass | Custom licence | |
| Openai Knowledgeopenai/openai-agents-python | 30k | 1 repos | ~408 | Automated safety check: Pass | MIT | |
| Cognee Integrations Setuptopoteretes/cognee | 32k | — | ~1k | Automated safety check: Notes | Apache-2.0 | |
| Codex Agent Provider for NanoClawnanocoai/nanoclaw | 31k | — | ~2.3k | Automated safety check: Notes | MIT |
DenisSergeevitch/agents-best-practices
A skill your agent uses when designing, generating an MVP blueprint for, auditing, troubleshooting, refactoring, or explaining an agentic harness for any domain.
starbaser/ccproxy
Operates the ccproxy inspector MITM system for intercepting, inspecting, and transforming LLM API traffic.
openai/openai-agents-python
Retrieve authoritative OpenAI API and platform documentation when an integration or claim needs current external evidence.
topoteretes/cognee
Switches cognee's LLM, embedding, relational, vector and graph backends through environment variables, with the extras to install and the traps to avoid.
nanocoai/nanoclaw
Installs Codex as an agent provider for NanoClaw groups, with streaming, MCP tools, server-side history and vault-only credentials, next to or instead of Claude.
aiskillstore/marketplace
Query the OpenAI developer documentation via the OpenAI Docs MCP server using CLI (curl/jq).
leookun/cursor-byok
Guides SQLite schema changes in the Cursor BYOK server, keeping SQLx migrations, the Rust store, API contracts and fixtures aligned.
leookun/cursor-byok
Sets the rules for building the Cursor BYOK desktop app's React and Tauri frontend, especially its HTTP boundary and component state architecture.
leookun/cursor-byok
Standardizes how a desktop app's UI lets a person choose one or more already-configured AI models, through a single grouped dropdown component.
leookun/cursor-byok
Guides releases of the Cursor BYOK desktop app on GitHub, with strict rules on who may publish and how version tags, updater manifests and signing are handled.
leookun/cursor-byok
Rules for localizing the Cursor BYOK desktop app: the global t() function, complete locale catalogs, system-language selection and the scan-and-check commands.
leookun/cursor-byok
Rules for building dropdowns, popovers, tooltips and menus in the desktop app with @floating-ui/dom, covering portals, positioning, dismissal and ARIA state.
Works with
Categories
Guides changes to the cursor-byok server so provider conversation history stays append-only and each turn's history remains an exact prefix of the next, protecting prefix caches. A rulebook for implementing and reviewing how cursor-byok projects a Cursor conversation into provider history. The central rule is to keep the longest valid provider prefix across turns and to treat provider-visible history as an append-only log unless an explicit compaction replaces it.
Cursor BYOK Prefix Stability fits situations like: changing runtime prompts or request context in cursor-byok; reviewing a change to canonical messages or provider history serialization; working on checkpoint hydration or compaction; debugging a lost prefix cache.
Run `npx skills add leookun/cursor-byok --skill cursor-prefix-stability -a claude-code`. Or copy the skill folder (.agents/skills/cursor-prefix-stability in leookun/cursor-byok) into .claude/skills/cursor-prefix-stability in your project. Claude Code loads it when a task matches its description.
Run `npx skills add leookun/cursor-byok --skill cursor-prefix-stability -a codex`. Or copy the skill folder (.agents/skills/cursor-prefix-stability in leookun/cursor-byok) into .agents/skills/cursor-prefix-stability in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add leookun/cursor-byok --skill cursor-prefix-stability -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cursor-prefix-stability, .gemini/skills/cursor-prefix-stability, .github/skills/cursor-prefix-stability and .opencode/skills/cursor-prefix-stability in your project.
Going by SKILL.md and its folder, Cursor BYOK Prefix Stability needs the command-line tools its instructions call (cargo). Our summary lists: A checkout of cursor-byok with its server directory.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Cursor BYOK Prefix Stability is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.3k tokens (SKILL.md is roughly 5.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Cursor BYOK Prefix Stability: Agents Best Practices (DenisSergeevitch/agents-best-practices, 2.4k stars), Using Ccproxy Inspector (starbaser/ccproxy, 350 stars), Openai Knowledge (openai/openai-agents-python, 30k stars) and Cognee Integrations Setup (topoteretes/cognee, 32k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
leookun (a GitHub user) maintains it in leookun/cursor-byok, which has 3,156 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on October 8, 2026.
Source: leookun/cursor-byok on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.