From analytics-toolkit
Use when the user has FINISHED R analysis code and wants it cleaned up for human readability — removes LLM code smells, rewrites to match personal style. Only use after analysis is complete and outputs are verified, never during initial development or debugging.
npx claudepluginhub halidaee/econtools_marketplace --plugin analytics-toolkitThis skill uses the workspace's default tool permissions.
Detects LLM code smells in R scripts and rewrites them to match the user's personal coding style, with archive-verify-revert safety. **This is a post-production skill** — use it only after the analysis is complete and outputs are verified. Do NOT use it while first writing or debugging scripts; the verbose LLM patterns (status printing, tryCatch, etc.) are useful during development. This skill ...
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Guides TDD-style skill creation: pressure scenarios as tests, baseline agent failures, write docs to enforce compliance, verify with RED-GREEN-REFACTOR.
Guides idea refinement into designs: explores context, asks questions one-by-one, proposes approaches, presents sections for approval, writes/review specs before coding.
Detects LLM code smells in R scripts and rewrites them to match the user's personal coding style, with archive-verify-revert safety. This is a post-production skill — use it only after the analysis is complete and outputs are verified. Do NOT use it while first writing or debugging scripts; the verbose LLM patterns (status printing, tryCatch, etc.) are useful during development. This skill is for making finished code readable to humans.
NEVER:
%>% vs |>), ifelse() vs if_else(), or across() vs mutate_at()MUST:
<filename>_llm_draft.R before any changes<- for assignment exclusivelyreturn() in every functionpurrr::map() and friends when purrr/tidyverse is loaded — do NOT convert purrr to lapplygrep -r "function_name") before classifying any function as single-use.drafts/ subfolder (not alongside the working files)CAN:
cat() / status printing / emoji checkmarksProceed automatically when:
cat() outputdata_ prefixes= assignment to <-return()Flag for user when:
tryCatch that protects genuinely risky operations (file I/O, network)references/style-guide.md §I)Hand off to user when:
references/smell-catalog.mdreferences/style-guide.md §I).drafts/ subfolder if it doesn't exist; copy original to .drafts/<filename>_llm_draft.R"Archive LLM draft of <filename> before restyling"references/verification.mdreferences/style-guide.md and patterns from references/smell-catalog.mdreferences/verification.md.drafts/ archive, git commit the revert, report discrepancies, hand off to user| Signal in code | Category | Action | Fix |
|---|---|---|---|
cat("✓ ...") / cat("✗ ...") | Emoji status | Auto | Remove |
cat(rep("=", N), ...), boxed headers | ASCII art | Auto | Remove |
cat("Step N: ...") | Step narration | Auto | Remove |
cat("Next step: ...") | Signpost | Auto | Remove |
| 20+ line header with Inputs/Outputs/Scalability | Template header | Auto | Condense to 1-3 lines |
# Author: Refactored for X / # Last Modified: | Attribution boilerplate | Auto | Remove |
# End of Script / # End of X | Script closer | Auto | Remove |
#' @param / #' @return on non-exported functions | Roxygen on analysis code | Auto | Remove or brief comment |
# ABSTRACTION NOTE: | Meta-commentary | Auto | Remove |
# Scalability: / # Parallel: / # Dependencies: | Metadata comments | Auto | Remove |
tryCatch around lm(), glm(), source() | Defensive model/source | Auto | Remove wrapper |
tryCatch around file I/O, network | Defensive I/O | Flag | Ask user |
invisible(list(...)) at script end | SDE return pattern | Auto | Remove |
run_script() wrapper around source() | Over-engineered runner | Flag | Suggest direct source() |
SCREAMING_SNAKE_CASE variables | SDE naming | Auto | Rename to snake_case |
data_ prefix on data frames | SDE naming | Auto | Drop prefix |
| Script producing 3+ independent outputs (tables, figures, datasets) | Scope bloat | Flag | Suggest splitting per §I |
| Two scripts that share >50% logic | Redundant scripts | Flag | Suggest merging per §I |
| Non-obvious logic with no comment | Missing context | Auto | Add substantive comment explaining WHY |
= for assignment | Assignment style | Auto | Replace with <- |
Function without explicit return() | Implicit return | Auto | Add return() |
| Helper function used once + justification comment | Unnecessary abstraction | Flag | Suggest inlining |
| Utility file with single caller | Over-modularization | Flag | Suggest merging |
| Unit test files for analysis scripts | SDE infrastructure | Flag | Note to user |
| Dual-format figure saving (PDF + PNG) | LLM caution | Flag | Ask user preference |
| 400-line package management utility | Over-engineering | Flag | Suggest library() at top |
<- always, never =return() in every functionpurrr::map() when tidyverse is loaded; leave existing purrr/lapply as-ismessage() for genuinely useful info, no emoji/boxes/narration.drafts/ subfolder, never alongside working filesifelse vs if_else, across vs mutate_at, lapply vs map