Swarm Forge Skill
Use this skill when the user wants the repository prepared for agent-based work without invoking a CLI command. The skill should inspect the codebase, ask only the missing setup questions, and then create or update the project context files directly.
What This Skill Owns
- Repository inspection before writing anything
- Guided setup for target-specific entrypoint files such as
CLAUDE.md, AGENTS.md, and GEMINI.md
- Safe creation of target-specific workspace files and shared workflow artifacts
- Refinement of existing setup instead of blind overwrite
- Converting vague user intent into a concrete project context scaffold
Primary Use Cases
- User asks to set up project instruction files or an agent workflow for a repository.
- User wants the setup to support one or more coding CLIs such as Claude Code, Codex, OpenCode, or Gemini CLI.
- User wants the repo reviewed first and then scaffolded based on the real stack.
- User wants a guided setup with a few clarifying questions instead of invoking a CLI command.
- User wants either a full workflow, a lightweight setup, or a knowledge-only starting point.
- User wants one of these development patterns encoded in the repository:
TDD, BDD, ATDD, or SDD.
Target Model
Do not assume a single CLI by default when the user is asking for a reusable setup. The skill should support one or more of these targets:
Claude Code
Codex
OpenCode
Gemini CLI
The scripts also accept a multi target for multi-CLI folder creation; this is a script convenience, not a CLI itself.
When the user wants more than one target, prefer:
- one visible context namespace per CLI
- one thin entrypoint file per CLI
- tool-specific folders only where the CLI actually supports them
Supported Patterns
These are setup structure patterns, not development patterns.
full: complete workflow with entrypoint files, knowledge, rules, plans, and tasks, plus optional agents when the user opts in
collaborative: same structure as full, preferred when the user explicitly wants plans and persistent task context, with optional agents when the user opts in
lean: lightweight setup with entrypoint files, knowledge, and rules
knowledge-first: repository memory first, focused on knowledge/ without forcing the full workflow
Pattern selection rules:
- If the user explicitly names a pattern or describes one clearly, use it.
- If the repo already contains partial context files, extend the nearest matching pattern instead of forcing a new one.
- If the user asks for minimal setup, prefer
lean.
- If the user asks for documentation or institutional memory first, prefer
knowledge-first.
- Otherwise default to
full.
Supported Development Patterns
TDD: test-driven development centered on fast unit-test feedback loops before implementation
BDD: behavior-driven development centered on shared understanding and scenario-based behavior descriptions
ATDD: acceptance-test-driven development centered on acceptance criteria and stakeholder collaboration before implementation
SDD: spec-driven development centered on specs as the source of implementation context, often using structured artifacts such as specs, plans, and tasks
Pattern selection rules:
- If the user names one of these patterns, preserve it.
- If the user wants unit tests to drive implementation, prefer
TDD.
- If the user wants user behavior and Given/When/Then scenarios, prefer
BDD.
- If the user wants acceptance criteria written collaboratively before implementation, prefer
ATDD.
- If the user wants specs, plans, and structured context as the primary source of truth, prefer
SDD.
Workflow
For complex setups, copy this checklist into the working notes and mark progress as you go:
- Confirm target CLI or CLIs
- Inspect repository
- Detect stack and existing context files
- Select or confirm integration pattern
- Select or confirm development pattern
- Decide whether agent scaffolding should be created at all
- Ask only missing questions
- Run folder setup script if needed
- Run base file scaffold script if needed
- Create or update context files
- Report created, updated, skipped, and assumptions
- Ask which CLI or CLIs the repository should support unless the answer is already explicit and unambiguous.
- Inspect the repository.
- Identify facts from source files:
- app type
- language/runtime
- package manager
- test/lint/format commands
- existing docs and conventions
- Check which target-specific files already exist, such as
CLAUDE.md, AGENTS.md, GEMINI.md, .claude/, .opencode/, and .gemini/.
- Choose the integration pattern that best fits the repo and the user request.
- Choose the development pattern that best fits the repo and the user request.
- Decide whether initial agent scaffolding should be created. If the user did not explicitly ask for agents and the repo does not already contain them, ask whether they want no agents, only the minimum core agents, or a custom initial set. Do not silently create agent files just because a pattern supports them.
- Ask only the missing high-value questions, including pattern confirmation when uncertain.
- Summarize the intended setup before major edits when the repo already contains agent context files.
- If the workflow directories do not exist yet, run
scripts/create-workflow-folders.sh from the skill directory with the selected CLI target and pattern instead of recreating the directory creation logic manually.
- If the base context files do not exist yet, run
scripts/scaffold-base-files.sh from the skill directory with the selected CLI target and pattern to create the initial files that fit that target.
- Create or update the setup files, including pattern-specific guidance inside the generated context where appropriate.
- Refresh target-specific entrypoint files after scaffolding so they reflect the actual current state of the workspace. Document:
- which agents exist now
- whether agent creation was intentionally skipped
- which key folders exist in
.claude/, .codex/, .opencode/, or .gemini/
- what each documented folder is for
- For multi-CLI setups, keep one visible context namespace per CLI and create thin target-specific entrypoint files.
- Report what was created, what was updated, which CLI targets were selected, what setup pattern was chosen, what development pattern was chosen, and what still needs human input.
Required Questions
Ask these only when they cannot be inferred with confidence:
- What is the project trying to achieve?
- Which CLI or CLIs should this repository support?
- Which integration pattern fits best: full, collaborative, lean, or knowledge-first?
- Which development pattern fits best for this repository and team: TDD, BDD, ATDD, or SDD?
- Do you want this setup to create initial agents now, or leave agent scaffolding out for the moment?
- If agents should be created, which specialized agents should exist initially?
- What rules are non-negotiable for changes in this repo?
- Should session context and implementation plans be part of the workflow?
Optional follow-ups:
- Are there architecture constraints not obvious from the codebase?
- Are there business terms or domain rules that should be captured immediately?
- Should the setup be minimal or comprehensive?
Writing Rules
- Prefer facts extracted from the repo over placeholders.
- Do not overwrite user-authored sections blindly.
- Merge by sections when updating target-specific entrypoint files.
- Keep knowledge files concise and searchable.
- If a fact is uncertain, label it as an assumption or ask.
- If the repo already contains a better source of truth, reference it instead of duplicating it.
File Strategy
Entrypoint Files
Create or update:
- Project overview
- Tech stack reference
- Documentation map
- Rules reference
- Agent list
- Agent creation policy summary
- Workspace folder map
- Key constraints summary
- Command quick reference
Use the appropriate file for each selected CLI:
CLAUDE.md for Claude Code
AGENTS.md for Codex
AGENTS.md plus .opencode/ extensions for OpenCode
GEMINI.md for Gemini CLI
For multi-CLI setups, keep these files short and point them to shared workflow artifacts.
Shared Knowledge And Workflow Artifacts
Create only the files that are justified by the repository and user answers. Prefer this initial set:
critical-constraints.md
architecture-overview.md
tech-stack.md
business-vision.md
folder-structure.md
These should live inside the selected CLI namespace, for example:
.claude/knowledge/
.codex/knowledge/
.opencode/knowledge/
.gemini/knowledge/
Agent Definitions
Create agents only when the user explicitly asks for them or agrees to an initial core set.
If the user prefers not to create agents yet, keep the workflow documentation explicit about that choice and do not create agent definition files just because the directory exists.
Shape the initial agent set according to the selected development pattern.
For SDD, prefer a role set that can maintain specs, plans, and shared project knowledge.
Place them according to target:
.claude/agents/ for Claude Code
.opencode/agents/ for OpenCode
- shared docs plus
AGENTS.md references for Codex
- shared docs plus
GEMINI.md references for Gemini CLI
Rules
Create code-style.md when the repo has enough evidence to describe conventions or when the user wants it scaffolded.
Tasks And Plans
Create the session protocol only if the user wants persistent task context or if the setup is meant for multi-step collaboration.
Create the directory when agent planning is part of the intended workflow.
For multi-CLI setups, prefer per-target locations such as:
.claude/plans/, .claude/tasks/, .claude/specs/, .claude/scenarios/, .claude/acceptance/
.codex/plans/, .codex/tasks/, .codex/specs/, .codex/scenarios/, .codex/acceptance/
.opencode/plans/, .opencode/tasks/, .opencode/specs/, .opencode/scenarios/, .opencode/acceptance/
.gemini/plans/, .gemini/tasks/, .gemini/specs/, .gemini/scenarios/, .gemini/acceptance/
Adapt the output to the selected pattern instead of always forcing the full directory set.
Also adapt the output to the selected CLI targets instead of assuming Claude-only scaffolding.
After the directory structure is in place, update the relevant entrypoint files so they describe the real folders that exist and what each one is used for.
Also adapt the file contents to the selected development pattern. For example:
TDD: emphasize unit test locations, red-green-refactor, and framework-specific test commands
BDD: emphasize user behavior, scenarios, Given/When/Then structure, and cross-role collaboration
ATDD: emphasize acceptance criteria, stakeholder collaboration, and acceptance test artifacts
SDD: emphasize specs, plans, tasks, and structured context artifacts as the main execution anchor
Script Usage
When the repository is missing the base workflow folders, execute this bundled script from the skill directory:
scripts/create-workflow-folders.sh [target_dir] [cli_target] [pattern] [context_dir] [create_agents]
Default behavior:
target_dir: current working directory
cli_target: claude
pattern: full
context_dir: target default such as .claude, .codex, .opencode, or .gemini
create_agents: yes or no
Use the script instead of reproducing the folder creation step manually. Override context_dir when the repository already uses a custom namespace.
When the user has not opted into agents, pass no so the folder layout does not imply agents that were never requested.
When the repository is missing the base context files, execute this bundled script from the skill directory:
scripts/scaffold-base-files.sh [target_dir] [cli_target] [pattern] [context_dir]
Default behavior:
target_dir: current working directory
cli_target: claude
pattern: full
context_dir: target default such as .claude, .codex, .opencode, or .gemini
This script only creates missing base files. It does not overwrite existing content. Use it to bootstrap the repository before making targeted edits, and override context_dir when the repository already uses a custom namespace.
After scaffolding or after any later agent/folder changes, run:
scripts/update-workflow-summary.sh [target_dir] [cli_target] [context_dir]
Use it to refresh the summary blocks inside CLAUDE.md, AGENTS.md, GEMINI.md, and knowledge/folder-structure.md so they match the current workspace state.
When To Read References
- Read
references/cli-targets.md first when the user wants one or more CLI targets supported.
- Read
references/workflow.md when running the guided setup flow.
- Read
references/pattern-matrix.md when mapping a requested pattern to folders, files, and setup scope.
- Read
references/pattern-research.md when the user wants deeper justification or ecosystem grounding for a pattern choice.
- Read
references/patterns.md when choosing the setup structure pattern.
- Read
references/orchestration-patterns.md when choosing between TDD, BDD, ATDD, and SDD.
- Read
references/testing.md when validating whether the skill triggers and completes the workflow reliably.
Implementation Guidance
If you need deterministic generation or repeated file updates, prefer reusable scripts over rewriting the same logic inline every time.
Success Criteria
- The skill activates for common setup requests without needing explicit naming.
- The workflow completes without the user having to specify the next step manually.
- The repository ends with the correct entrypoint files and folder structure for the selected CLI targets.
- Agent creation is treated as an explicit setup choice instead of an automatic side effect.
- Entrypoint files reflect the actual agents and workspace folders that exist after the run.
- The setup matches the requested or inferred development pattern instead of only scaffolding folders.
- Existing context files are extended safely instead of being overwritten carelessly.
Output Expectations
At the end of the run:
- list created files
- list updated files
- list skipped files
- state selected setup pattern
- state selected development pattern
- call out assumptions
- identify any placeholders the user should complete later
1---2name: swarm-forge-skill3description: Sets up or refines repository AI workflow context across multiple CLI targets and four development patterns: TDD, BDD, ATDD, and SDD. Use when the user says things like "set up this repo for Claude Code", "set up this repo for Codex", "prepare the agent workflow", "add a TDD setup", "make this BDD-friendly", "set up ATDD", "set up spec driven development", or "review this project and scaffold the context files". It inspects the repo, chooses or confirms suitable CLI targets, setup patterns, and one of the four supported development patterns, asks only missing setup questions, runs bundled scaffold scripts when needed, and safely merges into existing project context files.4license: Apache-2.05---67# Swarm Forge Skill89Use this skill when the user wants the repository prepared for agent-based work without invoking a CLI command. The skill should inspect the codebase, ask only the missing setup questions, and then create or update the project context files directly.1011## What This Skill Owns1213- Repository inspection before writing anything14- Guided setup for target-specific entrypoint files such as `CLAUDE.md`, `AGENTS.md`, and `GEMINI.md`15- Safe creation of target-specific workspace files and shared workflow artifacts16- Refinement of existing setup instead of blind overwrite17- Converting vague user intent into a concrete project context scaffold1819## Primary Use Cases2021- User asks to set up project instruction files or an agent workflow for a repository.22- User wants the setup to support one or more coding CLIs such as Claude Code, Codex, OpenCode, or Gemini CLI.23- User wants the repo reviewed first and then scaffolded based on the real stack.24- User wants a guided setup with a few clarifying questions instead of invoking a CLI command.25- User wants either a full workflow, a lightweight setup, or a knowledge-only starting point.26- User wants one of these development patterns encoded in the repository: `TDD`, `BDD`, `ATDD`, or `SDD`.2728## Target Model2930Do not assume a single CLI by default when the user is asking for a reusable setup. The skill should support one or more of these targets:3132- `Claude Code`33- `Codex`34- `OpenCode`35- `Gemini CLI`3637The scripts also accept a `multi` target for multi-CLI folder creation; this is a script convenience, not a CLI itself.3839When the user wants more than one target, prefer:4041- one visible context namespace per CLI42- one thin entrypoint file per CLI43- tool-specific folders only where the CLI actually supports them4445## Supported Patterns4647These are setup structure patterns, not development patterns.4849- `full`: complete workflow with entrypoint files, knowledge, rules, plans, and tasks, plus optional agents when the user opts in50- `collaborative`: same structure as `full`, preferred when the user explicitly wants plans and persistent task context, with optional agents when the user opts in51- `lean`: lightweight setup with entrypoint files, knowledge, and rules52- `knowledge-first`: repository memory first, focused on `knowledge/` without forcing the full workflow5354Pattern selection rules:5556- If the user explicitly names a pattern or describes one clearly, use it.57- If the repo already contains partial context files, extend the nearest matching pattern instead of forcing a new one.58- If the user asks for minimal setup, prefer `lean`.59- If the user asks for documentation or institutional memory first, prefer `knowledge-first`.60- Otherwise default to `full`.6162## Supported Development Patterns6364- `TDD`: test-driven development centered on fast unit-test feedback loops before implementation65- `BDD`: behavior-driven development centered on shared understanding and scenario-based behavior descriptions66- `ATDD`: acceptance-test-driven development centered on acceptance criteria and stakeholder collaboration before implementation67- `SDD`: spec-driven development centered on specs as the source of implementation context, often using structured artifacts such as specs, plans, and tasks6869Pattern selection rules:7071- If the user names one of these patterns, preserve it.72- If the user wants unit tests to drive implementation, prefer `TDD`.73- If the user wants user behavior and Given/When/Then scenarios, prefer `BDD`.74- If the user wants acceptance criteria written collaboratively before implementation, prefer `ATDD`.75- If the user wants specs, plans, and structured context as the primary source of truth, prefer `SDD`.7677## Workflow7879For complex setups, copy this checklist into the working notes and mark progress as you go:8081- Confirm target CLI or CLIs82- Inspect repository83- Detect stack and existing context files84- Select or confirm integration pattern85- Select or confirm development pattern86- Decide whether agent scaffolding should be created at all87- Ask only missing questions88- Run folder setup script if needed89- Run base file scaffold script if needed90- Create or update context files91- Report created, updated, skipped, and assumptions92931. Ask which CLI or CLIs the repository should support unless the answer is already explicit and unambiguous.942. Inspect the repository.953. Identify facts from source files:96 - app type97 - language/runtime98 - package manager99 - test/lint/format commands100 - existing docs and conventions1014. Check which target-specific files already exist, such as `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, `.claude/`, `.opencode/`, and `.gemini/`.1025. Choose the integration pattern that best fits the repo and the user request.1036. Choose the development pattern that best fits the repo and the user request.1047. Decide whether initial agent scaffolding should be created. If the user did not explicitly ask for agents and the repo does not already contain them, ask whether they want no agents, only the minimum core agents, or a custom initial set. Do not silently create agent files just because a pattern supports them.1058. Ask only the missing high-value questions, including pattern confirmation when uncertain.1069. Summarize the intended setup before major edits when the repo already contains agent context files.10710. If the workflow directories do not exist yet, run `scripts/create-workflow-folders.sh` from the skill directory with the selected CLI target and pattern instead of recreating the directory creation logic manually.10811. If the base context files do not exist yet, run `scripts/scaffold-base-files.sh` from the skill directory with the selected CLI target and pattern to create the initial files that fit that target.10912. Create or update the setup files, including pattern-specific guidance inside the generated context where appropriate.11013. Refresh target-specific entrypoint files after scaffolding so they reflect the actual current state of the workspace. Document:111 - which agents exist now112 - whether agent creation was intentionally skipped113 - which key folders exist in `.claude/`, `.codex/`, `.opencode/`, or `.gemini/`114 - what each documented folder is for11514. For multi-CLI setups, keep one visible context namespace per CLI and create thin target-specific entrypoint files.11615. Report what was created, what was updated, which CLI targets were selected, what setup pattern was chosen, what development pattern was chosen, and what still needs human input.117118## Required Questions119120Ask these only when they cannot be inferred with confidence:121122- What is the project trying to achieve?123- Which CLI or CLIs should this repository support?124- Which integration pattern fits best: full, collaborative, lean, or knowledge-first?125- Which development pattern fits best for this repository and team: TDD, BDD, ATDD, or SDD?126- Do you want this setup to create initial agents now, or leave agent scaffolding out for the moment?127- If agents should be created, which specialized agents should exist initially?128- What rules are non-negotiable for changes in this repo?129- Should session context and implementation plans be part of the workflow?130131Optional follow-ups:132133- Are there architecture constraints not obvious from the codebase?134- Are there business terms or domain rules that should be captured immediately?135- Should the setup be minimal or comprehensive?136137## Writing Rules138139- Prefer facts extracted from the repo over placeholders.140- Do not overwrite user-authored sections blindly.141- Merge by sections when updating target-specific entrypoint files.142- Keep knowledge files concise and searchable.143- If a fact is uncertain, label it as an assumption or ask.144- If the repo already contains a better source of truth, reference it instead of duplicating it.145146## File Strategy147148### Entrypoint Files149150Create or update:151152- Project overview153- Tech stack reference154- Documentation map155- Rules reference156- Agent list157- Agent creation policy summary158- Workspace folder map159- Key constraints summary160- Command quick reference161162Use the appropriate file for each selected CLI:163164- `CLAUDE.md` for Claude Code165- `AGENTS.md` for Codex166- `AGENTS.md` plus `.opencode/` extensions for OpenCode167- `GEMINI.md` for Gemini CLI168169For multi-CLI setups, keep these files short and point them to shared workflow artifacts.170171### Shared Knowledge And Workflow Artifacts172173Create only the files that are justified by the repository and user answers. Prefer this initial set:174175- `critical-constraints.md`176- `architecture-overview.md`177- `tech-stack.md`178- `business-vision.md`179- `folder-structure.md`180181These should live inside the selected CLI namespace, for example:182183- `.claude/knowledge/`184- `.codex/knowledge/`185- `.opencode/knowledge/`186- `.gemini/knowledge/`187188### Agent Definitions189190Create agents only when the user explicitly asks for them or agrees to an initial core set.191If the user prefers not to create agents yet, keep the workflow documentation explicit about that choice and do not create agent definition files just because the directory exists.192Shape the initial agent set according to the selected development pattern.193For `SDD`, prefer a role set that can maintain specs, plans, and shared project knowledge.194195Place them according to target:196197- `.claude/agents/` for Claude Code198- `.opencode/agents/` for OpenCode199- shared docs plus `AGENTS.md` references for Codex200- shared docs plus `GEMINI.md` references for Gemini CLI201202### Rules203204Create `code-style.md` when the repo has enough evidence to describe conventions or when the user wants it scaffolded.205206### Tasks And Plans207208Create the session protocol only if the user wants persistent task context or if the setup is meant for multi-step collaboration.209Create the directory when agent planning is part of the intended workflow.210211For multi-CLI setups, prefer per-target locations such as:212213- `.claude/plans/`, `.claude/tasks/`, `.claude/specs/`, `.claude/scenarios/`, `.claude/acceptance/`214- `.codex/plans/`, `.codex/tasks/`, `.codex/specs/`, `.codex/scenarios/`, `.codex/acceptance/`215- `.opencode/plans/`, `.opencode/tasks/`, `.opencode/specs/`, `.opencode/scenarios/`, `.opencode/acceptance/`216- `.gemini/plans/`, `.gemini/tasks/`, `.gemini/specs/`, `.gemini/scenarios/`, `.gemini/acceptance/`217218Adapt the output to the selected pattern instead of always forcing the full directory set.219Also adapt the output to the selected CLI targets instead of assuming Claude-only scaffolding.220After the directory structure is in place, update the relevant entrypoint files so they describe the real folders that exist and what each one is used for.221222Also adapt the file contents to the selected development pattern. For example:223224- `TDD`: emphasize unit test locations, red-green-refactor, and framework-specific test commands225- `BDD`: emphasize user behavior, scenarios, Given/When/Then structure, and cross-role collaboration226- `ATDD`: emphasize acceptance criteria, stakeholder collaboration, and acceptance test artifacts227- `SDD`: emphasize specs, plans, tasks, and structured context artifacts as the main execution anchor228229## Script Usage230231When the repository is missing the base workflow folders, execute this bundled script from the skill directory:232233```bash234scripts/create-workflow-folders.sh [target_dir] [cli_target] [pattern] [context_dir] [create_agents]235```236237Default behavior:238239- `target_dir`: current working directory240- `cli_target`: `claude`241- `pattern`: `full`242- `context_dir`: target default such as `.claude`, `.codex`, `.opencode`, or `.gemini`243- `create_agents`: `yes` or `no`244245Use the script instead of reproducing the folder creation step manually. Override `context_dir` when the repository already uses a custom namespace.246When the user has not opted into agents, pass `no` so the folder layout does not imply agents that were never requested.247248When the repository is missing the base context files, execute this bundled script from the skill directory:249250```bash251scripts/scaffold-base-files.sh [target_dir] [cli_target] [pattern] [context_dir]252```253254Default behavior:255256- `target_dir`: current working directory257- `cli_target`: `claude`258- `pattern`: `full`259- `context_dir`: target default such as `.claude`, `.codex`, `.opencode`, or `.gemini`260261This script only creates missing base files. It does not overwrite existing content. Use it to bootstrap the repository before making targeted edits, and override `context_dir` when the repository already uses a custom namespace.262263After scaffolding or after any later agent/folder changes, run:264265```bash266scripts/update-workflow-summary.sh [target_dir] [cli_target] [context_dir]267```268269Use it to refresh the summary blocks inside `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, and `knowledge/folder-structure.md` so they match the current workspace state.270271## When To Read References272273- Read `references/cli-targets.md` first when the user wants one or more CLI targets supported.274- Read `references/workflow.md` when running the guided setup flow.275- Read `references/pattern-matrix.md` when mapping a requested pattern to folders, files, and setup scope.276- Read `references/pattern-research.md` when the user wants deeper justification or ecosystem grounding for a pattern choice.277- Read `references/patterns.md` when choosing the setup structure pattern.278- Read `references/orchestration-patterns.md` when choosing between TDD, BDD, ATDD, and SDD.279- Read `references/testing.md` when validating whether the skill triggers and completes the workflow reliably.280281## Implementation Guidance282283If you need deterministic generation or repeated file updates, prefer reusable scripts over rewriting the same logic inline every time.284285## Success Criteria286287- The skill activates for common setup requests without needing explicit naming.288- The workflow completes without the user having to specify the next step manually.289- The repository ends with the correct entrypoint files and folder structure for the selected CLI targets.290- Agent creation is treated as an explicit setup choice instead of an automatic side effect.291- Entrypoint files reflect the actual agents and workspace folders that exist after the run.292- The setup matches the requested or inferred development pattern instead of only scaffolding folders.293- Existing context files are extended safely instead of being overwritten carelessly.294295## Output Expectations296297At the end of the run:298299- list created files300- list updated files301- list skipped files302- state selected setup pattern303- state selected development pattern304- call out assumptions305- identify any placeholders the user should complete later