#10579: feat(skills): auto-discover project-scoped skills from .claude/skills and .agents/skills
commands
agents
stale
Cluster:
Skill Enhancements and Fixes
## Summary
Adds support for per-project skill discovery based on the **current working directory (cwd)**, enabling automatic skill loading when working in cloned repos.
### Supported directories (checked in cwd):
- `.claude/skills/` — Claude Code compatibility
- `.agents/skills/` — Cross-agent convention
### New `cwd` parameter
Added to all skill loading functions:
- `loadWorkspaceSkillEntries(workspaceDir, { cwd })`
- `buildWorkspaceSkillSnapshot(workspaceDir, { cwd })`
- `buildWorkspaceSkillsPrompt(workspaceDir, { cwd })`
- `buildWorkspaceSkillCommandSpecs(workspaceDir, { cwd })`
### Precedence (lowest to highest):
1. extra (config extraDirs)
2. bundled
3. managed
4. `.agents/skills/` (from cwd)
5. `.claude/skills/` (from cwd)
6. `workspace/skills`
Falls back to `workspaceDir` if `cwd` is not provided.
### Why both directories?
- `.claude/skills/` is Claude Code's current format — immediate compatibility
- `.agents/skills/` is the emerging cross-agent standard — future-proof
### Changes:
- `src/agents/skills/workspace.ts` — Add `cwd` param, load skills from project directories
- `src/agents/skills.loadworkspaceskillentries.project-skills.test.ts` — Test coverage
- Updated all callers to pass `cwd: process.cwd()`
### Use case:
When working in a cloned repo like `/home/user/repos/my-project`, OpenClaw can now discover skills from `/home/user/repos/my-project/.claude/skills/` without manual configuration.
Closes #10595
Related: #8822
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
- Adds project-scoped skill discovery by extending workspace skill loaders to also scan `<cwd>/.agents/skills` and `<cwd>/.claude/skills` (with `.claude` higher precedence).
- Threads a new optional `cwd` parameter through skill snapshot/prompt/spec generation and several call sites to ensure the runtime CWD is used when building prompts/snapshots.
- Adds a new Vitest suite covering loading from both project-scope directories and precedence rules.
<h3>Confidence Score: 3/5</h3>
- This PR is close to safe to merge, but at least one newly added test is incorrect and will likely fail in CI.
- Core implementation changes are localized and the precedence merge logic is straightforward, but the new test case expecting an empty entry list conflicts with the loader’s default behavior of always including bundled/managed/workspace skills, making test failure very likely.
- src/agents/skills.loadworkspaceskillentries.project-skills.test.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#12076: fix(skills): recursive directory filtering to actually exclude venv...
by xiaoyaner0201 · 2026-02-08
78.1%
#10016: fix: prevent FD exhaustion from skill watcher scanning artifact trees
by oldeucryptoboi · 2026-02-06
77.9%
#8873: fix: document skill loading locations in system prompt
by ytfh44 · 2026-02-04
77.9%
#12956: fix: guard .trim() calls on potentially undefined workspaceDir
by omair445 · 2026-02-10
74.5%
#19664: fix(skills): log skill YAML parsing diagnostics with skill name
by orchidsun · 2026-02-18
74.3%
#15115: fix: pre-load skill docs in cron sessions to prevent hallucinated syn…
by joaolcorreia · 2026-02-13
74.3%
#9595: fix(skills): ignore .venv, __pycache__, and .openclaw to prevent FD...
by amoghacloud · 2026-02-05
74.0%
#9925: docs: warn about Python venv placement in skill directories
by kj9kj9qv4m-bit · 2026-02-05
74.0%
#14023: fix: filter skills watcher to relevant file types to prevent FD exh...
by funmerlin · 2026-02-11
73.4%
#9221: fix(skills): use skillKey for env config lookup in snapshots
by gavinbmoore · 2026-02-05
73.3%