better-context: Skill for Codex

.codex/skills/better-result-adopt/SKILL.md

better-result-adopt is a skill for Codex from davis7dotsh/better-context. It costs 46 tokens per session (1,280 once invoked), scanned A, original, MIT.

A migration workflow for replacing thrown exceptions and rejected Promises with typed Result values using better-result. Result values represent either a successful value or a known error.

In plain words
What is it for?
Use it to migrate API, database, and file-operation boundaries; define typed domain and infrastructure errors; wrap throwing or asynchronous functions; and refactor checks into Result chains.
Why use it?
It makes expected errors explicit and easier to handle consistently, while keeping programming defects available to fail normally. The workflow also provides an incremental order for changing an existing codebase.

Skill for Codex

Written for Codex: installed under .codex/.

This is davis7dotsh/better-context's own configuration. It tells Codex how to work on better-context itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything better-context configures →

About the project

better-context, also called btca, helps coding agents answer questions about project libraries and frameworks by searching their actual source code instead of relying only on documentation. It is for developers who need current technical context during coding, and the catalogue entries package its agent skill, rule, command, and instruction.

davis7dotsh/better-context · 1,155 stars · on GitHub · btca.dev

Reuse

Borrowing it

Nothing to install: this file belongs to davis7dotsh/better-context. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/davis7dotsh/better-context/main/.codex/skills/better-result-adopt/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/davis7dotsh/better-context

Made for: 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 better-result-adopt

README.md
[![agentmods](https://agentmods.dev/badge/skills/davis7dotsh/better-context/better-result-adopt.svg)](https://agentmods.dev/skills/davis7dotsh/better-context/better-result-adopt)
Your own site
<a href="https://agentmods.dev/skills/davis7dotsh/better-context/better-result-adopt"><img src="https://agentmods.dev/badge/skills/davis7dotsh/better-context/better-result-adopt.svg" alt="Measured on agentmods" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,280 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00046 $0.01280
Opus 5 $0.00023 $0.00640
Sonnet 5 $0.00009 $0.00256
Haiku 4.5 $0.00005 $0.00128

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

Security

Grade A, and why

better-result-adopt 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 8d 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.

.codex/skills/better-result-adopt/SKILL.md · 163 lines

How it starts

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

better-result Adoption

Migrate existing error handling (try/catch, Promise rejections, thrown exceptions) to typed Result-based error handling with better-result.

When to Use

  • Adopting better-result in existing codebase
  • Converting try/catch blocks to Result types
  • Replacing thrown exceptions with typed errors
  • Migrating Promise-based code to Result.tryPromise
  • Introducing railway-oriented programming patterns

Migration Strategy

1. Start at Boundaries

Begin migration at I/O boundaries (API calls, DB queries, file ops) and work inward. Don't attempt full-codebase migration at once.

2. Identify Error Categories

Before migrating, categorize errors in target code:

Category Example Migration Target
Domain errors NotFound, Validation TaggedError + Result.err
Infrastructure Network, DB connection Result.tryPromise + TaggedError
Bugs/defects null deref, type error Let throw (becomes Panic if in Result callback)

3. Migration Order

  1. Define TaggedError classes for domain errors
  2. Wrap throwing functions with Result.try/tryPromise
  3. Convert imperative error checks to Result chains
  4. Refactor callbacks to generator composition

Pattern Transformations

Try/Catch to Result.try

// BEFORE
function parseConfig(json: string): Config {
  try {
    return JSON.parse(json);
  } catch (e) {
    throw new ParseError(e);
  }
}

// AFTER
function parseConfig(json: string): Result<Config, ParseError> {
  return Result.try({
    try: () => JSON.parse(json) as Config,
    catch: (e) => new ParseError({ cause: e, message: `Parse failed: ${e}` }),
  });
}

Async/Await to Result.tryPromise

// BEFORE
async function fetchUser(id: string): Promise<User> {
  const res = await fetch(`/api/users/${id}`);
  if (!res.ok) throw new ApiError(res.status);
  return res.json();
}

// AFTER
async function fetchUser(id: string): Promise<Result<User, ApiError | UnhandledException>> {
  return Result.tryPromise({
    try: async () => {
      const res = await fetch(`/api/users/${id}`);
      if (!res.ok) throw new ApiError({ status: res.status, message: `API ${res.status}` });
      return res.json() as Promise<User>;
    },
    catch: (e) => (e instanceof ApiError ? e : new UnhandledException({ cause: e })),
  });
}

Read the full file on GitHub · 163 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 8d ago First seen · 163 lines · 46 tokens per session scan A 5f1b3cfb8689

Subscribe to this mod's changes

better-result-adopt is a skill published in the GitHub repository davis7dotsh/better-context (1,155 stars, last pushed 4mo ago), licensed MIT. It adds 46 tokens to every session and 1,280 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

mindos-zh

A local knowledge-base assistant for storing and finding decisions, meeting notes, procedures, troubleshooting lessons, and preferences across conversations and coding agents. It works only with the MindOS knowledge base.

GeminiLight/MindOS · 490 tokens

mindos

MindOS: local knowledge assistant & shared KB. Keeps decisions, notes, SOPs, debugging lessons, research findings, preferences across sessions/agents. Core: save notes, search KB, organize files, run workflows, review, append CSV, hand off context, distill lessons. NOT for app source or paths outside KB. Triggers…

GeminiLight/MindOS · 136 tokens

mindos

Operate a MindOS knowledge base: update notes, search, organize files, execute SOPs/workflows, retrospective, append CSV, cross-agent handoff, route unstructured input to the right files, distill experience, sync related docs. Use when the task targets files inside the user's MindOS KB (mindRoot). NOT for editing app…

GeminiLight/MindOS · 157 tokens

i18n-lookup

Look up Zeabur platform UI term translations from the dashboard i18n files. Use when writing or reviewing docs that reference UI elements (button labels, tab names, menu items) to ensure docs match the actual platform translations.

zeabur/zeabur · 52 tokens

shodh-memory

Persistent memory system for AI agents. Use this skill to remember context across conversations, recall relevant information, and build long-term knowledge. Activate when you need to store decisions, learnings, errors, or context that should persist beyond the current session.

varun29ankuS/shodh-memory · 53 tokens

rag-retrieval

Retrieval-Augmented Generation patterns for grounded LLM responses. Use when building RAG pipelines, embedding documents, implementing hybrid search, contextual retrieval, HyDE, agentic RAG, multimodal RAG, query decomposition, reranking, or pgvector search.

yonatangross/orchestkit · 58 tokens