extract-behavioral-contracts

extract-behavioral-contracts is a skill for Claude Code, Codex from HuginnIndustries/CodeCartographer. It costs 59 tokens per session (789 once invoked), scanned A, original, MIT.

A guide for recovering the system’s user-visible rules from documentation, examples, tests, settings, and source code. These rules describe what inputs, outputs, defaults, errors, and side effects users should expect.

In plain words
What is it for?
It helps document the contracts of command-line tools, interfaces, APIs, background workers, storage, and exported data.
Why use it?
It creates a clear behavior specification before rebuilding the system or checking whether changes preserve its existing behavior.

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/huginnindustries/codecartographer/contracts
Any agent
npx skills add HuginnIndustries/CodeCartographer --skill contracts
Clone the repo
git clone --depth 1 https://github.com/HuginnIndustries/CodeCartographer

Made for: Claude Code, 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 extract-behavioral-contracts

README.md
[![agentmods](https://agentmods.dev/badge/skills/huginnindustries/codecartographer/contracts.svg)](https://agentmods.dev/skills/huginnindustries/codecartographer/contracts)
Your own site
<a href="https://agentmods.dev/skills/huginnindustries/codecartographer/contracts"><img src="https://agentmods.dev/badge/skills/huginnindustries/codecartographer/contracts.svg" alt="Measured on agentmods" height="20"></a>
Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 789 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.00059 $0.00789
Opus 5 $0.00030 $0.00394
Sonnet 5 $0.00012 $0.00158
Haiku 4.5 $0.00006 $0.00079

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

Security

Grade A, and why

extract-behavioral-contracts 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.

.codecarto/findings/contracts/SKILL.md · 90 lines

What it actually says

Extract Behavioral Contracts

Recover what the system does from the outside in.

Prioritize sources in this order:

  1. READMEs, docs, and built-in help text
  2. examples, demos, screenshots, sample sessions
  3. tests and fixtures
  4. schemas, default settings, and changelogs
  5. source code for gaps and contradictions

Split the analysis by user-facing surface:

  • CLI
  • TUI
  • web UI
  • API or SDK
  • bot or background worker
  • storage or export formats

For each feature, capture a contract with these fields:

  • feature
  • trigger or input
  • defaults
  • observable output
  • side effects
  • persisted state
  • error behavior
  • retry or recovery behavior

Treat tests as executable contracts:

  • Prefer them for edge cases, ordering, and failure handling.
  • Compare them against docs to detect drift.
  • Call out any doc/test conflict instead of silently picking one.

Separate essential behavior from source-specific ergonomics:

  • Preserve user-visible semantics.
  • Do not overfit to exact class names, file names, or UI implementation tricks.
  • Keep keyboard shortcuts, command aliases, or display details only if they matter to parity.

Pay special attention to these high-value behaviors:

  • cancellation and abort handling
  • streaming and partial output
  • queueing or follow-up behavior
  • compaction and summarization
  • persistence and resume flows
  • tool execution and validation

Document the security and authorization model (if the system has one):

  • Authentication method(s): OAuth, API keys, session tokens, SSO, etc.
  • Authorization model: RBAC, ABAC, ACLs, capability-based, etc.
  • Trust boundaries: what input is trusted vs untrusted.
  • Permission checks: how and where permissions are enforced.
  • Secret management: how tokens, keys, and credentials are stored and rotated.
  • Session lifecycle: expiration, refresh, invalidation.
  • Skip this area entirely if the system has no auth model (e.g., a pure library).

Document the configuration model:

  • Config sources and their precedence (env vars > config file > defaults, etc.).
  • Config file format, location, and discovery mechanism.
  • Feature flags and how they are toggled.
  • Environment-specific overrides (dev, staging, prod).
  • Config validation and error handling for malformed config.
  • If the config model is complex, use the secondary output at findings/config-model/config-model.md.

Map every contract back to its owner:

  • package or module
  • shared core vs surface wrapper
  • platform-specific adapter, if any

End with a black-box acceptance list:

  • Write scenario-style checks that another implementation can run without referencing the source.
  • Favor exact preconditions and expected outcomes over vague quality statements.

Mark every finding with one of these evidence levels:

  • observed fact: direct statement from docs, tests, schemas, types, or code.
  • strong inference: behavioral conclusion drawn from multiple facts.
  • portability hazard: assumption tied to the source language, runtime, terminal, OS, or third-party SDKs.
  • open question: missing or conflicting behavior that still needs evidence.

If behavior is hard to infer from docs alone, read the companion protocol skill next. Many user-visible quirks are really protocol or state-machine rules.

Use the output template at templates/behavioral-contracts.md.

The source code to analyze is in the parent directory (../ relative to .codecarto/). This is the repository root.

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 · 90 lines · 59 tokens per session scan A 209b05abf5b7

Subscribe to this mod's changes

extract-behavioral-contracts is a skill published in the GitHub repository HuginnIndustries/CodeCartographer (4 stars, last pushed 5d ago), licensed MIT. It adds 59 tokens to every session and 789 once invoked, about $0.0003 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

repomix

Pack and analyze codebases into AI-friendly single files using Repomix. Use when the user wants to explore repositories, analyze code structure, find patterns, check token counts, or prepare codebase context for AI analysis. Supports both local directories and remote GitHub repositories.

yamadashy/repomix · 58 tokens

ctf-pwn

Solve CTF binary exploitation challenges by discovering and exploiting memory corruption vulnerabilities to read flags. Use for buffer overflows, format strings, heap exploits, ROP challenges, or any pwn/exploitation task.

cyberkaida/reverse-engineering-assistant · 46 tokens

deep-analysis

Performs focused, depth-first investigation of specific reverse engineering questions through iterative analysis and database improvement. Answers questions like "What does this function do?", "Does this use crypto?", "What's the C2 address?", "Fix types in this function". Makes incremental improvements (renaming…

cyberkaida/reverse-engineering-assistant · 98 tokens

ctf-rev

Solve CTF reverse engineering challenges using systematic analysis to find flags, keys, or passwords. Use for crackmes, binary bombs, key validators, obfuscated code, algorithm recovery, or any challenge requiring program comprehension to extract hidden information.

cyberkaida/reverse-engineering-assistant · 52 tokens

pyghidra-scripting

Write and run Python (PyGhidra) code inside the Ghidra session that ReVa's MCP server is already attached to, using the five ReVa scripting tools — run-script, list-scripts, read-script, write-script, edit-script. Use this whenever the user asks to execute Python against the current program, reach for the Ghidra Flat…

cyberkaida/reverse-engineering-assistant · 209 tokens

ctf-crypto

Solve CTF cryptography challenges by identifying, analyzing, and exploiting weak crypto implementations in binaries to extract keys or decrypt data. Use for custom ciphers, weak crypto, key extraction, or algorithm identification.

cyberkaida/reverse-engineering-assistant · 46 tokens