tdd-workflow

Establish a test-first workflow for Anarchy changes across Rust pallets, wasm-engine, frontend, and blockchain shell.

Updated Feb 6, 2026
One-click install
npx skills add https://github.com/MoriwakiYusuke/anarchy --skill tdd-workflow-moriwakiyusuke
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-workflow
Source: https://github.com/MoriwakiYusuke/anarchy/tree/main/.claude/skills/tdd-workflow
Command: npx skills add https://github.com/MoriwakiYusuke/anarchy --skill tdd-workflow-moriwakiyusuke

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents slow, fragile development cycles by ensuring changes to Anarchy are verified through tests that are designed first, then implemented until they pass.

Core Features & Use Cases

  • Four-layer TDD structure: Rust pallet unit tests, Rust workspace integration tests, wasm-engine unit tests, and frontend unit tests via Jest/Testing Library.
  • Correct test placement discipline: keeps mock-only logic from pretending to be real behavior, aligning with CLAUDE.md #6 by separating mock scope from actual implementation scope.
  • Shell-based blockchain E2E integration: uses dev node + storage node combined scenarios in apps/blockchain/tests/integration/**/*.sh for cross-pallet and runtime-upgrade style acceptance.
  • Actionable, color-coded workflow: RED (assert failure) → GREEN (implement extrinsic/logic) → REFACTOR (extract helpers) with clear assertions for storage and events.
  • Practical examples of assertions: verifies errors via assert_noop!/error variants, and validates runtime events and storage mutations deterministically.

Quick Start

Use the tdd-workflow skill to design a failing unit test (RED) for the exact pallet/module behavior you’re changing, then implement until GREEN, and finally run the matching test suite for that layer.

Frequently Asked Questions about tdd-workflow

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure test-driven development for Rust blockchain pallets and Wasm components?

Test-driven development for Rust pallets and Wasm components requires a four-layer structure: mock runtime unit tests for pallets, workspace integration tests, Wasm-engine unit vectors, and Jest frontend tests. Each layer uses strict mock boundaries to separate logic from implementation scope.

What's the best way to write failing tests first for Substrate pallet bug fixes?

Writing failing tests first for Substrate pallet bug fixes follows a RED-GREEN-REFACTOR sequence. Start by asserting failure with assert_noop! for error variants, implement the extrinsic logic until GREEN, then extract helpers during REFACTOR using deterministic assertions for storage and events.

How does Jest integration testing work with Rust blockchain shell E2E scenarios?

Jest integration testing works alongside Rust blockchain E2E scenarios by separating frontend React hooks and component tests from shell-based multi-node acceptance tests. Shell E2E uses dev node and storage node scripts in apps/blockchain/tests/integration for cross-pallet and runtime-upgrade validation.

Why does my TDD workflow keep mixing mock logic with real pallet implementation scope?

Your TDD workflow mixes mock logic with real implementation scope because test placement discipline is missing. Correct placement separates mock-only logic from actual behavior by mapping each concern to the correct layer—mock runtime unit tests versus workspace integration wiring—to avoid CLAUDE.md #6 violations.

Can I use this TDD workflow for refactoring existing Rust pallets without breaking runtime upgrades?

Yes, this TDD workflow applies to refactoring existing Rust pallets by mapping changes to layer-appropriate tests. Runtime upgrades are validated through shell-based blockchain E2E integration scenarios that combine dev node and storage node for cross-pallet acceptance testing.

When do I need Wasm-engine unit test vectors versus Rust workspace integration tests?

You need Wasm-engine unit test vectors for cryptography logic isolation and Rust workspace integration tests for verifying wiring between pallets. The TDD workflow maps each concern to its correct layer, ensuring deterministic assertions and appropriate test execution commands per layer.