Skip to content

feat: define skill placement and provenance policy#748

Merged
affaan-m merged 1 commit into
affaan-m:mainfrom
nehaaprasad:feat/def-gen-skill-plc-pol
Mar 22, 2026
Merged

feat: define skill placement and provenance policy#748
affaan-m merged 1 commit into
affaan-m:mainfrom
nehaaprasad:feat/def-gen-skill-plc-pol

Conversation

@nehaaprasad

@nehaaprasad nehaaprasad commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

fix : #422

What Changed

  • Added docs/SKILL-PLACEMENT-POLICY.md and schemas/provenance.schema.json.
  • Clarified CI validators (curated vs generated paths); validate-commands allows learned / imported skill path refs.
  • Linked policy from CLAUDE.md.

Why This Change

  • Separate curated vs generated/imported skills, provenance rules, and what ships vs stays local.
  • Remove ambiguous validator behavior around optional/generated skill locations.

Testing Done

  • Manual testing completed (ran validate-skills.js, validate-commands.js, skill-evolution.test.js)
  • Edge cases considered and tested (reserved roots; validators unchanged for real missing skills)

Type of Change

[x] feat: New feature
[x] docs: Documentation
[x] ci: CI/CD changes

Security & Quality Checklist

[x] No secrets or API keys committed (ghp_, sk-, AKIA, xoxb, xoxp patterns checked)
[x] JSON files validate cleanly
[x] No sensitive data exposed in logs or output
[x] Follows conventional commits format

Documentation

[x] Updated relevant documentation
[x] Added comments for complex logic

Summary by CodeRabbit

  • Documentation
    • Established comprehensive policy documentation for skill placement and organization
    • Defined provenance metadata schema specifying required tracking fields for skills (source, author, creation timestamp, confidence level)

@ecc-tools

ecc-tools Bot commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Analyzing 5000 commits...

@ecc-tools

ecc-tools Bot commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Analysis Failed

Not Found - https://docs.github.com/rest/git/refs#get-a-reference

Troubleshooting
Cause Resolution
Large repository Analysis may timeout on repos with extensive history
API rate limits Wait 15 minutes before retrying
Network issues Queue timeout is 15 minutes; retry may succeed
Permissions Verify app has Contents: Read access

Retry: /ecc-tools analyze


Report Issue | ECC Tools

@coderabbitai

coderabbitai Bot commented Mar 22, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR establishes a comprehensive skill placement and provenance policy framework by adding documentation, a JSON schema for provenance validation, and updating CI validators to enforce curated versus generated/imported skill distinctions across repository directories.

Changes

Cohort / File(s) Summary
Documentation & Policy
CLAUDE.md, docs/SKILL-PLACEMENT-POLICY.md
Added development note referencing skill placement policy and introduced comprehensive policy document defining directory roots for curated (skills/), learned/imported (~/.claude/skills/), and evolved skills with provenance requirements, validation rules, and implementation roadmap.
Schema Definition
schemas/provenance.schema.json
New JSON Schema defining skill provenance object with required fields: source, created_at (ISO 8601), confidence (0–1), and author; allows additional properties.
CI Validators
scripts/ci/validate-commands.js, scripts/ci/validate-install-manifests.js, scripts/ci/validate-skills.js
Updated validator logic and messaging: added reserved-root whitelist for learned/imported in command validation, clarified install manifest policy excludes generated roots, and adjusted skill validator scope to curated directories only with updated no-op messaging.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • affaan-m

Poem

🐰 Hop along, skills now have a home sweet home,
Curated in skills/, or abroad they may roam,
With provenance tracked and validators aligned,
A policy clear for all skills to find! 🌱✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: define skill placement and provenance policy' accurately and concisely summarizes the main objective of the pull request, which is to define and document the skill placement and provenance policy framework.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Tip

CodeRabbit can use oxc to improve the quality of JavaScript and TypeScript code reviews.

Add a configuration file to your project to customize how CodeRabbit runs oxc.

@greptile-apps

greptile-apps Bot commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR establishes a formal skill placement and provenance policy by adding docs/SKILL-PLACEMENT-POLICY.md and schemas/provenance.schema.json, and updates the CI validators to align with the new curated-vs-generated distinction. The changes are primarily documentation and minor clarifications to existing scripts, with no breaking logic changes.

Key changes:

  • New policy doc (docs/SKILL-PLACEMENT-POLICY.md) clearly separates curated (skills/), learned (~/.claude/skills/learned/), imported (~/.claude/skills/imported/), and evolved (~/.claude/homunculus/…) skill roots, and documents which are shipped and which require provenance.
  • New JSON schema (schemas/provenance.schema.json) formalizes the provenance record structure. Note: additionalProperties is explicitly set to true, which allows unrecognized or misspelled fields to silently pass schema validation — consider setting it to false.
  • validate-commands.js: Adds a reservedSkillRoots set so skills/learned/ and skills/imported/ references in command files no longer generate spurious warnings. The set is created inside the per-file loop and should be hoisted out for clarity.
  • validate-install-manifests.js / validate-skills.js: Comment-only changes to make the curated-only scope explicit.
  • Documentation inconsistency: The per-project evolved path in the policy doc summary table is missing the ~/.claude/homunculus/ prefix — correctly written in the detailed section below.

Confidence Score: 4/5

  • Safe to merge with minor documentation and style fixes addressed.
  • No functional logic regressions — CI validator behavior is correct and backward-compatible. The one factual error (truncated evolved path in the policy doc table) is documentation-only and doesn't affect runtime behavior. The additionalProperties: true in the schema and the in-loop Set instantiation are low-risk style concerns.
  • docs/SKILL-PLACEMENT-POLICY.md (path inconsistency in table) and schemas/provenance.schema.json (additionalProperties setting).

Important Files Changed

Filename Overview
CLAUDE.md Single-line addition linking to the new skill placement policy doc — clean, accurate, and well-placed.
docs/SKILL-PLACEMENT-POLICY.md New policy document with a factual inconsistency: the per-project evolved skill path in the summary table is missing the ~/.claude/homunculus/ prefix, while the detailed section below has it correct. Everything else is well-structured and comprehensive.
schemas/provenance.schema.json New JSON Schema for provenance metadata. Required fields and constraints are correct; additionalProperties: true (explicit) allows unrecognized/misspelled fields to pass validation silently — should be false for a strict schema.
scripts/ci/validate-commands.js Added reservedSkillRoots set to skip validation warnings for learned/imported skill path references. Logic is correct but the Set is instantiated inside the per-file loop rather than hoisted outside.
scripts/ci/validate-install-manifests.js Comment-only change clarifying that module paths are curated repo paths only. No logic changes.
scripts/ci/validate-skills.js Header comment and log message updated to reflect the curated-only scope. No logic changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Skill] --> B{Classification}
    B -->|Curated| C["skills/<name>/ (repo)"]
    B -->|Learned| D["~/.claude/skills/learned/<name>/"]
    B -->|Imported| E["~/.claude/skills/imported/<name>/"]
    B -->|Evolved| F["~/.claude/homunculus/evolved/skills/<name>/"]

    C --> G[No .provenance.json required]
    C --> H[Validated by validate-skills.js]
    C --> I[In install manifests]
    C --> J[Shipped]

    D --> K[.provenance.json required]
    E --> K
    F --> L[Provenance inherited from instinct source]

    K --> M[validateProvenance in provenance.js]
    M --> N[Schema: provenance.schema.json]

    H --> O[validate-install-manifests.js checks all paths exist]
    
    P[validate-commands.js] -->|Skip warn for| Q["reservedSkillRoots: learned, imported"]
    P -->|Warn if missing| R[Other skill refs not in skills/]
Loading

Reviews (1): Last reviewed commit: "feat: define skill placement and provena..." | Re-trigger Greptile

| Curated | `skills/` (repo) | Yes | Not required |
| Learned | `~/.claude/skills/learned/` | No | Required |
| Imported | `~/.claude/skills/imported/` | No | Required |
| Evolved | `~/.claude/homunculus/evolved/skills/` (global) or `projects/<hash>/evolved/skills/` (per-project) | No | Inherits from instinct source |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Incomplete per-project evolved path in table

The per-project path in the table is missing the ~/.claude/homunculus/ prefix. It currently reads projects/<hash>/evolved/skills/, but the detailed section below (line 45) correctly shows the full path as ~/.claude/homunculus/projects/<hash>/evolved/skills/. This inconsistency could cause contributors to create skills in the wrong location.

Suggested change
| Evolved | `~/.claude/homunculus/evolved/skills/` (global) or `projects/<hash>/evolved/skills/` (per-project) | No | Inherits from instinct source |
| Evolved | `~/.claude/homunculus/evolved/skills/` (global) or `~/.claude/homunculus/projects/<hash>/evolved/skills/` (per-project) | No | Inherits from instinct source |


// Check skill directory references (e.g., "skills/tdd-workflow/")
// learned and imported are reserved roots (~/.claude/skills/); no local dir expected
const reservedSkillRoots = new Set(['learned', 'imported']);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 reservedSkillRoots instantiated on every loop iteration

reservedSkillRoots is declared inside the for (const file of files) loop, so a new Set is created for every command file processed. Since the set is constant and does not depend on any per-file state, it should be hoisted outside the loop so it is created only once.

Suggested change
const reservedSkillRoots = new Set(['learned', 'imported']);
const reservedSkillRoots = new Set(['learned', 'imported']);
for (const file of files) {

Then remove the inner declaration at line 103.

}
},
"required": ["source", "created_at", "confidence", "author"],
"additionalProperties": true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 additionalProperties: true allows unvalidated fields silently

"additionalProperties": true is the JSON Schema default and means any extra or misspelled field (e.g. "confidance": 0.9) will pass schema validation without any error. Since this is a provenance schema with a fixed set of required fields, using false would make schema validation strictly enforce the contract and catch typos early.

Suggested change
"additionalProperties": true
"additionalProperties": false

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

3 issues found across 6 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="docs/SKILL-PLACEMENT-POLICY.md">

<violation number="1" location="docs/SKILL-PLACEMENT-POLICY.md:12">
P2: The policy document defines conflicting per-project evolved skill paths, which can cause skills to be read/written in the wrong location.</violation>

<violation number="2" location="docs/SKILL-PLACEMENT-POLICY.md:28">
P2: Documentation implies configurable learned skill location, but health/provenance scripts default to fixed `~/.claude/skills/learned` unless separately overridden, causing inconsistent behavior for custom paths.</violation>

<violation number="3" location="docs/SKILL-PLACEMENT-POLICY.md:31">
P2: Policy text claims provenance is currently mandatory, but the roadmap and code indicate enforcement is not yet implemented.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.


Location: `~/.claude/skills/learned/<skill-name>/`.

Created by continuous-learning (evaluate-session hook, /learn command). Default path is configurable via `skills/continuous-learning/config.json` → `learned_skills_path`.

@cubic-dev-ai cubic-dev-ai Bot Mar 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Documentation implies configurable learned skill location, but health/provenance scripts default to fixed ~/.claude/skills/learned unless separately overridden, causing inconsistent behavior for custom paths.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/SKILL-PLACEMENT-POLICY.md, line 28:

<comment>Documentation implies configurable learned skill location, but health/provenance scripts default to fixed `~/.claude/skills/learned` unless separately overridden, causing inconsistent behavior for custom paths.</comment>

<file context>
@@ -0,0 +1,104 @@
+
+Location: `~/.claude/skills/learned/<skill-name>/`.
+
+Created by continuous-learning (evaluate-session hook, /learn command). Default path is configurable via `skills/continuous-learning/config.json` → `learned_skills_path`.
+
+- Not in repo. Not shipped.
</file context>
Suggested change
Created by continuous-learning (evaluate-session hook, /learn command). Default path is configurable via `skills/continuous-learning/config.json``learned_skills_path`.
Created by continuous-learning (evaluate-session hook, /learn command). Write path is configurable via `skills/continuous-learning/config.json``learned_skills_path`; note that health/provenance tooling defaults to `~/.claude/skills/learned` unless `--learned-root`/`--home` overrides are provided.
Fix with Cubic

Created by continuous-learning (evaluate-session hook, /learn command). Default path is configurable via `skills/continuous-learning/config.json` → `learned_skills_path`.

- Not in repo. Not shipped.
- Must have `.provenance.json` sibling to `SKILL.md`.

@cubic-dev-ai cubic-dev-ai Bot Mar 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Policy text claims provenance is currently mandatory, but the roadmap and code indicate enforcement is not yet implemented.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/SKILL-PLACEMENT-POLICY.md, line 31:

<comment>Policy text claims provenance is currently mandatory, but the roadmap and code indicate enforcement is not yet implemented.</comment>

<file context>
@@ -0,0 +1,104 @@
+Created by continuous-learning (evaluate-session hook, /learn command). Default path is configurable via `skills/continuous-learning/config.json` → `learned_skills_path`.
+
+- Not in repo. Not shipped.
+- Must have `.provenance.json` sibling to `SKILL.md`.
+- Loaded at runtime when directory exists.
+
</file context>
Fix with Cubic

| Curated | `skills/` (repo) | Yes | Not required |
| Learned | `~/.claude/skills/learned/` | No | Required |
| Imported | `~/.claude/skills/imported/` | No | Required |
| Evolved | `~/.claude/homunculus/evolved/skills/` (global) or `projects/<hash>/evolved/skills/` (per-project) | No | Inherits from instinct source |

@cubic-dev-ai cubic-dev-ai Bot Mar 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: The policy document defines conflicting per-project evolved skill paths, which can cause skills to be read/written in the wrong location.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/SKILL-PLACEMENT-POLICY.md, line 12:

<comment>The policy document defines conflicting per-project evolved skill paths, which can cause skills to be read/written in the wrong location.</comment>

<file context>
@@ -0,0 +1,104 @@
+| Curated | `skills/` (repo) | Yes | Not required |
+| Learned | `~/.claude/skills/learned/` | No | Required |
+| Imported | `~/.claude/skills/imported/` | No | Required |
+| Evolved | `~/.claude/homunculus/evolved/skills/` (global) or `projects/<hash>/evolved/skills/` (per-project) | No | Inherits from instinct source |
+
+Curated skills live in the repo under `skills/`. Install manifests reference only curated paths. Generated and imported skills live under the user home directory and are never shipped.
</file context>
Fix with Cubic

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/SKILL-PLACEMENT-POLICY.md`:
- Line 12: The per-project evolved skill path is inconsistent: update the entry
that currently shows `projects/<hash>/evolved/skills/` so it matches the other
section by including the `~/.claude/homunculus/` prefix (i.e., use
`~/.claude/homunculus/projects/<hash>/evolved/skills/`), and make the same
change wherever the shorter form appears (ensure both occurrences are consistent
with the `~/.claude/homunculus/evolved/skills/` global path).
- Line 65: The docs claim that validateProvenance performs schema-based
validation but the function in scripts/lib/skill-evolution/provenance.js
currently uses hard-coded checks; either update validateProvenance to load and
apply schemas/provenance.schema.json (e.g., import/require the JSON schema,
compile it with your project's validator like Ajv, replace the manual property
checks in validateProvenance with a schema validate/validate.errors flow and
return/report those errors) or change the doc line to state that
validateProvenance uses explicit hard-coded checks rather than schema
compilation; reference validateProvenance and schemas/provenance.schema.json
when making the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 77ddaca4-590a-44f6-a0f9-b417a67134c1

📥 Commits

Reviewing files that changed from the base of the PR and between 900c983 and 4fb4cdc.

📒 Files selected for processing (6)
  • CLAUDE.md
  • docs/SKILL-PLACEMENT-POLICY.md
  • schemas/provenance.schema.json
  • scripts/ci/validate-commands.js
  • scripts/ci/validate-install-manifests.js
  • scripts/ci/validate-skills.js

| Curated | `skills/` (repo) | Yes | Not required |
| Learned | `~/.claude/skills/learned/` | No | Required |
| Imported | `~/.claude/skills/imported/` | No | Required |
| Evolved | `~/.claude/homunculus/evolved/skills/` (global) or `projects/<hash>/evolved/skills/` (per-project) | No | Inherits from instinct source |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Per-project evolved path is inconsistent across sections.

Line 12 omits the ~/.claude/homunculus/ prefix that Line 45 includes, which can mislead path resolution.

Suggested doc fix
-| Evolved | `~/.claude/homunculus/evolved/skills/` (global) or `projects/<hash>/evolved/skills/` (per-project) | No | Inherits from instinct source |
+| Evolved | `~/.claude/homunculus/evolved/skills/` (global) or `~/.claude/homunculus/projects/<hash>/evolved/skills/` (per-project) | No | Inherits from instinct source |

Also applies to: 45-45

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/SKILL-PLACEMENT-POLICY.md` at line 12, The per-project evolved skill
path is inconsistent: update the entry that currently shows
`projects/<hash>/evolved/skills/` so it matches the other section by including
the `~/.claude/homunculus/` prefix (i.e., use
`~/.claude/homunculus/projects/<hash>/evolved/skills/`), and make the same
change wherever the shorter form appears (ensure both occurrences are consistent
with the `~/.claude/homunculus/evolved/skills/` global path).

| confidence | number | 0–1 |
| author | string | Who or what produced the skill |

Schema: `schemas/provenance.schema.json`. Validation: `scripts/lib/skill-evolution/provenance.js` → `validateProvenance`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify whether provenance validator actually loads/uses the schema file.
rg -n "provenance\\.schema\\.json|validateProvenance|Ajv|compile\\(" \
  scripts/lib/skill-evolution/provenance.js \
  schemas/provenance.schema.json \
  docs/SKILL-PLACEMENT-POLICY.md

Repository: affaan-m/everything-claude-code

Length of output: 476


🏁 Script executed:

cat -n scripts/lib/skill-evolution/provenance.js | sed -n '98,130p'

Repository: affaan-m/everything-claude-code

Length of output: 1218


🏁 Script executed:

ls -la schemas/provenance.schema.json 2>/dev/null || echo "Schema file not found"

Repository: affaan-m/everything-claude-code

Length of output: 153


🏁 Script executed:

head -50 schemas/provenance.schema.json 2>/dev/null || echo "Schema file not readable"

Repository: affaan-m/everything-claude-code

Length of output: 952


Validation claim is stronger than current implementation.

This line states schema-based validation is performed by validateProvenance, but the function uses hard-coded checks instead of loading and applying schemas/provenance.schema.json. The validation rules in the code (lines 98-130) mirror the schema requirements, but the implementation directly validates properties rather than compiling and using the schema. Wire schema validation into validateProvenance or reword this line to accurately describe the validation approach.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/SKILL-PLACEMENT-POLICY.md` at line 65, The docs claim that
validateProvenance performs schema-based validation but the function in
scripts/lib/skill-evolution/provenance.js currently uses hard-coded checks;
either update validateProvenance to load and apply
schemas/provenance.schema.json (e.g., import/require the JSON schema, compile it
with your project's validator like Ajv, replace the manual property checks in
validateProvenance with a schema validate/validate.errors flow and return/report
those errors) or change the doc line to state that validateProvenance uses
explicit hard-coded checks rather than schema compilation; reference
validateProvenance and schemas/provenance.schema.json when making the change.

@affaan-m

Copy link
Copy Markdown
Owner

Interesting addition. Will review. 🦞

@codeCraft-Ritik codeCraft-Ritik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Excellent contribution! The addition of a clear skill placement policy brings much-needed structure to the project

@affaan-m affaan-m left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Clean policy doc addressing #422. Validator scoping is correct.

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.

Define generated skill placement and provenance policy

3 participants