← Back to PRs

#10579: feat(skills): auto-discover project-scoped skills from .claude/skills and .agents/skills

by mycarrysun-lowerbot open 2026-02-06 17:51 View on GitHub →
commands agents stale
## 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