Skip to content

Commit 83eaa3e

Browse files
committed
Checkpoint from VS Code for cloud agent session
1 parent d50d788 commit 83eaa3e

15 files changed

Lines changed: 1206 additions & 2 deletions

File tree

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
^paper$
1414
^revdep$
1515
cobertura.xml
16+
^AGENTS\.md$
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
name: create-issue
3+
trigger: create GitHub issues
4+
description: Creates GitHub issues for the package repository. Use when asked to create, file, or open a GitHub issue, or when planning new features or functions that need to be tracked.
5+
compatibility: Requires the `gh` CLI and an authenticated GitHub session.
6+
---
7+
8+
# Create a GitHub issue
9+
10+
Use `gh api graphql` with the `createIssue` mutation to create issues. This sets the issue type in a single step. Write the body to a temp file first, then pass it via `$(cat ...)`.
11+
12+
If `gh` is not authenticated, stop and ask the user to authenticate before continuing.
13+
14+
## Looking up IDs
15+
16+
The hardcoded IDs below are correct for this repo as of 2026-04-10 13:43:58 UTC. If they ever change, or if you're working in a fork, re-run these queries to get fresh values:
17+
18+
```bash
19+
# Repository node ID
20+
gh api graphql -f query='{ repository(owner: "NRCan", name: "PlotFTIR") { id } }'
21+
22+
# Available issue type IDs
23+
gh api graphql -f query='{ repository(owner: "NRCan", name: "PlotFTIR") { issueTypes(first: 20) { nodes { id name description } } } }'
24+
```
25+
26+
## Issue type
27+
28+
Choose the type that best fits the issue:
29+
30+
| Type | ID | Use for |
31+
|---|---|---|
32+
| Task | `IT_kwDOAB1wHM4AA6lT` | A specific piece of work |
33+
| Bug | `IT_kwDOAB1wHM4AA6lV` | An unexpected problem or behavior |
34+
| Feature | `IT_kwDOAB1wHM4AA6lY` | A request, idea, or new functionality |
35+
36+
## Issue title
37+
38+
Titles use conventional commit prefixes:
39+
40+
- `feat: my_function()` — new exported function or feature
41+
- `fix: short description` — bug fix
42+
- `docs: short description` — documentation
43+
- `chore: short description` — maintenance or task
44+
45+
## Issue body structure
46+
47+
Which sections to include depends on the issue type:
48+
49+
| Section | Feature | Bug | Documentation | Task |
50+
|---|---|---|---|---|
51+
| `## Summary` |||||
52+
| `## Details` | optional | optional | optional | optional |
53+
| `## Proposed signature` |||||
54+
| `## Behavior` |||||
55+
| `## References` | optional | optional | optional | optional |
56+
57+
### `## Summary` (all types)
58+
59+
A single user story sentence (no other content in this section):
60+
61+
```markdown
62+
> As a [role], in order to [goal], I would like to [feature].
63+
```
64+
65+
Example:
66+
67+
```markdown
68+
## Summary
69+
70+
> As a package developer, in order to set up agent skills quickly, I would like to generate a skill template from a single function call.
71+
```
72+
73+
### `## Details` (optional, all types)
74+
75+
For information that's important to capture but doesn't fit naturally into any other section, including implementation details such as packages to add to `Imports` in `DESCRIPTION` or files to add to `inst`. Use sparingly — if the content belongs in `## Behavior`, `## Proposed signature`, or `## References`, put it there instead.
76+
77+
### `## Proposed signature` (Feature only)
78+
79+
The proposed R function signature, arguments table, and return value description:
80+
81+
````markdown
82+
## Proposed signature
83+
84+
```r
85+
function_name(arg1, arg2)
86+
```
87+
88+
**Arguments**
89+
90+
- `arg1` (`TYPE`) — Description.
91+
- `arg2` (`TYPE`) — Description.
92+
93+
**Returns** a `TYPE` with description.
94+
````
95+
96+
### `## Behavior` (Feature and Bug)
97+
98+
- **Feature**: bullet points describing expected behavior, edge cases, and any internal helpers to implement as part of this issue.
99+
- **Bug**: describe the current (broken) behavior, the expected behavior, and steps to reproduce if known.
100+
101+
### `## References` (optional, all types)
102+
103+
Only include when there are specific reference implementations, external URLs, or related code to link to. Omit it entirely when there are none.
104+
105+
## Creating the issue
106+
107+
Use the `repoId` and the `typeId` for the chosen issue type from the table above.
108+
109+
```bash
110+
gh api graphql \
111+
-f query='mutation($repoId:ID!, $title:String!, $body:String!, $typeId:ID!) {
112+
createIssue(input:{repositoryId:$repoId, title:$title, body:$body, issueTypeId:$typeId}) {
113+
issue { url }
114+
}
115+
}' \
116+
-f repoId="R_kgDOM0EL7A" \
117+
-f title="feat: my_function()" \
118+
-f body="$(cat /tmp/issue_body.md)" \
119+
-f typeId="{typeId}"
120+
```

.github/skills/document/SKILL.md

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
---
2+
name: document
3+
trigger: document functions
4+
description: Document package functions. Use when asked to document functions.
5+
---
6+
7+
# Document functions
8+
9+
*All* R functions in `R/` should be documented in roxygen2 `#'` style, including internal/unexported functions.
10+
11+
- Run `air format .` then `devtools::document()` after changing any roxygen2 docs.
12+
- Use sentence case for all headings.
13+
- Wrap roxygen comments at 80 characters.
14+
- Files matching `R/import-standalone-*.R` are imported from other packages and have their own conventions. Do not modify their documentation.
15+
- After documenting functions, run `devtools::document(roclets = c('rd', 'collate', 'namespace'))`.
16+
- If `_pkgdown.yml` exists and contains a `reference` section:
17+
- Whenever you add a new (non-internal) documentation topic, also add the topic to `_pkgdown.yml`.
18+
- Use `pkgdown::check_pkgdown()` to check that all topics are included in the reference index.
19+
20+
## Shared parameters
21+
22+
**Parameters used in more than one function** go in `R/aaa-shared_params.R` under `@name .shared-params`. Functions inherit them with `@inheritParams .shared-params`. See `R/aaa-shared_params.R` for current definitions (if it exists).
23+
24+
Shared params blocks: alphabetize parameters, use `@name .shared-params` (with leading dot), include `@keywords internal`, end with `NULL`.
25+
26+
Multiple shared-params groups (e.g. `.shared-params-io`, `.shared-params-parsing`) are appropriate when parameters are only shared within a file and closely related files.
27+
28+
## Parameter documentation format
29+
30+
```r
31+
#' @param param_name (`TYPE`) Brief description (usually 1-3 sentences. Can
32+
#' include [cross_references()]. Additional details on continuation lines if
33+
#' needed.
34+
```
35+
36+
Function-specific `@param` definitions always appear *before* any `@inheritParams` lines. If all parameters are defined locally, omit `@inheritParams` entirely.
37+
38+
### Type notation
39+
40+
| Notation | Meaning |
41+
|----------|---------|
42+
| ``(`character`)`` | Character vector |
43+
| ``(`character(1)`)`` | Single string |
44+
| ``(`logical(1)`)`` | Single logical |
45+
| ``(`integer`)`` | Integer vector |
46+
| ``(`integer(1)`)`` | Single integer |
47+
| ``(`double`)`` | Double vector |
48+
| ``(`vector(0)`)`` | A prototype (zero-length vector) |
49+
| ``(`vector`)`` | A vector of unspecified type |
50+
| ``(`list`)`` | List |
51+
| ``(`data.frame`)`` | Data frame or tibble |
52+
| ``(`function` or `NULL`)`` | A function or NULL |
53+
| ``(`my_class`)`` | A class-specific type (use the actual class name) |
54+
| ``(`any`)`` | Any type |
55+
56+
### Enumerated values
57+
58+
When a parameter takes one of a fixed set of values, document them with a bullet list:
59+
60+
```r
61+
#' @param method (`character(1)`) The aggregation method. Can be one of:
62+
#' * `"mean"`: Arithmetic mean.
63+
#' * `"median"`: Median value.
64+
#' * `"sum"`: Total sum.
65+
```
66+
67+
## Returns
68+
69+
Use `@returns` (not `@return`). Include a type when it's informative:
70+
71+
```r
72+
#' @returns A summary tibble.
73+
#' @returns (`logical(1)`) `TRUE` if `x` is a valid record.
74+
#' @returns Either a tibble or a list, depending on the input.
75+
#' @returns `NULL` (invisibly).
76+
```
77+
78+
**Structured returns with columns:**
79+
80+
```r
81+
#' @returns A [tibble::tibble()] with columns:
82+
#' - `name`: Record name.
83+
#' - `value`: Numeric value.
84+
#' - `status`: Status (`"active"` or `"inactive"`).
85+
```
86+
87+
## Exported functions
88+
89+
```r
90+
#' Title in sentence case
91+
#'
92+
#' Description paragraph providing context and details.
93+
#'
94+
#' @param param_name (`TYPE`) Description.
95+
#' @inheritParams .shared-params
96+
#'
97+
#' @returns Description of return value.
98+
#' @seealso [related_function()]
99+
#' @export
100+
#'
101+
#' @examples
102+
#' example_code()
103+
```
104+
105+
- Blank `#'` lines separate: title/description, description/params, and `@export`/`@examples`.
106+
- `@seealso` (optional) goes between `@returns` and `@export`.
107+
- `@details` can supplement the description when needed.
108+
109+
## Internal (unexported) functions
110+
111+
Internal helpers (identified by a dot prefix, e.g. `.parse_response()`) use abbreviated documentation. Mark them with `@keywords internal` and omit `@export`:
112+
113+
```r
114+
#' Title in sentence case
115+
#'
116+
#' @param one_off_param (`TYPE`) Description.
117+
#' @inheritParams .shared-params
118+
#' @returns (`TYPE`) What it returns.
119+
#' @keywords internal
120+
```
121+
122+
Description paragraph is optional (only include when usage isn't obvious), fewer blank `#'` lines, and no `@examples`.
123+
124+
## S3 methods and `@rdname` grouping
125+
126+
Use `@rdname` to group related functions under one help page. This applies to:
127+
- **S3 methods we own** (generic defined in this package): generic gets full docs, methods get `@rdname` + `@export`.
128+
- **Related exported functions** (e.g. multiple variants of the same operation): primary function gets full docs, variants get `@rdname` + `@export`.
129+
130+
```r
131+
#' Format a summary object
132+
#'
133+
#' @param x (`any`) The object to format.
134+
#' @param ... Additional arguments passed to methods.
135+
#' @returns A formatted character string.
136+
#' @keywords internal
137+
.format_summary <- function(x, ...) {
138+
UseMethod(".format_summary")
139+
}
140+
141+
#' @rdname .format_summary
142+
#' @export
143+
.format_summary.data_summary <- function(x, ...) {
144+
# method implementation
145+
}
146+
```
147+
148+
**S3 methods we don't own** (generic from another package) need standalone documentation:
149+
150+
```r
151+
#' Title describing the method
152+
#'
153+
#' @param x (`TYPE`) Description.
154+
#' @param ... Additional arguments (ignored).
155+
#' @returns Description.
156+
#' @exportS3Method pkg::generic
157+
method.class <- function(x, ...) { ... }
158+
```
159+
160+
## Style notes
161+
162+
**Cross-references:** Use square brackets — `[fetch_records()]` (internal), `[tibble::tibble()]` (external), `[topic_name]` (topics).
163+
164+
**Section comment headers** optionally organize code within a file, lowercase with dashes to column 80:
165+
166+
```r
167+
# helpers ----------------------------------------------------------------------
168+
```
169+
170+
Only use such headers in complex files. The need for section comment headers might indicate that the file should be split into multiple files.
171+
172+
**Examples:** Exported functions include `@examples`. Use `@examplesIf interactive()` for network-dependent or slow functions. Use section-style comments (`# Section ---`) to organize longer example blocks. Internal functions do not get examples.

.github/skills/github/SKILL.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: github
3+
trigger: from github
4+
description: GitHub workflows using the `gh` CLI, including viewing issues/PRs and commit message conventions. Use when interacting with GitHub in any way, such as viewing, creating, or editing issues and pull requests, making commits, or running any `gh` command.
5+
compatibility: Requires the `gh` CLI and an authenticated GitHub session.
6+
---
7+
8+
# GitHub
9+
10+
Use `gh` CLI, not web URLs: `gh issue view 123`, `gh issue list`, `gh pr view 456`, `gh pr list`.
11+
12+
## Commit messages
13+
14+
Conventional commits; backtick-quote function names; close issues in body with `- Closes #N`.
15+
16+
```
17+
feat: add `create_skill()`
18+
19+
Generates a new skill directory with a SKILL.md template.
20+
21+
- Closes #3
22+
```
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: implement-issue
3+
trigger: implement issue / work on #NNN
4+
description: Implements a GitHub issue end-to-end. Use when asked to implement, work on, or fix a specific issue number.
5+
compatibility: Requires the `gh` CLI and an authenticated GitHub session.
6+
---
7+
8+
# Implement a GitHub issue
9+
10+
This skill wraps the Standard Workflow defined in `AGENTS.md`. Run the steps below before and after that workflow.
11+
12+
## Before the standard workflow
13+
14+
**A. Read the issue in full:**
15+
16+
```bash
17+
gh issue view {number}
18+
```
19+
20+
If `gh` is not authenticated, stop and ask the user to authenticate before continuing.
21+
22+
**B. Check/create the branch:**
23+
24+
- If on `main`: `usethis::pr_init("fix-{number}-{description}")`
25+
- Branch format: `fix-{number}-{description}`
26+
- Parts separated by hyphens; `{description}` uses snake_case
27+
- Example: `fix-42-validate_input`
28+
- If a branch already exists for this issue, check it out instead
29+
30+
## Run the Standard Workflow from AGENTS.md
31+
32+
Steps 1–9 of the Standard Workflow are the core development loop.
33+
34+
## After the standard workflow
35+
36+
**C. Commit and push:**
37+
38+
1. Review commits already on this branch (not on `main`) — these are all part of the same PR and should inform the PR description:
39+
```bash
40+
git log main..HEAD --oneline
41+
```
42+
2. Stage and commit all changes:
43+
```bash
44+
git add -A
45+
git commit -m "{short imperative summary}"
46+
```
47+
3. Push and open the PR:
48+
```bash
49+
gh pr create --fill
50+
```
51+
Use `--title` and `--body` explicitly if `--fill` produces an inadequate description.
52+
53+
This step may be overridden — the user may ask you to stop before committing, handle the push themselves, or complete only part of the workflow. Always follow explicit user instructions over these defaults.

0 commit comments

Comments
 (0)