feat(agent-catalog): add create-agent-catalog-source skill - #2975
Conversation
Add a Claude Code skill that scans repositories for agent templates (agent.yaml files, YAML heuristics, and Markdown analysis) and generates a custom agent catalog source YAML compatible with the catalog service. Includes: - SKILL.md with full 6-step workflow - Helper script (agent_yaml_to_json.py) for deterministic YAML-to-JSON - Pytest tests for the helper script - Documents all available skills in AGENTS.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: lugi0 <lgiorgi@redhat.com>
…rsion The project already requires yq (./bin/yq). Use it directly in the skill instead of shipping a separate Python script and its tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: lugi0 <lgiorgi@redhat.com>
Replace RHOAI, OpenShift, and oc references with generic upstream terminology (agents catalog, Kubernetes, kubectl). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: lugi0 <lgiorgi@redhat.com>
| | `labels` | From agent.yaml `labels` field. Default `[]`. **Always include this field.** | | ||
| | `logo` | From agent.yaml `logo` field. Default `""`. **Always include this field.** | | ||
| | `env` | Transform from `{required: [...], optional: [...]}` to flat list: each required var gets `{name: X, required: true}`, each optional var gets `{name: X, required: false}`. For markdown-inferred agents, use env vars extracted from the README. Default `[]`. **Always include this field.** | | ||
| | `templates` | Use `./bin/yq` to convert agent.yaml to a compact JSON string. The result becomes a single template entry: `{name: "agent.yaml", content: "<json>"}`. **For convention-discovered agents** (agent.yaml already on disk): run `./bin/yq <agent-dir>/agent.yaml -o json -I 0` and capture stdout. **For heuristic/markdown-discovered agents** (no agent.yaml on disk): write the generated agent.yaml content (confirmed by the user in Step 3c) to a temporary file (`TMPFILE=$(mktemp /tmp/agent-yaml-XXXXXX.yaml)`), run `./bin/yq "$TMPFILE" -o json -I 0`, capture stdout, then clean up (`rm "$TMPFILE"`). **Always include this field.** | |
There was a problem hiding this comment.
One thing to double-check (from cursor): if the user edits fields in Step 4, should templates[].content be regenerated from that final metadata, or stay as the original/on-disk agent.yaml? Maybe worth spelling out so agents don't guess - especially for heuristic/markdown agents where the template is generated.
There was a problem hiding this comment.
Done, now the template gets updated to the last metadata available and the user is asked if they want to update the source agent.yaml file as well
| ```bash | ||
| test -d <original-cwd>/.agent-catalog | ||
| ``` | ||
| If `.agent-catalog/` already exists, ask the user whether to overwrite or choose a different output path using `AskUserQuestion`. |
There was a problem hiding this comment.
This lets the user pick a custom output path, but Steps 5–6 still hardcode .agent-catalog/
There was a problem hiding this comment.
Good catch, done and abstracted in <output-dir>
|
/lgtm too. Thanks, @lugi0 |
- Use <output-dir> variable throughout Steps 5-6 instead of hardcoding .agent-catalog/, honoring the user's choice from Step 1 - Clarify that templates[].content always reflects the final confirmed metadata, not the original on-disk agent.yaml; if a convention agent's fields were edited, ask the user whether to update the source file Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: lugi0 <lgiorgi@redhat.com>
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Al-Pragliola The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
Adds a Claude Code skill (
/create-agent-catalog-source) that scans repositories for agent templates and generates a custom agent catalog source YAML compatible with the catalog service'syamlAgentCatalogconsumer.What the skill does:
agent.yamlconvention scan, YAML heuristic scan, and Markdown analysiscatalog.yamlwith all required fields (name,displayName,description,framework,labels,logo,env,templates, etc.)Files added:
.agents/skills/create-agent-catalog-source/SKILL.md— full skill definition with 6-step workflow.agents/skills/create-agent-catalog-source/scripts/agent_yaml_to_json.py— helper script for deterministic YAML-to-JSON conversion (used for thetemplatesfield).agents/skills/create-agent-catalog-source/scripts/test_agent_yaml_to_json.py— pytest tests for the helper script (8 tests)Also:
AGENTS.mddocumenting all 5 skills (4 existing + 1 new) so contributors and agents can discover themHow Has This Been Tested?
python3 -m pytest .agents/skills/create-agent-catalog-source/scripts/test_agent_yaml_to_json.py -v— 8/8 tests passcatalog consumed by the catalog service
Merge criteria:
DCOcheck)