stellar-agent 0.2.0 → 0.3.0

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
@@ -10,6 +10,22 @@ npx stellar-agent init
10
10
 
11
11
  This scaffolds a `_stellar/` directory in your project. From that point, invoke agents directly from your AI assistant (Claude Code, Cursor, Windsurf, etc.).
12
12
 
13
+ ### Pinning a version
14
+
15
+ The CLI and the skill catalog ship as one versioned package. To pin a project to a specific version of the agent team:
16
+
17
+ ```bash
18
+ npx stellar-agent@0.2.0 init # always installs v0.2.0 skills
19
+ ```
20
+
21
+ The chosen version is recorded in `_stellar/_config/manifest.yaml`. Check it any time with:
22
+
23
+ ```bash
24
+ stellar-agent version
25
+ ```
26
+
27
+ If the CLI you're running differs from the skills version recorded in your project, the command warns you and tells you how to re-pin.
28
+
13
29
  ---
14
30
 
15
31
  ## Agent Team
@@ -137,6 +153,7 @@ These work from any project with `_stellar/` initialized:
137
153
  | `stellar-help` | Browse the full skill catalog with next-step recommendations |
138
154
  | `stellar-brainstorming` | Facilitated brainstorming for project ideas, architecture, and tokenomics |
139
155
  | `stellar-party-mode` | Multi-agent roundtable — all agents in one discussion |
156
+ | `stellar-lean` | Switch the active agent into terse, result-only output mode |
140
157
 
141
158
  ---
142
159
 
@@ -179,12 +196,33 @@ npm run validate:skills
179
196
  # Test CLI
180
197
  node tools/installer/stellar-cli.js --help
181
198
 
199
+ # Run the MCP server locally
200
+ npm run mcp
201
+
182
202
  # Link globally for testing in other projects
183
203
  npm link
184
204
  # then in another project:
185
205
  stellar-agent init
186
206
  ```
187
207
 
208
+ ## Releasing
209
+
210
+ CI/CD is wired up via GitHub Actions:
211
+
212
+ - **[`.github/workflows/validate.yml`](.github/workflows/validate.yml)** — runs on every push and PR to `main`: validates all skills, runs the test suite on Node 20.x and 22.x, builds the docs site, and smoke-tests the MCP server.
213
+ - **[`.github/workflows/publish.yml`](.github/workflows/publish.yml)** — runs on tags matching `v*`: re-validates, verifies the tag matches `package.json` version, publishes to npm with provenance, and creates a GitHub release.
214
+
215
+ **One-time setup**: add an `NPM_TOKEN` secret to the repo (Settings → Secrets and variables → Actions). Use a granular access token scoped to publish only the `stellar-agent` package.
216
+
217
+ **Releasing a new version**:
218
+
219
+ ```bash
220
+ npm version minor # 0.2.0 → 0.3.0 (creates commit + git tag v0.3.0)
221
+ git push --follow-tags # triggers publish.yml
222
+ ```
223
+
224
+ `prepublishOnly` runs `validate:skills && test` automatically on any `npm publish` — local or CI.
225
+
188
226
  ## Requirements
189
227
 
190
228
  - Node.js >= 20.12.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stellar-agent",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "AI agent team for Stellar blockchain developers",
5
5
  "keywords": [
6
6
  "stellar",
@@ -16,13 +16,16 @@
16
16
  },
17
17
  "files": [
18
18
  "tools/installer/",
19
+ "tools/mcp-server/",
19
20
  "src/",
20
21
  "package.json",
21
22
  "README.md"
22
23
  ],
23
24
  "scripts": {
24
25
  "validate:skills": "node tools/validate-skills.js --strict",
25
- "test": "node test/test-installation.js"
26
+ "test": "node test/test-installation.js",
27
+ "prepublishOnly": "npm run validate:skills && npm test",
28
+ "mcp": "node tools/mcp-server/server.js"
26
29
  },
27
30
  "dependencies": {
28
31
  "@clack/core": "1.3.1",
@@ -3,3 +3,5 @@ Core,_meta,,,,,,,,,false,https://github.com/tolgazorlu/stellar-agent#readme,
3
3
  Core,stellar-brainstorming,Brainstorming,BSP,Facilitate interactive brainstorming for Stellar project ideas architecture and tokenomics design.,,,anytime,,,false,{output_folder}/brainstorming,brainstorming session
4
4
  Core,stellar-party-mode,Party Mode,PM,Orchestrate multi-agent roundtable discussions with the full Stellar Agent team.,,,anytime,,,false,,
5
5
  Core,stellar-help,Stellar Help,SH,Navigate the Stellar Agent skill catalog and get next-step recommendations.,,,anytime,,,false,,
6
+ Core,stellar-lean,Lean Mode,LN,Switch the active agent into terse result-only output — no preamble no summary no fluff.,,,anytime,,,false,,
7
+ Core,stellar-project-context,Project Context,PX,Interview the user once and produce project-context.md that every agent loads as persistent facts.,,,anytime,,,false,{project-root},project-context.md
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: stellar-lean
3
+ description: 'Switch the active agent into terse, result-only output mode. Suppresses preamble, summary, hedging, and conversational fluff — only the artifact. Use when the user types stellar-lean, /lean, --lean, "be terse", "less talk", "just the code", "result only", or asks for Karpathy-style minimal output.'
4
+ ---
5
+
6
+ # Lean Mode
7
+
8
+ Output the artifact. Skip everything else.
9
+
10
+ ## On Activation
11
+
12
+ Acknowledge with one line: `Lean mode on.`
13
+
14
+ Then, for the rest of the session, follow the rules below.
15
+
16
+ ## Output rules
17
+
18
+ | Ask | Output |
19
+ |---|---|
20
+ | "Write X" | The code. No preamble. |
21
+ | "Fix the bug" | The diff. No "I found that…". |
22
+ | "Explain X" | ≤ 3 sentences. No headers. |
23
+ | Yes/no | "Yes" or "No" + one clause. |
24
+ | Command-style ask | The command. Copy-pasteable. One line. |
25
+ | "Compare A vs B" | One table. No prose intro. |
26
+
27
+ ## Forbidden phrases
28
+
29
+ - `Let me…` · `I'll start by…` · `Now let me…` · `First I'll…`
30
+ - `Here's what I did:` · `I've completed…` · `To summarize…`
31
+ - `Let me know if…` · `Hope this helps!` · `Happy to…`
32
+ - `Great question!` · `Of course!` · `Certainly!`
33
+ - Bullet-point recap of code you just wrote
34
+ - Emojis (unless the user used them first)
35
+ - Headers for ≤ 1-paragraph answers
36
+
37
+ ## Forbidden patterns
38
+
39
+ - **Narrating tool calls.** Don't say "Now I'll read the file." Just read it.
40
+ - **Trailing summaries.** Don't end with "Done. The function now does X." The diff is the summary.
41
+ - **Hedge clauses.** No "It might be worth considering…" → say "Do X." or don't say it.
42
+ - **Pre-emptive caveats.** Add caveats only when they change the answer.
43
+
44
+ ## Code output
45
+
46
+ ```
47
+ <the code>
48
+ ```
49
+
50
+ That's it. No paragraph above. No paragraph below.
51
+
52
+ If the user wants explanation, they'll ask.
53
+
54
+ ## File edits
55
+
56
+ Show the diff. Don't restate what changed in prose.
57
+
58
+ ## When the user is wrong
59
+
60
+ Say so in one sentence. Then give the right answer. Don't apologize for correcting.
61
+
62
+ ## Exit
63
+
64
+ Stay lean until the user says `stellar-verbose`, `verbose mode`, `explain more`, or `back to normal`. Then drop the constraints.
65
+
66
+ ## Why
67
+
68
+ LLM output bloats by default. Every "Let me…", every recap, every "Happy to help!" costs tokens the user paid for and attention they can't reclaim. Lean mode trades politeness for signal. Use it when the user is in flow and wants the next artifact, not a conversation.
69
+
70
+ Modeled on Karpathy's framing: skills should be opinionated execution, not narrated process.
@@ -0,0 +1,152 @@
1
+ ---
2
+ name: stellar-project-context
3
+ description: 'Interview the user once and produce a project-context.md that every Stellar Agent loads as persistent_facts. Captures product intent, users, on-chain primitives, deployment targets, and constraints. Use when the user starts a new project, asks "what is project-context.md", any agent detects project-context.md is missing, or the user wants to refresh project context.'
4
+ ---
5
+
6
+ # Project Context Generator
7
+
8
+ ## Purpose
9
+
10
+ Every Stellar Agent loads `**/project-context.md` as a persistent fact on activation. When that file doesn't exist, agents respond with generic priors instead of project-specific knowledge. This skill produces the file once — durable across sessions, readable by all agents.
11
+
12
+ ## On Activation
13
+
14
+ Resolve config from `{project-root}/_stellar/stellar/config.yaml` and `{project-root}/_stellar/core/config.yaml`. Capture: `{user_name}`, `{project_name}`, `{network_preference}`, `{primary_language}`.
15
+
16
+ Check if `{project-root}/project-context.md` already exists.
17
+
18
+ - If yes → ask: *"Project context exists. Refresh it, or just review what's there?"*
19
+ - If no → start the interview.
20
+
21
+ ## Workflow
22
+
23
+ ### Step 1: The 7-Question Interview
24
+
25
+ Ask the user 7 questions. Each one has a default — they can say `skip` to accept the default. Conduct as a single block, not one at a time.
26
+
27
+ ```
28
+ 1. **One-sentence elevator pitch.** What does this project do?
29
+ (Default: pulled from {project_name} if descriptive enough.)
30
+
31
+ 2. **Primary user.** Who uses this? Name a persona, not "everyone".
32
+ (Default: "Stellar developers" if it's a dev tool, else "skip".)
33
+
34
+ 3. **Primary on-chain action.** What's the one transaction the user signs that delivers the core value?
35
+ (Default: "skip" — but flag that downstream skills work better with this filled in.)
36
+
37
+ 4. **Stellar primitives used.** Pick all that apply: Soroban contracts · Classic payments · Custom assets · Trustlines · Anchors (SEP-24/SEP-31) · SEP-10 auth · AMM pools · Path payments.
38
+ (Default: infer from {primary_language} — Rust → Soroban; TS → Classic + Soroban via SDK.)
39
+
40
+ 5. **Deployment target(s).** Testnet · Mainnet · Both · Futurenet.
41
+ (Default: {network_preference}.)
42
+
43
+ 6. **Hard constraints.** Anything the build *cannot* do (regulatory, technical, time, team size)?
44
+ (Default: "skip" — but useful for agents to know.)
45
+
46
+ 7. **Success in 30 days.** What's the one metric or milestone you'd celebrate?
47
+ (Default: "skip" — but useful for prioritization.)
48
+ ```
49
+
50
+ Record raw answers. Don't paraphrase yet.
51
+
52
+ ### Step 2: Write the File
53
+
54
+ Render the answers to `{project-root}/project-context.md`:
55
+
56
+ ```markdown
57
+ # Project Context — {project_name}
58
+
59
+ > This file is read by every Stellar Agent on activation. Keep it ≤ 200 lines.
60
+ > Last updated: <YYYY-MM-DD>
61
+
62
+ ## Elevator pitch
63
+
64
+ <one sentence from Q1>
65
+
66
+ ## Primary user
67
+
68
+ <from Q2>
69
+
70
+ ## Primary on-chain action
71
+
72
+ <from Q3>
73
+
74
+ ## Stellar stack
75
+
76
+ - **Primitives:** <comma-separated list from Q4>
77
+ - **Network:** <from Q5>
78
+ - **Primary language:** {primary_language}
79
+
80
+ ## Constraints
81
+
82
+ <from Q6 — bullets if multiple>
83
+
84
+ ## Success criteria (30-day horizon)
85
+
86
+ <from Q7>
87
+
88
+ ## Project state
89
+
90
+ - Phase: <inferred — analysis | planning | architecture | implementation | mentorship>
91
+ - Started: <YYYY-MM-DD>
92
+ - Lead: {user_name}
93
+
94
+ ## Glossary
95
+
96
+ <Optional. Domain-specific terms that recur in the codebase. Add as the project grows.>
97
+ ```
98
+
99
+ ### Step 3: Suggest Where It Goes
100
+
101
+ By default, save at `{project-root}/project-context.md`. This is the path that matches the glob `**/project-context.md` every agent loads.
102
+
103
+ If the user has multiple sub-projects in a monorepo, save under each: `{sub-project}/project-context.md`. The glob picks up all of them; agents load whichever is nearest.
104
+
105
+ ### Step 4: Confirm and Wire
106
+
107
+ Show the rendered file to the user. Ask: *"Save this?"*
108
+
109
+ If yes:
110
+ - Write the file
111
+ - Confirm path
112
+ - Suggest the user `git add` and commit it (this is durable project state, should be in version control)
113
+
114
+ ### Step 5: Refresh Trigger
115
+
116
+ `project-context.md` decays. When any of these happens, agents should suggest re-running this skill:
117
+
118
+ - The hackathon brief locks in a different track or scope
119
+ - The primary on-chain action changes
120
+ - A contract gets deployed to mainnet (state change)
121
+ - A new team member joins
122
+ - The user explicitly says "we pivoted"
123
+
124
+ Re-running this skill regenerates the file with a new `Last updated` date. Old content can be preserved in a `## History` section if the user wants.
125
+
126
+ ## Anti-patterns to flag
127
+
128
+ - **Long, prose-heavy context files.** Keep it ≤ 200 lines. Agents read this every time — verbose = expensive.
129
+ - **Capturing implementation details.** That's what `{implementation_artifacts}` is for. This file is intent, not implementation.
130
+ - **Skipping Q3 (primary on-chain action).** This is the single most useful field for Sol, Nova, and Pera. Push back on `skip` here.
131
+ - **Filling in defaults blindly.** If the user says `skip` to all 7, write a file with `[unknown]` placeholders and tell them to refresh later.
132
+
133
+ ## Why this matters
134
+
135
+ Every agent's `persistent_facts` includes:
136
+ ```toml
137
+ persistent_facts = [
138
+ "file:{project-root}/**/project-context.md",
139
+ ]
140
+ ```
141
+
142
+ Without this file, agents fall back to generic Stellar priors — they don't know your network, your users, your scope. A 100-line context file shifts every subsequent agent response from generic to project-specific. Cheap to write once, compounds across every interaction.
143
+
144
+ ## Output
145
+
146
+ `{project-root}/project-context.md` — single file, version-controlled, loaded by every agent.
147
+
148
+ ## Next Steps
149
+
150
+ - `@stellar-agent-pm` (Kai) — turn the elevator pitch into a project brief (PB)
151
+ - `@stellar-agent-architect` (Nova) — architecture from the primary on-chain action
152
+ - `@stellar-agent-mentor` (Pera) — if there's a deadline, hackathon arc starts here
@@ -39,3 +39,8 @@ skill = "stellar-analytics"
39
39
  code = "DR"
40
40
  description = "Research Stellar domain — protocol specifics, regulatory landscape, use cases"
41
41
  skill = "stellar-domain-research"
42
+
43
+ [[agent.menu]]
44
+ code = "KA"
45
+ description = "Known Assets Registry — canonical issuer addresses for USDC, EURC, AQUA, yXLM with verification commands"
46
+ skill = "stellar-known-assets"
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: stellar-known-assets
3
+ description: 'Look up canonical Stellar asset issuer addresses (USDC, EURC, AQUA, yXLM, etc.) with provenance and verification commands. Prevents LLM hallucination of issuer addresses. Use when the user references a Stellar asset by code (USDC, EURC, AQUA), needs to create a trustline, builds a path payment, or any task that requires a verified issuer address.'
4
+ ---
5
+
6
+ # Known Assets Registry
7
+
8
+ ## Purpose
9
+
10
+ Stop the LLM from inventing Stellar asset issuer addresses. Every well-known Stellar asset (USDC, EURC, AQUA, yXLM, etc.) has a specific 56-character issuer address — using the wrong one silently breaks trustlines and burns user funds.
11
+
12
+ ## Hard rule
13
+
14
+ **Never write a Stellar issuer address from memory.** Always either:
15
+ 1. Look it up in the registry below.
16
+ 2. Verify with one of the verification commands.
17
+ 3. Refuse to fill it in and ask the user to provide it.
18
+
19
+ If a value is not in this file and not provided by the user, output a placeholder like `<USDC_ISSUER>` and tell the user to fill it in — do not guess.
20
+
21
+ ## Mainnet (public network)
22
+
23
+ > Last verified: 2025-06-01. Always verify against [stellar.expert/explorer/public/assets](https://stellar.expert/explorer/public/assets) before mainnet deployment.
24
+
25
+ | Code | Issuer | Custodian | Notes |
26
+ |---|---|---|---|
27
+ | `USDC` | `GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN` | Circle | Native USDC on Stellar. Source: [circle.com/multi-chain-usdc/stellar](https://www.circle.com/multi-chain-usdc/stellar) |
28
+ | `EURC` | `GDHU6WRG4IEQXM5NZ4BMPKOXHW76MZM4Y2IEMFDVXBSDP6SJY4ITNPP2` | Circle | Native EURC. Source: [circle.com/multi-chain-eurc/stellar](https://www.circle.com/multi-chain-eurc/stellar) |
29
+ | `AQUA` | `GBNZILSTVQZ4R7IKQDGHYGY2QXL5QOFJYQMXPKWRRM5PAV7Y4M67AQUA` | Aquarius | Governance token for Aquarius DEX. **Verify before use.** |
30
+ | `yXLM` | `GARDNV3Q7YGT4AKSDF25LT32YSCCW4EV22Y2TV3I2PU2MMXJTEDL5T55` | Ultra Stellar | Yield-bearing XLM. **Verify before use.** |
31
+ | `XLM` | *(native)* | Stellar protocol | Native asset — no issuer. Use `Asset.native()` in the SDK. |
32
+
33
+ **For any asset not listed above**: tell the user "I don't have a verified issuer for `<CODE>`. Look it up at https://stellar.expert/explorer/public/assets and paste the issuer."
34
+
35
+ ## Testnet
36
+
37
+ > Testnet issuers are different from mainnet. Never copy a mainnet issuer to testnet.
38
+
39
+ | Code | Issuer | Notes |
40
+ |---|---|---|
41
+ | `USDC` | `GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH37Y2QJU2` | Circle testnet USDC. Source: [circle.com/multi-chain-usdc/stellar](https://www.circle.com/multi-chain-usdc/stellar) (toggle to testnet) |
42
+ | `XLM` | *(native)* | Same on every network. Use `Asset.native()`. |
43
+
44
+ For testnet custom assets, the user typically creates their own issuer with `stellar keys generate`. Look in `{implementation_artifacts}/asset-config.md` for project-specific issuers.
45
+
46
+ ## Futurenet
47
+
48
+ Futurenet is reset periodically — there are no stable canonical issuers. Always create a fresh issuer or ask the user.
49
+
50
+ ## Verification commands
51
+
52
+ Before using any address from this file in a transaction that moves real funds, run one of these:
53
+
54
+ ### Verify against stellar.expert
55
+
56
+ ```bash
57
+ # Replace ISSUER with the address from the table
58
+ curl -s "https://api.stellar.expert/explorer/public/asset/USDC-ISSUER" | jq '.code, .issuer, .domain'
59
+
60
+ # Expected output for USDC mainnet:
61
+ # "USDC"
62
+ # "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN"
63
+ # "centre.io"
64
+ ```
65
+
66
+ ### Verify via SEP-1 (`stellar.toml`)
67
+
68
+ For any asset, the issuer's `stellar.toml` is the canonical source. Find the domain via `home_domain` on the issuer account:
69
+
70
+ ```bash
71
+ stellar account inspect <ISSUER_ADDRESS> --network public | grep home_domain
72
+
73
+ # Then fetch the toml:
74
+ curl -s "https://${HOME_DOMAIN}/.well-known/stellar.toml" | grep -A 3 "CURRENCIES"
75
+ ```
76
+
77
+ ### Verify via Horizon
78
+
79
+ ```bash
80
+ # Check the issuer account exists and is configured as an issuer
81
+ curl -s "https://horizon.stellar.org/accounts/<ISSUER>" | jq '.flags, .home_domain'
82
+
83
+ # auth_required = true means it's an issuer that gates trustlines
84
+ # home_domain links to the stellar.toml
85
+ ```
86
+
87
+ ## When to refuse to answer
88
+
89
+ If the user asks you to write code that includes a custom-asset issuer and:
90
+
91
+ 1. The asset is **not in this file**, AND
92
+ 2. The user has **not provided** the issuer in conversation or in `{implementation_artifacts}/asset-config.md`
93
+
94
+ → Refuse to fill in the issuer. Output a placeholder and request the address explicitly:
95
+
96
+ ```
97
+ const USDC = new Asset(
98
+ 'USDC',
99
+ '<FILL_IN_USDC_ISSUER>' // Verify at https://stellar.expert/explorer/public/assets
100
+ );
101
+ ```
102
+
103
+ Tell the user: *"I don't have a verified issuer for `<CODE>` on this network. Paste the issuer address from stellar.expert and I'll wire it in."*
104
+
105
+ ## How to extend this file
106
+
107
+ When a maintainer wants to add a new asset:
108
+
109
+ 1. Verify the issuer via `stellar.expert` AND `stellar.toml` AND Horizon.
110
+ 2. Add a row to the table with the **source link** (not just the address).
111
+ 3. Bump the "Last verified" date at the top of the section.
112
+ 4. If the asset is well-known (top 20 by holders), no further review needed. If niche, also note who uses it.
113
+
114
+ ## Output
115
+
116
+ This skill is reference-only — no artifacts written. It exists to be loaded into context when other skills need an issuer address.
117
+
118
+ ## Used by
119
+
120
+ - `stellar-create-transaction` (Sol `TX`) — path payments, asset transfers
121
+ - `stellar-create-asset` (Sol `CA`) — when comparing to existing issuers
122
+ - `stellar-setup-trustline` (Sol `TL`) — never create a trustline to an unverified issuer
123
+ - `stellar-liquidity-pool` (Sol `LP`) — both pool tokens must be verified
124
+ - `stellar-market-research` (Aria `MR`) — market caps by asset
125
+ - `stellar-tokenomics-analysis` (Aria `TA`) — comparable asset designs
@@ -20,6 +20,11 @@ principles = [
20
20
  "stellar doctor before asking the community.",
21
21
  ]
22
22
 
23
+ [[agent.menu]]
24
+ code = "SD"
25
+ description = "Stellar Doctor — diagnose toolchain, network, wallet, contract state, and project context"
26
+ skill = "stellar-doctor"
27
+
23
28
  [[agent.menu]]
24
29
  code = "SE"
25
30
  description = "Set up local Stellar development environment with Docker quickstart bundle"
@@ -0,0 +1,207 @@
1
+ ---
2
+ name: stellar-doctor
3
+ description: 'Diagnose the local Stellar development environment — toolchain, network reachability, wallet state, contract WASM target, Freighter, account funding. Use when the user reports "it does not work", before any deployment, when something is failing without a clear error, or as a sanity check after onboarding a new dev.'
4
+ ---
5
+
6
+ # Stellar Doctor
7
+
8
+ ## Purpose
9
+
10
+ One command runs every "is my environment broken?" check that costs hackathon teams hours of debugging. Same energy as `flutter doctor` or `rustup doctor`. Output is a pass/fail table with copy-paste fixes for each failure.
11
+
12
+ ## On Activation
13
+
14
+ Load `{network_preference}` and `{primary_language}` from config. The checks adapt — Rust users get Rust toolchain checks, TypeScript users get Node/SDK checks, full-stack users get both.
15
+
16
+ ## Workflow
17
+
18
+ Run the checks below in order. For each, output:
19
+
20
+ ```
21
+ ✓ <check name> → <observed value>
22
+ ✗ <check name> → <error> · fix: <one-line fix command>
23
+ ```
24
+
25
+ Group results into sections. Show the section summary at the bottom.
26
+
27
+ ### Section A — Toolchain (always run)
28
+
29
+ ```bash
30
+ # 1. Stellar CLI present
31
+ stellar --version
32
+ # expected: stellar 22.0.0+ (or current — bump as the project moves)
33
+
34
+ # 2. Node.js present and >= 20.12.0
35
+ node --version
36
+
37
+ # 3. Network reachability
38
+ curl -s -o /dev/null -w "%{http_code}" https://horizon-testnet.stellar.org
39
+ # expected: 200
40
+ ```
41
+
42
+ **Failures:**
43
+ | Symptom | Fix |
44
+ |---|---|
45
+ | `stellar: command not found` | macOS: `brew install stellar-cli` · Linux/Win: see [Stellar CLI install](https://developers.stellar.org/docs/tools/developer-tools/cli/install-cli) |
46
+ | Node version < 20 | `nvm install 22 && nvm use 22` |
47
+ | Horizon unreachable (non-200) | Check firewall / VPN / corporate proxy |
48
+
49
+ ### Section B — Rust toolchain (run if `primary_language` is `rust` or `fullstack`)
50
+
51
+ ```bash
52
+ # 1. cargo present
53
+ cargo --version
54
+
55
+ # 2. rustup default toolchain
56
+ rustup show active-toolchain
57
+
58
+ # 3. wasm32 target installed
59
+ rustup target list --installed | grep wasm32-unknown-unknown
60
+
61
+ # 4. soroban-sdk version compatible (read from any contract Cargo.toml)
62
+ grep -r 'soroban-sdk' --include=Cargo.toml | head -3
63
+ ```
64
+
65
+ **Failures:**
66
+ | Symptom | Fix |
67
+ |---|---|
68
+ | `cargo: command not found` | `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \| sh` |
69
+ | `wasm32-unknown-unknown` missing | `rustup target add wasm32-unknown-unknown` |
70
+ | `soroban-sdk` version < 22 | Bump in `Cargo.toml` and `cargo update` |
71
+
72
+ ### Section C — TypeScript / SDK (run if `primary_language` is `typescript` or `fullstack`)
73
+
74
+ ```bash
75
+ # 1. Stellar SDK installed in project
76
+ node -e "console.log(require('@stellar/stellar-sdk/package.json').version)" 2>/dev/null
77
+
78
+ # 2. Network passphrase in code matches network_preference
79
+ grep -r "Networks\." --include="*.ts" --include="*.tsx" --include="*.js" src/ 2>/dev/null | head -3
80
+ ```
81
+
82
+ **Failures:**
83
+ | Symptom | Fix |
84
+ |---|---|
85
+ | `@stellar/stellar-sdk` not found | `npm install @stellar/stellar-sdk` |
86
+ | `Networks.PUBLIC` but `network_preference=testnet` | Switch code to `Networks.TESTNET` or update config |
87
+
88
+ ### Section D — Wallet & network state
89
+
90
+ ```bash
91
+ # 1. Wallet keypair configured
92
+ stellar keys ls
93
+ # expected: at least one key, ideally one matching project name
94
+
95
+ # 2. Active wallet account exists on chosen network
96
+ DEFAULT_KEY=$(stellar keys ls 2>/dev/null | head -1)
97
+ ADDR=$(stellar keys address "$DEFAULT_KEY" 2>/dev/null)
98
+ curl -s "https://horizon-testnet.stellar.org/accounts/$ADDR" | jq -r '.account_id // "not-funded"'
99
+
100
+ # 3. Account funded — at least 5 XLM
101
+ curl -s "https://horizon-testnet.stellar.org/accounts/$ADDR" | jq -r '.balances[] | select(.asset_type=="native") | .balance'
102
+ ```
103
+
104
+ **Failures:**
105
+ | Symptom | Fix |
106
+ |---|---|
107
+ | No keys configured | `stellar keys generate <name> --network testnet` |
108
+ | `not-funded` on testnet | `stellar keys fund <name> --network testnet` |
109
+ | Balance < 5 XLM | Same fix — friendbot will top up |
110
+ | `not-funded` on mainnet | Real XLM required — transfer from exchange |
111
+
112
+ ### Section E — Freighter (only if frontend phase)
113
+
114
+ Open the dev server, then run in browser console:
115
+
116
+ ```js
117
+ // Freighter installed?
118
+ window.freighter
119
+ // expected: object with isConnected, getAddress, signTransaction
120
+
121
+ // Active network
122
+ window.freighter.getNetworkDetails()
123
+ // expected: matches network_preference
124
+ ```
125
+
126
+ **Failures:**
127
+ | Symptom | Fix |
128
+ |---|---|
129
+ | `window.freighter` undefined | Install [Freighter extension](https://freighter.app) |
130
+ | Network mismatch | Click Freighter icon → Settings → Network → switch |
131
+ | `User declined access` | Disconnect site, retry connect flow |
132
+
133
+ ### Section F — Contract state (only if a contract is deployed)
134
+
135
+ If `{implementation_artifacts}/deployed-contracts.md` exists, read each contract ID and verify:
136
+
137
+ ```bash
138
+ # Contract reachable on network
139
+ stellar contract invoke --id <CONTRACT_ID> --network testnet -- <view_function>
140
+
141
+ # Storage TTL still valid
142
+ stellar contract read --id <CONTRACT_ID> --network testnet --key <STORAGE_KEY>
143
+ ```
144
+
145
+ **Failures:**
146
+ | Symptom | Fix |
147
+ |---|---|
148
+ | `Contract not found` | Redeploy: `stellar contract deploy ...` |
149
+ | `KeyExpired` / `EntryExpired` | `stellar contract extend --id <ID> --ledgers-to-extend 535679` |
150
+
151
+ ### Section G — Project context (sanity)
152
+
153
+ ```bash
154
+ # project-context.md exists at any level
155
+ find . -maxdepth 3 -name 'project-context.md' 2>/dev/null
156
+
157
+ # _stellar/_config/manifest.yaml matches CLI version
158
+ stellar-agent version
159
+ ```
160
+
161
+ **Failures:**
162
+ | Symptom | Fix |
163
+ |---|---|
164
+ | No `project-context.md` | Run `stellar-project-context` skill |
165
+ | CLI version ≠ skills version | Run `npx stellar-agent init` (Update) or pin: `npx stellar-agent@<version> ...` |
166
+
167
+ ## Summary Output
168
+
169
+ After all sections, output:
170
+
171
+ ```
172
+ ═══════════════════════════════════════════
173
+ Stellar Doctor — <YYYY-MM-DD HH:MM>
174
+ ═══════════════════════════════════════════
175
+ Toolchain <pass | N issues>
176
+ Rust <pass | N issues | skipped>
177
+ TypeScript / SDK <pass | N issues | skipped>
178
+ Wallet & network <pass | N issues>
179
+ Freighter <pass | N issues | skipped>
180
+ Contract state <pass | N issues | skipped>
181
+ Project context <pass | N issues>
182
+ ───────────────────────────────────────────
183
+ Critical: <N> ← must fix before building
184
+ Warnings: <N> ← will bite eventually
185
+ ═══════════════════════════════════════════
186
+ ```
187
+
188
+ If `Critical: 0`, output:
189
+ > "Environment is clean. You're clear to build."
190
+
191
+ If `Critical > 0`, list the top 3 critical issues with their fix commands. Refuse to recommend any deployment skill (`DC`, `TX`, `TL`) until critical issues are resolved.
192
+
193
+ ## Anti-patterns to flag
194
+
195
+ - **Skipping the doctor before a hackathon demo.** 80% of demo failures are environment problems doctor would have caught.
196
+ - **Running doctor once, never again.** Run it after every machine reboot, network change, or `npm install`.
197
+ - **Ignoring warnings.** Warnings become criticals at the worst possible time (mid-demo).
198
+
199
+ ## Output
200
+
201
+ This skill is read-only — produces no artifacts. Output is the diagnostic report.
202
+
203
+ ## Next Steps
204
+
205
+ - **All green** → start building. Sol's `IC` (Init Contract) or Lyra's `NS` (Next.js Setup) is the next step.
206
+ - **Critical issues** → fix them, re-run doctor.
207
+ - **Warnings only** → safe to proceed but schedule fixes before mainnet deployment.