Agent skill

Contract Key Safety

by PlamenTSV in PlamenTSV/plamen

Trigger Pattern Always required for DAML audits (self-skips if no template defines a key) - Inject Into Breadth agents, depth-state-trace

MITAuto-check passed

Install Contract Key Safety

skills CLI
$ npx skills add PlamenTSV/plamen --skill contract-key-safety -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install PlamenTSV/plamen contract-key-safety --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/PlamenTSV/plamen.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agents/skills/daml/contract-key-safety .claude/skills/contract-key-safety && rm -rf skills-src

Use ~/.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/

Facts

Skill name
contract-key-safety
GitHub stars
303
Token cost
~1.5k tokens
SKILL.md length
623 words
Files
1
Skills in repo
87
Repo updated
First seen
Licence
MIT

At a glance

Trigger Pattern Always required for DAML audits (self-skips if no template defines a key) - Inject Into Breadth agents, depth-state-trace

  • Works in 4 steps: Key + Maintainer Inventory → lookupByKey False-None Audit → exerciseByKey / fetchByKey Authority → …
  • Pattern Always required for DAML audits (self-skips if no template defines a key) - Inject Into Breadth agents
  • SKILL.md covers 1. Key + Maintainer Inventory, 2. lookupByKey False-None Audit, 3. exerciseByKey / fetchByKey… and 4. Stale-Key / Cleanup, plus 2 more sections
  • Needs NO_SUCH_KEY

What it does

Contract Key Safety is an agent skill from PlamenTSV/plamen. Trigger Pattern Always required for DAML audits (self-skips if no template defines a key) - Inject Into Breadth agents, depth-state-trace

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: Autonomous Web3 security audit agent for Claude Code. The licence is MIT.

When your agent uses it

  • Pattern Always required for DAML audits (self-skips if no template defines a key) - Inject Into Breadth agents
  • Depth-state-trace

Example prompts

  • “/contract-key-safety”

Requirements

  • A credential in NO_SUCH_KEY

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Key + Maintainer Inventory
  2. lookupByKey False-None Audit
  3. exerciseByKey / fetchByKey Authority
  4. Stale-Key / Cleanup

What it can do on your machine

Read from SKILL.md and the folder at commit 795962b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • NO_SUCH_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Contract Key Safety loads about 1.5k tokens when it runs. Until then it costs about 39 tokens; SKILL.md has 623 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~39
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from PlamenTSV/plamen at commit 795962b, republished under its MIT licence (© PlamenTSV). 623 words, ~1,521 tokens.

Download SKILL.mdSave it as .claude/skills/contract-key-safety/SKILL.md (or your agent's skills folder).
name
contract-key-safety
description
Trigger Pattern Always required for DAML audits (self-skips if no template defines a key) - Inject Into Breadth agents, depth-state-trace

CONTRACT_KEY_SAFETY Skill (DAML)

Trigger Pattern: Always required for DAML audits — self-skip if no template defines a key Inject Into: Breadth agents, depth-state-trace Finding prefix: [DML-CK-N] Rules referenced: R8, R12

A DAML contract key is a uniqueness handle plus a maintainer set. The single most dangerous DAML key bug is the lookupByKey false-None: a None result means "no contract with this key is visible to the reading parties" — NOT "no such contract exists". A choice that treats None as "absent" and creates fresh state can mint duplicates. Additionally, maintainer parties MUST be signatories of the keyed contract; a maintainer/signatory gap breaks key authority. If no template in scope defines a key, this skill self-skips (every section ✗(N/A — no keyed templates)).

1. Key + Maintainer Inventory

For every template that defines a key:

TemplateKey Type/ExprMaintainer ExprMaintainers ⊆ Signatories?Key Globally Unique?Finding?
{T}key (owner, id) : (Party, Text)maintainer key._1YES/NOYES/NO[DML-CK-N] if maintainer not signatory

Critical patterns to flag:

  • A maintainer party that is NOT in the template's signatory set — DAML requires maintainers be signatories; if the code attempts otherwise it will not compile, but a refactor that drops a signatory while keeping the maintainer is a latent break. Verify the binding holds.
  • A key whose maintainer set is a single party where the keyed value represents joint state (one party can unilaterally re-key).

DAML note: A negative lookupByKey (the None branch) requires the maintainers' authority to assert non-existence. If the reading party is not a maintainer, they cannot get an authoritative None.

2. lookupByKey False-None Audit

For every lookupByKey/visibleByKey call, determine what the None branch does and whether None is correctly interpreted:

ChoicelookupByKey TargetNone Branch ActionReader Is Maintainer?False-None Risk?
{T.C}{key}creates fresh / treats as absent / errorsYES/NO[DML-CK-N] if None→create and reader not maintainer

Attack: A choice does lookupByKey @T k and, on None, creates a new T. If the exercising party is not a maintainer of T, None only means "not visible to me" — a contract with key k may already exist, signed by other parties. The caller mints a duplicate, breaking the uniqueness invariant ([ELEVATE:LOOKUP_FALSE_NONE]).

Check for:

  • None-branch creates that are reachable by a party who is not a maintainer of the looked-up key.
  • None-branch that grants access / resets a counter / re-initializes config assuming the key was never set.
Show full SKILL.md (235 more words)Show less

3. exerciseByKey / fetchByKey Authority

exerciseByKey/fetchByKey require the maintainers' authority to resolve the key. Verify the exercising context actually has it:

ChoiceUses exerciseByKey/fetchByKey?Target KeyMaintainer Authority Present In Context?Finding?
{T.C}YES/NO{key}YES/NO[DML-CK-N] if authority gap

Check for:

  • A choice that exerciseByKeyes a contract whose maintainers are not authorizers of the current transaction — it will fail at runtime (liveness brick) OR, if the maintainer happens to be a controller, may resolve a contract the caller should not reach.
  • Authority assumed via the one-hop propagation rule that does not actually hold for the keyed target.

4. Stale-Key / Cleanup

A keyed contract that is archived without its key being freed (or recreated under a stale value) leaves dangling-key risk.

TemplateArchived ByKey Freed / Recreated Correctly?Stale-Key Reachable?Finding?
{T}{choice}YES/NOYES/NO[DML-CK-N] if stale

Check for:

  • A lifecycle where the keyed contract is archived but a consumer still exerciseByKeys the old key → NO_SUCH_KEY brick.
  • A re-create that reuses an old key with stale field values, so a lookupByKey returns outdated state a later choice trusts.

Finding Template

markdown
**ID**: [DML-CK-N]
**Severity**: [Critical if duplicate mint / uniqueness break, High if liveness brick, Medium if stale read]
**Step Execution**: ✓1,2,3,4 | ✗(reasons) | ?(uncertain)
**Rules Applied**: [R8:✓/✗, R12:✓/✗]
**Location**: {Module}.daml:LineN (template X, choice Y)
**Title**: lookupByKey false-None / maintainer-authority gap in {Choice} allows {duplicate / brick / stale read}
**Description**: [The key, the None-branch action or maintainer gap, and why the reader's visibility ≠ existence]
**Impact**: [Duplicate keyed contract minted / uniqueness invariant broken / choice bricks / stale state trusted]
**PoC steer**: allocate a party that genuinely cannot see the keyed contract (not a maintainer/stakeholder), exercise the None-branch, assert a duplicate exists via a maintainer's `query@T`.

Step Execution Checklist (MANDATORY)

SectionRequiredCompleted?Notes
1. Key + Maintainer InventoryIF keyed templates present✓/✗(N/A)/?Every template with a key
2. lookupByKey False-None AuditIF lookupByKey used✓/✗(N/A)/?Every None branch
3. exerciseByKey / fetchByKey AuthorityIF exerciseByKey/fetchByKey used✓/✗(N/A)/?Maintainer authority in context
4. Stale-Key / CleanupIF keyed templates archived✓/✗(N/A)/?Archive-then-lookup lifecycles

© PlamenTSV, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in agents/skills/daml/contract-key-safety of PlamenTSV/plamen.

Open the folder on GitHubat commit 795962b

Compare with similar skills

Contract Key Safety 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.

Contract Key Safety compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Contract Key Safety this skillPlamenTSV/plamen303—~1.5kAutomated safety check: PassMIT
Audit Exception Safetyben-manes/caffeine18k—~633Automated safety check: PassApache-2.0
Python Patternsaffaan-m/ECC276k—~2.3kAutomated safety check: PassMIT
React Audit Grep Patternsgithub/awesome-copilot40k1 repos~461Automated safety check: PassMIT
Audit Subsystem Safetyben-manes/caffeine18k—~697Automated safety check: PassApache-2.0
Memory Safety Patternswshobson/agents40k9 repos~646Automated safety check: PassMIT

Similar skills

  • Audit Exception Safety

    ben-manes/caffeine

    Audit exception safety and failure atomicity across all throw sites

    18k GitHub stars~633 tokensUpdated yesterday
    Auto-check passed
  • Python Patterns

    affaan-m/ECC

    Python-specific design patterns and best practices including protocols, dataclasses, context managers, decorators, async/await, type hints, and package organization.

    276k GitHub stars~2.3k tokensUpdated today
    DevelopmentAuto-check passed
  • React Audit Grep Patterns

    github/awesome-copilot

    Official

    Provides the complete, verified grep scan command library for auditing React codebases before a React 18.3.1 or React 19 upgrade.

    40k GitHub starsUsed in 1 repo~461 tokens
    Auto-check passed
  • Audit Subsystem Safety

    ben-manes/caffeine

    Audit one cache subsystem for concurrency correctness defects

    18k GitHub stars~697 tokensUpdated yesterday
    Auto-check passed
  • Memory Safety Patterns

    wshobson/agents

    Implement memory-safe programming with RAII, ownership, smart pointers, and resource management across Rust, C++, and C.

    40k GitHub starsUsed in 9 repos~646 tokens
    Auto-check passed
  • Golang Patterns

    affaan-m/ECC

    Go-specific design patterns and best practices including functional options, small interfaces, dependency injection, concurrency patterns, error handling, and package organization.

    276k GitHub stars~1.1k tokensUpdated today
    DevelopmentAuto-check passed

More from PlamenTSV/plamen

All 87 skills in this repo
  • Audit Prep

    PlamenTSV/plamen

    Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project…

    303 GitHub stars~3.7k tokensUpdated 13 days ago
    Auto-check passed
  • Verification Protocol

    PlamenTSV/plamen

    Trigger Pattern Always (used by all verifier agents) - Inject Into security-verifier agents (Phase 5)

    303 GitHub stars~3.5k tokensUpdated 13 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Aptos Move) - foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.3k tokensUpdated 13 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Sui Move) -- foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.2k tokensUpdated 13 days ago
    Auto-check passed
  • Account Lifecycle

    PlamenTSV/plamen

    Trigger Pattern ACCOUNTCLOSING flag detected (close/CloseAccount usage) - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.2k tokensUpdated 13 days ago
    Auto-check passed
  • Account Validation

    PlamenTSV/plamen

    Trigger Pattern Always required for Solana audits - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.7k tokensUpdated 13 days ago
    Auto-check passed

Questions about Contract Key Safety

What does Contract Key Safety do?

Trigger Pattern Always required for DAML audits (self-skips if no template defines a key) - Inject Into Breadth agents, depth-state-trace. Contract Key Safety is an agent skill from PlamenTSV/plamen.

When should I use Contract Key Safety?

Contract Key Safety fits situations like: pattern Always required for DAML audits (self-skips if no template defines a key) - Inject Into Breadth agents; depth-state-trace.

How do I install Contract Key Safety in Claude Code?

Run `npx skills add PlamenTSV/plamen --skill contract-key-safety -a claude-code`. Or copy the skill folder (agents/skills/daml/contract-key-safety in PlamenTSV/plamen) into .claude/skills/contract-key-safety in your project. Claude Code loads it when a task matches its description.

How do I install Contract Key Safety in Codex?

Run `npx skills add PlamenTSV/plamen --skill contract-key-safety -a codex`. Or copy the skill folder (agents/skills/daml/contract-key-safety in PlamenTSV/plamen) into .agents/skills/contract-key-safety in your project. Codex loads it when a task matches its description.

Can I use Contract Key Safety in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add PlamenTSV/plamen --skill contract-key-safety -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/contract-key-safety, .gemini/skills/contract-key-safety, .github/skills/contract-key-safety and .opencode/skills/contract-key-safety in your project.

What does Contract Key Safety need to run?

Going by SKILL.md and its folder, Contract Key Safety needs credentials named NO_SUCH_KEY. Our summary lists: A credential in NO_SUCH_KEY.

Does Contract Key Safety access the network?

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.

Is Contract Key Safety safe to install?

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.

What licence does Contract Key Safety use?

Contract Key Safety is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Contract Key Safety use?

About 1.5k tokens (SKILL.md is roughly 6.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Contract Key Safety?

Skills that share tags, products or a category with Contract Key Safety: Audit Exception Safety (ben-manes/caffeine, 18k stars), Python Patterns (affaan-m/ECC, 276k stars), React Audit Grep Patterns (github/awesome-copilot, 40k stars) and Audit Subsystem Safety (ben-manes/caffeine, 18k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Contract Key Safety?

PlamenTSV (a GitHub user) maintains it in PlamenTSV/plamen, which has 303 GitHub stars. The repository holds 87 skills in this directory. The repository was last updated on September 26, 2026.

Source: PlamenTSV/plamen on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.