Skip to content

refactor(skills): move Skills Repository to experimental + CREWAI_EXPERIMENTAL gate#5963

Merged
greysonlalonde merged 3 commits into
mainfrom
gl/refactor/skills-repo-experimental
May 28, 2026
Merged

refactor(skills): move Skills Repository to experimental + CREWAI_EXPERIMENTAL gate#5963
greysonlalonde merged 3 commits into
mainfrom
gl/refactor/skills-repo-experimental

Conversation

@greysonlalonde
Copy link
Copy Markdown
Contributor

@greysonlalonde greysonlalonde commented May 28, 2026

Summary

  • Moves the registry/cache pieces of feat: Skills Repository — registry, cache, CLI, and SDK integration #5867 under crewai.experimental.skills and the CLI commands under crewai experimental skill. The stable local-file skills feature (loader, parser, validation, models) stays in crewai.skills.
  • Gates both entry points behind CREWAI_EXPERIMENTAL=1: resolve_registry_ref() calls require_experimental_skills(), and the crewai experimental CLI group raises UsageError when the flag is unset.
  • SkillDownloadStartedEvent / SkillDownloadCompletedEvent move out of crewai.events.types.skill_events into crewai.experimental.skills.events (these events are not re-exported from crewai.events, so no public surface change).

What moved

SDK (lib/crewai/src/crewai/)

  • skills/cache.pyexperimental/skills/cache.py
  • skills/registry.pyexperimental/skills/registry.py
  • New: experimental/skills/_flag.py, experimental/skills/events.py
  • agent/core.py rewired to import from crewai.experimental.skills.registry
  • crewai.skills.__init__ no longer re-exports SkillCacheManager/is_registry_ref/resolve_registry_ref

CLI (lib/cli/src/crewai_cli/)

  • skills/experimental/skills/
  • Commands now: crewai experimental skill {create,install,publish,list}

Tests — moved to lib/{crewai,cli}/tests/experimental/skills/; added a conftest.py autouse fixture to set the flag and test_flag.py covering the gate.

Test plan

  • pytest lib/crewai/tests/experimental/skills/ lib/cli/tests/experimental/skills/ lib/crewai/tests/skills/ — 109 passed
  • ruff check on touched paths clean
  • Import smoke test: crewai.experimental.skills.*, crewai_cli.experimental.skills.main, Agent, Crew
  • Manual: crewai experimental skill list without flag → UsageError; with CREWAI_EXPERIMENTAL=1 → works
  • Manual: Agent(skills=['@org/x']).set_skills() without flag → ExperimentalFeatureDisabledError

Note

Medium Risk
Breaking for callers of removed crewai.skills registry exports and old crewai skill CLI; SKILL.md must use metadata.version for publish. Gating limits blast radius for users who do not opt in.

Overview
Registry-backed skills (cache, @org/name resolution, downloads) move under crewai.experimental.skills and crewai experimental skill, both gated by CREWAI_EXPERIMENTAL=1. Stable filesystem skills stay in crewai.skills; its public exports drop cache/registry helpers.

resolve_registry_ref() and the experimental CLI group fail fast without the flag. Download lifecycle events move to crewai.experimental.skills.events. SkillFrontmatter no longer has a top-level version; publishing and templates use metadata.version (agentskills.io). Tests relocate under tests/experimental/skills/ with autouse flag fixtures.

Reviewed by Cursor Bugbot for commit 9d3ef6c. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • Experimental skills gated by CREWAI_EXPERIMENTAL=1.
    • New registry-backed skill download lifecycle events.
  • Refactor

    • Skill CLI commands moved under an experimental CLI group.
    • Registry/cache-backed skill resolution and events moved into the experimental namespace.
    • Skill frontmatter now prefers version inside metadata (top-level version removed).
  • Tests

    • Tests updated/added to cover experimental gate, registry, cache, and metadata version handling.

Review Change Stack

…ERIMENTAL gate

Moves the registry/cache pieces of PR #5867 under crewai.experimental.skills
and the CLI commands under `crewai experimental skill`. The stable local-file
skills feature (loader, parser, validation, models) stays in crewai.skills.

Both entry points now require CREWAI_EXPERIMENTAL=1:
- resolve_registry_ref() calls require_experimental_skills() before resolving
- The `crewai experimental` CLI group raises UsageError when the flag is unset

SkillDownloadStarted/CompletedEvent move out of crewai.events.types.skill_events
into crewai.experimental.skills.events.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c6385240-3390-4080-991f-49b334e4e5e9

📥 Commits

Reviewing files that changed from the base of the PR and between dff2e6f and 9d3ef6c.

📒 Files selected for processing (4)
  • lib/cli/src/crewai_cli/experimental/skills/main.py
  • lib/cli/tests/experimental/skills/test_main.py
  • lib/crewai/src/crewai/skills/models.py
  • lib/crewai/tests/experimental/skills/test_models_version.py
💤 Files with no reviewable changes (1)
  • lib/crewai/src/crewai/skills/models.py

📝 Walkthrough

Walkthrough

This PR moves registry-backed skill resolution and related cache/registry helpers and events into a new crewai.experimental.skills namespace gated by CREWAI_EXPERIMENTAL, adds a feature gate and CLI experimental group, updates consumers/tests to the new modules, and migrates skill frontmatter version handling into metadata.

Skills Registry Experimental Namespace Migration

Layer / File(s) Summary
Feature gate infrastructure and enforcement
lib/crewai/src/crewai/experimental/skills/_flag.py, lib/crewai/tests/experimental/skills/test_flag.py, lib/crewai/tests/experimental/skills/conftest.py
Introduces CREWAI_EXPERIMENTAL env var, ExperimentalFeatureDisabledError, is_enabled()/require_experimental_skills(), and an autouse fixture enabling the flag for experimental tests.
Registry skill download event types migration
lib/crewai/src/crewai/events/types/skill_events.py, lib/crewai/src/crewai/experimental/skills/events.py
Removes registry-download event classes from stable events and reintroduces SkillDownloadStartedEvent/SkillDownloadCompletedEvent in the experimental events module with registry-specific metadata fields.
Experimental skills package initialization and exports
lib/crewai/src/crewai/experimental/skills/__init__.py
Adds the crewai.experimental.skills package, documents registry-backed behavior, and re-exports SkillCacheManager and registry-reference helpers via __all__.
Registry resolution and cache manager under experimental
lib/crewai/src/crewai/experimental/skills/registry.py, lib/crewai/tests/experimental/skills/test_registry.py, lib/crewai/tests/experimental/skills/test_cache.py
Switches registry resolution to use experimental cache manager, calls require_experimental_skills() in resolve_registry_ref, imports experimental events, and updates registry/cache tests to target experimental module paths.
Stable skills package API cleanup
lib/crewai/src/crewai/skills/__init__.py
Removes experimental-only exports (SkillCacheManager, registry helpers) from the stable crewai.skills package __all__.
CLI experimental command group with flag enforcement
lib/cli/src/crewai_cli/cli.py
Adds a top-level experimental click group that errors when the flag is unset and nests the skill subcommand under it; updates SkillCommand import to experimental location.
CLI experimental skills command changes
lib/cli/src/crewai_cli/experimental/skills/main.py
Reorders generated SKILL.md (metadata before description), uses experimental SkillCacheManager fallback for global installs, and reads/prefers metadata.version for publish/version extraction and _read_version.
Update consumers and tests to experimental APIs
lib/crewai/src/crewai/agent/core.py, lib/cli/tests/experimental/skills/test_main.py, lib/crewai/tests/experimental/skills/test_cache.py
Updates Agent.set_skills import to experimental registry; test fixtures and patch targets now reference experimental skills modules and settings; cache tests import experimental cache manager.
Skill frontmatter version migration and tests
lib/crewai/src/crewai/skills/models.py, lib/crewai/tests/experimental/skills/test_models_version.py
SkillFrontmatter documents version under metadata and removes the top-level version field; new tests exercise metadata-based version handling.

Sequence Diagram

sequenceDiagram
  participant CLI as crewi_cli
  participant Flag as crewi.experimental.skills._flag
  participant Registry as crewi.experimental.skills.registry
  participant CacheMgr as SkillCacheManager
  CLI->>Flag: require_experimental_skills()
  Flag-->>CLI: OK / raise ExperimentalFeatureDisabledError
  CLI->>Registry: resolve_registry_ref(registry_ref)
  Registry->>CacheMgr: download_skill / resolve from cache
  CacheMgr-->>Registry: cache_path or raise SkillNotCachedError
  Registry-->>CLI: resolved path
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • crewAIInc/crewAI#5867: Directly related; reworks the same skills registry/cache feature into an experimental namespace and adjusts CLI/Agent integration.

Suggested labels

size/L

Suggested reviewers

  • joaomdmoura
  • lorenzejay

Poem

🐰 I hopped through code with a curious grin,

Moved skills to experimental, tucked new bits in,
A flag to unlock the adventurous trail,
Events and cache now tell a new tale,
Stable stays tidy — hush, let experiments begin!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 53.85% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: moving the Skills Repository functionality to experimental scope with a feature gate.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gl/refactor/skills-repo-experimental

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 and usage tips.

Comment thread lib/crewai/src/crewai/experimental/skills/registry.py
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/crewai/src/crewai/experimental/skills/registry.py (1)

23-27: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update remediation command in SkillNotCachedError to the experimental CLI path.

Line 26 still suggests crewai skill install {ref}, but this PR moves the command under crewai experimental skill install. The current message will direct users to a non-existent/incorrect command.

Suggested fix
-            f"Run `crewai skill install {ref}` to install it first."
+            f"Run `crewai experimental skill install {ref}` to install it first."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/crewai/src/crewai/experimental/skills/registry.py` around lines 23 - 27,
The error message in the SkillNotCachedError constructor (__init__) points users
to the old CLI command; update the string to instruct running "crewai
experimental skill install {ref}" instead of "crewai skill install {ref}" so the
exception message correctly guides users to the experimental CLI path (update
the f-string in the __init__ of SkillNotCachedError to use the new command).
🧹 Nitpick comments (1)
lib/cli/src/crewai_cli/cli.py (1)

549-549: 💤 Low value

Remove redundant import os statement.

The os module is already imported at the top of the file (line 4), so this local import is unnecessary.

♻️ Proposed fix
 def experimental() -> None:
     """Experimental, unstable commands. Subject to change without notice."""
-    import os
-
     if os.environ.get("CREWAI_EXPERIMENTAL") != "1":
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/cli/src/crewai_cli/cli.py` at line 549, Remove the redundant local
"import os" statement found in the function/block (the duplicated "import os"
line) since "os" is already imported at the top of the file; simply delete the
duplicate import and run tests/lint to verify no references were affected.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@lib/crewai/src/crewai/experimental/skills/registry.py`:
- Around line 23-27: The error message in the SkillNotCachedError constructor
(__init__) points users to the old CLI command; update the string to instruct
running "crewai experimental skill install {ref}" instead of "crewai skill
install {ref}" so the exception message correctly guides users to the
experimental CLI path (update the f-string in the __init__ of
SkillNotCachedError to use the new command).

---

Nitpick comments:
In `@lib/cli/src/crewai_cli/cli.py`:
- Line 549: Remove the redundant local "import os" statement found in the
function/block (the duplicated "import os" line) since "os" is already imported
at the top of the file; simply delete the duplicate import and run tests/lint to
verify no references were affected.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c0c4d21c-f84b-4549-8b74-23f32b4b6346

📥 Commits

Reviewing files that changed from the base of the PR and between 2148c7e and b980dd8.

📒 Files selected for processing (21)
  • lib/cli/src/crewai_cli/cli.py
  • lib/cli/src/crewai_cli/experimental/__init__.py
  • lib/cli/src/crewai_cli/experimental/skills/__init__.py
  • lib/cli/src/crewai_cli/experimental/skills/main.py
  • lib/cli/tests/experimental/__init__.py
  • lib/cli/tests/experimental/skills/__init__.py
  • lib/cli/tests/experimental/skills/test_main.py
  • lib/crewai/src/crewai/agent/core.py
  • lib/crewai/src/crewai/events/types/skill_events.py
  • lib/crewai/src/crewai/experimental/skills/__init__.py
  • lib/crewai/src/crewai/experimental/skills/_flag.py
  • lib/crewai/src/crewai/experimental/skills/cache.py
  • lib/crewai/src/crewai/experimental/skills/events.py
  • lib/crewai/src/crewai/experimental/skills/registry.py
  • lib/crewai/src/crewai/skills/__init__.py
  • lib/crewai/tests/experimental/skills/__init__.py
  • lib/crewai/tests/experimental/skills/conftest.py
  • lib/crewai/tests/experimental/skills/test_cache.py
  • lib/crewai/tests/experimental/skills/test_flag.py
  • lib/crewai/tests/experimental/skills/test_models_version.py
  • lib/crewai/tests/experimental/skills/test_registry.py
💤 Files with no reviewable changes (2)
  • lib/crewai/src/crewai/skills/init.py
  • lib/crewai/src/crewai/events/types/skill_events.py

The skill version is now stored as `metadata.version` rather than a
top-level field on `SkillFrontmatter`. A `before` validator lifts any
top-level YAML `version:` into `metadata['version']` so existing SKILL.md
files keep parsing.

- crewai.skills.models: drop `version` field; add lift validator
- crewai_cli experimental skill template: `metadata.version: 0.1.0`
- publish/_read_version: read from metadata first, fall back to top-level
- test_models_version: cover metadata access, lift, and precedence
@github-actions github-actions Bot added size/L and removed size/M labels May 28, 2026
Per the agentskills.io spec, `version` only ever lives under `metadata` —
top-level was never a valid frontmatter field. Remove the back-compat
lift validator on SkillFrontmatter and the matching CLI fallback in
publish/_read_version.
coderabbitai[bot]
coderabbitai Bot previously requested changes May 28, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/crewai/src/crewai/skills/models.py`:
- Around line 97-105: The lift_top_level_version method is currently using
values.get("metadata") or {} which will coerce falsy but invalid metadata (e.g.
"" or []) into an empty dict and hide malformed input; change the logic in
lift_top_level_version to only default metadata to {} when metadata is exactly
None, e.g. metadata = values.get("metadata") and if metadata is None: metadata =
{}; then ensure you only assign metadata["version"] when isinstance(metadata,
dict) and finally return values from lift_top_level_version so the updated dict
is returned.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 13e704b7-aae6-41ca-b943-49c7018cdba9

📥 Commits

Reviewing files that changed from the base of the PR and between b980dd8 and dff2e6f.

📒 Files selected for processing (3)
  • lib/cli/src/crewai_cli/experimental/skills/main.py
  • lib/crewai/src/crewai/skills/models.py
  • lib/crewai/tests/experimental/skills/test_models_version.py

Comment thread lib/crewai/src/crewai/skills/models.py Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9d3ef6c. Configure here.

Comment thread lib/cli/src/crewai_cli/experimental/skills/main.py
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

@greysonlalonde greysonlalonde merged commit ed91100 into main May 28, 2026
56 checks passed
@greysonlalonde greysonlalonde deleted the gl/refactor/skills-repo-experimental branch May 28, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants