SkillPedia Skills Encyclopedia
中文 EN

Skills 2026-09-03 02:47 UTC

vietnamese-language-skill

Committed by davengn. Update Category: Performance & Efficiency Optimizations. Commit details: Optimize file collection by excluding build/dependency directories (#6). This update improves response speed and lowers resource consumption.

davengn 9ab8443 trussary/vietnamese-language-skill

CommitRaw commit message

Optimize file collection by excluding build/dependency directories (#6)

* fix(perf): stop walking node_modules/.git when linting a directory

collect() in validate_copy.py and check_font_coverage.py used
Path.rglob("*") to find files inside a directory argument, which
descends into every subdirectory before filtering by extension. Run
against a real project (python validate_copy.py src/messages/, the
skill's own documented usage) rather than this repo's own dependency-
free skill folders, that walks node_modules, .git, dist/build output,
etc. in full — the actual cause of the skill "taking too long to
launch" once it's used outside this repo, since a typical
node_modules tree is tens to hundreds of thousands of files for a
handful of matching source files.

Switch to os.walk with in-place dirnames pruning so common
dependency/build/VCS directories (node_modules, .git, dist, build,
.next, venv, __pycache__, target, vendor, coverage, ...) are never
descended into. Behavior for the intended targets (a skill folder, a
src/ tree) is unchanged — only the excluded directories are skipped.

Fixed in shared/scripts/validate_copy.py and propagated to all five
skills via tools/sync_shared.py. check_font_coverage.py isn't part of
shared/, so the same fix is applied to its four duplicated copies
directly, keeping them byte-identical.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011hS1v8wWe6Ey7y2vVgcMAq

* fix: restore regular-file filtering in the os.walk directory collector

os.walk()'s filenames list includes anything that isn't a directory —
FIFOs, sockets, device files, and dangling symlinks, none of which the
prior Path.rglob(...).is_file() collector would have picked up. A FIFO
matching the extension filter would hang the linter on read (blocking
until a writer connects), and a dangling symlink would surface as a
spurious IO001 finding — both regressions from the node_modules-pruning
fix in this PR.

Add back an is_file() check on each extension-matched candidate before
including it, matching pre-PR behavior. Verified with a real named pipe
and a dangling symlink dropped into a scanned directory: no hang, no
spurious findings, and the one regular file present is still picked up.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011hS1v8wWe6Ey7y2vVgcMAq

---------

Co-authored-by: Claude <noreply@anthropic.com>