holochain
git clone https://github.com/Soushi888/holochain-agent-skill
git clone --depth=1 https://github.com/Soushi888/holochain-agent-skill ~/.claude/skills/soushi888-holochain-agent-skill-holochain
SKILL.mdHolochain Development Skill
Expert assistant for Holochain hApp development. Covers the full development spiral: architecture, design, scaffolding, implementation, testing, and deployment.
Proactive Invocation Rule
Always invoke this skill in the PLAN phase when the task touches a Holochain project. Do not wait to be asked explicitly.
Trigger conditions — any of these means the skill should be loaded before coding begins:
- Working directory is a Holochain project (contains
orworkdir/*.happ
)dnas/*/zomes/ - Task involves
files inside.rs
orzomes/coordinator/zomes/integrity/ - Task involves entry types, link types, cross-DNA calls, or zome functions
- Task involves a PR on a Holochain project
When proactively invoked: load
Architecture.md + Patterns.md, run the ReviewZome checklist against any files being modified, surface issues before implementation begins.
Workflow Routing
| Workflow | Trigger | File |
|---|---|---|
| ReviewZome | review zome, audit zome, check implementation, validate patterns, before implementing, PR review, code review on zome | |
| DesignDataModel | design data model, model entries, what entries, what links, DHT schema | |
| Scaffold | scaffold, new happ, new project, setup environment, init project, Holonix, nix develop, hc scaffold | |
| ImplementZome | implement zome, create zome, scaffold zome, write zome | |
| DesignAccessControl | design access control, who can call, cap grant design | |
| PackageAndDeploy | deploy, package, distribute, kangaroo, installer, desktop app, webhapp | |
Context Files
Load on demand based on task:
| File | Load When |
|---|---|
| Coordinator/integrity split, DNA structure, Cargo workspace, Nix, progenitor (dna_info, dna properties, network_seed), private entries, multi-DNA (multiple roles, bridge call, OtherRole) |
| New project setup, Holonix installation, Nix flake, hc CLI, commands, adding a new domain to existing project |
| Entry types, link types, CRUD, cross-zome calls, validation, HDK 0.6 API (GetStrategy, LinkQuery, Local vs Network), must_get, signals (remote signal, init cap grant) |
| Cap grants, capability system, cap claim, recv_remote_signal setup, admin-only access |
| Cell cloning, partitioned data, clone roles, createCloneCell, clone_limit |
| Error types, WasmError, ExternResult patterns, thiserror |
| Four-layer strategy, Sweettest (Rust-native), E2E Playwright + AdminWebsocket, Wind-Tunnel performance |
| Performance/load testing with wind-tunnel: ScenarioDefinitionBuilder, call_zome, ReportMetric, multi-agent roles, DHT sync lag measurement, InfluxDB metrics pipeline |
| holochain-client setup, callZome, signals, SvelteKit integration |
| Packaging, distributing, Kangaroo-Electron, installers, desktop app, versioning |
Quick Reference
Versions (current stable): hdk = "=0.6.0" hdi = "=0.7.0" holonix ref=main-0.6 Dev commands: nix develop | hc s sandbox generate workdir/ | bun run test Scaffold: hc scaffold entry-type MyEntry | hc scaffold link-type AgentToMyEntry
Common Pitfalls Checklist
Run this against any zome code being written or reviewed. Each item is a class of bug that has burned projects before.
Entry Schema Evolution
-
on new optional fields — Any field added to an existing entry struct after initial deployment MUST have#[serde(default)]
. Without it, existing entries serialized before the field existed will fail to deserialize.#[serde(default)]
alone is NOT sufficient.Option<T>#[serde(default)] // ← REQUIRED for fields added post-deployment pub new_field: Option<ActionHash>,
Cross-DNA Calls
-
is exhaustive — HDK 0.6 has 5 variants:ZomeCallResponse
,Ok
,Unauthorized
,AuthenticationFailed
,NetworkError
. WildcardCountersigningSession
is safe but hides new variants. Exhaustive match is preferred._ - Role name matches
—happ.yaml
must exactly match the role name inCallTargetCell::OtherRole("role_name")
. Typos fail silently at runtime.workdir/happ.yaml - Zome name matches coordinator crate name —
must match the coordinator'sZomeName("zome_name")
inname
. Check both.Cargo.toml - Local mirror structs for cross-DNA types — Avoid importing the remote DNA's Cargo crate. Define a local serialization mirror struct instead.
Validation Rules
- No DHT reads in
—validate()
must be deterministic. Novalidate()
,get()
,get_links()
,agent_info()
. Only inspect the op itself.sys_time() - Use
— Not the oldop.flattened::<EntryTypes, LinkTypes>()
. Patterns.md has the correct pattern.op.to_type()
HDK 0.6 API
-
requiresdelete_link()
—GetOptions
notdelete_link(hash, GetOptions::default())
.delete_link(hash) -
usesget_links()
— NotLinkQuery::try_new()
for most cases.GetLinksInputBuilder -
vsGetStrategy::Local
— UseNetwork
for own-data queries (fast, no network),Local
for DHT queries (cross-agent data).Network
Shared Utility Patterns (project-specific)
-
andagent_pub_key
are NOT entry fields — They live in the action header. Remove them from entry structs.created_at - If using a shared utility crate — verify intra-DNA and cross-DNA call helpers are used consistently rather than raw
inline.call()
Examples
Example 1: Design a new entry type for a marketplace listing
User: "I need to model a Listing entry with status transitions" → Loads Patterns.md (entry types, status enum, link types) → Designs ListingStatus enum (Active/Archived/Deleted) → Defines link types (AgentToListing, PathToListing, ListingUpdates) → Implements soft-delete via status field update, not entry deletion
Example 2: Debug a cross-agent test that fails intermittently
User: "My Tryorama test passes alone but fails when another agent reads the entry" → Loads Testing.md → Identifies missing dhtSync call before cross-agent read → Adds dhtSync([alice, bob], t) after Alice's create, before Bob's get → Test passes reliably
Example 3: Scaffold a new hApp from scratch
User: "Start a new Holochain project for a community coordination app" → Loads Scaffold.md + Workflows/Scaffold.md → Guides: nix flake setup → hc scaffold happ → first DNA → first zome pair → Verifies compilation with hc s sandbox generate workdir/
Example 4: Implement CRUD for a new zome
User: "Implement a full resource zome with create, read, update, delete" → Loads Architecture.md + Patterns.md → Invokes Workflows/ImplementZome.md → Creates integrity crate (entry struct, link enum, validation) → Creates coordinator crate (create/read/update/delete functions) → Writes Tryorama tests at foundation + integration layers