SkillSpector Browser Porting & Upgrade Methodology
This skill provides step-by-step instructions for porting a new version of the SkillSpector Python security scanner into a 100% browser-executed WebAssembly / JavaScript web application (SkillSpectorWeb).
🎯 Architectural Principles
-
100% Client-Side Browser Execution:
- The scanner must run entirely in the user's browser without requiring a backend server.
- All GitHub repository content is fetched via GitHub REST APIs (
api.github.comandraw.githubusercontent.com).
-
Strict Module Isolation:
- Core Scanner Engine (
docs/js/skillspector-engine.js): Pure translated static analysis rules matching Pythonnodes/analyzers/. - Isolated Repo Filter (
docs/js/repo-filter.js): Keeps custom non-skill file filtering (README.md,CHANGELOG.md,.git/, etc.) separated from translated scanner code. - GitHub Fetcher (
docs/js/github-fetcher.js): Handles URL parsing, tree expansion, and batch downloading.
- Core Scanner Engine (
-
Multi-Skill Repository Support:
- Must mirror
src/skillspector/multi_skill.pyto discover all nested skills across a repository (resources/skills/*.md,skills/*.md,agents/*.md).
- Must mirror
-
License & Version Parity:
- Retain exact version numbers (
vX.Y.Z) matching the upstream Python SkillSpector release. - Preserve the unedited upstream
LICENSE(Apache 2.0).
- Retain exact version numbers (
📋 Step-by-Step Porting Workflow
Phase 1: Rule & AST Analysis Extraction
- Inspect new analyzer rules in upstream
src/skillspector/nodes/analyzers/:pattern_defaults.py(Rule IDs:P1-P8,E1-E5,PE1-PE3,SC1-SC7,EA1-EA4,OH1-OH3,MP1-MP3,TM1-TM4,RA1-RA2,TR1-TR3,MCP1).
- Translate new Python regexes and AST checks into JavaScript
RegExppatterns insidedocs/js/skillspector-engine.js. - Update category lists, rule descriptions, explanations, and remediation guides.
Phase 2: GitHub Fetcher & Tree Expansion
- Ensure
docs/js/github-fetcher.jsfetches recursive tree structures viahttps://api.github.com/repos/{owner}/{repo}/git/trees/{branch}?recursive=1. - Do NOT cap fetching to small arbitrary file limits (use high threshold up to 250 files to support large multi-skill repositories).
- Use parallel batch fetching (e.g. 10 files per batch) with live UI progress callbacks (
onProgress(current, total, filename)).
Phase 3: Multi-Skill Discovery Engine
- Implement
discoverSkills(filesMap)inskillspector-engine.js. - Parse Markdown frontmatter YAML (
--- name: ... description: ... ---) for all.mdfiles in the repository. - Render a multi-skill selector bar in
index.htmlallowing users to filter findings by individual discovered skill or inspect the whole repository context.
Phase 4: Isolated Repository File Filtering
- Keep
docs/js/repo-filter.jscompletely separate from the core scanner engine. - Provide UI checkboxes in
index.html:Omit Standard Repo Docs (README, CHANGELOG, LICENSE)Omit System Metadata (.git/, .github/, dotfiles)
- Log omitted files into the Inspection Ledger as
skippeditems with explicit reasons.
Phase 5: GitHub Pages Packaging (docs/)
- Ensure all static website assets live inside
SkillSpectorWeb/docs/:docs/index.htmldocs/css/styles.cssdocs/js/*.jsdocs/CNAME(skillspector.niyogilabs.com)docs/sitemap.xmldocs/robots.txtdocs/.nojekylldocs/LICENSE
- Ensure
server.pyserves thedocs/directory by default.
🧪 Verification Checklist
-
python3 server.py 8090launches and serves cleanly fromdocs/. - Scanning a multi-skill repo (e.g.,
Bhanunamikaze/Agentic-SEO-Skill) discovers all nested skills. - Light theme is set as default; Dark theme toggle works and persists in
localStorage. - SEO endpoints (
/sitemap.xml,/robots.txt,/CNAME) return200 OK. - SARIF 2.1.0, JSON, and Markdown export functions run cleanly.
- Unedited root
LICENSEfile is intact.