Skip to content

feat(skills): import a directory of skills by picking from a discovered list - #9

Merged
wujunyi792 merged 1 commit into
mainfrom
feat/skill-directory-import
Jul 22, 2026
Merged

wujunyi792 merged 1 commit into
mainfrom
feat/skill-directory-import

Conversation

@wujunyi792

Copy link
Copy Markdown
Member

Problem

Importing a GitHub URL that points at a container directory —
github.com/larksuite/cli/tree/main/skills — fails with "SKILL.md not found". The importer treats the URL as a single skill, so the user has to paste each sub-skill URL (…/skills/lark-base) one by one (27 of them for that repo).

Data structure (for context)

A skill is a single-skill entity: skill (one row: name unique per workspace, content=SKILL.md, config JSONB with origin+sync metadata) + skill_file (supporting files) + agent_skill (M2M). The GitHub importer fetches <dir>/SKILL.md — a container dir has none, hence the failure.

Change

When the pointed directory has no SKILL.md but its immediate subdirectories do, the import now returns the discovered sub-skills and the create dialog shows a checklist to pick which to import (select-all by default). Each candidate re-imports as a normal single skill via its own /tree/<ref>/<dir>/<sub> URL, so provenance and hourly origin-sync keep working per skill.

Backend

  • discoverGitHubDirectorySkills: one recursive git-trees request, filtered to immediate subdirs with a SKILL.md (immediateSubSkillDirs) — avoids N per-subdir contents calls / rate limits.
  • ImportSkill: on a GitHub single-skill miss, falls back to discovery and returns SkillImportResult{status:"multiple", candidates:[…]} (HTTP 200) instead of erroring.

Frontend

  • api.importSkill → Skill | {status:"multiple", candidates}.
  • URL import form renders the checklist, imports selected candidates, reports per-skill success/failure. i18n en/zh/ja/ko (locale parity test passes).

Verification

  • Go: go build, go vet, unit tests for immediateSubSkillDirs (own/nested SKILL.md excluded) + buildGitHubTreeURL round-trip. Verified live against larksuite/cli → 27 sub-skills discovered with correct URLs.
  • TS: core + views typecheck; full @multica/views vitest suite (2914 tests) incl. locale parity.

🤖 Generated with Claude Code

…ed list

Importing a GitHub URL that points at a CONTAINER directory (e.g.
github.com/larksuite/cli/tree/main/skills) failed with "SKILL.md not found",
because the importer treats the URL as one skill and there was no way to import
a parent directory holding many skills — the user had to paste each sub-skill
URL (…/skills/lark-base) individually.

Now, when the pointed directory has no SKILL.md of its own but its immediate
subdirectories do, the import returns the discovered sub-skills instead of an
error, and the create dialog presents them as a checklist for the user to pick
which to import. Each candidate re-imports as a normal single skill (its own
/tree/<ref>/<dir>/<sub> URL), so provenance + hourly origin sync work per skill.

Backend:
- discoverGitHubDirectorySkills: one recursive git-trees request, filtered to
  immediate subdirectories containing a SKILL.md (immediateSubSkillDirs). Stays
  within GitHub's rate limit vs N per-subdir contents calls.
- ImportSkill: on a GitHub single-skill miss, fall back to discovery and return
  SkillImportResult{status:"multiple", candidates:[…]} (HTTP 200) rather than
  failing.

Frontend:
- api.importSkill now returns Skill | {status:"multiple", candidates}.
- URL import form renders a select-all checklist and imports the selected
  candidates, reporting per-skill success/failure. i18n across en/zh/ja/ko.

Tests: immediateSubSkillDirs (container filtering, nested/own SKILL.md excluded)
and buildGitHubTreeURL round-trip through parseGitHubURL. Verified live against
larksuite/cli (27 sub-skills discovered).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NYStwEXJFCJLokYqKVUBUg
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@wujunyi792, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 19 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 672af57b-3090-46e2-ab27-9380f5f02442

📥 Commits

Reviewing files that changed from the base of the PR and between 6dc73f9 and c9eb2f9.

📒 Files selected for processing (10)
  • packages/core/api/client.ts
  • packages/core/types/agent.ts
  • packages/core/types/index.ts
  • packages/views/locales/en/skills.json
  • packages/views/locales/ja/skills.json
  • packages/views/locales/ko/skills.json
  • packages/views/locales/zh-Hans/skills.json
  • packages/views/skills/components/create-skill-dialog.tsx
  • server/internal/handler/skill.go
  • server/internal/handler/skill_directory_import_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/skill-directory-import

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@wujunyi792
wujunyi792 merged commit 9ce6af7 into main Jul 22, 2026
7 checks passed
@wujunyi792
wujunyi792 deleted the feat/skill-directory-import branch July 22, 2026 03:42
wujunyi792 added a commit that referenced this pull request Aug 24, 2026
…ed list (#9)

Importing a GitHub URL that points at a CONTAINER directory (e.g.
github.com/larksuite/cli/tree/main/skills) failed with "SKILL.md not found",
because the importer treats the URL as one skill and there was no way to import
a parent directory holding many skills — the user had to paste each sub-skill
URL (…/skills/lark-base) individually.

Now, when the pointed directory has no SKILL.md of its own but its immediate
subdirectories do, the import returns the discovered sub-skills instead of an
error, and the create dialog presents them as a checklist for the user to pick
which to import. Each candidate re-imports as a normal single skill (its own
/tree/<ref>/<dir>/<sub> URL), so provenance + hourly origin sync work per skill.

Backend:
- discoverGitHubDirectorySkills: one recursive git-trees request, filtered to
  immediate subdirectories containing a SKILL.md (immediateSubSkillDirs). Stays
  within GitHub's rate limit vs N per-subdir contents calls.
- ImportSkill: on a GitHub single-skill miss, fall back to discovery and return
  SkillImportResult{status:"multiple", candidates:[…]} (HTTP 200) rather than
  failing.

Frontend:
- api.importSkill now returns Skill | {status:"multiple", candidates}.
- URL import form renders a select-all checklist and imports the selected
  candidates, reporting per-skill success/failure. i18n across en/zh/ja/ko.

Tests: immediateSubSkillDirs (container filtering, nested/own SKILL.md excluded)
and buildGitHubTreeURL round-trip through parseGitHubURL. Verified live against
larksuite/cli (27 sub-skills discovered).

Claude-Session: https://claude.ai/code/session_01NYStwEXJFCJLokYqKVUBUg

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant