agent-orchestration
Master the art of spawning and managing sub-agents. Write prompts that actually work, track running agents, and learn from every outcome. Part of the Hal Stack 🦞
What this skill does
# Agent Orchestration 🦞 **By Hal Labs** — Part of the Hal Stack Your agents fail because your prompts suck. This skill fixes that. --- ## The Core Problem You're not prompting. **You're praying.** Most prompts are wishes tossed into the void: ``` ❌ "Research the best vector databases and write a report" ``` You type something reasonable. The output is mid. You rephrase. Still mid. You add keywords. Somehow worse. You blame the model. Here's what you don't understand: **A language model is a pattern-completion engine.** It generates the most statistically probable output given your input. Vague input → generic output. Not because the model is dumb. Because generic is what's most probable when you give it nothing specific to work with. **The model honored exactly what you asked for. You just didn't realize how little you gave it.** --- ## The Core Reframe A prompt is not a request. **A prompt is a contract.** Every contract must answer four non-negotiables: | Element | Question | |---------|----------| | **Role** | Who is the model role-playing as? | | **Task** | What exactly must it accomplish? | | **Constraints** | What rules must be followed? | | **Output** | What does "done" look like? | Miss one, the model fills the gap with assumptions. Assumptions are where hallucinations are born. --- ## The 5-Layer Architecture Effective prompts share a specific structure. This maps to how models actually process information. ### Layer 1: Identity Who is the model in this conversation? Not "helpful assistant" but a specific role with specific expertise: ```markdown You are a senior product marketer who specializes in B2B SaaS positioning. You have 15 years of experience converting technical features into emotional benefits. You write in short sentences. You never use jargon without explaining it. ``` The model doesn't "become" this identity—it accesses different clusters of training data, different stylistic patterns, different reasoning approaches. **Identity matters.** Miss this and you get generic output. ### Layer 2: Context What does the model need to know to do this task exceptionally well? Context must be: - **Ordered** — Most important first - **Scoped** — Only what's relevant - **Labeled** — What's rules vs. editable vs. historical ```markdown ## Context ### Rules (never change) - Design system: Tailwind, shadcn components - Voice: Professional but warm, never corporate ### Current State (may evolve) - Landing page exists at /landing - Using Next.js 14 with App Router ### Historical (for reference) - Originally built with Create React App, migrated Jan 2025 ``` **Without labels, the model treats everything as equally optional.** Then it rewrites your core logic halfway through. ### Layer 3: Task What specific action must be taken? Not "write something about X" but precise instructions: ```markdown ## Task Produce a 500-word product description that: - Emphasizes time-saving benefits for busy executives - Opens with the primary pain point - Includes 3 specific use cases - Ends with a clear call to action ``` The more precisely you define the task, the more precisely the model executes. ### Layer 4: Process ⚡ **This is where most prompts fail.** You're asking for output. You should be asking for **how the output is formed.** ❌ Bad: ``` Write me a marketing page. ``` ✅ Good: ```markdown ## Process 1. First, analyze the target audience and identify their primary pain points 2. Then, define the positioning that addresses those pain points 3. Then, write the page 4. Show your reasoning at each step 5. Do not skip steps 6. Audit your work before reporting done ``` **You don't want answers. You want how the answer is formed.** Think like a director. You're not asking for a scene—you're directing how the scene gets built. ### Layer 5: Output What does "done" actually look like? If you don't specify, you get whatever format the model defaults to. ```markdown ## Output Format Return a JSON object with: - `headline`: string (max 60 chars) - `subheadline`: string (max 120 chars) - `body`: string (markdown formatted) - `cta`: string (action verb + benefit) Do not include explanations, notes, or commentary. Only the JSON. ``` **Miss one layer, the structure wobbles. Miss two, it collapses.** --- ## Model Selection **Prompt portability is a myth.** Different models are different specialists. You wouldn't give identical instructions to your exec assistant, designer, and backend dev. | Model Type | Best For | Watch Out For | |------------|----------|---------------| | Claude Opus | Complex reasoning, nuanced writing, long context | Expensive, can be verbose | | Claude Sonnet | Balanced tasks, code, analysis | Less creative than Opus | | GPT-4 | Broad knowledge, structured output | Can be sycophantic | | Smaller models | Quick tasks, simple queries | Limited reasoning depth | **Adapt your prompts per model:** - Some prefer structured natural language - Some need explicit step sequencing - Some collapse under verbose prompts - Some ignore constraints unless repeated - Some excel at analysis but suck at creativity **The person who writes model-specific prompts will outperform the person with "better ideas" every time.** --- ## Constraints Are Instructions Vagueness isn't flexibility. **It's cowardice.** You hedge because being specific feels risky. But the model doesn't read your mind. **Constraints are not limitations. Constraints are instructions.** ```markdown ## Constraints - Never alter the existing design system - Always maintain the established voice/tone - Never change the data model without explicit approval - Max 3 API calls per operation - If unsure, ask rather than assume ``` Every conversation starts at zero. The model doesn't have accumulated context from working with you. **Consistency comes from instruction, not memory.** --- ## Canonical Documentation If you don't have docs, you're gambling. | Document | Purpose | |----------|---------| | PRD | What we're building and why | | Design System | Visual rules and components | | Constraints Doc | What must never change | | Context Doc | Current state and history | **The rule:** Reference docs in your prompts. ```markdown The attached PRD is the source of truth. Do not contradict it. The design system in /docs/design.md must be followed exactly. ``` Without explicit anchoring, the model assumes everything is mutable—including your core decisions. > "Good prompting isn't writing better sentences. It's anchoring the model to reality." --- ## The Complete Template ```markdown ## Identity You are a [specific role] with [specific expertise]. [Behavioral traits and style] ## Context ### Rules (never change) - [Constraint 1] - [Constraint 2] ### Current State - [Relevant background] ### Reference Docs - [Doc 1]: [what it contains] - [Doc 2]: [what it contains] ## Task [Specific, measurable objective] ## Process 1. First, [analysis step] 2. Then, [planning step] 3. Then, [execution step] 4. Finally, [verification step] Show your reasoning at each step. ## User Stories 1. As [user], I want [goal], so that [benefit] 2. As [user], I want [goal], so that [benefit] ## Output Format [Exact specification of deliverable] ## Constraints - [Limit 1] - [Limit 2] - [What NOT to do] ## Error Handling - If [situation]: [action] - If blocked: [escalation] ## Before Reporting Done 1. Review each user story 2. Verify the output satisfies it 3. If not, iterate until it does 4. Only then report complete ``` --- ## Ralph Mode For complex tasks where first attempts often fail: ```markdown ## Mode: Ralph Keep trying until it works. Don't give up on first failure. If something breaks: 1. Debug and understand why 2. Try a different approach 3. Research how others solved similar problems 4. Iterate until user stories are satisfied You have [N] attempts before escalating. ``` **When to use:** - Build tasks with multiple components - Integratio
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.