$npx -y skills add Borda/AI-Rig --skill manageCreate, update, or delete agents, skills, rules, and hooks with full cross-reference propagation. Trivial edits (typos, small fixes ≤10 words) applied inline without agent; .md content-edits delegated to foundry:curator; code file edits (.js, .py, .ts) delegated to foundr
| 1 | > **Note:** `disable-model-invocation: true` — `/manage` user-invoked only, no `Skill()` chaining from orchestrators. When suggesting `/manage` as follow-up, invoking skill must present as user-run command, not auto step. |
| 2 | |
| 3 | <objective> |
| 4 | |
| 5 | Manage lifecycle of agents, skills, rules, hooks in `.claude/`. Handles creation with rich domain content, atomic renames with cross-ref propagation, content editing (trivial edits inline; `.md` files → foundry:curator; code files `*.js`/`*.py`/`*.ts` → foundry:sw-engineer; rule edits inline), clean deletion with broken-ref cleanup. Keeps MEMORY.md inventory in sync with disk. |
| 6 | |
| 7 | </objective> |
| 8 | |
| 9 | <inputs> |
| 10 | |
| 11 | - **$ARGUMENTS**: required, one of: |
| 12 | - `create agent <name> "description"` — create new agent with generated domain content |
| 13 | - `create skill <name> "description"` — create new skill with workflow scaffold |
| 14 | - `create rule <name> "description"` — create new rule file with frontmatter and sections |
| 15 | - `update <name> <new-name>` — rename; type auto-detected from disk |
| 16 | - `update <name> "change description"` — content-edit; trivial → inline, `.md` → foundry:curator, code → foundry:sw-engineer, rule → inline |
| 17 | - `update <name> <spec-file.md>` — content-edit from spec file; trivial → inline, `.md` → foundry:curator, code → foundry:sw-engineer, rule → inline |
| 18 | - `delete <name>` — delete; type auto-detected from disk (agents, skills, rules, hooks); asks user if ambiguous |
| 19 | - `add perm <rule> "description" "use case"` — add permission to settings.json allow list and permissions-guide.md |
| 20 | - `remove perm <rule>` — remove permission from settings.json allow list and permissions-guide.md |
| 21 | |
| 22 | - Names must be **kebab-case** (lowercase, hyphens only) |
| 23 | - Descriptions must be quoted when containing spaces |
| 24 | - Permission rules use Claude Code format: `WebSearch`, `Bash(cmd:*)`, `WebFetch(domain:example.com)` |
| 25 | - `--skip-audit` — optional flag: skip Step 9 `/audit` validation (use inside `audit fix` loop to avoid recursion) |
| 26 | - **Spec-file paths must be quoted** — `update <name> <spec-file.md>` requires the spec path quoted if it contains any whitespace (e.g. `update my-agent "docs/My Spec.md"`); unquoted paths with spaces split into multiple arguments and trigger argument-shape mismatch. Recommended: keep spec filenames free of spaces. |
| 27 | |
| 28 | **Update/delete mode** — name looked up across agents, skills, rules automatically: |
| 29 | |
| 30 | - One match on disk → proceed with that type |
| 31 | - Multiple matches → `AskUserQuestion`: (a) agent, (b) skill, (c) rule |
| 32 | - No match → report error and stop |
| 33 | |
| 34 | **Update second-argument discrimination**: |
| 35 | |
| 36 | - Two bare kebab-case args (second arg no spaces, no `.md` extension) → **rename mode** |
| 37 | - One name + quoted string → **content-edit mode** (trivial → inline; `.md`: foundry:curator; code `*.js`/`*.py`/`*.ts`: foundry:sw-engineer; rule: inline) |
| 38 | - One name + path ending in `.md` → **content-edit mode** (trivial → inline; `.md`: foundry:curator; code `*.js`/`*.py`/`*.ts`: foundry:sw-engineer; rule: inline) |
| 39 | |
| 40 | **Examples:** |
| 41 | |
| 42 | - `/foundry:manage create agent task-planner "Planning specialist for decomposing epics into actionable tasks"` |
| 43 | - `/foundry:manage update my-agent "add a section on error handling patterns"` |
| 44 | - `/foundry:manage update optimize docs/specs/YYYY-MM-DD-<spec-name>.md` |
| 45 | - `/foundry:manage delete old-agent-name` |
| 46 | - `/foundry:manage add perm "Bash(jq:*)" "Parse and filter JSON" "Extract fields from REST API responses"` |
| 47 | |
| 48 | </inputs> |
| 49 | |
| 50 | <constants> |
| 51 | |
| 52 | - AGENTS_DIR: `.claude/agents` |
| 53 | - SKILLS_DIR: `.claude/skills` |
| 54 | - RULES_DIR: `.claude/rules` |
| 55 | - HOOKS_DIR: `.claude/hooks` |
| 56 | - AVAILABLE_COLORS: indigo, lime, magenta, teal, violet |
| 57 | |
| 58 | Each Step 4 spawn applies the health monitoring in `_shared/agent-spawn-protocol.md` §8b — rely on the harness completion notification, then read the agent's output file; optional single `health_sentinel.py` probe per turn (no sleep loop). Substitute only its own `<ID>` suffix and output-file glob; do not |