clarity-check
Clarity pre-deployment validation — syntax checking, deprecated keyword detection, sender check analysis, error propagation review, and test verification.
What this skill does
# Clarity Check Skill
Pre-deployment validation gate for Clarity smart contracts. Runs automated checks for syntax errors, deprecated keywords, incorrect sender checks, error propagation issues, and missing tests. Pairs with the existing `contract` skill for deploy operations.
## Usage
This is a doc-only skill. Agents read this file to understand available checks and invoke them through the skill framework. The CLI interface below documents the planned implementation.
```
bun run clarity-check/clarity-check.ts <subcommand> [options]
```
## Subcommands
### validate
Run all automated checks against a Clarity contract file.
```
bun run clarity-check/clarity-check.ts validate --source <path-to-file.clar> [--project-dir <clarinet-project-dir>]
```
Options:
- `--source` (required) — Path to the `.clar` source file to validate
- `--project-dir` (optional) — Clarinet project directory for `clarinet check` integration; auto-detected from source path if omitted
Output:
```json
{
"file": "contracts/my-contract.clar",
"passed": false,
"checks": [
{
"name": "syntax",
"status": "pass",
"description": "clarinet check passes"
},
{
"name": "deprecated-keywords",
"status": "fail",
"description": "Deprecated keywords found",
"findings": [
{
"line": 15,
"keyword": "block-height",
"replacement": "stacks-block-height",
"severity": "warning"
}
]
},
{
"name": "sender-checks",
"status": "warn",
"description": "Sender check analysis",
"findings": [
{
"line": 22,
"issue": "Token transfer uses contract-caller instead of tx-sender",
"recommendation": "Use tx-sender for token operations to preserve human identity through proxies",
"severity": "warning"
}
]
}
],
"summary": {
"total": 7,
"pass": 5,
"fail": 1,
"warn": 1
}
}
```
### checklist
Generate a human-readable pre-deployment checklist for a contract, combining automated checks with manual verification items.
```
bun run clarity-check/clarity-check.ts checklist --source <path-to-file.clar> [--project-dir <clarinet-project-dir>]
```
Options:
- `--source` (required) — Path to the `.clar` source file
- `--project-dir` (optional) — Clarinet project directory
Output:
```json
{
"file": "contracts/my-contract.clar",
"automated": [
{"check": "clarinet check passes", "status": "pass"},
{"check": "No deprecated keywords", "status": "fail", "details": "Found: block-height on line 15"},
{"check": "Correct sender checks", "status": "warn", "details": "1 finding"},
{"check": "Error propagation uses try!", "status": "pass"},
{"check": "No dead code or unused features", "status": "pass"},
{"check": "Events follow structured format", "status": "pass"},
{"check": "Error codes are unique", "status": "pass"}
],
"manual": [
"Verify tests exist and pass (npm test)",
"Check execution costs in clarinet console (::get_costs)",
"Review post-conditions for all token operations",
"Verify trait whitelisting if external contracts are called",
"Test on testnet before mainnet deployment",
"Document contract address after deployment"
]
}
```
## Checks Performed
### Automated
| Check | What it detects |
|-------|----------------|
| Syntax | `clarinet check` errors and warnings |
| Deprecated keywords | `block-height` (use `stacks-block-height`), other legacy keywords |
| Sender checks | `tx-sender` vs `contract-caller` misuse in token operations |
| Error propagation | `unwrap!` used where `try!` is more appropriate for recoverable errors |
| Dead code | Unused private functions, unreachable branches |
| Event format | Events missing `notification`/`payload` structure |
| Error code uniqueness | Duplicate error code constants |
| Public function returns | Functions missing `(response ok err)` return type |
### Manual (Checklist Only)
| Check | Why it matters |
|-------|---------------|
| Tests exist and pass | Ensures behavior is verified |
| Execution costs | Prevents exceeding block limits |
| Post-conditions | Protects users from unexpected token transfers |
| Trait whitelisting | Prevents unauthorized contract interactions |
| Testnet deployment | Catches issues before mainnet |
## Notes
- Requires `clarinet` CLI installed locally for syntax checking
- If `clarinet` is not found, syntax check is skipped with a warning
- Static analysis only — does not execute the contract or run tests
- Use `clarity-test-scaffold` to generate tests, then `clarity-audit` for deep review
- Complements `clarinet check` by adding Clarity-specific best practice checks that the compiler doesn't enforce
Related in Data & Analytics
clawarr-suite
IncludedComprehensive management for self-hosted media stacks (Sonarr, Radarr, Lidarr, Readarr, Prowlarr, Bazarr, Overseerr, Plex, Tautulli, SABnzbd, Recyclarr, Unpackerr, Notifiarr, Maintainerr, Kometa, FlareSolverr). Deep library exploration, analytics, dashboard generation, content management, request handling, subtitle management, indexer control, download monitoring, quality profile sync, library cleanup automation, notification routing, collection/overlay management, and media tracker integration (Trakt, Letterboxd, Simkl).
querying-soql
IncludedSOQL query generation, optimization, and analysis with 100-point scoring. Use this skill when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan analysis, and performance or safety improvements for Salesforce queries. TRIGGER when: user writes, optimizes, or debugs SOQL/SOSL queries, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER when: bulk data operations (use handling-sf-data), Apex DML logic (use generating-apex), or report/dashboard queries.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
habit-flow
IncludedAI-powered atomic habit tracker with natural language logging, streak tracking, smart reminders, and coaching. Use for creating habits, logging completions naturally ("I meditated today"), viewing progress, and getting personalized coaching.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
visualizing-data
IncludedBuilds dashboards, reports, and data-driven interfaces requiring charts, graphs, or visual analytics. Provides systematic framework for selecting appropriate visualizations based on data characteristics and analytical purpose. Includes 24+ visualization types organized by purpose (trends, comparisons, distributions, relationships, flows, hierarchies, geospatial), accessibility patterns (WCAG 2.1 AA compliance), colorblind-safe palettes, and performance optimization strategies. Use when creating visualizations, choosing chart types, displaying data graphically, or designing data interfaces.