From cardano-dev-skills
Guides writing Cardano validators from a specification, covering datum/redeemer design, validator logic, security checks, and test planning in Aiken.
How this skill is triggered — by the user, by Claude, or both
Slash command
/cardano-dev-skills:write-validatorThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
<!-- Documentation lookup path: ${CLAUDE_SKILL_DIR}/../../docs/sources/ -->
Guide the development of a Cardano smart contract from specification to implementation, with security built in from the start.
The datum represents the state stored at the script address.
Questions to answer:
See references/datum-redeemer-design.md for detailed guidance.
Search the bundled documentation for relevant content:
${CLAUDE_SKILL_DIR}/../../docs/sources/aiken/ - Aiken language docs${CLAUDE_SKILL_DIR}/../../docs/sources/aiken-stdlib/ - Aiken standard library docs${CLAUDE_SKILL_DIR}/../../docs/sources/aiken-examples/ - Aiken example projects${CLAUDE_SKILL_DIR}/../../docs/sources/aiken-design-patterns/ - Aiken design patterns${CLAUDE_SKILL_DIR}/../../docs/sources/plutus/ - Plutus docsThe redeemer represents the action the user wants to perform.
type Redeemer { Action1 | Action2 { field: Type } }For each redeemer variant, define:
Structure the validator clearly:
validator my_validator(params: Params) {
spend(
datum: Option<Datum>,
redeemer: Redeemer,
own_ref: OutputReference,
tx: Transaction,
) {
expect Some(datum) = datum
when redeemer is {
Action1 -> handle_action1(datum, tx)
Action2 { field } -> handle_action2(datum, field, tx)
}
}
}
For each action handler:
Before considering the validator complete, verify each item:
extra_signatoriesFor each redeemer action, document the transaction shape:
This becomes the specification for the off-chain transaction building code.
Define tests for each redeemer action:
Positive tests (should succeed):
Negative tests (should fail):
Use Aiken's built-in test framework:
test action1_succeeds() {
let tx = mock_transaction(...)
handle_action1(mock_datum, tx)
}
test action1_fails_wrong_signer() fail {
let tx = mock_transaction_wrong_signer(...)
handle_action1(mock_datum, tx)
}
Plutus/Haskell notes:
plutus-simple-model or cardano-testnet for testingPlutusTx.compile for on-chain compilationPlutusTx.unstableMakeIsDataOpShin notes:
build() function from opshin.builder (e.g., from opshin.builder import build; contract = build("path/to/contract.py"))opshin eval for local testingreferences/aiken-patterns.md -- Common validator patterns with code structurereferences/datum-redeemer-design.md -- Guide for designing datums and redeemers${CLAUDE_SKILL_DIR}/../../docs/sources/ for existing protocol specifications and design documentsProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub cardano-foundation/cardano-dev-skills --plugin cardano-dev-skills