derive-source-stubs

A skill for creating Python source stub files from existing tests. It defines every class, method, and relationship that the tests use, without adding the implementation.

In plain words
What is it for?
It is for translating integration and end-to-end test bodies into source interfaces and organizing types across system layers.
Why use it?
It keeps the planned source structure aligned with what the tests actually require and exposes missing design pieces early.

Skill for Claude CodeCodex

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/nullhack/temple8/derive-source-stubs
Any agent
npx skills add nullhack/temple8 --skill derive-source-stubs
Clone the repo
git clone --depth 1 https://github.com/nullhack/temple8

Made for: Claude Code, Codex.

Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 609 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.00029 $0.00609
Opus 5 $0.00015 $0.00304
Sonnet 5 $0.00006 $0.00122
Haiku 4.5 $0.00003 $0.00061

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

Security

Grade A, and why

derive-source-stubs 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 2d 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.

.opencode/skills/derive-source-stubs/SKILL.md · 16 lines

What it actually says

Derive Source Stubs

  1. Load [[software-craft/source-stubs]], [[software-craft/solid]], [[software-craft/object-calisthenics]], [[software-craft/design-patterns]], [[architecture/context-mapping]] — source stub conventions, the quality principles, the pattern catalog, and the inter-context relationship patterns.
  2. Read .cache/<session_id>/journal.md (always present — bootstrapped at plan entry by model-data-schema). IF it carries escalation findings from build THEN adjust the source stubs of the contracts it names; otherwise skip.
  3. Read the test .py imports and bodies — every type constructed, method called, and relationship asserted in a body is the specification of the source surface. Emit a matching .pyi signature (with an ellipsis body) for every type the tests reference, wherever the source lives.
  4. Define types, relationships, and compositions to satisfy SOLID and Object Calisthenics per [[software-craft/solid]], [[software-craft/object-calisthenics]]. IF a relationship emits a smell at the type surface (a kind-field that will switch, parallel hierarchies, construction scattered across callers, refused bequest) THEN reach for the matching pattern per [[software-craft/design-patterns]] — but KISS/YAGNI first: prefer the simplest structure that removes the smell, and prefer Python idioms (a Protocol, a dataclass, a first-class callable, a generator, a decorator) over GoF ceremony. Do not apply a pattern speculatively; Speculative Generality is the smell that rejects it.
  5. IF a relationship bridges two bounded contexts (an external service, an upstream module, a shared data shape) THEN pick the inter-context pattern per [[architecture/context-mapping]] — default to an Anti-Corruption Layer (an adapter that translates the foreign model into ours) for any external dependency; reach for Shared Kernel only for a small value-object set both contexts truly co-own.
  6. Do not prescribe layout — no hardcoded module structure. External connector and adapter stubs are not a separate category; they live under the package alongside everything else.
  7. Handle config per [[software-craft/secrets-and-config]]: non-secret config in the workspace .env; secrets in ~/.secrets/<project>.env (out-of-workspace), loaded with dotenv_values() into a frozen typed Settings, never into os.environ. A Settings model is optional and, if warranted, is a normal source stub.
  8. IF a value's representation is ambiguous (e.g. a database URL passed as bare string) THEN pin one canonical form once (the sqlite:///path URL form) and state it in the stub so every consumer agrees per [[software-craft/source-stubs]].
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. 2d ago First seen · 16 lines · 29 tokens per session scan A 92a821fec3e4

Subscribe to this mod's changes

derive-source-stubs is a skill published in the GitHub repository nullhack/temple8 (11 stars, last pushed 27d ago), licensed MIT. It adds 29 tokens to every session and 609 once invoked, about $0.0001 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.