llm-first-code

llm-first-code is a skill for Claude Code, Codex from avanturer/claude-bestpractice. It costs 35 tokens per session (868 once invoked), scanned A, original, MIT.

A coding guide for writing comments, docstrings, and type annotations that help an AI model understand a codebase. It emphasizes precise types and comments about decisions or non-obvious behavior.

In plain words
What is it for?
Use it when writing or reviewing functions, modules, comments, docstrings, and type annotations.
Why use it?
It reduces unclear or duplicated explanations that can mislead later code changes and encourages information that the code itself cannot show.

Skill for Claude CodeCodex

Part of the claude-bestpractice plugin — 3 skills, 3 commands, 1 agent, 10 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/avanturer/claude-bestpractice/llm-first-code
Any agent
npx skills add avanturer/claude-bestpractice --skill llm-first-code
Clone the repo
git clone --depth 1 https://github.com/avanturer/claude-bestpractice

Made for: Claude Code, Codex.

Or install claude-bestpractice, the plugin that ships this one along with the rest of its 3 skills, 3 commands, 1 agent, 10 hooks.

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 llm-first-code

README.md
[![agentmods](https://agentmods.dev/badge/skills/avanturer/claude-bestpractice/llm-first-code.svg)](https://agentmods.dev/skills/avanturer/claude-bestpractice/llm-first-code)
Your own site
<a href="https://agentmods.dev/skills/avanturer/claude-bestpractice/llm-first-code"><img src="https://agentmods.dev/badge/skills/avanturer/claude-bestpractice/llm-first-code.svg" alt="Measured on agentmods" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 868 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00035 $0.00868
Opus 5 $0.00017 $0.00434
Sonnet 5 $0.00007 $0.00174
Haiku 4.5 $0.00003 $0.00087

Measured 4d ago against content hash 39287d2d74bb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

llm-first-code 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 4d 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.

plugin/skills/llm-first-code/SKILL.md · 75 lines

How it starts

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

LLM-first code

The person who owns this repository reads almost none of the code. You read all of it, repeatedly, in fresh contexts with no memory of having written it. Optimise for that reader.

The rule that replaces most comments

If you are about to write a comment describing what a value is, write a type instead. A type is checked; a comment is a claim nobody verifies. 94% of LLM compile errors are type errors, and type constraining halves them.

Workflow

  1. Types first. Full annotations. No Any, no bare generics, no untyped *args/**kwargs, no unlabelled suppressions. A suppression carries its error code or it does not ship.
  2. Write a docstring only if it carries something non-derivable. Preconditions, invariants, why-not-what, the failure mode, the thing that will surprise the next reader. If the signature already says it, say nothing.
  3. Never restate the signature. Args:, Returns:, Parameters:, :param:, @param are banned outright. They duplicate what types already state, they cost context on every read, and they rot independently of the code.
  4. Comment the decision, not the mechanism. # sorted by mtime because the caller pages from newest is worth its tokens. # sort the list is not.
  5. When you change a signature, change its docstring in the same edit. A gate hashes (param names, param types, return type) and fails the commit when the signature moved and the docstring did not.
  6. Delete before correcting. Remediation order for a wrong comment is: delete it, then consider rewriting. A deleted comment costs nothing; a stale one actively misleads.

Why staleness is the whole point

Stale context is measurably worse than none. Retrieval carrying only outdated material induced calls to dead APIs on 15 of 17 samples; retrieval carrying nothing produced 0 of 17. Without context a model fails visibly. With stale context it binds confidently to something that no longer exists.

Read the full file on GitHub · 75 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. 4d ago First seen · 75 lines · 35 tokens per session scan A 39287d2d74bb

Subscribe to this mod's changes

llm-first-code is a skill published in the GitHub repository avanturer/claude-bestpractice (1 stars, last pushed today), licensed MIT. It adds 35 tokens to every session and 868 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-31.

Related

Other skills, from other repositories

nowait-reasoning-optimizer

Implements the NOWAIT technique for efficient reasoning in R1-style LLMs. Use when optimizing inference of reasoning models (QwQ, DeepSeek-R1, Phi4-Reasoning, Qwen3, Kimi-VL, QvQ), reducing chain-of-thought token usage by 27-51% while preserving accuracy. Triggers on "optimize reasoning", "reduce thinking tokens"…

foryourhealth111-pixel/Vibe-Skills · 110 tokens

prompt-lookup

Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.

foryourhealth111-pixel/Vibe-Skills · 39 tokens

loom-prompt-engineering

Designs and optimizes prompts for large language models including system prompts, agent signals, and few-shot examples.

cosmix/loom · 28 tokens

strategy

Run structured brainstorming sessions (divergent/convergent), improve prompts with 7-dimension framework, and apply decision frameworks (RICE, weighted scoring, first principles, pre-mortem).

EliasOulkadi/shokunin · 42 tokens

prompt-engineering

Create, update, review, or discuss an LLM prompt — a system prompt, a skill, or an agent. Use when writing or improving a prompt, discussing a skill or agent, diagnosing prompt failures, or when the user says a prompt needs work.

doodledood/manifest-dev · 56 tokens

ai-observability-promptfoo

Testing and evaluation framework for LLM prompts and applications -- promptfooconfig.yaml, assertions, model-graded evals, red teaming, CI/CD integration, custom providers, and comparative evaluation.

agents-inc/skills · 46 tokens