--- name: bulk-optimize description: | Bulk skill optimization for external PR contributions. Greps for "auto-generated" markers to skip generated files, validates Python/JS syntax with ast.parse and node --check, checks git log for recent migrations, runs tessl skill review, and generates PR templates with before/after scores. Use when improving multiple skills in external repositories, preparing bulk PRs, contributing skill improvements, batch editing skills, or mass updating open source skills. --- # Bulk Optimize Improve external SKILL.md files for PR contributions using `tessl skill review` plus safety checks that prevent rejected PRs. Respects maintainers by detecting auto-generated files, preserving domain expertise, and suggesting appropriate PR scope. ## For External PR Contributions Adds safety checks for contributing to other people's repositories. See [TEMPLATES.md](TEMPLATES.md) for lessons from past PR rejections. ## Workflow ### Phase 1: Safety Checks (CRITICAL) Run before making changes to prevent rejected PRs: ```bash # 1. Auto-generated file detection grep -i "auto-generated\|generated by\|DO NOT EDIT\|generator:" /SKILL.md # 2. Recent migration detection git log --oneline -10 --all -- / | grep -i "migrate\|rename\|move" # 3. Repository pattern analysis find . -name "SKILL.md" -type f | head -5 | xargs head -20 ``` **If auto-generated detected**: STOP - changes must go to generator source **If recent migration found**: WARN - may cause merge conflicts **Note domain patterns**: Preserve expert framing and terminology in Phase 4 ### Phase 2: Baseline Evaluation **Run review for each skill:** ```bash tessl skill review /SKILL.md ``` Parse output to extract: - Overall score - Validation issues - Description/content dimension scores - Judge suggestions **If improving multiple skills:** - Track baseline scores for all - Identify which need improvement most - Consider PR scope (see Phase 7) ### Phase 3: Discover Skill Bundle Read SKILL.md and list files in its directory. Bundle = SKILL.md + sibling files + referenced files. Use for progressive disclosure improvements. Use bundle context for recommendations. ### Phase 4: Generate Recommendations (Preserve Domain Expertise) Review recommendations to preserve valuable domain knowledge. Grep for specialized terminology (CRO, funnel, A/B test, etc.). **KEEP**: Expert framing with domain concepts ("CRO expert who understands funnel optimization, conversion psychology...") **REMOVE**: Generic expert statements ("You are an expert at helping users...") For each issue: what to change, why (dimension + score), before/after, impact, domain check. ### Phase 5: Validate Recommendations ```python # Validate Python syntax import ast ast.parse(code_snippet) # Raises SyntaxError if invalid ``` ```bash # Validate command flags gh pr create --help | grep -q "\-\-flag" || echo "Invalid" # Validate file references [[ -f "$SKILL_DIR/$FILE" ]] || echo "Missing file" ``` ### Phase 6: Present Recommendations Show recommendations with: - Current state (score) - Issue explanation - Recommended change - Impact - Domain preservation note **Get approval per skill or in batch** (user choice). ### Phase 7: PR Scope Assessment **Multiple skills (15+)**: Recommend one-skill-per-PR for easier review. Start with 2-3 highest-impact, get feedback, iterate. **High-scoring skills (90%+)**: Open issue first before unsolicited PR. Risk: maintainer may not want cosmetic changes. ### Phase 8: Apply Changes Apply approved changes to approved skills only. ### Phase 9: Verify Improvements ```bash # For each changed skill tessl skill review /SKILL.md ``` Show before/after scores. ### Phase 10: Final Accuracy Review Re-run validation from Phase 5 on updated SKILL.md. Check: - ✓ Code syntax valid - ✓ Command flags correct - ✓ File references exist - ✓ Third-person voice - ✓ "Use when..." clause present Fix issues, then re-run `tessl skill review`. ### Phase 11: PR Guidance Use commit message format, PR description template, and best practices from [TEMPLATES.md](TEMPLATES.md). Display ready-to-create PR info for user confirmation. ## Notes - Uses `tessl skill review` plus PR-specific safety checks - For external PR work on repos you don't maintain - For personal skill improvement, use `skill-optimizer` instead