brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
create-r-packageScaffold a new R package with complete structure including DESCRIPTION, NAMESPACE, testthat, roxygen2, renv, Git, GitHub Actions CI, and development configuration files (.Rprofile, .Renviron.example, CLAUDE.md). Follows usethis conventions and tidyverse style. Use when starting a new R package from scratch, converting loose R scripts into a structured packa…
Independent GitHub snapshot · Automated classification · Original documentation governs
Scaffold fully configured R package with modern tooling and best practices.
.)usethis::create_package("packagename")
setwd("packagename")
Got: Directory created with DESCRIPTION, NAMESPACE, R/, man/ subdirectories.
If fail: Confirm usethis installed (install.packages("usethis")). Check directory does not already exist.
Edit DESCRIPTION with accurate metadata:
Package: packagename
Title: What the Package Does (Title Case)
Version: 0.1.0
Authors@R:
person("First", "Last", , "email@example.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0000-0000-0000"))
Description: One paragraph describing what the package does. Must be more
than one sentence. Avoid starting with "This package".
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
URL: https://github.com/username/packagename
BugReports: https://github.com/username/packagename/issues
Got: Valid DESCRIPTION passing R CMD check with no metadata warnings.
If fail: R CMD check warns about DESCRIPTION fields? Verify Title in Title Case, Description more than one sentence, Authors@R uses valid person() syntax.
usethis::use_mit_license()
usethis::use_readme_md()
usethis::use_news_md()
usethis::use_testthat(edition = 3)
usethis::use_git()
usethis::use_github_action("check-standard")
Got: LICENSE, README.md, NEWS.md, tests/ directory, .git/ initialized, .github/workflows/ created.
If fail: Any usethis::use_*() function fails? Install missing dependency, rerun. .git/ already exists? use_git() skips init.
Create .Rprofile:
if (file.exists("renv/activate.R")) {
source("renv/activate.R")
}
if (requireNamespace("mcptools", quietly = TRUE)) {
mcptools::mcp_session()
}
Create .Renviron.example:
RSTUDIO_PANDOC="C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools"
# GITHUB_PAT=your_github_token_here
Create .Rbuildignore entries:
^\.Rprofile$
^\.Renviron$
^\.Renviron\.example$
^renv$
^renv\.lock$
^CLAUDE\.md$
^\.github$
^.*\.Rproj$
Got: .Rprofile, .Renviron.example, .Rbuildignore created. Development files dropped from built package.
If fail: .Rprofile causes startup errors? Check syntax. Confirm requireNamespace() guards stop failures when optional packages missing.
renv::init()
Got: renv/ directory and renv.lock created. Project-local library active.
If fail: Install renv with install.packages("renv"). renv hangs during init? Check network. Set options(timeout = 600).
Create R/packagename-package.R:
#' @keywords internal
"_PACKAGE"
## usethis namespace: start
## usethis namespace: end
NULL
Got: R/packagename-package.R exists with "_PACKAGE" sentinel. Running devtools::document() generates package-level help.
If fail: Confirm filename matches pattern R/<packagename>-package.R. "_PACKAGE" string must be standalone expression, not inside function.
Create CLAUDE.md in project root with project-specific instructions for AI assistants.
Got: CLAUDE.md exists in project root with project-specific editing conventions, build commands, architecture notes.
If fail: Unsure what to include? Start with package name, one-line description, common dev commands (devtools::check(), devtools::test()), any non-obvious conventions.
devtools::check() returns 0 errors, 0 warnings.Rprofile loads without errorsrenv::status() shows no issues.gitignoreavailable::available("packagename") before committing to a name.Rprofile, .Renviron, renv/) must drop from built packageEncoding: UTF-8 in DESCRIPTION# Minimal creation
usethis::create_package("myanalysis")
# Full setup in one session
usethis::create_package("myanalysis")
usethis::use_mit_license()
usethis::use_testthat(edition = 3)
usethis::use_readme_md()
usethis::use_git()
usethis::use_github_action("check-standard")
renv::init()
write-roxygen-docs - document functions you createwrite-testthat-tests - add tests for packagesetup-github-actions-ci - detailed CI/CD configurationmanage-renv-dependencies - manage package dependencieswrite-claude-md - create effective AI assistant instructions