Skip to content

fix(skill-creator): support direct execution of package_skill.py and update usage paths - #1681

Open
Kuldeeep18 wants to merge 2 commits into
anthropics:mainfrom
Kuldeeep18:fix/skill-creator-package-skill-direct-execution
Open

Kuldeeep18 wants to merge 2 commits into
anthropics:mainfrom
Kuldeeep18:fix/skill-creator-package-skill-direct-execution

Conversation

@Kuldeeep18

Copy link
Copy Markdown

Problem

Running \package_skill.py\ directly as a standalone script (e.g., \python skills/skill-creator/scripts/package_skill.py ) fails with \ModuleNotFoundError: No module named 'scripts.quick_validate'. Additionally, the docstrings and CLI help messages contain outdated references to \utils/package_skill.py\ and \skills/public/....

Root Cause

When executed directly as a script, Python places the script's immediate directory (\skills/skill-creator/scripts) at \sys.path[0], preventing the top-level \scripts\ package from being resolved.

Solution

  1. Add the parent \skill-creator\ directory to \sys.path\ if not already present, allowing \ rom scripts.quick_validate import validate_skill\ to resolve under both direct script execution and module execution (\python -m scripts.package_skill).
  2. Update the docstring and CLI help usage examples to reference current repository paths (\scripts/package_skill.py\ and \skills/brand-guidelines).

Verification

  • Direct execution from workspace root: \python skills/skill-creator/scripts/package_skill.py skills/brand-guidelines\
  • Direct execution from \skills/skill-creator: \python scripts/package_skill.py ../brand-guidelines\
  • Module execution from \skills/skill-creator: \python -m scripts.package_skill ../brand-guidelines\
  • Verified CLI usage message when called without arguments.

Risk

Low. The change is limited to \package_skill.py\ and preserves the existing \scripts.quick_validate\ import. Direct and module execution were both verified successfully.

@Kuldeeep18

Copy link
Copy Markdown
Author

Hi @maheshmurag, whenever you have a moment, could you please take a look at this quick fix? It is a small self-contained change (+13/-6) resolving standalone script execution for package_skill.py while preserving existing module imports. All verification steps have been tested and passed.

@Kuldeeep18
Kuldeeep18 force-pushed the fix/skill-creator-package-skill-direct-execution branch from 93e57e4 to f99c58a Compare September 19, 2026 16:29
@Kuldeeep18

Copy link
Copy Markdown
Author

Hi @maheshmurag, just following up on this small self-contained fix. I've rebased the branch onto the latest \main\ so it is clean and ready to merge whenever you have a moment. Thank you!

@98zc5g5jyw-arch

Copy link
Copy Markdown

Hi @Kuldeeep18 — thanks for the fix, and for the rebase: the branch now sits on the current main tip (34040c9), single commit, MERGEABLE. Reviewed at head f99c58a3fd3a0e12e9f7882e5d7d12d06634cd18 and ran a two-state battery with Python 3.11:

  • ✅ Direct execution fails before, works after: from the repo root, python skills/skill-creator/scripts/package_skill.py skills/brand-guidelines → pre-PR file raises ModuleNotFoundError: No module named 'scripts' (exit 1); head packages brand-guidelines.skill (exit 0).
  • ✅ Works from any cwd: also verified from skills/skill-creator/ (python scripts/package_skill.py ../brand-guidelines) and from an unrelated directory with an absolute script path — all succeed.
  • ✅ No module-mode regression: python -m scripts.package_skill ../brand-guidelines works on both the pre-PR file and head (the not in sys.path guard makes the insert a no-op under -m).
  • ✅ Docs & packaging: usage examples now point at scripts/package_skill.py / skills/brand-guidelines; no utils/package_skill.py references remain anywhere in the tree (grepped); the generated .skill contains brand-guidelines/SKILL.md + LICENSE.txt (identical 5281-byte artifact in every mode); py_compile clean; 100755 mode preserved; the diff is the single file, +13/−6.

Optional (non-blocking): run_eval.py, run_loop.py and improve_description.py carry the same from scripts.… imports — direct execution still raises the same ModuleNotFoundError (verified on run_eval.py). They're documented as python -m scripts.…, so nothing needs changing in this PR; just noting a shared bootstrap would cover them if direct execution is wanted repo-wide.

@Kuldeeep18

Copy link
Copy Markdown
Author

Hi @cj-ant, @rlancemartin — gentle follow-up on this standalone execution fix for \package_skill.py.

The branch is up to date with latest \main, clean, and has been verified by community reviewers across all execution modes without regression. Whenever you have a moment, could you please take a look for merge? Thank you!

@98zc5g5jyw-arch

Copy link
Copy Markdown

Follow-up re-review at head 01b0047ee1.

Since our previous review at f99c58a3fd3a (comment above), the only change is a merge of main (3337550, claude-api docs): skills/skill-creator/scripts/package_skill.py is byte-identical to the previously reviewed revision (blob 07dc5208). Re-ran the two-state battery at the new head (Python 3.11):

Verified

  • Parent state (f99c58a^) direct execution from its own repo root: ModuleNotFoundError: No module named 'scripts', exit 1; at the new head: exit 0, packages brand-guidelines.skill.
  • Works from every cwd: repo root, skills/skill-creator/ (relative scripts/package_skill.py ../brand-guidelines), and an unrelated directory with absolute paths — all exit 0.
  • No module-mode regression: python -m scripts.package_skill ../brand-guidelines exit 0.
  • All four artifacts identical (sha256 586639af…), containing brand-guidelines/SKILL.md + LICENSE.txt.
  • Diff re-checked at the new head: single file, +13/−6; py_compile clean; mode 100755 preserved; no utils/package_skill.py references remain; no network/subprocess patterns in the touched file.

Remaining: none blocking. The optional note from the earlier review still stands (siblings run_eval.py / run_loop.py / improve_description.py share the from scripts.… pattern and are documented as python -m scripts.…; a shared bootstrap would cover them if direct execution is ever wanted repo-wide).

Still LGTM for merge.

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.

3 participants