stacksagent 1.4.0 β 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +343 -100
- package/dist/assets/.claude/skills/stacks-agent/SKILL.md +63 -9
- package/dist/assets/.shared/stacks-agent/data/examples.csv +3041 -0
- package/dist/assets/.shared/stacks-agent/data/oracles.csv +31 -0
- package/dist/assets/.shared/stacks-agent/data/relationships.csv +130 -0
- package/dist/assets/.shared/stacks-agent/scripts/core.py +101 -9
- package/dist/assets/.shared/stacks-agent/scripts/examples.py +522 -0
- package/dist/assets/.shared/stacks-agent/scripts/relationships.py +377 -0
- package/dist/assets/.shared/stacks-agent/scripts/search.py +137 -11
- package/dist/assets/.shared/stacks-agent/scripts/validate_examples.py +421 -0
- package/dist/index.js +0 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,179 +1,422 @@
|
|
|
1
|
-
|
|
1
|
+
<!--
|
|
2
|
+
This README is the single source of truth.
|
|
3
|
+
It's automatically copied to cli/README.md during `npm run build`
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
# Stacks Agent
|
|
7
|
+
|
|
8
|
+
> AI Skill for building Stacks blockchain applications - Bitcoin's most powerful smart contract layer
|
|
9
|
+
|
|
10
|
+
An intelligent AI assistant that provides development guidance for Clarity smart contracts, DeFi integration, and blockchain development on Stacks. Works with **Claude Code, Cursor, Windsurf, Antigravity, GitHub Copilot, Kiro, and Codex**.
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+

|
|
14
|
+

|
|
15
|
+
|
|
16
|
+
## β¨ Features
|
|
17
|
+
|
|
18
|
+
**v2.0 Highlights:**
|
|
19
|
+
- π― **40 Production Code Examples** - Real code from live dApps (sbtc-market, stacksagent, STX City)
|
|
20
|
+
- πΈοΈ **100 Knowledge Relationships** - Connected concepts across domains
|
|
21
|
+
- π« **Zero Deprecated Code** - All modern @stacks/connect v7+ API patterns
|
|
22
|
+
- π **Security-First Examples** - Post-conditions, error handling, real vulnerabilities
|
|
23
|
+
|
|
24
|
+
**495+ Knowledge Base Entries Across 15 Domains:**
|
|
25
|
+
|
|
26
|
+
### Core Language & Tools (175 entries)
|
|
27
|
+
- **π· 61 Clarity Functions** - Complete language reference with examples
|
|
28
|
+
- **βοΈ 75 Stacks.js Utilities** - Wallet, transactions, CV constructors, API integration
|
|
29
|
+
- **π 14 Contract Templates** - SIP-010, SIP-009, DAO, Vault, Marketplace, Stacking
|
|
30
|
+
- **π 25 Deployment Steps** - Testnet, mainnet, and devnet workflows
|
|
31
|
+
|
|
32
|
+
### Domain-Specific Integrations (185 entries)
|
|
33
|
+
- **π 21 BNS Operations** - Name registration, resolution (Clarity + JS + API)
|
|
34
|
+
- **π° 25 Stacking Guides** - PoX stacking and pool delegation (Clarity + JS + API)
|
|
35
|
+
- **π 25 DeFi Protocols** - Alex, Velar, Bitflow, Zest, StackingDAO (Clarity + JS + API)
|
|
36
|
+
- **π¨ 30 NFT Operations** - SIP-009, minting, marketplace patterns (Clarity + JS + API)
|
|
37
|
+
- **π 40 Token Operations** - SIP-010 fungible tokens, DeFi integrations (Clarity + JS + API)
|
|
38
|
+
- **π 14 Authentication** - Wallet auth, JWT, sessions, token-gating (**No Gaia** - deprecated) (Clarity + JS + API)
|
|
39
|
+
- **π 30 Oracle Integration** - Pyth Network price feeds, VAA handling, Hermes API (Clarity + JS + API)
|
|
40
|
+
|
|
41
|
+
### Advanced & Specialized (135 entries)
|
|
42
|
+
- **π‘οΈ 15 Security Patterns** - Common vulnerabilities and secure implementations
|
|
43
|
+
- **π― 40 Advanced Patterns** - Pagination, SWR, presales, lotteries, vesting, CSV export
|
|
44
|
+
- **π 30 Chainhooks** - Event indexing, webhooks, predicates, ordinals tracking
|
|
45
|
+
- **π€ 50 Trading Bots** - Automated trading, wallet SDKs, Privy, bonding curves
|
|
46
|
+
|
|
47
|
+
## π― Use Cases
|
|
48
|
+
|
|
49
|
+
- Generate Clarity smart contracts from natural language
|
|
50
|
+
- Audit contracts for security vulnerabilities
|
|
51
|
+
- Integrate with DeFi protocols (swaps, liquidity, lending)
|
|
52
|
+
- Integrate Pyth Network oracle for price feeds
|
|
53
|
+
- Deploy to testnet/mainnet
|
|
54
|
+
- Build dApps with Stacks.js
|
|
55
|
+
- Implement stacking and BNS features
|
|
2
56
|
|
|
3
|
-
|
|
57
|
+
## π¦ Installation
|
|
4
58
|
|
|
5
|
-
|
|
6
|
-
[](https://www.npmjs.com/package/stacksagent)
|
|
7
|
-
[](https://opensource.org/licenses/MIT)
|
|
59
|
+
### Using CLI (Recommended)
|
|
8
60
|
|
|
9
|
-
|
|
61
|
+
```bash
|
|
62
|
+
# Install globally
|
|
63
|
+
npm install -g stacksagent
|
|
10
64
|
|
|
11
|
-
|
|
65
|
+
# Go to your project
|
|
66
|
+
cd /path/to/your/project
|
|
67
|
+
|
|
68
|
+
# Install for your AI assistant
|
|
69
|
+
stacksagent init --ai claude # Claude Code
|
|
70
|
+
stacksagent init --ai cursor # Cursor
|
|
71
|
+
stacksagent init --ai windsurf # Windsurf
|
|
72
|
+
stacksagent init --ai antigravity # Antigravity
|
|
73
|
+
stacksagent init --ai copilot # GitHub Copilot
|
|
74
|
+
stacksagent init --ai kiro # Kiro
|
|
75
|
+
stacksagent init --ai codex # OpenAI Codex
|
|
76
|
+
stacksagent init --ai all # All platforms
|
|
77
|
+
```
|
|
12
78
|
|
|
13
|
-
|
|
14
|
-
- **Cursor** - AI-first code editor
|
|
15
|
-
- **Windsurf** - AI coding assistant
|
|
16
|
-
- **Antigravity** - AI development tool
|
|
17
|
-
- **GitHub Copilot** - GitHub's AI assistant
|
|
18
|
-
- **Kiro** - AI coding helper
|
|
19
|
-
- **Codex** - OpenAI Codex integration
|
|
79
|
+
### Manual Installation
|
|
20
80
|
|
|
21
|
-
|
|
81
|
+
Copy the appropriate folders to your project:
|
|
22
82
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
83
|
+
| AI Assistant | Folders to Copy |
|
|
84
|
+
| --------------- | -------------------------------------------------------- |
|
|
85
|
+
| Claude Code | `.claude/skills/stacks-agent/` |
|
|
86
|
+
| Cursor | `.cursor/commands/stacks-agent.md` + `.shared/stacks-agent/` |
|
|
87
|
+
| Windsurf | `.windsurf/workflows/stacks-agent.md` + `.shared/stacks-agent/` |
|
|
88
|
+
| Antigravity | `.agent/workflows/stacks-agent.md` + `.shared/stacks-agent/` |
|
|
89
|
+
| GitHub Copilot | `.github/prompts/stacks-agent.prompt.md` + `.shared/stacks-agent/` |
|
|
90
|
+
| Kiro | `.kiro/steering/stacks-agent.md` + `.shared/stacks-agent/` |
|
|
91
|
+
| Codex | `.codex/skills/stacks-agent/` |
|
|
26
92
|
|
|
27
93
|
## π Usage
|
|
28
94
|
|
|
29
|
-
###
|
|
95
|
+
### Claude Code
|
|
30
96
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
97
|
+
The skill activates automatically when you request Stacks development work, tag or mention the `stacksagent`
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
Create a meme token called PEPE with 1 billion supply @stacksagent
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Cursor / Windsurf / Antigravity
|
|
34
104
|
|
|
35
|
-
|
|
36
|
-
stacksagent init --ai cursor
|
|
105
|
+
Use the slash command:
|
|
37
106
|
|
|
38
|
-
|
|
39
|
-
|
|
107
|
+
```
|
|
108
|
+
/stacks-agent Create a meme token called PEPE with 1 billion supply
|
|
109
|
+
```
|
|
40
110
|
|
|
41
|
-
|
|
42
|
-
stacksagent init --ai antigravity
|
|
111
|
+
### GitHub Copilot
|
|
43
112
|
|
|
44
|
-
|
|
45
|
-
stacksagent init --ai copilot
|
|
113
|
+
Reference in chat:
|
|
46
114
|
|
|
47
|
-
|
|
48
|
-
|
|
115
|
+
```
|
|
116
|
+
@stacks-agent How do I swap tokens on Alex?
|
|
117
|
+
```
|
|
49
118
|
|
|
50
|
-
|
|
51
|
-
stacksagent init --ai codex
|
|
119
|
+
## π‘ Example Prompts
|
|
52
120
|
|
|
53
|
-
|
|
54
|
-
|
|
121
|
+
**Basic Queries:**
|
|
122
|
+
```
|
|
123
|
+
"Create a SIP-010 token with burn mechanism"
|
|
124
|
+
"Build an NFT collection with royalties"
|
|
125
|
+
"Audit this Clarity contract for security issues"
|
|
126
|
+
"Deploy my contract to testnet"
|
|
55
127
|
```
|
|
56
128
|
|
|
57
|
-
|
|
129
|
+
**Production Code Examples (New in v2.0):**
|
|
130
|
+
```
|
|
131
|
+
"Show me a complete working example of swapping tokens with slippage protection"
|
|
132
|
+
"How do I connect a wallet using the new @stacks/connect v7 API?"
|
|
133
|
+
"Give me production code for NFT marketplace listing"
|
|
134
|
+
"Show me how to integrate Pyth oracle for BTC/USD price"
|
|
135
|
+
"How do I implement JWT authentication with wallet signatures?"
|
|
136
|
+
"Show me a secure token transfer with post-conditions"
|
|
137
|
+
```
|
|
58
138
|
|
|
59
|
-
|
|
60
|
-
|
|
139
|
+
**With Relationships:**
|
|
140
|
+
```
|
|
141
|
+
"What are the dependencies for implementing a token swap?"
|
|
142
|
+
"Show me all security patterns related to NFT marketplace"
|
|
143
|
+
"What JavaScript SDK functions implement Clarity stacking?"
|
|
61
144
|
```
|
|
62
145
|
|
|
63
|
-
|
|
146
|
+
## π Knowledge Base Search
|
|
147
|
+
|
|
148
|
+
The skill includes a powerful BM25-based search engine:
|
|
64
149
|
|
|
65
150
|
```bash
|
|
66
|
-
|
|
151
|
+
# Auto-detect domain
|
|
152
|
+
python3 .claude/skills/stacks-agent/scripts/search.py "define-public"
|
|
153
|
+
|
|
154
|
+
# Search specific domain
|
|
155
|
+
python3 .claude/skills/stacks-agent/scripts/search.py "swap tokens" --domain defi
|
|
156
|
+
|
|
157
|
+
# Get more results
|
|
158
|
+
python3 .claude/skills/stacks-agent/scripts/search.py "security" --domain security -n 10
|
|
159
|
+
|
|
160
|
+
# JSON output
|
|
161
|
+
python3 .claude/skills/stacks-agent/scripts/search.py "stx transfer" --domain stacksjs -f json
|
|
67
162
|
```
|
|
68
163
|
|
|
69
|
-
|
|
164
|
+
**Available domains**:
|
|
165
|
+
- `clarity` - Syntax and functions
|
|
166
|
+
- `templates` - Contract templates
|
|
167
|
+
- `security` - Security patterns
|
|
168
|
+
- `defi` - DeFi protocols (swaps, liquidity, stacking, oracles)
|
|
169
|
+
- `nfts` - NFT operations (minting, marketplace, royalties)
|
|
170
|
+
- `tokens` - Token operations (SIP-010, vesting, allowances)
|
|
171
|
+
- `auth` - Authentication (wallet connect, JWT, sessions)
|
|
172
|
+
- `stacksjs` - JavaScript snippets
|
|
173
|
+
- `bns` - BNS operations
|
|
174
|
+
- `stacking` - Stacking guides
|
|
175
|
+
- `deployment` - Deployment steps
|
|
176
|
+
- `auto` - Auto-detect (default)
|
|
177
|
+
|
|
178
|
+
## π― Production Code Examples (New in v2.0)
|
|
179
|
+
|
|
180
|
+
Search 40 complete, production-tested code examples extracted from live dApps:
|
|
70
181
|
|
|
71
182
|
```bash
|
|
72
|
-
|
|
183
|
+
# Search examples
|
|
184
|
+
python3 .claude/skills/stacks-agent/scripts/search.py "how to swap" --examples
|
|
185
|
+
|
|
186
|
+
# Filter by domain
|
|
187
|
+
python3 .claude/skills/stacks-agent/scripts/search.py "marketplace" --domain nfts --examples
|
|
188
|
+
|
|
189
|
+
# Filter by difficulty
|
|
190
|
+
python3 .claude/skills/stacks-agent/scripts/search.py "token" --difficulty beginner --examples
|
|
191
|
+
|
|
192
|
+
# Search specific example type
|
|
193
|
+
python3 .claude/skills/stacks-agent/scripts/search.py "debug" --example-type debugging
|
|
73
194
|
```
|
|
74
195
|
|
|
75
|
-
###
|
|
196
|
+
### Example Types
|
|
197
|
+
- **quickstart** - Single-feature examples (8 examples)
|
|
198
|
+
- **integration** - Multi-step workflows (12 examples)
|
|
199
|
+
- **debugging** - Troubleshooting failed transactions (3 examples)
|
|
200
|
+
- **best-practice** - Recommended patterns (3 examples)
|
|
201
|
+
- **security** - Security-focused implementations (2 examples)
|
|
202
|
+
|
|
203
|
+
### Example Coverage
|
|
204
|
+
|
|
205
|
+
**DeFi (10 examples)**:
|
|
206
|
+
- Swap with slippage protection (sbtc-market-frontend)
|
|
207
|
+
- Add/remove liquidity (prediction markets)
|
|
208
|
+
- Pyth oracle integration with VAA
|
|
209
|
+
- Delegate stacking to PoX pools
|
|
210
|
+
- Bonding curve buys (STX City)
|
|
211
|
+
- Multi-hop swap routing
|
|
212
|
+
- Debug failed swaps
|
|
213
|
+
- Secure token approvals
|
|
214
|
+
|
|
215
|
+
**NFT (10 examples)**:
|
|
216
|
+
- Mint/transfer with SIP-009 compliance
|
|
217
|
+
- Marketplace listing and buying (Gamma patterns)
|
|
218
|
+
- NFT royalties (EIP-2981-like)
|
|
219
|
+
- Batch minting for airdrops
|
|
220
|
+
- Dynamic metadata updates
|
|
221
|
+
- Collection launch workflows
|
|
222
|
+
- Debug transfer failures
|
|
223
|
+
- Secure marketplace with escrow
|
|
224
|
+
|
|
225
|
+
**Tokens (8 examples)**:
|
|
226
|
+
- Deploy SIP-010 tokens
|
|
227
|
+
- Secure transfers with post-conditions
|
|
228
|
+
- Token allowances (DEX integration)
|
|
229
|
+
- Vesting schedules with cliff periods
|
|
230
|
+
- Token burns (deflationary mechanics)
|
|
231
|
+
- Multi-token atomic swaps
|
|
232
|
+
- Debug transfer failures
|
|
233
|
+
|
|
234
|
+
**Security (7 examples)**:
|
|
235
|
+
- Reentrancy prevention
|
|
236
|
+
- Integer overflow protection
|
|
237
|
+
- Access control (RBAC)
|
|
238
|
+
- Input validation
|
|
239
|
+
- Rate limiting for DoS
|
|
240
|
+
- Secure randomness
|
|
241
|
+
- Privilege escalation prevention
|
|
242
|
+
|
|
243
|
+
**Auth (5 examples)**:
|
|
244
|
+
- Wallet connect flow (sbtc-market)
|
|
245
|
+
- JWT authentication via signatures (stacksagent)
|
|
246
|
+
- Protected routes with persistence (STX City)
|
|
247
|
+
- NFT token gating
|
|
248
|
+
- Session management with cleanup
|
|
249
|
+
|
|
250
|
+
### Example Output Format
|
|
251
|
+
|
|
252
|
+
Each example includes:
|
|
253
|
+
- β
**Complete working code** from production dApps
|
|
254
|
+
- β
**Test inputs/outputs** with valid JSON
|
|
255
|
+
- β
**Common pitfalls** from real bugs
|
|
256
|
+
- β
**Live example URLs** to actual code
|
|
257
|
+
- β
**Modern API patterns** (@stacks/connect v7+)
|
|
258
|
+
- β
**Security best practices** (post-conditions, deny mode)
|
|
259
|
+
|
|
260
|
+
## πΈοΈ Knowledge Graph Relationships (New in v2.0)
|
|
261
|
+
|
|
262
|
+
100 relationships connect concepts across domains:
|
|
76
263
|
|
|
77
264
|
```bash
|
|
78
|
-
|
|
265
|
+
# Get related entries for top results
|
|
266
|
+
python3 .claude/skills/stacks-agent/scripts/search.py "swap tokens" --include-relationships
|
|
267
|
+
|
|
268
|
+
# Export relationship graph
|
|
269
|
+
python3 -c "from scripts.relationships import get_graph; print(get_graph().export_graph('mermaid'))"
|
|
79
270
|
```
|
|
80
271
|
|
|
81
|
-
|
|
272
|
+
### Relationship Types
|
|
273
|
+
- **requires** - Critical dependency (e.g., "swap requires ft-transfer")
|
|
274
|
+
- **uses** - Functional dependency (e.g., "DEX uses post-conditions")
|
|
275
|
+
- **implements** - Standard compliance (e.g., "token implements SIP-010")
|
|
276
|
+
- **javascript-for** - Language bridge (e.g., "SDK implements Clarity function")
|
|
277
|
+
- **prevents** - Security defense (e.g., "access control prevents unauthorized access")
|
|
278
|
+
- **similar-to** - Alternative approach
|
|
279
|
+
- **conflicts** - Incompatibility
|
|
280
|
+
- **complements** - Enhanced together
|
|
82
281
|
|
|
83
|
-
|
|
282
|
+
### Example Output
|
|
84
283
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
- **Windsurf**: `.windsurf/workflows/` + `.shared/stacks-agent/`
|
|
88
|
-
- **Antigravity**: `.agent/workflows/` + `.shared/stacks-agent/`
|
|
89
|
-
- **Copilot**: `.github/prompts/` + `.shared/stacks-agent/`
|
|
90
|
-
- **Kiro**: `.kiro/steering/` + `.shared/stacks-agent/`
|
|
91
|
-
- **Codex**: `.codex/skills/stacks-agent/`
|
|
284
|
+
```
|
|
285
|
+
Search: "name-to-address"
|
|
92
286
|
|
|
93
|
-
|
|
287
|
+
Result: bns:1 - name-to-address function
|
|
94
288
|
|
|
95
|
-
|
|
289
|
+
π Related Entries:
|
|
290
|
+
[requires] clarity-syntax:59 (strength: 10) - Uses contract-call?
|
|
291
|
+
[javascript-for] bns:12 (strength: 10) - SDK implements resolution
|
|
292
|
+
[uses] security-patterns:1 (strength: 8) - Needs access control
|
|
293
|
+
```
|
|
96
294
|
|
|
97
|
-
|
|
98
|
-
- **Templates** (14) - Contract templates (SIP-010, SIP-009, DAO, Vault)
|
|
99
|
-
- **Security** (15) - Vulnerability patterns and fixes
|
|
100
|
-
- **DeFi** (15) - Protocol integrations (Alex, Velar, Bitflow, Zest)
|
|
101
|
-
- **Stacks.js** (30) - Frontend integration snippets
|
|
102
|
-
- **BNS** (10) - Bitcoin Name System operations
|
|
103
|
-
- **Stacking** (15) - PoX stacking guides
|
|
104
|
-
- **Deployment** (25) - Testnet/mainnet deployment steps
|
|
295
|
+
## π Knowledge Base Contents
|
|
105
296
|
|
|
106
|
-
|
|
297
|
+
### Clarity Language (61 entries)
|
|
298
|
+
Types, functions, control flow, arithmetic, comparisons, maps, tokens, STX operations
|
|
107
299
|
|
|
108
|
-
|
|
300
|
+
### Contract Templates (14 entries)
|
|
301
|
+
- **Tokens**: SIP-010 basic, mintable, burnable, capped
|
|
302
|
+
- **NFTs**: SIP-009 basic, mintable, royalties
|
|
303
|
+
- **DeFi**: Vault basic/timelocked, liquidity pool
|
|
304
|
+
- **DAO**: Basic DAO, treasury management
|
|
305
|
+
- **Other**: Marketplace, stacking pool
|
|
109
306
|
|
|
110
|
-
|
|
111
|
-
|
|
307
|
+
### Security Patterns (15 entries)
|
|
308
|
+
- Critical: Access control, unchecked transfers
|
|
309
|
+
- High: Reentrancy, arithmetic safety
|
|
310
|
+
- Medium: Input validation, front-running
|
|
311
|
+
- Low: Code style, gas optimization
|
|
112
312
|
|
|
113
|
-
|
|
114
|
-
|
|
313
|
+
### DeFi Protocols (15 entries)
|
|
314
|
+
Alex, Velar, Bitflow, Zest, StackingDAO, Boost, Faktory integration patterns
|
|
115
315
|
|
|
116
|
-
|
|
117
|
-
|
|
316
|
+
### Stacks.js (30 entries)
|
|
317
|
+
Wallet connection, transactions, Clarity values, API calls, post-conditions
|
|
118
318
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
```
|
|
319
|
+
### BNS (10 entries)
|
|
320
|
+
Name resolution, registration, transfer, updates
|
|
122
321
|
|
|
123
|
-
|
|
322
|
+
### Stacking (15 entries)
|
|
323
|
+
Direct stacking, delegation, pools, rewards
|
|
124
324
|
|
|
125
|
-
|
|
325
|
+
### Deployment (25 entries)
|
|
326
|
+
Testnet, mainnet, devnet workflows with Clarinet
|
|
126
327
|
|
|
127
|
-
|
|
128
|
-
- "Build an NFT collection with royalties"
|
|
129
|
-
- "Audit this Clarity contract for security issues"
|
|
130
|
-
- "Show me how to integrate Alex swap"
|
|
131
|
-
- "Deploy my contract to testnet"
|
|
132
|
-
- "How do I implement stacking?"
|
|
328
|
+
## π‘οΈ Security Best Practices
|
|
133
329
|
|
|
134
|
-
|
|
330
|
+
All generated contracts include:
|
|
135
331
|
|
|
136
|
-
|
|
332
|
+
- β
Access control (`tx-sender` validation)
|
|
333
|
+
- β
Error handling (`try!`, `unwrap!`)
|
|
334
|
+
- β
Input validation (`asserts!`)
|
|
335
|
+
- β
Named error constants
|
|
336
|
+
- β
Kebab-case naming
|
|
337
|
+
- β
Network compatibility checks
|
|
137
338
|
|
|
138
|
-
|
|
139
|
-
- Python 3.x (for search functionality)
|
|
339
|
+
## π Networks
|
|
140
340
|
|
|
141
|
-
|
|
341
|
+
- **Mainnet**: Production (SP... addresses)
|
|
342
|
+
- **Testnet**: Testing (ST... addresses, free STX)
|
|
343
|
+
- **Devnet**: Local development (Clarinet)
|
|
344
|
+
|
|
345
|
+
## π§ Prerequisites
|
|
346
|
+
|
|
347
|
+
- Python 3.x (for search functionality)
|
|
348
|
+
- Node.js 18+ (for CLI installation)
|
|
142
349
|
|
|
143
350
|
```bash
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
npm install
|
|
147
|
-
npm run build
|
|
148
|
-
npm link
|
|
351
|
+
python3 --version
|
|
352
|
+
node --version
|
|
149
353
|
```
|
|
150
354
|
|
|
151
355
|
## π Documentation
|
|
152
356
|
|
|
153
|
-
- [Main Repository](https://github.com/kai-builder/stacksagent)
|
|
154
357
|
- [Stacks Docs](https://docs.stacks.co)
|
|
155
358
|
- [Clarity Reference](https://docs.stacks.co/clarity)
|
|
156
359
|
- [Hiro Platform](https://platform.hiro.so)
|
|
360
|
+
- [Explorer (Mainnet)](https://explorer.hiro.so)
|
|
361
|
+
- [Explorer (Testnet)](https://explorer.hiro.so/?chain=testnet)
|
|
362
|
+
|
|
363
|
+
## π DeFi Resources
|
|
364
|
+
|
|
365
|
+
- [Alex DEX](https://app.alexlab.co)
|
|
366
|
+
- [Velar DEX](https://app.velar.co)
|
|
367
|
+
- [Bitflow DEX](https://app.bitflow.finance)
|
|
368
|
+
- [Zest Protocol](https://www.zestprotocol.com)
|
|
157
369
|
|
|
158
370
|
## π€ Contributing
|
|
159
371
|
|
|
160
|
-
Contributions welcome! Please
|
|
372
|
+
Contributions are welcome! Please:
|
|
373
|
+
|
|
374
|
+
1. Fork the repository
|
|
375
|
+
2. Create a feature branch
|
|
376
|
+
3. Make your changes
|
|
377
|
+
4. Add knowledge entries to appropriate CSV files
|
|
378
|
+
5. Test the search functionality
|
|
379
|
+
6. Submit a pull request
|
|
161
380
|
|
|
162
381
|
## π License
|
|
163
382
|
|
|
164
|
-
MIT License - see [LICENSE](LICENSE) for details
|
|
383
|
+
MIT License - see [LICENSE](LICENSE) file for details
|
|
165
384
|
|
|
166
|
-
## π
|
|
385
|
+
## π Acknowledgments
|
|
167
386
|
|
|
168
387
|
Built for the Stacks community with:
|
|
169
|
-
- [Stacks.js](https://github.com/hirosystems/stacks.js)
|
|
388
|
+
- [Stacks.js](https://github.com/hirosystems/stacks.js) by Hiro Systems
|
|
170
389
|
- [Stacks Blockchain](https://www.stacks.co)
|
|
171
390
|
- [Clarity Language](https://docs.stacks.co/clarity)
|
|
172
391
|
|
|
173
392
|
## π Support
|
|
174
393
|
|
|
175
|
-
-
|
|
176
|
-
-
|
|
394
|
+
- GitHub Issues: [Report bugs or request features](https://github.com/kai-builder/stacks-agent/issues)
|
|
395
|
+
- Stacks Discord: [Join the community](https://discord.gg/stacks)
|
|
396
|
+
- Twitter: [@kai_builder](https://twitter.com/kai_builder)
|
|
397
|
+
|
|
398
|
+
## π― Roadmap
|
|
399
|
+
|
|
400
|
+
### Completed (v2.0) β
|
|
401
|
+
- [x] Multi-platform AI skill support (7 platforms)
|
|
402
|
+
- [x] 495+ knowledge base entries
|
|
403
|
+
- [x] BM25 search engine with regex boosting
|
|
404
|
+
- [x] CLI installer
|
|
405
|
+
- [x] 40 production code examples from live dApps
|
|
406
|
+
- [x] 100 knowledge graph relationships
|
|
407
|
+
- [x] Modern API patterns (@stacks/connect v7+)
|
|
408
|
+
- [x] Deprecated code removal (Gaia, openContractCall, showConnect)
|
|
409
|
+
|
|
410
|
+
### In Progress (v2.1)
|
|
411
|
+
- [ ] Web-based search interface
|
|
412
|
+
- [ ] Interactive example playground
|
|
413
|
+
- [ ] Community example contributions
|
|
414
|
+
|
|
415
|
+
### Future (v3.0+)
|
|
416
|
+
- [ ] VSCode extension
|
|
417
|
+
- [ ] Real-time contract analysis
|
|
418
|
+
- [ ] Semantic search with embeddings
|
|
419
|
+
- [ ] Multi-language support (Chinese, Spanish)
|
|
177
420
|
|
|
178
421
|
---
|
|
179
422
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: stacks-agent
|
|
3
|
-
description: AI-powered intelligence for building Stacks blockchain applications
|
|
4
|
-
version:
|
|
3
|
+
description: AI-powered intelligence for building Stacks blockchain applications with 40 production code examples
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
author: kai-builder
|
|
6
6
|
triggers:
|
|
7
7
|
- stacks
|
|
@@ -17,6 +17,9 @@ triggers:
|
|
|
17
17
|
- bns
|
|
18
18
|
- bitcoin
|
|
19
19
|
- web3
|
|
20
|
+
- wallet connect
|
|
21
|
+
- pyth oracle
|
|
22
|
+
- marketplace
|
|
20
23
|
---
|
|
21
24
|
|
|
22
25
|
# Stacks Agent Skill
|
|
@@ -25,27 +28,50 @@ AI-powered development intelligence for building on Stacks blockchain - Bitcoin'
|
|
|
25
28
|
|
|
26
29
|
## Capabilities
|
|
27
30
|
|
|
31
|
+
### Core Features
|
|
28
32
|
- **Clarity Contracts**: Generate, audit, and deploy smart contracts
|
|
29
33
|
- **Token Standards**: SIP-010 (fungible) and SIP-009 (NFT) templates
|
|
30
34
|
- **DeFi Integration**: Alex, Velar, Bitflow, Zest, Boost, Faktory protocol patterns
|
|
31
35
|
- **Security Analysis**: Vulnerability detection and best practices
|
|
32
|
-
- **Stacks.js**: Frontend integration
|
|
36
|
+
- **Stacks.js**: Frontend integration with modern @stacks/connect v7+ API
|
|
33
37
|
- **BNS**: Bitcoin Name System operations
|
|
34
38
|
- **Stacking**: PoX stacking and pool delegation
|
|
35
39
|
- **Deployment**: Testnet and mainnet deployment guides
|
|
36
40
|
|
|
41
|
+
### New in v2.0 π
|
|
42
|
+
- **π― 40 Production Code Examples**: Complete working code from live dApps (sbtc-market, stacksagent, STX City)
|
|
43
|
+
- **πΈοΈ 100 Knowledge Relationships**: Connected concepts showing dependencies and prerequisites
|
|
44
|
+
- **π« Zero Deprecated Code**: All examples use modern API patterns (no openContractCall, showConnect, or Gaia)
|
|
45
|
+
- **π Security-First**: All examples include post-conditions, error handling, and common pitfalls
|
|
46
|
+
- **π Debugging Examples**: Real-world troubleshooting for failed transactions
|
|
47
|
+
|
|
37
48
|
## Knowledge Base
|
|
38
49
|
|
|
39
|
-
|
|
50
|
+
### Code Snippets (495+ entries)
|
|
40
51
|
- **61 Clarity functions** - Complete language reference
|
|
41
52
|
- **14 Contract templates** - FT, NFT, DAO, Vault, Marketplace, Stacking
|
|
42
53
|
- **15 Security patterns** - Common vulnerabilities and fixes
|
|
43
|
-
- **
|
|
44
|
-
- **76 Stacks.js snippets** -
|
|
45
|
-
- **
|
|
46
|
-
- **
|
|
54
|
+
- **25 DeFi protocols** - Alex, Velar, Bitflow, Zest, StackingDAO, Boost, Faktory
|
|
55
|
+
- **76 Stacks.js snippets** - Modern @stacks/connect v7+ patterns (wallet, transactions, post-conditions)
|
|
56
|
+
- **21 BNS operations** - Name registration and resolution (Clarity + JS + API)
|
|
57
|
+
- **25 Stacking guides** - PoX stacking and delegation (Clarity + JS + API)
|
|
58
|
+
- **30 Oracle integration** - Pyth Network price feeds with VAA handling (Clarity + JS + API)
|
|
47
59
|
- **25 Deployment steps** - Testnet, mainnet, and devnet
|
|
48
60
|
|
|
61
|
+
### Production Examples (40 examples - NEW in v2.0)
|
|
62
|
+
- **10 DeFi examples** - Swaps, liquidity, oracles, stacking, bonding curves, debugging
|
|
63
|
+
- **10 NFT examples** - Minting, marketplace, royalties, metadata, batch operations, debugging
|
|
64
|
+
- **8 Token examples** - SIP-010, vesting, allowances, burns, multi-token swaps
|
|
65
|
+
- **7 Security examples** - Reentrancy, overflow, access control, rate limiting
|
|
66
|
+
- **5 Auth examples** - Wallet connect, JWT, sessions, NFT gating (**No Gaia** - deprecated)
|
|
67
|
+
|
|
68
|
+
### Knowledge Relationships (100 relationships - NEW in v2.0)
|
|
69
|
+
- **requires** - Critical dependencies (e.g., "swap requires ft-transfer")
|
|
70
|
+
- **uses** - Functional dependencies (e.g., "DEX uses post-conditions")
|
|
71
|
+
- **javascript-for** - Language bridges (e.g., "SDK implements Clarity function")
|
|
72
|
+
- **prevents** - Security defenses (e.g., "access control prevents unauthorized access")
|
|
73
|
+
- **And 5 more relationship types** connecting concepts across domains
|
|
74
|
+
|
|
49
75
|
## Workflow
|
|
50
76
|
|
|
51
77
|
### Step 1: Understand Request
|
|
@@ -56,18 +82,36 @@ Analyze user request to determine:
|
|
|
56
82
|
- Target network (testnet/mainnet)
|
|
57
83
|
|
|
58
84
|
### Step 2: Search Knowledge Base
|
|
85
|
+
|
|
86
|
+
**Code Snippets:**
|
|
59
87
|
```bash
|
|
60
88
|
python3 .shared/stacks-agent/scripts/search.py "<query>" --domain <domain>
|
|
61
89
|
```
|
|
62
90
|
|
|
91
|
+
**Production Examples (v2.0):**
|
|
92
|
+
```bash
|
|
93
|
+
python3 .shared/stacks-agent/scripts/search.py "how to swap" --examples
|
|
94
|
+
python3 .shared/stacks-agent/scripts/search.py "marketplace" --domain nfts --examples
|
|
95
|
+
python3 .shared/stacks-agent/scripts/search.py "token" --difficulty beginner --examples
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**With Relationships (v2.0):**
|
|
99
|
+
```bash
|
|
100
|
+
python3 .shared/stacks-agent/scripts/search.py "swap tokens" --include-relationships
|
|
101
|
+
```
|
|
102
|
+
|
|
63
103
|
Available domains:
|
|
64
104
|
- `clarity` - Clarity syntax and functions
|
|
65
105
|
- `templates` - Contract templates
|
|
66
106
|
- `security` - Security patterns
|
|
67
|
-
- `defi` - DeFi protocol integrations
|
|
107
|
+
- `defi` - DeFi protocol integrations (swaps, liquidity, oracles)
|
|
108
|
+
- `nfts` - NFT operations (minting, marketplace, royalties)
|
|
109
|
+
- `tokens` - Token operations (SIP-010, vesting, allowances)
|
|
110
|
+
- `auth` - Authentication (wallet connect, JWT, sessions - **No Gaia**)
|
|
68
111
|
- `stacksjs` - Stacks.js code snippets
|
|
69
112
|
- `bns` - BNS operations
|
|
70
113
|
- `stacking` - PoX stacking
|
|
114
|
+
- `oracles` - Pyth Network price feeds
|
|
71
115
|
- `deployment` - Deployment guides
|
|
72
116
|
- `auto` - Auto-detect domain (default)
|
|
73
117
|
|
|
@@ -208,6 +252,16 @@ python3 scripts/search.py "stx transfer" --domain stacksjs -f json
|
|
|
208
252
|
|
|
209
253
|
## Version History
|
|
210
254
|
|
|
255
|
+
- **2.0.0** (2026-01): Major update with production code and relationships
|
|
256
|
+
- β
40 production code examples from live dApps
|
|
257
|
+
- β
100 knowledge graph relationships
|
|
258
|
+
- β
Modern @stacks/connect v7+ API patterns
|
|
259
|
+
- β
Deprecated code removal (Gaia, openContractCall, showConnect)
|
|
260
|
+
- β
Security-first examples with post-conditions
|
|
261
|
+
- β
Debugging examples for failed transactions
|
|
262
|
+
- β
Pyth Network oracle integration (30 entries)
|
|
263
|
+
- β
Expanded to 495+ knowledge base entries
|
|
264
|
+
|
|
211
265
|
- **1.0.0** (2025-01): Initial release with 170+ knowledge entries
|
|
212
266
|
- Clarity syntax and functions
|
|
213
267
|
- Contract templates
|