From astralform
Astralform integration best practices and optimization tips. Use when user asks about "Astralform best practices", "optimize Astralform", "Astralform security", or wants guidance on production usage.
How this skill is triggered — by the user, by Claude, or both
Slash command
/astralform:astralform-best-practicesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill provides guidance on best practices for Astralform integrations.
This skill provides guidance on best practices for Astralform integrations.
// NEVER do this
let apiKey = "sk_live_xxxxx" // Hardcoded - BAD!
// DO this instead
let apiKey = Bundle.main.object(forInfoDictionaryKey: "ASTRALFORM_API_KEY") as? String ?? ""
// Or use environment-based configuration
#if DEBUG
let apiKey = ProcessInfo.processInfo.environment["ASTRALFORM_API_KEY_DEV"] ?? ""
#else
let apiKey = ProcessInfo.processInfo.environment["ASTRALFORM_API_KEY_PROD"] ?? ""
#endif
SHA256(userId + salt)| Use Case | Recommended Provider | Model | Why |
|---|---|---|---|
| General chat | Anthropic | claude-sonnet-4-20250514 | Best quality/cost balance |
| High volume | Groq | llama-3.3-70b | Fast, cost-effective |
| Complex reasoning | Anthropic | claude-opus-4-20250514 | Best reasoning |
| Code generation | Anthropic | claude-sonnet-4-20250514 | Strong code understanding |
| Cloud inference | Ollama Cloud | qwen3.5 | Wide model selection |
| Budget conscious | Platform | varies | Optimized routing |
// INEFFICIENT - Too verbose
let systemPrompt = """
You are an AI assistant. You should always be helpful.
You should respond in a friendly manner. You should
provide accurate information. You should...
""" // Wastes tokens on every request
// EFFICIENT - Concise and clear
let systemPrompt = """
Helpful iOS app assistant. Be concise. Format lists with bullets.
Focus: \(appContext)
""" // Clear, specific, minimal
max_tokens to limit response lengthdo {
let response = try await Astralform.shared.chat(message: userInput)
} catch AstralformError.rateLimited(let retryAfter) {
// Implement exponential backoff
try await Task.sleep(for: .seconds(retryAfter))
// Retry
} catch AstralformError.networkError {
// Show offline message, queue for retry
} catch AstralformError.invalidAPIKey {
// Log error, prompt user to check configuration
} catch AstralformError.llmNotConfigured {
// Project needs LLM setup in dashboard
} catch {
// Generic error handling
}
// Use streaming for better UX
for try await chunk in Astralform.shared.streamChat(message: userInput) {
// Update UI incrementally
DispatchQueue.main.async {
self.responseText += chunk.content
}
}
| Tool Type | When to Use | Configuration |
|---|---|---|
| Platform (Tavily) | Web search needs | Enable in dashboard |
| Server MCP | Backend integrations | Add via dashboard |
| Client MCP | Device features | Register in SDK |
// GOOD - Specific, minimal data
Astralform.registerClientTool("get_weather") { params in
let location = params["location"] as? String ?? "current"
let weather = await WeatherService.current(for: location)
return .success([
"temp": weather.temperature,
"condition": weather.condition
])
}
// BAD - Returns too much data
Astralform.registerClientTool("get_all_data") { params in
// Don't return entire database dumps
return .success(hugeDataObject) // Wasteful!
}
require_auth for connectors that access user dataBefore going live:
sk_live_...)/astralform-analyticssupport-agent, billing-helper# Good - Focused and specific
You are a billing specialist. Handle invoice queries, payment issues,
and subscription changes. Escalate security concerns to the default agent.
# Bad - Too broad
You are a helpful assistant that can do anything.
Skills use YAML frontmatter with markdown body:
---
name: my-skill
description: Short description of what the skill provides
version: 1.0.0
---
# Skill content here
astralform_create_skill_from_url) for skills hosted in reposastralform_create_skill) for project-specific knowledgeastralform_refresh_skill to update from sourceAgents with non-system skills automatically get a Capsule sandbox with network access — no manual configuration needed. The sandbox is provisioned on the first agent turn and shared across all agents in the conversation via a /workspace filesystem.
Configurable per agent:
sandbox_template — base (default), browser (Chromium), code-interpreter-v1 (Jupyter), desktop (VNC)sandbox_envs — encrypted environment variables injected into the sandboxtemperature — LLM temperature (0.0-2.0)thinking_effort — thinking depth: low, medium, or highAll agents in a conversation share a /workspace filesystem (backed by MinIO S3 via rclone FUSE):
/workspace/attachments/ — user-uploaded files staged by AttachmentMiddleware/workspace/outputs/ — agent deliverables exported via export_file tool (creates signed download URLs)/workspace/todo.md — task tracking via write_todos/read_todos toolsMemory is a feature-flagged capability that gives agents persistent recall across conversations.
save_memory and search_memories tools| Use Case | What to Store | Example |
|---|---|---|
| Preferences | User likes/dislikes | "User prefers dark mode and metric units" |
| Context | Ongoing projects | "Working on Q4 marketing campaign" |
| Personalization | Communication style | "User prefers brief, bullet-point responses" |
| Pitfall | Solution |
|---|---|
| Hardcoded API keys | Use environment/config |
| No error handling | Implement comprehensive catch |
| Ignoring rate limits | Add backoff and UI feedback |
| Verbose system prompts | Keep concise, use context |
| No offline handling | Queue messages, show status |
| Missing analytics | Enable and monitor regularly |
If you need additional guidance:
astralform_search_docs toolCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub astralform-ai/astralform-plugins --plugin astralform