Przejdź do treści
Biblioteka skilli
AI i agenci · Automatyzacja

sub-agents

/sub-agents

Uruchamia zewnętrzne CLI AI jako izolowane subagenty do delegowania zadań, przetwarzania równoległego i rozdzielania kontekstu, zwracając ustrukturyzowany JSON z wynikiem, kodem wyjścia i statusem.

Repozytorium
cuecards ↗
Licencja
MIT
Ostatnia zmiana repozytorium
25.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
4
Skrypty
1
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 25.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • 1 skrypt w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.

Skrypty: scripts/run_subagent.py

Co robi i kiedy

Uruchamia zewnętrzne CLI AI jako izolowane subagenty do delegowania zadań, przetwarzania równoległego i rozdzielania kontekstu, zwracając ustrukturyzowany JSON z wynikiem, kodem wyjścia i statusem.

Oryginalny opis (EN)

Execute external CLI AIs as isolated sub-agents for task delegation, parallel processing, and context separation. Use when delegating complex multi-step tasks, running parallel investigations, needing fresh context without current conversation history, or leveraging specialized agent definitions. Returns structured JSON with agent output, exit code, and execution status.

Jak działa

  1. Resources
  2. CLI-Specific Notes
  3. Interpreting User Requests
  4. When to Use This Skill
  5. Important: Permission and Timeout
  6. Workflow
  7. Parameters
  8. Agent Definition Location
  9. Agent Definition Format
  10. CLI Selection Priority
Sekcje z nagłówków SKILL.md, w oryginale · 173 linii, 754 słów
Podgląd SKILL.md
---
name: sub-agents
description: Execute external CLI AIs as isolated sub-agents for task delegation, parallel processing, and context separation. Use when delegating complex multi-step tasks, running parallel investigations, needing fresh context without current conversation history, or leveraging specialized agent definitions. Returns structured JSON with agent output, exit code, and execution status.
allowed-tools: Bash Read
---

# Sub-Agents - External CLI AI Task Delegation

Spawns external CLI AIs (claude, cursor-agent, codex, gemini) as isolated sub-agents with dedicated context.

## Resources

- **[run_subagent.py](scripts/run_subagent.py)** - Main execution script
- **[codex.md](references/codex.md)** - Codex-specific setup (permissions, timeout)

**Script Path**: Use absolute path `{SKILL_DIR}/scripts/run_subagent.py` where `{SKILL_DIR}` is the directory containing this SKILL.md file.

## CLI-Specific Notes

Check the corresponding reference for your environment:
- **Codex**: Read [references/codex.md](references/codex.md) BEFORE first execution

## Interpreting User Requests

Extract parameters from user's natural language request:

| Parameter | Source |
|-----------|--------|
| --agent | Agent name from user request (see selection rules below) |
| --prompt | Task instruction part (excluding agent specification) |
| --cwd | Current working directory (absolute path) |

**Agent Selection Rules** (when user doesn't specify agent name):
1. Run `--list` to get available agents
2. **0 agents**: Inform user no agents available, show setup instructions (see [Agent Definition Format](#agent-definition-format))
3. **1 agent**: Auto-select without asking
4. **2+ agents**: Show list with descriptions, ask user to choose

**Example**:
"Run code-reviewer on src/"
→ `--agent code-reviewer --prompt "Review src/" --cwd $(pwd)`

## When to Use This Skill

**Use sub-agent when ANY of these apply:**
- Complex multi-step task (isolated context prevents interference)
- Parallel investigation (multiple agents can run simultaneously)
- Task needs fresh context (sub-agent starts without conversation history)
- Specialized agent definition exists (leverage pre-defined expert prompts)

## Important: Permission and Timeout

This script executes external CLIs that require elevated permissions.

**Before first execution:**
1. Request elevated permissions via your CLI's tool parameters
2. Set tool timeout to match `--timeout` argument (default: 600000ms)

**For Codex CLI** (most common permission issues): See [references/codex.md](references/codex.md) for exact JSON parameter format.

## Workflow

### Step 0: Read CLI-Specific Setup (if applicable)

If you are running on Codex, read [references/codex.md](references/codex.md) first.

### Step 1: List Available Agents

**Always list agents first** to discover available definitions:

```bash
scripts/run_subagent.py --list
```

Output:
```json
{"agents": [{"name": "code-reviewer", "description": "Reviews code..."}], "agents_dir": "/path/.agents"}
```

**If agents list is empty**:
1. Create `{cwd}/.agents/` directory
2. Add agent definition file (see [Agent Definition Format](#agent-definition-format))
3. Re-run `--list` to verify

### Step 2: Execute Agent

```bash
scripts/run_subagent.py \
  --agent <name> \
  --prompt "<task>" \
  --cwd <absolute-path>
```

### Step 3: Handle Response

Parse JSON output and check `status` field:

```json
{"result": "...", "exit_code": 0, "status": "success", "cli": "claude"}
```

**By status:**

| status | Meaning | Action |
|--------|---------|--------|
| `success` | Task completed | Use `result` directly |
| `partial` | Timeout but has output | Review partial `result`, may need retry |
| `error` | Execution failed | Check `error` field and `exit_code`, fix and retry |

**By exit_code** (when status is `error`):

| exit_code | Meaning | Resolution |
|-----------|---------|------------|
| 0 | Success | - |
| 124 | Timeout | Increase `--timeout` or simplify task |
| 127 | CLI not found | Install required CLI (claude, codex, etc.) |
| 1 | General error | Check `error` field in response |

## Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `--list` | - | List available agents (no other params needed) |
| `--agent` | Yes* | Agent definition name from --list |
| `--prompt` | Yes* | Task description to delegate |
| `--cwd` | Yes* | Working directory (absolute path) |
| `--timeout` | No | Timeout ms (default: 600000) |
| `--cli` | No | Force CLI: `claude`, `cursor-agent`, `codex`, `gemini` |

*Required when not using --list

## Agent Definition Location

| Priority | Source | Path |
|----------|--------|------|
| 1 | Environment variable | `$SUB_AGENTS_DIR` |
| 2 | Default | `{cwd}/.agents/` |

To customize: `export SUB_AGENTS_DIR=/custom/path`

## Agent Definition Format

Place `.md` files in `.agents/` directory:

```markdown
---
run-agent: claude
---

# Agent Name

Brief description of agent's purpose.

## Task
What this agent does.

## Output Format
How results should be structured.
```

**Critical**: The `run-agent` frontmatter determines which CLI executes the agent. See [cli-formats.md](references/cli-formats.md) for CLI-specific behaviors.

## CLI Selection Priority

1. `--cli` argument (explicit override)
2. Agent definition `run-agent` frontmatter
3. Auto-detect caller environment
4. Default: `codex`

## Common Mistakes

| Mistake | Result | Fix |
|---------|--------|-----|
| Skip `--list` before execution | Agent not found error | Always run `--list` first |
| Use relative path for `--cwd` | Validation fails | Use absolute path |
| Ignore `status` field in response | Undetected errors | Always check `status` before using `result` |
| Very long prompts | May exceed CLI limits | Break into smaller tasks |
Pliki w paczce (4)
  • SKILL.md 6 KB
  • references/codex.md 2 KB
  • scripts/agents_sub_skills_1.2.zip 503 KB
  • scripts/run_subagent.py 15 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · opencue/cuecards100MIT
opencue/cuecards100MIT

Identyczna treść występuje jeszcze w 1 innych folderach na GitHubie. Tu pokazujemy jedną, najlepiej ocenioną kopię.

Migawka bazy z 13.11.2026 · wersja paczki 6b8683d0886d (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100sub-agents-patterns
    Pokazuje wzorce podziału pracy na równoległe subagenty: eksplorację, planowanie, ogólne zadania i niezależne badania.
  • 100subagent-cli
    Uruchamia zewnętrzne agenty AI z poziomu Basha bez interakcji, np. codex exec lub cursor-agent, do złożonych zmian w wielu plikach.
  • 100create-subagent
    Generuje jednofunkcyjne subagenty Claude Code do użycia przez narzędzie Task, z definicjami agentów, diagnostyką i konfiguracją uprawnień.
  • 100subagent-creator
    Tworzy wyspecjalizowane subagenty Claude Code z własnymi promptami systemowymi i konfiguracją narzędzi do konkretnych zadań.
  • 100subagent-delegation
    Opisuje, jak określać zakres, przygotowywać brief i wybierać subagentów przy delegowaniu przez narzędzie Agent: nazwane kontra forkowane, granice własności plików, wybór modelu i kiedy fork się nie sprawdza.
  • 100sub-agent-delegation
    Deleguje pracę podagentom w Claude Agent SDK: definiuje ich, ogranicza narzędzia i ustala limity głębokości, równoległości i wydatków.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.