Code Smarter, Not Harder: Unlocking AI-Assisted Coding
Updated: March 26th, 2026
This material was authored by Shelby Golden, M.S. You can learn more about the instructors here.
Workshop Learning Goals
Over the course of the workshop chapter, we will take you through:
- Foundational AI Literacy: Trace the long (and short) history of AI and its evolution from Alan Turing to the present day, distinguish between AI system types, and clarify what AI is — and isn’t.
- Understand the AI coding tool landscape, learn best practices for prompts and verification, and identify and navigate common pitfalls.
- Replicate the results of a paper using Yale’s AI Clarity LLM and Positron’s native IDE assistant, practicing prompting, iteration, debugging, and comparing the systems.
We have prepared a script outline (with solutions) for the workshop’s hands-on component. To use these materials, download the codebase and complete the setup steps. Participants will also need access to an LLM chatbot and the ability to configure an Integrated Development Environment (IDE) based AI assistant with a provider. Full setup instructions—including steps for enabling GitHub Copilot—are provided below under Accessing the Codespaces.
Slides and Handouts
Download the complete slide decks with annotations and the in-person workshop handouts. Comments have been saved in the bottom left corner of each slide, and references for this webpage are located in the Appendix.
Accessing the Codespaces
We have prepared a script outline (with solutions) for the workshop’s hands-on component. To use these materials, download the codebase and complete the setup steps listed below. Participants will also need access to an LLM chatbot and the ability to configure an IDE-based AI assistant with a provider.
If you haven’t already, please ensure you have a current installation of R and the new Positron IDE, a VS Code-based text editor developed by the same team behind Posit (formerly RStudio) 1. If this is your first time installing Positron or configuring the AI assistant, you will need to complete a few setup steps:
- OPTIONAL: Log into your GitHub account through the Positron Accounts tab
- Enable the “Positron Assistant,” the IDE’s integrated AI coding assistant
- Connect the “Positron Assistant” to a provider of your choice (e.g., Anthropic, Amazon Bedrock, GitHub Copilot)
Below are the full steps for configuring Positron with GitHub Copilot as your AI assistant. You are welcome to use any other supported provider, and for setup instructions for other compatible providers, refer to the Positron Getting Started page. We recommend using GitHub Copilot as your provider, as it offers a free standard tier, a 30-day Pro trial, and free Pro access for qualifying faculty and students.
This example also includes instructions for initializing a GitHub repository. Git and a GitHub account must be installed and configured beforehand. If you have not yet completed this setup, refer to Configurations and Credentials first.
Please note that all materials provided in this workshop, including any code added to your personal repository, belongs to DSDE. When using or referencing this material, please ensure to cite it correctly to give proper credit to the original authors.
This workshop was created using R (v 4.5.2) in the Positron IDE (v 2026.03.0 build 212). The renv() package (v 1.1.7) is included to reproduce the same coding environment, ensuring all relevant packages and package versions are stored. If you encounter issues running the scripts, please check that the environment is initialized and that you are using the same versions of R and Positron.
Configure Your AI Assistant in Positron
Log in to your personal GitHub account. If you don’t have one, follow the sign-up steps on our Book of Workshops page Sign Up for GitHub Account.
Review and select a GitHub Copilot license that works best for you: GitHub Copilot licenses. Follow GitHub’s setup instructions relevant to the license you selected.
Faculty and students signing up for the free Pro option will be told setup takes up to 3 days, though in practice it is often completed is less time. Plan accordingly.
If you have not already, download the Positron IDE.
Open a new Positron window. In the left sidebar, click the icon that looks like
to open the “Positron Assistant” window 2. First-time Positron Assistant users will need to make sure it is enabled. Click Enable Positron Assistant to open the settings and enable it.
Next, link the GitHub Copilot AI model provider. To confirm it is enabled, search for positron.assistant.provider.githubCopilot.enable in the settings tab. You may need to restart Positron for this to take effect.
In the same settings view, you’ll see a hyperlink labeled “language model provider dialog.” Click it to open the “Configure Language Model Providers” window.
The default settings will show Anthropic and GitHub Copilot as available providers. Select
GitHub Copilot to configure it as your AI model provider, then click Sign in to continue the configuration on GitHub. A second window will pop up displaying your configuration code. Click Copy & Continue to GitHub to be taken to GitHub for device activation. When prompted, paste the copied code and authorize the connection.
Restart Positron for this to take effect. You’ll know the integration is complete when you can successfully interact with the assistant through its pop-up sidebar chat box.
OPTIONAL: If you chose not to use GitHub Copilot, you can still link Positron to your GitHub account to access additional GitHub interactions from within Positron.
Click
(at the bottom of the left sidebar) and select “Sign into GitHub to use GitHub Pull Requests (1)”. A window will pop up displaying your configuration code. Click Copy & Continue to GitHub to be taken to GitHub for device activation. When prompted, paste the copied code and authorize the connection.
Restart Positron for this to take effect. You’ll know the integration is complete when you can successfully interact with the assistant through its pop-up sidebar chat box.
Initializing the Environment
- Download the prepared codebase, which is configured as Positron project and includes code for the hands-on portion of the workshop.
Unzipped the downloaded directory and move it to the file location you wish to house the project.
Command-Line Application
cd "file_path/Downloads/" # Open the directory the file was downloaded into. unzip Code-Smarter-Not-Harder-Unlocking-AI-Assisted-Coding.zip # Unzip the file. mv Code-Smarter-Not-Harder-Unlocking-AI-Assisted-Coding "/new_path/" # Move the unzipped directory to the new location.Open a new Positron window and select
Open Folder… to open a new folder from the main view. Navigate to the ~/Code-Smarter-Not-Harder-Unlocking-AI-Assisted-Codingdirectory and open it.From the left sidebar, click
to see the project directory contents and click Worked-Through Example.Rto open it.In the R console, activate the environment by running the following lines of code.
RStudio Console
renv::init() # Initialize the project. renv::restore() # Download packages and their version saved in the lockfile.
If you are asked to update packages, say no. The renv() is intended to recreate the same environment under which the project was created, making it reproducible. You are ready to proceed when running renv::restore() gives the output:
RStudio Output
- The library is already synchronized with the lockfile.If you experience any trouble with this step, you might want to confirm that you are using R (v 4.5.1) in the Positron IDE (v 2026.03.0 build 212). You can also read more about renv() in their vignette 3.
A .gitignore file has been included in the directory, specifying the files and file types that do not need to be version controlled or shared with GitHub. Please note that on some devices, this file might be hidden depending on your settings.
Deploying to GitHub
With a Git-initialized project, you can add it to a remote repository on GitHub. Below are instructions to help you establish a remote copy of this codebase on GitHub. If you are new to using Git and GitHub for code-based projects, please check out our workshop on the topic: Getting Started with Git and GitHub.
Log in to your personal GitHub account.
In the top-right of the page navigation bar, select the
dropdown menu and click New repository 4. Fill out the following sections:
Adjust the GitHub account owner as needed and create the name for the new repository.
It is good practice to initially set the repository to “Private”.
Do NOT use a template or include a description,
README.md,.gitignore, or license.
Open the command-line application (i.e. Terminal for Macs and Git Bash for Windows) and navigate to the file location you want to temporarily store the repository copy.
Command-Line Application
cd "/file_path/Code-Smarter-Not-Harder-Unlocking-AI-Assisted-Coding"Confirm that Git has been initialized by checking the project status. If the project is initialized, you should see that Git is present and tracking files.
Command-Line Application
git statusIf instead, you see the following message, you will need to initialize Git for the first time.
Command-Line Output
fatal: not a git repository (or any of the parent directories): .gitCommand-Line Application
git init # Initialize Git tracking.If
git statusshows untracked files or untracked changes to tracked files, add and commit these to the project’s.gitdirectory. If this is your first time committing the directory contents, you will see all files listed as untracked.Command-Line Application
git add . # Stage all changed and new files for version tracking. git commit -m "first commit"` # Commit the changes with a message.Create a branch named
main.Command-Line Application
git branch -a # Check that the branch 'main' does not exist. git branch -M main # If the main branch doesn’t exist, create it.In the newly created GitHub repository, under “Quick setup,” you will find the repository’s SSH or HTTPS URL. Copy one of these URLs to define the remote location and transfer protocol you want to use between your local device and this GitHub repository.
For example, if the repository name is “NEW-REPOSITORY,” the URLs will look like this:
# SSH git@github.com:EXAMPLE-USER/NEW-REPOSITORY.git # HTTPS https://github.com/EXAMPLE-USER/NEW-REPOSITORY.gitSet the GitHub repository location and save it as
origin. Replace the placeholder URL with the repository URL you copied from GitHub in the previous step.Command-Line Application
# using SSH git remote add origin git@github.com:EXAMPLE-USER/NEW-REPOSITORY.git # or using HTTPS git remote add origin https://github.com/EXAMPLE-USER/NEW-REPOSITORY.gitFinally, push the directory to your empty GitHub repository. Since you are establishing a new repository, use
-u origin mainto create and set the upstream branch in the GitHub repository.Command-Line Application
git push -u origin main # Push to remote and set upstream.Refresh the page to confirm the transfer and linking were successful.
About the Data
In this workshop, we aim to reproduce selected summary statistics and figures from Thomas et al. (2023), “Healthy Lifestyle Behaviors and Biological Aging in the U.S. National Health and Nutrition Examination Surveys, 1999–2018” 5. This paper used the Continuous National Health and Nutrition Examination Survey (NHANES) dataset, which provides information on participants’ eating and exercise habits, anthropometric measurements, and lab results 6.
The continuous series was launched in 1999 and has been conducted biennially since then. NHANES is a cross-sectional study that uses a stratified, multistage, probability-clustered sample of approximately 5,000 participants from 15 counties and includes sampling weights to generate nationally representative estimates 5,7,8. The authors applied the PhenoAge algorithm to predict participants’ biological age using the “Levine Original” formula (9 biomarkers) from the BioAge R package, which was trained on NHANES-III data (collected 1988–94): package paper and documentation 9–11.
Based on the methods section, the paper implies the use of sample weights to generate national estimates. Weight selection varies depending on which data files you’re combining, and weighted datasets require survey-specific functions for analysis (e.g., svyglm instead of glm) 12–14. However, the BioAge R package doesn’t appear to use weighted NHANES-III data when training the PhenoAge model. For consistency and simplicity, we skipped the weights in this example and focused on participant-level results instead.
Minimal differences in sample size were observed between our pipeline and the paper up until the pre-calculated PhenoAge values were assessed. At that step, approximately 10,000 more participants were identified as having missing PhenoAge values than reported in the paper.
Much of the data preparation has been conducted in the background so this example can remain focused on AI-assisted coding techniques. If you want to review the complete data processing steps, along with links to the full data dictionary associated with the NHANES datasets used, see “Code/Data Cleaning/Import and Compiling Continuous NHANES 1999 to 2018.R”.
Other Recommended Resources
This workshop only had so much time to cover the breadth of concepts we tackled. Below you’ll find the key resources we referenced to help you step into your next chapter of learning and implementing AI in your own work.
AI Literacy Fundamentals
- AI at Yale 15
- Yale’s Data-Intensive Social Science Center (DISSC) “Artificial Intelligence and Machine Learning for Social Science Research” page for events and content lead by Nick Warren 16
- Artificial Intelligence Basics: A Non-Technical Introduction by Tom Taulli
- The Cambridge Handbook of Artificial Intelligence edited by Keith Frankish and William M. Ramsey 17
- “What is a neural network?”, “… machine learning?”, “… generative AI?”, “… large language models (LLMs)?” from IBM 18–21
- “What is Good Old-Fashioned AI?” by Harpreet Singh Kalsi 22
AI-Assisted Coding
- Yale’s Harvey Cushing/John Hay Whitney Medical Library workshop “Code with Clarity: AI-Powered Programming for Researchers” by Justin DeMayo and Max Wegener 23
- Yale’s Data-Intensive Social Science Center (DISSC) “Artificial Intelligence and Machine Learning for Social Science Research” page for events and content lead by Nick Warren 16
- Yale’s Library “Using AI in Research” webpage 24
- AI-Assisted Programming - Better Planning, Coding, Testing, And Deployment by Tom Taulli 25
- What is a recurrent neural network? and What is a transformer model? from IBM 26,27
Section Glossary
| Integrated Development Environment (IDE) | A software application that combines tools for editing, building, testing, and debugging code into a single, user-friendly interface 1. |