stacksagent 1.5.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 CHANGED
@@ -15,6 +15,12 @@ An intelligent AI assistant that provides development guidance for Clarity smart
15
15
 
16
16
  ## ✨ Features
17
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
+
18
24
  **495+ Knowledge Base Entries Across 15 Domains:**
19
25
 
20
26
  ### Core Language & Tools (175 entries)
@@ -29,7 +35,7 @@ An intelligent AI assistant that provides development guidance for Clarity smart
29
35
  - **πŸ”„ 25 DeFi Protocols** - Alex, Velar, Bitflow, Zest, StackingDAO (Clarity + JS + API)
30
36
  - **🎨 30 NFT Operations** - SIP-009, minting, marketplace patterns (Clarity + JS + API)
31
37
  - **πŸ’Ž 40 Token Operations** - SIP-010 fungible tokens, DeFi integrations (Clarity + JS + API)
32
- - **πŸ” 14 Authentication** - Gaia storage, wallet auth, JWT, token-gating (Clarity + JS + API)
38
+ - **πŸ” 14 Authentication** - Wallet auth, JWT, sessions, token-gating (**No Gaia** - deprecated) (Clarity + JS + API)
33
39
  - **πŸ“Š 30 Oracle Integration** - Pyth Network price feeds, VAA handling, Hermes API (Clarity + JS + API)
34
40
 
35
41
  ### Advanced & Specialized (135 entries)
@@ -88,10 +94,10 @@ Copy the appropriate folders to your project:
88
94
 
89
95
  ### Claude Code
90
96
 
91
- The skill activates automatically when you request Stacks development work:
97
+ The skill activates automatically when you request Stacks development work, tag or mention the `stacksagent`
92
98
 
93
99
  ```
94
- Create a meme token called PEPE with 1 billion supply
100
+ Create a meme token called PEPE with 1 billion supply @stacksagent
95
101
  ```
96
102
 
97
103
  ### Cursor / Windsurf / Antigravity
@@ -112,15 +118,29 @@ Reference in chat:
112
118
 
113
119
  ## πŸ’‘ Example Prompts
114
120
 
121
+ **Basic Queries:**
115
122
  ```
116
123
  "Create a SIP-010 token with burn mechanism"
117
124
  "Build an NFT collection with royalties"
118
125
  "Audit this Clarity contract for security issues"
119
- "Show me how to integrate Alex swap in my dApp"
120
- "How do I get BTC/USD price from Pyth oracle?"
121
126
  "Deploy my contract to testnet"
122
- "How do I implement stacking in my app?"
123
- "Generate a DAO contract with proposal voting"
127
+ ```
128
+
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
+ ```
138
+
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?"
124
144
  ```
125
145
 
126
146
  ## πŸ” Knowledge Base Search
@@ -145,13 +165,133 @@ python3 .claude/skills/stacks-agent/scripts/search.py "stx transfer" --domain st
145
165
  - `clarity` - Syntax and functions
146
166
  - `templates` - Contract templates
147
167
  - `security` - Security patterns
148
- - `defi` - DeFi protocols
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)
149
172
  - `stacksjs` - JavaScript snippets
150
173
  - `bns` - BNS operations
151
174
  - `stacking` - Stacking guides
152
175
  - `deployment` - Deployment steps
153
176
  - `auto` - Auto-detect (default)
154
177
 
178
+ ## 🎯 Production Code Examples (New in v2.0)
179
+
180
+ Search 40 complete, production-tested code examples extracted from live dApps:
181
+
182
+ ```bash
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
194
+ ```
195
+
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:
263
+
264
+ ```bash
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'))"
270
+ ```
271
+
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
281
+
282
+ ### Example Output
283
+
284
+ ```
285
+ Search: "name-to-address"
286
+
287
+ Result: bns:1 - name-to-address function
288
+
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
+ ```
294
+
155
295
  ## πŸ“š Knowledge Base Contents
156
296
 
157
297
  ### Clarity Language (61 entries)
@@ -257,15 +397,26 @@ Built for the Stacks community with:
257
397
 
258
398
  ## 🎯 Roadmap
259
399
 
260
- - [x] Multi-platform AI skill support
261
- - [x] 170+ knowledge base entries
262
- - [x] BM25 search engine
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
263
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)
264
411
  - [ ] Web-based search interface
412
+ - [ ] Interactive example playground
413
+ - [ ] Community example contributions
414
+
415
+ ### Future (v3.0+)
265
416
  - [ ] VSCode extension
266
417
  - [ ] Real-time contract analysis
267
- - [ ] Community knowledge contributions
268
- - [ ] Multi-language support
418
+ - [ ] Semantic search with embeddings
419
+ - [ ] Multi-language support (Chinese, Spanish)
269
420
 
270
421
  ---
271
422
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: stacks-agent
3
- description: AI-powered intelligence for building Stacks blockchain applications
4
- version: 1.1.4
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 code snippets
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
- This skill includes searchable databases for:
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
- - **15 DeFi protocols** - Alex, Velar, Bitflow, Zest, StackingDAO, Boost, Faktory
44
- - **76 Stacks.js snippets** - Production wallet patterns (STX/BTC addresses, connect, getLocalStorage, isConnected), transactions, API calls, React hooks, server-side patterns
45
- - **10 BNS operations** - Name registration and resolution
46
- - **15 Stacking guides** - PoX stacking and delegation
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