Skip to content

refactor: move generated skills to .agents/skills with .claude compatibility - #308

Merged
edenreich merged 2 commits into
mainfrom
refactor/issue-307-20260718-1630
Jul 18, 2026
Merged

edenreich merged 2 commits into
mainfrom
refactor/issue-307-20260718-1630

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Summary

Moves generated skills out of the project-root skills/ directory into the portable .agents/skills/<id>/SKILL.md layout, and generates a .claude -> .agents symlink so the scaffolded agent is directly usable by Claude Code (which reads .claude/skills/) as well as any runtime following the .agents/ convention. The ADL manifest stays the single source of truth.

Changes

  • Output layout (registry.go, generator.go): bare + non-bare skills now generate to .agents/skills/<id>/SKILL.md for Go, Rust, and TypeScript.
  • .claude pointer: new writeClaudePointer creates a relative .claude -> .agents symlink when the manifest declares skills. Idempotent, tracked (committed by the generated repo), best-effort with a warning on platforms lacking symlink support.
  • Runtime defaults: Go skillsDir, Rust unwrap_or_else, and TS envString default to .agents/skills; the A2A_SKILLS_DIR override is preserved in all three.
  • Dockerfiles: Go/Rust/TS copy .agents/skills so SKILL.md is readable at startup.
  • .adl-ignore: bare-skill glob is now .agents/skills/<id>/.
  • Docs: README (fixes the stale skills/<id>.md reference), the skill.md scaffold, and the generated CLAUDE.md / GEMINI.md / AGENTS.md docs point at .agents/skills/<id>/SKILL.md.
  • .well-known/agent-card.json is unchanged - already spec-driven from .Skills, consistent across all three languages.

Open questions resolved

  • Symlink: ship a real relative .claude -> .agents symlink, committed by the generated repo, created idempotently. Windows checkouts with core.symlinks=false are the known ceiling - generation warns instead of failing.
  • .agents/ scope: skills-only for this change (no AGENTS.md index), per the issue.

Verification

  • go build, go vet, full go test ./... pass.
  • task examples:test + task examples:generate pass; verified the .claude symlink, .agents/skills/<id>/SKILL.md, Dockerfile COPY, .adl-ignore glob, and runtime defaults across go-agent, go-agent-builtin-tools, and rust-agent.

Migration (breaking)

Generated skills move from skills/<id>/SKILL.md to .agents/skills/<id>/SKILL.md and the default A2A_SKILLS_DIR becomes .agents/skills. Existing generated projects must either move skills/ -> .agents/skills/ or set A2A_SKILLS_DIR=skills on regenerate.

Closes #307

Generate skills to .agents/skills/<id>/SKILL.md and add a .claude ->
.agents symlink so Claude Code reads the same tree at
.claude/skills/<id>/SKILL.md. Runtime loaders (Go/Rust/TS) default
A2A_SKILLS_DIR to .agents/skills; Dockerfiles and .adl-ignore follow.

BREAKING CHANGE: generated skills now live in .agents/skills/<id>/SKILL.md
(was skills/<id>/SKILL.md) and the default A2A_SKILLS_DIR is now
.agents/skills. Existing generated projects must move skills/ to
.agents/skills/ (or set A2A_SKILLS_DIR=skills) on regenerate.
@edenreich

Copy link
Copy Markdown
Contributor

@claude Can you review this ? use /ponytail:ponytail /ponytail:ponytail-review

@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Claude finished @edenreich's task in 3m 49s —— View job


Ponytail review

  • Read the full diff
  • Analyze writeClaudePointer (the only new logic)
  • Check template / registry / runtime-default changes
  • Verify .gitignore / .dockerignore / .env.example interactions
  • Post review

Verdict: lean. The diff is almost entirely a mechanical skills/ → .agents/skills/ swap across templates, registry, runtime defaults, Dockerfiles, and docs. The one piece of new logic (writeClaudePointer) is tight. One small cut, otherwise ship.

Over-engineering (the /ponytail-review pass)

internal/generator/generator.go:800: yagni: always-nil error return. writeClaudePointer is error-returning but every path returns nil - that's the stated design (the ponytail: comment says best-effort, warn-don't-abort). So the return type and the wrapper at 583-587 are dead flexibility:

// now
if len(adl.Spec.Skills) > 0 {
    if err := g.writeClaudePointer(outputDir); err != nil {
        return err
    }
}
// ->  drop the error return, call bare
if len(adl.Spec.Skills) > 0 {
    g.writeClaudePointer(outputDir)
}

net: -4 lines. Fix this →

Everything else is fine: the idempotent Lstat/Readlink guard is necessary (a committed symlink regenerated on every run), not bloat, and the new symlink test is the minimum. Don't touch.

Correctness / design (checked while I was in there)

  • ✅ .dockerignore / .gitignore don't exclude .agents or .claude - so the symlink + .agents/skills get committed, and the Rust/TS COPY .agents/skills (which reads from the build context, not the builder stage) still resolves. This is the trap this kind of dotfile move usually falls into; you avoided it.
  • ✅ No stale output paths left. The remaining "skills/skill.md" in registry.go / engine_test.go is the embedded template key, not an on-disk path - correct to leave unchanged.
  • ✅ A2A_SKILLS_DIR override preserved in all three runtimes, and .env.example doesn't hardcode the old default.
  • ⚠️ Design note (not a blocker): the pointer symlinks the whole .claude/ dir, not just .claude/skills. Claude Code also reads/writes .claude/settings.json, .claude/commands/, .claude/agents/ there, which now resolve into .agents/. One concrete consequence: a user-local .claude/settings.local.json (normally gitignored) would materialize at .agents/settings.local.json, which the generated .gitignore does not cover - so it could be committed by accident. The whole-dir symlink is the laziest one-symlink option and is defensible, but it's broader than the PR's stated "skills-only" scope. If you want true skills-only isolation, a narrower .claude/skills -> ../.agents/skills does it (cost: one real .claude/ dir + relative target). Your call - just worth naming since the PR raised scope as an open question.

Pre-existing (skip unless bored)

The bare-skill loop for _, skill := range adl.Spec.Skills { if skill.Bare { ... } } is copy-pasted identically in getGoFiles / getRustFiles / getTypeScriptFiles (registry.go:187,260,340). You edited all three here; a shared helper would make the next path change a one-liner. Out of scope for this refactor - noting it, not asking for it.

net: -4 lines possible. Otherwise ship.

--- · refactor/issue-307-20260718-1630

@edenreich

Copy link
Copy Markdown
Contributor

@claude Let's be explicit pointer from .claude/skills -> .agents/skills

@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Claude finished @edenreich's task in 4m 44s —— View job


Made the pointer explicit: .claude/skills -> ../.agents/skills

  • Read current writeClaudePointer and the symlink test
  • Rewrite pointer to a narrow .claude/skills -> ../.agents/skills symlink
  • Check .adl-ignore / .gitignore / .dockerignore interactions
  • Update tests + doc templates
  • Build + test (go build, go vet, full go test ./...)
  • Commit to PR branch (4ee6354)

Done. Swapped the whole-directory .claude -> .agents symlink for an explicit skills-only pointer.

What changed

  • internal/generator/generator.go - writeClaudePointer now MkdirAlls a real .claude/ and creates .claude/skills -> ../.agents/skills (relative, so it survives clone/checkout). Idempotent guard now reads .claude/skills and compares against the ../.agents/skills target; unrelated content there is left with a warning. Still best-effort (ponytail: warn-don't-abort on symlink-less platforms).
  • cmd/generate_test.go - TestGenerateWithoutInit asserts .claude/skills is a symlink to ../.agents/skills.
  • Docs - skill.md, claude.md, gemini.md templates updated to say .claude/skills -> ../.agents/skills.

Why this is better than the whole-dir link

It directly resolves the design note from the earlier review: only skills is redirected now, so .claude/settings.json, .claude/commands/, .claude/agents/, and a user-local .claude/settings.local.json all stay a real local .claude/ directory - nothing leaks into .agents/ and there's no accidental-commit risk. Claude Code still resolves .claude/skills/<id>/SKILL.md transparently. Dockerfiles/runtime defaults are unaffected (they already read .agents/skills).

Verification

  • go build ./..., go vet - clean.
  • go test ./... - full suite green. TestGenerateWithoutInit drives the real runGenerate path with a bare skill and asserts the new symlink shape; since the same run scaffolds .agents/skills/<id>/SKILL.md in the output dir, the relative target resolves by construction.
  • Confirmed no .gitignore/.dockerignore pattern matches skills, so the committed symlink isn't swallowed.

(Note: a live ./bin/adl generate smoke run was gated by a permission prompt in this environment, so I relied on the end-to-end unit test for on-disk verification.)
· refactor/issue-307-20260718-1630

@edenreich
edenreich merged commit 6d86459 into main Jul 18, 2026
1 check passed
@edenreich
edenreich deleted the refactor/issue-307-20260718-1630 branch July 18, 2026 18:46
inference-gateway-releaser Bot added a commit that referenced this pull request Jul 18, 2026
## [0.52.2](v0.52.1...v0.52.2) (2026-07-18)

### ⚠ BREAKING CHANGES

* generated skills now live in .agents/skills/<id>/SKILL.md
  (was skills/<id>/SKILL.md) and the default A2A_SKILLS_DIR is now
  .agents/skills. Existing generated projects must move skills/ to
  .agents/skills/ (or set A2A_SKILLS_DIR=skills) on regenerate.

  * refactor: narrow pointer to .claude/skills -> .agents/skills

### ♻️ Improvements

* move generated skills to .agents/skills with .claude compatibility ([#308](#308)) ([6d86459](6d86459))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.52.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

[TASK] Refactor generated skills to .agents/skills with .claude compatibility

1 participant