Clarity Skills
Build, improve, test and secure Clarity smart contracts with your AI agent.
Clarity Skills give your agent a router plus 21 focused skills for building, testing, auditing and shipping Clarity smart contracts on Stacks. They also correct what agents get wrong: left alone, an agent writes Clarity the way it writes Solidity, or the way Clarity looked two years ago. The code compiles, the tests pass against mocks, and it breaks on mainnet.
/plugin marketplace add cybasecurity/clarity-skills
/plugin install clarity@clarity-skillsThen describe your task. Using Codex or another tool? See every install option.
What Models Get Wrong
Clarity is small and decidable, but its mistakes are specific. Asked unaided, current models explain generic DeFi attacks well and miss the Clarity-specific consequences.
Authority
tx-sender is inherited through ordinary contract calls; contract-caller tracks the immediate caller. Inside as-contract?, both refer to the executing contract. Admin checks, user funds and DAO proposals each need the right context.
Assets
In Clarity 4+, a contract spends its own funds inside as-contract? with explicit allowances. Native ft-transfer? does not authenticate the caller as the token owner. Zero and self transfers return errors, which try! propagates.
Traits
A trait argument is checked by shape, not identity, so every one must be compared with the contract expected for its role.
A Moving Ecosystem
Epoch 4.0, Clarity 4 to 6, stacks-block-time, sBTC locked balances, Pyth Core retired in favor of Pyth Lazer, new protocol versions every few months.
Addresses and Interfaces
An agent that guesses a principal or a parameter list writes code that cannot work. The skills ship dated, chain-verified registries and exact call shapes.
Clarity Knowledge
Every model we tested scored higher on Clarity knowledge with the skills.
The article explains how we measured it.
| Model | Without Skills | With Skills | Gain |
|---|---|---|---|
| Claude Fable 5.1 | 85% | 100% | +15 pts |
| Claude Haiku 5.5 | 80% | 94% | +14 pts |
| Claude Sonnet 5.5 | 86% | 100% | +14 pts |
| Claude Opus 5.5 | 89% | 100% | +11 pts |
| gpt-5.6-luna | 63.6% | 97.2% | +34 pts |
| gpt-6-astra | 92% | 100% | +8 pts |
| gpt-6-sol | 83% | 100% | +17 pts |
| gpt-6.1-sol | 91% | 100% | +9 pts |
One Router, the Right Skills
clarity:start guides the agent to the skills its task needs. Routing and the finish checklist are instructions for the agent; they are not automated enforcement or a guarantee that every check passes.
Session Starts
In Claude Code, a one-line startup hook names the router and common skills when it detects a Clarinet or Stacks project. On other hosts, invoke the router explicitly or add a project instruction.
Route
clarity:start tells the agent which skills to load for the request before writing, reviewing or explaining code.
Apply
The loaded skills hold the rules, exact call shapes and verified addresses, so the agent works from them instead of from memory.
Finish
The router asks the agent to check the work and fix failing items before finishing. Each item links to the relevant rule and test guidance.
Load by Task
| Task | Relevant Skills |
|---|---|
| How Clarity code behaves: what returns, aborts or rolls back | |
| Write or refactor a contract | |
| Tests, project setup, coverage, invariants | |
| Integrate Zest, Granite, Bitflow, Stacks Swap, Hermetica, USDCx, Pyth Lazer and others | |
| Deploy, publish, initialize | |
| Audit, review, find bugs | |
| Upgradeable design, controller replacement, v2 migration | |
| DAO, multisig, admin roles, timelocks | |
| Execution cost, block limits | |
| Language versions, epochs, compile errors on a keyword | |
| SIP-010/009/013 tokens, SIP-018 signatures | |
| Off-chain scripts, events, indexers, sBTC deposit history | |
| Bitcoin transaction proofs, sBTC settlement | |
| PoX staking | |
| Wallet connection, frontends, Ledger | |
| Boot contracts, SIP trait addresses, chain mechanics |
Before Calling a Contract Done
Each item addresses a defect seen in real builds. The router asks the agent to fix failing items before finishing.
- Trait arguments match the stored principal
- Upgrade targets typed and probed first
- Privileged setters checked and logged
- Outflows capped by exact as-contract? allowances
- Zero, self and dust amounts handled
- Assets valued at a verified price
- Pyth Lazer prices fully verified
- Share mints resist first-deposit inflation
- Signers choose minimums and deadlines
- Capital in other protocols never blocks claims
- Protocol calls match the deployed contracts
- Every position has a tested exit
- Tested on a pinned mainnet fork
- Tests call through attacker contracts
- A scripted, resumable release
The Skills
Each skill is one SKILL.md with its rules, decisions, exact call shapes and short code fragments backed by regression tests and source checks. Shared facts live in one owning skill and are linked from the others.
Write
Writing and changing contract code.
Scholar
Writes idiomatic Clarity for the version you deploy: types, responses, error handling, loops and contract layout.
clarity:scholarSecurity
Keeps funds and admin roles safe: who is calling, trait checks, asset allowances, arithmetic and rollbacks, with 29 known vulnerability patterns.
clarity:securityAssets
Moves and holds STX, tokens, NFTs and sBTC correctly, including locked balances and wallet post-conditions.
clarity:assetsSIP Compliance
Builds tokens and NFTs that match the SIP-010, SIP-009 and SIP-013 standards exactly, and signed structured data (SIP-018).
clarity:sip-complianceOptimizer
Cuts execution cost: how Clarity measures cost, block and tenure budgets, and optimizations that keep behavior the same.
clarity:optimizerEpochs
Picks the right Clarity version and explains what changed between Stacks epochs, including functions that were added or removed.
clarity:epochsTest and Audit
Proving a contract does what it should, and finding where it does not.
Testing
Sets up and writes typed tests with Clarigen and the Clarinet SDK, from fixtures to tests against a copy of mainnet.
clarity:testingFuzzing
Finds edge cases with property and invariant tests in Rendezvous, then replays any failure it finds.
clarity:fuzzingAuditor
Runs a security review: threat model, a Clarity checklist, proof-of-concept exploits and findings rated by severity.
clarity:auditorShip and Operate
Getting contracts on chain and running them safely.
Deployment
Plans and scripts releases to testnet and mainnet: deployment plans, initialization calls, keys, nonces and checks afterwards.
clarity:deploymentUpgrades
Makes immutable contracts upgradable: replaceable controllers, timelocked switch-overs, and moving state and tokens to a new version.
clarity:upgradesGovernance
Designs who controls the protocol: multisigs, DAOs, proposals, timelocks and two-step ownership transfer.
clarity:governanceEnvironments
Explains why code behaves differently in simnet, devnet, testnet and mainnet, and where to test what.
clarity:environmentsWallets
Connects apps to Leather, Xverse and Ledger to call contracts and sign messages, with post-conditions.
clarity:walletsIntegrate
Working with the rest of Stacks, and with Bitcoin.
Protocols
Verified addresses and exact function signatures for Stacks DeFi protocols such as Zest, Granite, Bitflow and Hermetica.
clarity:protocolsEcosystem
Combines several protocols in one contract: flash loans, liquidations, swaps and vault strategies in a single transaction.
clarity:ecosystemOracles
Reads prices safely from Pyth and DIA: signature checks, units, staleness and confidence.
clarity:oraclesBitcoin Proofs
Verifies Bitcoin transactions from Clarity with Merkle proofs, checks BTC payments and settles sBTC deposits and withdrawals.
clarity:bitcoin-proofsStaking
Stakes STX through PoX: staking and unstaking, signers, reward cycles, delegation and liquid staking.
clarity:stakingAPIs
Reads chain data from scripts and indexers: Hiro and node APIs, events, balances and sBTC deposit history.
clarity:apisSystem Integration
Finds standard Stacks system contracts and trait addresses, and explains blocks, tenures and transactions.
clarity:system-integrationInstall
The skills link to each other: install the whole set, never a single folder. One repository is both the plugin and its marketplace, so Claude Code and Codex install the same clarity@clarity-skills. Install it separately in each tool you use.
Claude Code
CLI · IDE · Desktop/plugin marketplace add cybasecurity/clarity-skills
/plugin install clarity@clarity-skillsclaude plugin install clarity --marketplace cybasecurity/clarity-skills- Skills appear as
clarity:*. Describe the task, or start with/clarity:start. - A startup hook adds about 200 tokens in Clarity and Stacks projects, naming the router and the skills for common tasks; elsewhere it prints nothing.
- Update with
claude plugin update clarity@clarity-skills. - Remove with
claude plugin uninstall clarity@clarity-skills.
Codex
CLIcodex plugin marketplace add cybasecurity/clarity-skills
codex plugin add clarity@clarity-skills- Or install from
/pluginsin Codex. The Codex IDE extension does not load plugins. - Invoke
$clarity:startor any skill, such as$clarity:auditor. Codex asks you to review the startup hook before it runs. - Update with
codex plugin marketplace upgrade clarity-skills. - Remove with
codex plugin remove clarity@clarity-skills.
Gemini CLI
CLIgemini extensions install https://github.com/cybasecurity/clarity-skills- Skills appear as
clarity-start,clarity-securityand so on. Instead of a startup hook, the extension loads the router into every session. - Update with
gemini extensions update clarity. - Remove with
gemini extensions uninstall clarity.
Google Antigravity
CLI · Appagy plugin install https://github.com/cybasecurity/clarity-skills- Each skill is also a slash command:
/clarity-start,/clarity-security. - Remove with
agy plugin uninstall clarity; to update, install again.
OpenCode
CLI · Desktopgit clone https://github.com/cybasecurity/clarity-skills.git ~/clarity-skills{
"skills": { "paths": ["~/clarity-skills/skills"] }
}- OpenCode loads all 22 skills from the clone; check with
opencode debug skill. Update withgit pullin the clone. - Skills appear as
clarity-start,clarity-securityand so on, and the startup hook does not run: ask forclarity-startto begin.
Claude Apps
Coming soonClaude apps support is on the way.
ChatGPT Workspaces
Coming soonChatGPT workspace support is on the way.
GitHub Copilot
Coming soonGitHub Copilot support is on the way.
Factory Droid
Coming soonFactory Droid support is on the way.
Devin CLI
Coming soonDevin CLI support is on the way.
Cline
Coming soonCline support is on the way.
Kiro
Coming soonKiro support is on the way.
Cursor
Coming soonCursor support is on the way.
ChatGPT
Coming soonClarity skills is on its way to the ChatGPT Plugins directory.
Other Agents
Any Agent Skills toolnpx skills add https://github.com/cybasecurity/clarity-skills/tree/main/skills --skill '*'Install the Clarity skills from https://github.com/cybasecurity/clarity-skills: copy every folder in its skills/ directory into your skills directory, then use clarity-start for Clarity and Stacks tasks.Before writing, testing or reviewing Clarity contracts, read /path/to/clarity-skills/skills/clarity-start/SKILL.md and the skills it names for the task.- The repository's
skills/folder holds every skill with aclarity-prefix, so it sits next to other Agent Skills sets without clashes. Install all 22: they link to each other. - Point the skills CLI at
skills/, not the repository root, or copy everyskills/clarity-*folder into your tool's skills directory.
Try It
After loading the router, describe the task in your own words. You can also invoke a specific skill using the examples above.
Build a USDCx vault with a 7-day withdrawal queue and tests.
Review contracts/vault.clar for security issues.
Make this vault upgradable without migrating user funds.
Integrate a Zest flash loan to liquidate an unhealthy position, then deposit the surplus in Hermetica.
Deploy this project to mainnet; it depends on sBTC.Addresses That Stay Fresh
Deployed Clarity code is immutable, so a recorded address keeps its code. What ages is whether a protocol still uses that contract and its settings.
- Address registries carry the date they were verified against the chain.
- After 30 days, the skills suggest updating the package and verify each address an agent will use with a bundled, read-only script.
- The skills never fetch instructions or registry files at run time. Refreshed registries ship as releases, ideally about once a month.
- Roles and parameters are always read from the protocol before deploying or signing.
Corrections Need a Source
Open an issue or pull request with a minimal example, the affected Clarity version and epoch, and a link to the implementation, specification or chain evidence.
Open an issueHow We Built and Measured Them
Why the skills exist, how we evaluated them with and without the plugin, and where they help and where they do not.
Read the articleShipping Clarity to Mainnet?
Skills make an agent's first draft better. Before mainnet, get a security review from the team that wrote them.