How to adopt agent-marketplace in a repository
Add agent-marketplace to a repository so everyone on the team gets the same skills and other resources.
Prerequisites
agent-marketplaceis installed and on yourPATH(see Install). Everyone who syncs the repository, including CI, needs version v4.0.9 or newer, because older versions cannot read the lockfile this guide creates.- The URL of a Git registry that contains the resources you want.
- The harnesses the project uses.
- A terminal open at the repository's root folder.
1. Create the repository configuration
Create the .agents folder:
mkdir -p .agentsmkdir -p prints nothing on success.
Create .agents/config.yaml with a minimal configuration:
# .agents/config.yaml
apiVersion: agent-marketplace/v4
harnesses:
- claude
sources:
shared:
git: https://github.com/example-org/agent-resources.git
ref: v1.4.0
path: resources
resources:
shared:
include:
- skill/code-reviewReplace the Git URL with a registry you control or a public example, v1.4.0 with a tag or branch in that registry, and skill/code-review with the resources you want. The harnesses list here applies to everyone in the repository and takes precedence over each person's own list. A teammate's personal resources then go only to harnesses in both lists. See configure multiple harnesses.
2. Sync and verify
agent-marketplace syncSync resolves the tag to an exact commit, writes the lock, and installs the skill into the Claude Code folders. Output:
Installed 2 Removed 0 Malformed 0 Errors 0
→ /path/to/repo/.claude/.claude-plugin (1 written), /path/to/repo/.claude/skills (1 written)Installed counts the files and entries sync wrote, so it can be higher than the number of resources. For Claude Code, sync writes the skill under .claude/skills/ and lists it in .claude/.claude-plugin/plugin.json.
Check that the lock was created:
ls .agents/config.yaml lock.yaml.agents/lock.yaml records the exact commit that v1.4.0 resolved to.
TIP
If ~/.agents/config.yaml does not exist yet, the first sync also creates it, as a v4 file with the default harness list. Existing unsupported roots or fragments refuse before new acquisition or writes; convert them with an older released migrator before upgrading. The repository's harnesses list still decides where this repository's output goes.
3. Ignore generated harness output
Sync recreates the harness folders from the configuration and the lock, so most teams keep them out of Git. The exact paths depend on your harnesses (harnesses and output paths). For Claude Code, add them to .gitignore:
printf '%s\n' '.claude/skills/' '.claude/.claude-plugin/' >> .gitignoreThe command prints nothing.
4. Commit the configuration
git add .agents/config.yaml .agents/lock.yaml .gitignore
git commit -m "Add agent-marketplace configuration"git add prints nothing; git commit prints its usual summary, for example [main 1a2b3c4] Add agent-marketplace configuration followed by the file count.
A teammate who clones the repository runs agent-marketplace sync and gets the same resources at the same commit. To check the setup in CI, see how to keep resources reproducible.
Troubleshooting
- If sync reports
no machine-wide target harness set configured, addharnessesto.agents/config.yamlor to~/.agents/config.yaml. - If the
refdoes not resolve, check that the tag or branch exists in the registry and that you can clone it. For private registries, see configure private Git registries. - If a teammate or CI job fails with
lock.invalid-document, check its version withagent-marketplace --version, which prints the installed version. Versions older than v4.0.9 cannot read the lock; upgrade them.