AGENT SKILL

pseudocode-to-r

Translate pseudocode package to an R package whilst preserving behavior and generating verification tests. Use when translating pseudocode to R

License 许可
Apache-2.0
最近更新
2026-07-13
Stars
★ 2
Forks
0

01 前言 Front Matter

name
pseudocode-to-r
description
Translate pseudocode package to an R package whilst preserving behavior and generating verification tests. Use when translating pseudocode to R

02 资源文件 4

03 SKILL.md 正文

Pseudocode to R

Prompt the user for a location to create the new package. Suggest {../package-name R}

1. Setup

  • Use renv to create a local environment and use this to install any required packages.
  • Install the languageserver package to enable R LSP

2. Code translation

Translate the code in the pseudocode directory to an R package, whilst preserving behaviour, adapting idioms, and generating verification tests.

  • Preserve original behaviour exactly
  • Follow R tidyverse language idioms and conventions
  • Maintain code structure when possible.
  • Add appropriate R error handling.
  • Include necessary imports and dependencies

3. Create a Shiny GUI to recreate any dlg files in the package directory.

4. Generate Tests

Create tests to verify package functions:

Test generation approach:

  1. Create new tests covering:
    • Basic functionality for each function/method
    • Edge cases (empty inputs, null values, boundary conditions)
    • Error handling and exceptions
    • Integration between components

5. Complete Documentation

Compare the documentation in the .sthlp and examples/ directory with the R directory. Port any missing elements from stata to the R package.

Look through the source files in the package for any additional documentation or history information and port it to the R package.

Use examples to create vignettes

6. Add open source infrastructure

  • Copy the license file from the original package to the r package.
  • Add a contributing guide to the r package
  • Add a github workflow to run r tests on push to main, pull requests, and workflow dispatch
  • add a .gitignore to r package
  • Add a README to the r package

04 同仓库更多 Skills