Skip to content

Commit d7109ea

Browse files
FL4TLiN3claude
andcommitted
refactor(create-expert): make ecosystem-builder instruction declarative
Replace procedural language with declarative policies: - Remove "Step 1/2" sections, replace with "Ecosystem Structure" - Simplify Setup Expert template: replace 4 numbered phases with policies - Simplify Doctor Expert template: replace 3 numbered checks with areas Per docs/making-experts/best-practices.md: > The LLM knows how to have a conversation. What it doesn't know > is your company's policies — that's domain knowledge. Closes #353 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 3b61b9e commit d7109ea

File tree

2 files changed

+34
-60
lines changed

2 files changed

+34
-60
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
"create-expert": patch
3+
---
4+
5+
Refactor ecosystem-builder instruction to be declarative
6+
7+
Per best practices, replaced procedural "Step 1/2" language with
8+
declarative policies and domain knowledge:
9+
10+
- Removed "Step 1: Analyze Dependencies" / "Step 2: Generate Ecosystem"
11+
- Simplified Setup Expert template (removed numbered phases)
12+
- Simplified Doctor Expert template (removed numbered diagnostic steps)
13+
- Focus on what to achieve, not how to achieve it

apps/create-expert/src/lib/create-expert-toml.ts

Lines changed: 21 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -92,23 +92,15 @@ First read the file to understand the existing structure, then append your Exper
9292
Do NOT use writeTextFile - it would overwrite the entire file.
9393
Do NOT modify model, runtime, or provider settings - they already exist.
9494
95-
## Ecosystem Generation Strategy
95+
## Ecosystem Structure
9696
97-
### Step 1: Analyze Dependencies
98-
From the properties, identify:
99-
- Required API keys (e.g., BRAVE_API_KEY, OPENAI_API_KEY)
100-
- External services or tools
101-
- Environment variables needed
97+
Every ecosystem includes:
98+
- **Main Expert**: Core functionality
99+
- **Demo Expert**: Works without configuration, uses embedded sample data
102100
103-
### Step 2: Generate Ecosystem
104-
105-
**ALWAYS generate:**
106-
- Main expert (core functionality)
107-
- Demo expert (with sample/mock data)
108-
109-
**IF external dependencies exist, ALSO generate:**
110-
- Setup expert (automated configuration wizard)
111-
- Doctor expert (troubleshooting assistant)
101+
When external dependencies exist (API keys, services, environment variables):
102+
- **Setup Expert**: Guides users through configuration
103+
- **Doctor Expert**: Diagnoses configuration issues
112104
113105
## Expert Templates
114106
@@ -173,27 +165,15 @@ You guide users through setting up <name>.
173165
## Your Role
174166
Help users configure required dependencies quickly and correctly.
175167
176-
## Setup Process
177-
178-
### 1. Check Current Configuration
179-
- Check if .env file exists
180-
- Check if required environment variables are set
181-
- Report current status
182-
183-
### 2. Guide Through Missing Configuration
184-
For each missing dependency:
185-
- Explain what it is and why it's needed
186-
- Provide URL to obtain it (e.g., API key signup page)
187-
- Ask user for the value
188-
- Validate the format
189-
- Save to .env file
168+
## Configuration Policies
169+
- Check .env file and environment variables first
170+
- For missing items: explain purpose, provide signup URL, validate format
171+
- Save configuration to .env file
172+
- Verify with a simple test before confirming success
173+
- Target: Complete setup in under 2 minutes
190174
191-
### 3. Verify Configuration
192-
- Run a simple test to verify the configuration works
193-
- If test fails, explain what went wrong and how to fix it
194-
195-
### 4. Confirm Success
196-
Output: "✓ Setup complete! Try: npx perstack run <name> \\"your query\\""
175+
## Success Output
176+
"✓ Setup complete! Try: npx perstack run <name> \\"your query\\""
197177
198178
## Required Dependencies
199179
[List the specific dependencies this expert needs]
@@ -217,33 +197,14 @@ You diagnose and help fix issues with <name>.
217197
## Your Role
218198
Run diagnostics and provide actionable fixes for common problems.
219199
220-
## Diagnostic Checks
221-
222-
### 1. Environment Check
223-
- Verify required environment variables exist
224-
- Check .env file for proper formatting
225-
- Validate API key formats
226-
227-
### 2. Connectivity Check
228-
- Test network connectivity to required services
229-
- Verify API endpoints are reachable
230-
231-
### 3. Configuration Validation
232-
- Run a simple test query
233-
- Analyze any error messages
200+
## Diagnostic Areas
201+
- Environment: Verify variables exist and are properly formatted
202+
- Connectivity: Test network access to required services
203+
- Configuration: Run test query and analyze errors
234204
235205
## Output Format
236-
For each issue found:
237-
\`\`\`
238-
❌ Issue: [What's wrong]
239-
Why it matters: [Impact]
240-
To fix: [Exact steps to resolve]
241-
\`\`\`
242-
243-
If no issues found:
244-
\`\`\`
245-
✓ All checks passed! <name> is ready to use.
246-
\`\`\`
206+
For issues: "❌ Issue: [problem] | To fix: [steps]"
207+
If healthy: "✓ All checks passed! <name> is ready to use."
247208
'''
248209
249210
[experts."<name>-doctor".skills."@perstack/base"]

0 commit comments

Comments
 (0)