type-driven-development

Enforce type-driven development for Solidity smart contracts with formal verification.

4|1|Updated Jan 22, 2025
One-click install
npx skills add https://github.com/wvs-finance/ThetaSwap-core --skill type-driven-development-wvs-finance
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: type-driven-development
Source: https://github.com/wvs-finance/ThetaSwap-core/tree/main/skills/type-driven-development
Command: npx skills add https://github.com/wvs-finance/ThetaSwap-core --skill type-driven-development-wvs-finance

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces a rigorous development process that prevents bugs by ensuring that all Solidity code is built upon a foundation of well-defined types and invariants, drastically reducing the risk of runtime errors and security vulnerabilities.

Core Features & Use Cases

  • Type-First Design: Mandates the definition of types, specs, and invariants before any implementation code is written.
  • Formal Verification: Integrates Kontrol for symbolic execution and formal proof generation.
  • Static Analysis Gates: Utilizes Slither and Semgrep to catch issues early in the development cycle.
  • Use Case: When developing a new financial primitive on-chain, this Skill ensures that all state transitions are mathematically sound and that the types used correctly represent the economic constraints, leading to a more secure and predictable smart contract.

Quick Start

Use the type-driven-development skill to start defining the types and invariants for a new fee-handling contract.

Frequently Asked Questions about type-driven-development

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

FAQPage Schema
How do I use type-driven development for Solidity smart contracts?

Type-driven development for Solidity involves defining types, specs, and invariants before writing implementation code. This methodology prioritizes state transition correctness and mathematical soundness to prevent runtime errors and security vulnerabilities.

What is invariant-driven development in smart contracts?

Invariant-driven development in smart contracts is the process of establishing mathematical proofs and state properties prior to implementation. It ensures that economic constraints are correctly represented by types, resulting in predictable and secure on-chain financial primitives.

How do I integrate formal verification into a Solidity development workflow?

Formal verification integrates into Solidity workflows by using Kontrol for symbolic execution and proof generation. This validates that code adheres to pre-defined invariants and specifications before deployment.

Can I use libraries or inheritance when building smart contracts with SCOP principles?

No, adhering to SCOP principles disallows the use of inheritance and libraries in contract code. This constraint enforces rigorous type-driven design and prevents hidden state transitions or unexpected vulnerabilities from external dependencies.

How do static analysis tools like Slither and Semgrep improve Solidity security?

Static analysis tools like Slither and Semgrep improve Solidity security by acting as early gating mechanisms to catch code issues. They scan implementation code against defined types and specs to ensure correctness throughout the development cycle.

When do I need formal verification for on-chain financial primitives?

You need formal verification for on-chain financial primitives when mathematical soundness is critical for state transitions. Defining types and invariants first ensures economic constraints are correctly represented, reducing the risk of runtime vulnerabilities.