Skip to content
Back to search

r-skills

MarketplaceWorks with Claude CodeGitHub

Claude Code configurations for R development.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/ab604--claude-code-r-skills/badge.svg)](/listings/ab604--claude-code-r-skills)

HTML

<a href="/listings/ab604--claude-code-r-skills"><img src="/api/listings/ab604--claude-code-r-skills/badge.svg" alt="findsafeskills safety rating" /></a>

Install

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Option 1: Plugin Marketplace (recommended)

# Add the marketplace
/plugin marketplace add ab604/claude-code-r-skills

# Install R skills
/plugin install r-skills@r-skills

# Install R language server (optional, for code intelligence in VS Code/terminal)
# Note: Not needed if using Positron, which has built-in R language server support
/plugin install r-lsp@r-skills

The `r-lsp` plugin requires the R languageserver package:

install.packages(c("languageserver", "lintr", "styler"))

See [r-lsp](https://github.com/ab604/r-lsp) for more details.

Option 2: Copy to your project

# Clone this repository
git clone https://github.com/ab604/claude-code-r-skills.git

# Copy to your R project
cp -r claude-code-r-skills/.claude/ /path/to/your/project/
cp -r claude-code-r-skills/rules/ /path/to/your/project/
cp -r claude-code-r-skills/commands/ /path/to/your/project/
cp -r claude-code-r-skills/agents/ /path/to/your/project/
cp -r claude-code-r-skills/contexts/ /path/to/your/project/

Option 3: Copy to user configuration

# Create directories if they don't exist, then copy
mkdir -p ~/.claude/skills ~/.claude/rules ~/.claude/commands ~/.claude/agents ~/.claude/contexts

# Copy skills to global config
cp -r .claude/skills/* ~/.claude/skills/

# Copy rules, commands, agents, contexts
cp -r rules/* ~/.claude/rules/
cp -r commands/* ~/.claude/commands/
cp -r agents/* ~/.claude/agents/
cp -r contexts/* ~/.claude/contexts/

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 44 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. {
  2. "name": "r-skills",
  3. "owner": {
  4. "name": "Claude Code R Skills"
  5. },
  6. "metadata": {
  7. "description": "R development tools for Claude Code - skills, hooks, and language server integration"
  8. },
  9. "plugins": [
  10. {
  11. "name": "r-skills",
  12. "source": "./",
  13. "description": "Modern R development skills for tidyverse, rlang, Bayesian analysis, performance, and more",
  14. "version": "1.2.5",
  15. "author": {
  16. "name": "Claude Code R Skills"
  17. },
  18. "homepage": "https://github.com/ab604/claude-code-r-skills",
  19. "repository": "https://github.com/ab604/claude-code-r-skills",
  20. "license": "MIT",
  21. "keywords": [
  22. "r",
  23. "tidyverse",
  24. "rlang",
  25. "brms",
  26. "bayesian",
  27. "performance",
  28. "testing"
  29. ],
  30. "category": "development",
  31. "tags": ["r", "data-science", "statistics"]
  32. },
  33. {
  34. "name": "r-lsp",
  35. "source": {
  36. "source": "github",
  37. "repo": "ab604/r-lsp"
  38. },
  39. "description": "R language server for code intelligence - diagnostics, go-to-definition, hover, references. Not needed for Positron users.",
  40. "category": "code-intelligence",
  41. "tags": ["r", "lsp", "diagnostics"]
  42. }
  43. ]
  44. }
README.md · README · 527 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Claude Code R Skills
  2. *Version 1.2.5 | Last updated: 2026-09-17*
  3. A curated collection of Claude Code configurations for modern R use. These skills, rules, commands, and agents help Claude Code understand R best practices and generate idiomatic, high-quality R code. Additionally the rules and commands help with efficient token usage and enforce constraints, and agents can perform specific tasks. Obviously you can fork and adapt any of these to your case-use.
  4. I use Positron, but if you are a VSCode user there is also a plugin for R language server for code intelligence.
  5. To try and pre-empt some of the issues with LLMs being reinforced to please the user, I've added a scientific reasoning principle to CLAUDE.md: we test hypotheses; we never prove them. Claude is instructed to reason from evidence, maintain healthy scepticism, quantify uncertainty explicitly (preferring Bayesian framing), and never tell the user what it thinks the user wants to hear at the expense of accuracy. This doesn't seem to prevent the "telling you what it thinks you want to hear" problem entirely, but is hopefully better than nothing.
  6. ## Table of Contents
  7. - [Acknowledgments](#acknowledgments)
  8. - [Overview](#overview)
  9. - [Understanding Feature Types](#understanding-feature-types)
  10. - [Skills](#skills)
  11. - [Commands](#commands)
  12. - [Rules](#rules)
  13. - [Agents](#agents)
  14. - [Hooks](#hooks)
  15. - [Contexts](#contexts)
  16. - [Features](#features)
  17. - [Installation](#installation)
  18. - [Option 1: Plugin Marketplace](#option-1-plugin-marketplace-recommended)
  19. - [Option 2: Copy to your project](#option-2-copy-to-your-project)
  20. - [Option 3: Copy to user configuration](#option-3-copy-to-user-configuration)
  21. - [Quick Reference](#quick-reference)
  22. - [Essential Modern R Patterns](#essential-modern-r-patterns)
  23. - [Key Anti-Patterns to Avoid](#key-anti-patterns-to-avoid)
  24. - [Directory Structure](#directory-structure)
  25. - [Core Principles](#core-principles)
  26. - [Recommended Workflow](#recommended-workflow)
  27. - [Requirements](#requirements)
  28. - [Environment Management](#environment-management)
  29. - [Token Optimization](#token-optimization)
  30. - [License](#license)
  31. ## Acknowledgments
  32. This project uses and builds on the work of:
  33. - [**Sarah Johnson's Modern R Development Guide**](https://gist.github.com/sj-io/3828d64d0969f2a0f05297e59e6c15ad) - Original guide that formed the foundation for the R skills in this repository
  34. - [**Jeremy Allen's Claude Skills Repo**](https://github.com/jeremy-allen/claude-skills) - Jeremy's Claude Skills mostly derived from Sarah's guide
  35. - [**Affaan Mustafa's Everything Claude Code**](https://github.com/affaan-m/everything-claude-code) - Framework structure, rules, commands, and agents adapted for R development from Affan's Hackathon winning code
  36. - [**Posit's testing-r-packages Skill**](https://github.com/posit-dev/skills/tree/main/r-lib/testing-r-packages) - testthat Edition 3 patterns, test design principles, and comprehensive expectations reference incorporated into the tdd-workflow skill
  37. - [**statzhero's tidy-r-skill**](https://github.com/statzhero/tidy-r-skill) - Join quality control patterns (`relationship`, `na_matches`, `tidylog`), NA-safe filtering with `filter_out()`, `when_any()`/`when_all()`, `replace_when()` for in-place conditional updates, and `cli::cli_abort()` structured error messages incorporated into the tidyverse-patterns and r-style-guide skills
  38. - As an aside, I use Quarto in my workflow and use [Posit's Quarto plugin](https://github.com/posit-dev/skills) which you can add with: `/plugin marketplace add posit-dev/skills` and then `/plugin install quarto@posit-dev-skills`.
  39. ## Overview
  40. This repository provides Claude Code configurations specifically for R users, combining:
  41. - **R-specific skills** for modern tidyverse patterns, rlang, performance, OOP, and more
  42. - **Development workflow tools** adapted from [everything-claude-code](https://github.com/affaan-m/everything-claude-code)
  43. - **Testing and quality rules** for R development
  44. ## Understanding Feature Types
  45. Claude Code uses five official feature types to customise its behaviour for R development, plus a custom convention (Contexts) built on the CLI's `--system-prompt` flag. Each serves a distinct purpose in the development workflow.
  46. ### Skills
  47. **What they are:** Markdown documents containing domain knowledge, best practices, and coding patterns that Claude references when writing code. Skills are passive knowledge resources loaded into Claude's context when relevant.
  48. **When to use:** Claude automatically activates skills based on the code you're working on. For example, when you're writing tidyverse code, the `tidyverse-patterns` skill provides guidance on modern pipes, joins, and grouping.
  49. **How they work:** Skills live in `.claude/skills/` and contain detailed guidance, anti-patterns to avoid, and code examples. Claude consults these when making implementation decisions.
  50. **How to use:**
  51. ``` bash
  52. # Skills are automatically activated - no manual invocation needed
  53. # You can also explicitly request skill usage in your prompts:
  54. "Write a function using tidyverse-patterns to summarize data by group"
  55. ```
  56. ### Commands
  57. **What they are:** User-invocable shortcuts (prefixed with `/`) that trigger specific workflows or behaviours. Commands are active - you call them explicitly to perform actions.
  58. **When to use:** Use commands when you want Claude to follow a specific workflow, such as planning before implementation (`/plan`) or conducting a code review (`/code-review`).
  59. **How they work:** Commands are defined in the `commands/` directory and can trigger agents, enforce specific behaviours, or structure Claude's responses in particular ways.
  60. **How to use:**
  61. ``` bash
  62. # In your Claude Code conversation:
  63. /plan Add bootstrap confidence intervals to model output
  64. # After seeing the plan, respond:
  65. yes # or "proceed" to start implementation
  66. # Review code before committing:
  67. /code-review
  68. ```
  69. ### Rules
  70. **What they are:** Mandatory constraints and requirements that Claude must follow. Rules enforce project standards like test coverage thresholds, security practices, and git workflows.
  71. **When to use:** Rules are always active - Claude automatically enforces them throughout the session. They're particularly important for maintaining code quality, security, and testing standards.
  72. **How they work:** Rules are markdown files in the `rules/` directory that define requirements (e.g., "80% test coverage required") and constraints (e.g., "never commit credentials"). Claude validates actions against these rules.
  73. **How to use:**
  74. ``` bash
  75. # Rules are automatically enforced - no manual invocation needed
  76. # Claude will:
  77. # - Require 80% test coverage (from testing.md)
  78. # - Validate credential handling (from security.md)
  79. # - Format commits correctly (from git-workflow.md)
  80. # You can reference rules explicitly:
  81. "Make sure this follows our testing rules"
  82. ```
  83. ### Agents
  84. **What they are:** Specialized sub-agents with specific roles, expertise, and limited tool access. Agents are focused workers that handle particular types of tasks.
  85. **When to use:** Agents are invoked by commands or automatically by Claude when specialised expertise is needed. The `planner` agent creates implementation plans, while the `code-reviewer` agent analyses code for issues.
  86. **How they work:** Agents are defined in the `agents/` directory with specific tools and prompts. They receive a task, complete it with their specialised knowledge, and return results to the main conversation.
  87. **How to use:**
  88. ``` bash
  89. # Agents are typically invoked via commands:
  90. /plan Feature description # Activates the planner agent
  91. /code-review # Activates the code-reviewer agent
  92. # Claude may also invoke agents automatically when appropriate
  93. ```
  94. ### Hooks
  95. **What they are:** Event-driven JavaScript scripts that execute automatically at specific points in Claude's workflow (e.g., before editing files, on session start/end, before context compaction).
  96. **When to use:** Hooks run automatically in response to events - you don't invoke them directly. They're useful for context management, state persistence, and workflow optimisations.
  97. **How they work:** Hooks are configured only in `hooks/hooks.json`, which ships with the plugin. Matchers use simple tool names (`"Bash"`, `"Write"`, `"Edit|Write"`, `"*"`). Every hook is a script referenced by absolute path via `${CLAUDE_PLUGIN_ROOT}/.claude/hooks/scripts/`. Don't add hooks to `.claude/settings.json` with relative paths: Claude Code runs hook commands from your home directory, not the project root, so relative paths fail.
  98. **How to use:**
  99. ``` bash
  100. # Hooks run automatically. Configured hooks in this repo:
  101. # - suggest-compact: Suggests /compact after 50 tool uses
  102. # - pre-compact: Saves session state before compaction
  103. # - session-start: Reports available history on startup
  104. # - session-end: Persists session state for continuity
  105. # - doc-blocker: Warns about creating random .md files
  106. # - git-push-warn: Warns before any git push
  107. # Hooks are transparent - you'll see their output in the session:
  108. [StrategicCompact] 50 tool calls reached - consider /compact if transitioning phases
  109. [Hook] WARNING: About to run: git push origin main
  110. [Hook] Confirm this push is intentional before proceeding.
  111. ```
  112. ### Contexts
  113. **What they are:** Dynamic system prompt injection contexts — markdown files containing scenario-specific instructions passed to Claude at session start via the `--system-prompt` CLI flag.
  114. **When to use:** Use a context alias when starting a session with a specific focus. Your `.claude/rules/` files handle baseline project rules; contexts layer scenario-specific behaviour on top.
  115. **How they work:** Shell aliases inject context files as system prompts when launching Claude — no tool call overhead, system-level authority.
  116. **How to use:**
  117. ``` bash
  118. # Add to ~/.bashrc or ~/.zshrc
  119. alias claude-dev='claude --system-prompt "$(cat ~/.claude/contexts/dev.md)"'
  120. alias claude-review='claude --system-prompt "$(cat ~/.claude/contexts/review.md)"'
  121. alias claude-research='claude --system-prompt "$(cat ~/.claude/contexts/research.md)"'
  122. # Launch Claude in the mode you need:
  123. claude-research # Exploration mode
  124. claude-dev # Implementation mode
  125. claude-review # Code quality/security review
  126. ```
  127. > **Note:** For most workflows the difference between placing context in `.claude/rules/` and using the CLI `--system-prompt` approach is marginal. The CLI approach is faster (no tool call), more reliable (system-level authority), and slightly more token-efficient — but requires shell setup and may not be worth the overhead for everyone.
  128. **Recommended workflow sequence:**
  129. ```
  130. claude-research → /plan → claude-dev → /tdd → implement → /verify → claude-review → commit
  131. ```
  132. ## Features
  133. ### Skills (8 public + 1 local)
  134. | Skill | Description |
  135. |--------------------------|----------------------------------------------|
  136. | **tidyverse-patterns** | Modern pipes, joins, grouping, purrr, stringr |
  137. | **rlang-patterns** | Data-masking, injection operators, dynamic dots |
  138. | **r-performance** | Profiling, benchmarking, vctrs, optimisation |
  139. | **r-style-guide** | Naming, spacing, function design |
  140. | **r-oop** | S7, S3, S4, vctrs decision guide |
  141. | **r-package-development** | Dependencies, API design, testing |
  142. | **r-bayes** | brms, DAG validation, multilevel models, marginaleffects |
  143. | **tdd-workflow** | Test-driven development with testthat |
  144. *Local-only (not in public repo):*
  145. | Skill | Description |
  146. |-----------------------|-------------------------------------------------|
  147. | **r-machine-learning** | XGBoost, LightGBM, CatBoost, Elastic Net, ExtraTrees, ridge stacking, stratified CV — updated 2026-02-20 |
  148. ### Commands
  149. | Command | Description |
  150. |----------------|----------------------------------------------------|
  151. | `/plan` | Create implementation plans before coding |
  152. | `/tdd` | Test-driven development workflow |
  153. | `/code-review` | Review code for security and quality |
  154. | `/verify` | Full quality gate before committing (build → lint → coverage → review) |
  155. ### Rules
  156. | Rule | Description |
  157. |------------------|--------------------------------------|
  158. | **security** | Credential handling, data protection |
  159. | **testing** | 80% coverage, testthat patterns |
  160. | **git-workflow** | Commit format, PR workflow |
  161. ### Agents
  162. | Agent | Model | Description |
  163. |-------------------|-------|------------------------------------|
  164. | **planner** | Opus | Implementation planning specialist |
  165. | **tdd-guide** | — | TDD enforcement and test-first workflow |
  166. | **code-reviewer** | — | Security and quality review |
  167. ### Hooks (Context Window Management)
  168. | Hook | Trigger | Description |
  169. |---------------------|------------------------|--------------------------------|
  170. | **suggest-compact** | PreToolUse (Edit/Write) | Suggests `/compact` after 50 tool calls, then every 25 |
  171. | **pre-compact** | PreCompact | Logs the compaction and notes it in the current session's file |
  172. | **session-start** | SessionStart | Reports recent session history (last 7 days) and learned skills |
  173. | **session-end** | SessionEnd | Writes one file per session to `~/.claude/sessions/`, keeping the latest 50 |
  174. | **doc-blocker** | PreToolUse (Write .md) | Warns about creating random .md files |
  175. | **git-push-warn** | PreToolUse (Bash) | Warns before any `git push` to prevent accidental pushes |
  176. These hooks help optimise context window usage and workflow safety by:
  177. - Suggesting strategic compaction at logical task boundaries
  178. - Preserving session state across compaction events
  179. - Consolidating documentation to reduce context bloat
  180. - Requiring confirmation before irreversible git operations
  181. `doc-blocker` and `git-push-warn` only warn: the tool call still goes ahead.
  182. #### Disabling hooks
  183. Each hook checks these in order and exits quietly if it is disabled:
  184. | Method | Scope | Example |
  185. |--------|-------|---------|
  186. | `CLAUDE_DISABLE_ALL_HOOKS=1` | Every hook, this process | `CLAUDE_DISABLE_ALL_HOOKS=1 claude` |
  187. | `CLAUDE_DISABLE_HOOKS` | Named hooks, this process | `CLAUDE_DISABLE_HOOKS=doc-blocker,git-push-warn claude` |
  188. | `.claude/hooks/state.json` | Named hooks, persistent | `{ "disabled": ["suggest-compact"] }` |
  189. `state.json` is read from next to the hook scripts, so for plugin installs edit the copy in the plugin's install directory, not your project. Set `COMPACT_THRESHOLD` to change how many tool calls pass before `suggest-compact` fires (default 50).
  190. ### Contexts
  191. System prompt injection contexts — launch Claude with a specific focus using CLI aliases (`--system-prompt`).
  192. | Context | Description |
  193. |--------------|----------------------------------------------------|
  194. | **dev** | Implementation focus — write first, short responses, TDD defaults |
  195. | **research** | Exploration focus — thorough reading before acting |
  196. | **review** | Audit focus — find issues, rate by severity, verdict |
  197. ## Installation
  198. ### Option 1: Plugin Marketplace (recommended)
  199. ``` bash
  200. # Add the marketplace
  201. /plugin marketplace add ab604/claude-code-r-skills
  202. # Install R skills
  203. /plugin install r-skills@r-skills
  204. # Install R language server (optional, for code intelligence in VS Code/terminal)
  205. # Note: Not needed if using Positron, which has built-in R language server support
  206. /plugin install r-lsp@r-skills
  207. ```
  208. The `r-lsp` plugin requires the R languageserver package:
  209. ``` r
  210. install.packages(c("languageserver", "lintr", "styler"))
  211. ```
  212. See [r-lsp](https://github.com/ab604/r-lsp) for more details.
  213. ### Option 2: Copy to your project
  214. ``` bash
  215. # Clone this repository
  216. git clone https://github.com/ab604/claude-code-r-skills.git
  217. # Copy to your R project
  218. cp -r claude-code-r-skills/.claude/ /path/to/your/project/
  219. cp -r claude-code-r-skills/rules/ /path/to/your/project/
  220. cp -r claude-code-r-skills/commands/ /path/to/your/project/
  221. cp -r claude-code-r-skills/agents/ /path/to/your/project/
  222. cp -r claude-code-r-skills/contexts/ /path/to/your/project/
  223. ```
  224. ### Option 3: Copy to user configuration
  225. ``` bash
  226. # Create directories if they don't exist, then copy
  227. mkdir -p ~/.claude/skills ~/.claude/rules ~/.claude/commands ~/.claude/agents ~/.claude/contexts
  228. # Copy skills to global config
  229. cp -r .claude/skills/* ~/.claude/skills/
  230. # Copy rules, commands, agents, contexts
  231. cp -r rules/* ~/.claude/rules/
  232. cp -r commands/* ~/.claude/commands/
  233. cp -r agents/* ~/.claude/agents/
  234. cp -r contexts/* ~/.claude/contexts/
  235. ```
  236. ## Quick Reference
  237. ### Essential Modern R Patterns
  238. ``` r
  239. # Always use native pipe
  240. data |>
  241. filter(x > 0) |>
  242. summarise(mean(y))
  243. # Modern joins with join_by()
  244. inner_join(x, y, by = join_by(a == b))
  245. # Per-operation grouping with .by
  246. summarise(data, mean(value), .by = category)
  247. # Embrace for function arguments
  248. my_func <- function(data, var) {
  249. data |> summarise(mean = mean({{ var }}))
  250. }
  251. # Type-stable iteration
  252. map_dbl(data, mean) # Not sapply()
  253. ```
  254. ### Key Anti-Patterns to Avoid
  255. ``` r
  256. # Avoid legacy magrittr pipe
  257. data %>% filter(x > 0) # Use |> instead
  258. # Avoid old join syntax
  259. by = c("a" = "b") # Use join_by(a == b)
  260. # Avoid group_by/ungroup
  261. group_by(x) |> summarise(y) |> ungroup() # Use .by instead
  262. # Avoid sapply (type-unstable)
  263. sapply(x, f) # Use map_*() instead
  264. ```
  265. ## Directory Structure
  266. ``` text
  267. claude-code-r-skills/
  268. ├── README.md
  269. ├── LICENSE
  270. ├── .gitignore
  271. ├── .claude-plugin/
  272. │ ├── plugin.json # Plugin manifest
  273. │ └── marketplace.json # Marketplace catalog
  274. ├── .claude/
  275. │ ├── CLAUDE.md # Project instructions
  276. │ ├── settings.json # Schema only; hooks live in hooks/hooks.json
  277. │ ├── settings.local.json # Local permissions (gitignored)
  278. │ ├── hooks/
  279. │ │ ├── state.json # Persistent per-hook disable list
  280. │ │ └── scripts/
  281. │ │ ├── utils.js # Shared utilities
  282. │ │ ├── suggest-compact.js # Strategic compaction
  283. │ │ ├── pre-compact.js # Save state before compact
  284. │ │ ├── session-start.js # Load previous context
  285. │ │ ├── session-end.js # Persist session state
  286. │ │ ├── doc-blocker.js # Warn about random .md file creation
  287. │ │ └── git-push-warn.js # Warn before git push
  288. │ └── skills/
  289. │ ├── tidyverse-patterns/
  290. │ ├── rlang-patterns/
  291. │ ├── r-performance/
  292. │ ├── r-style-guide/
  293. │ ├── r-oop/
  294. │ ├── r-package-development/
  295. │ ├── r-bayes/
  296. │ └── tdd-workflow/
  297. ├── hooks/
  298. │ └── hooks.json # Plugin hooks (bundled with plugin)
  299. ├── contexts/
  300. │ ├── dev.md # Coding mode (write first, TDD)
  301. │ ├── research.md # Exploration mode (read before acting)
  302. │ └── review.md # Audit mode (find issues, verdict)
  303. ├── rules/
  304. │ ├── security.md
  305. │ ├── testing.md
  306. │ └── git-workflow.md
  307. ├── commands/
  308. │ ├── plan.md
  309. │ ├── tdd.md
  310. │ ├── code-review.md
  311. │ └── verify.md # Full quality gate before committing
  312. └── agents/
  313. ├── planner.md # Uses Opus model
  314. ├── tdd-guide.md # TDD enforcement specialist
  315. └── code-reviewer.md
  316. ```
  317. Note: `r-machine-learning` skill is local-only and not included in the public repository. Updated 2026-02-20 based on the WARND competition final model (4-model ridge stacked ensemble: XGBoost, Elastic Net, CatBoost, ExtraTrees; OOF AUC 0.8187). Key additions: Elastic Net and ExtraTrees patterns, stratified participant-level CV, expanded temporal feature engineering, ridge meta-learner stacking, and model selection guidance including documented TabNet failure.
  318. ## Core Principles
  319. 1. **Use modern tidyverse patterns** - dplyr 1.1+, native pipe, current APIs
  320. 2. **Profile before optimising** - Use profvis and bench
  321. 3. **Write readable code first** - Optimize only when necessary
  322. 4. **Follow tidyverse style guide** - Consistent naming and structure
  323. 5. **Test-driven development** - Write tests before implementation
  324. 6. **80% minimum coverage** - Comprehensive testing required
  325. ## Recommended Workflow
  326. For any non-trivial feature or fix, follow this sequence:
  327. ``` text
  328. claude-research # Start in exploration mode
  329. /plan # Design the approach (uses Opus)
  330. claude-dev # Restart in implementation mode
  331. /tdd # Write tests first (RED)
  332. # Implement (GREEN → REFACTOR)
  333. /verify # Full quality gate before committing
  334. claude-review # Restart in audit mode if needed
  335. ```
  336. ## Requirements
  337. - R 4.3+ (for native pipe `|>`)
  338. - dplyr 1.1+ (for `.by`, `join_by()`, `reframe()`)
  339. - purrr 1.0+ (for `list_rbind()`)
  340. - tidyr 1.3+ (for `separate_wider_*()`)
  341. - testthat 3.0+ (for snapshot testing)
  342. ## Environment Management
  343. - **R packages**: Use `pak` for installation
  344. - **R environments**: Use `renv` for project isolation
  345. - **Python**: Use `uv` for Python environments (if needed)
  346. ## Token Optimization
  347. Claude Code usage can be expensive if you don't manage token consumption. These settings significantly reduce costs without sacrificing quality. Adapted from [Affaan Mustafa's Everything Claude Code](https://github.com/affaan-m/everything-claude-code).
  348. ### Recommended Settings
  349. Add to `~/.claude/settings.json`:
  350. ```json
  351. {
  352. "model": "sonnet",
  353. "env": {
  354. "MAX_THINKING_TOKENS": "10000",
  355. "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "50"
  356. }
  357. }
  358. ```
  359. | Setting | Default | Recommended | Impact |
  360. |---------|---------|-------------|--------|
  361. | `model` | opus | **sonnet** | ~60% cost reduction; handles 80%+ of coding tasks |
  362. | `MAX_THINKING_TOKENS` | 31,999 | **10,000** | ~70% reduction in hidden thinking cost per request |
  363. | `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` | 95 | **50** | Compacts earlier — better quality in long sessions |
  364. Switch to Opus only when you need deep architectural reasoning:
  365. ```
  366. /model opus
  367. ```
  368. ### Daily Workflow Commands
  369. | Command | When to Use |
  370. |---------|-------------|
  371. | `/model sonnet` | Default for most tasks |
  372. | `/model opus` | Complex architecture, debugging, deep reasoning |
  373. | `/clear` | Between unrelated tasks (free, instant reset) |
  374. | `/compact` | At logical task breakpoints (research done, milestone complete) |
  375. | `/cost` | Monitor token spending during session |
  376. ### Strategic Compaction
  377. The `suggest-compact` hook (included in this plugin) suggests `/compact` at logical breakpoints instead of relying on auto-compaction at 95% context. It counts `Edit`/`Write` calls per session and fires at 50 (or `COMPACT_THRESHOLD`), then every 25.
  378. **When to compact:**
  379. - After research/exploration, before implementation
  380. - After completing a milestone, before starting the next
  381. - After debugging, before continuing feature work
  382. - After a failed approach, before trying a new one
  383. **When NOT to compact:**
  384. - Mid-implementation (you'll lose variable names, file paths, partial state)
  385. ## License
  386. MIT License - see [LICENSE](LICENSE) for details.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.