# d2l

Adopt this skill: https://proskills.md/skills/other/aaryan-kapoor-d2l-cli-src-d2l-data-skill

Page: https://proskills.md/skills/other/aaryan-kapoor-d2l-cli-src-d2l-data-skill
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: src/d2l/data/skill/SKILL.md
size: 8015
upstream: https://github.com/aaryan-kapoor/d2l-cli/blob/main/src/d2l/data/skill/SKILL.md

````text
---
name: d2l
description: Fetch read-only academic data from D2L Brightspace and run course onboarding. Use when the user asks about courses, grades, assignments, due dates, quizzes, syllabi, announcements, course content, downloads, academic status, or first-time academic workflow setup.
metadata: {"openclaw":{"emoji":"🎓","requires":{"bins":["d2l"]}}}
---

# D2L Brightspace Academic Data

You have access to the `d2l` CLI tool which fetches READ-ONLY data from the user's D2L Brightspace LMS.

## Quick Reference

```bash
# Setup & diagnosis
d2l --json doctor                  # Full setup state + the exact next command to run
d2l setup --list-schools           # Known school presets
d2l setup --school gsu             # Configure a preset school
d2l setup --host https://your-school.view.usg.edu   # Any Brightspace school

# Identity & auth
d2l token                          # Check if token is valid
d2l whoami                         # Current user info

# Courses
d2l courses                        # List enrolled courses
d2l courses --all                  # Include inactive/past

# Grades
d2l grades "data structures"       # Grades for a course (fuzzy name match)
d2l grades --final                 # Final grades across all courses
d2l --json grades "econ"           # JSON output

# Assignments
d2l assignments "calc"             # Assignments + due dates

# Due dates & overdue
d2l due                            # Items due in next 7 days
d2l due --days 14                  # Items due in next 14 days
d2l overdue                        # Overdue items

# Calendar
d2l calendar                       # Events next 7 days
d2l calendar --course "data structures" --days 30

# News / Announcements
d2l news "data structures"         # Course announcements
d2l news                           # Activity feed

# Quizzes
d2l quizzes "data structures"      # Quiz list + dates

# Discussions
d2l discussions "data structures"  # Discussion forums
d2l discussions "data structures" --forum 12345    # Topics in forum
d2l discussions "data structures" --posts 12345 67890  # Posts

# Content
d2l content "data structures"      # Course modules
d2l content "data structures" --toc  # Full table of contents

# Download assignment files (starter code, instructions, etc.)
d2l download "data structures" "A06" -o ./assignment6
d2l download "calc" "review" -o ./calc-review

# Download content files (lecture notes, slides, study guides)
d2l download-content "calc" "Exam Preparation" -o ./exam-prep
d2l download-content "calc" "Unit 3 Materials" -o ./unit3   # recursive
d2l download-content "data structures" "Big-O" -o ./bigo

# Syllabus (fetched from SimpleSyllabus, no auth needed)
d2l syllabus "data structures"     # Full syllabus text
d2l --md syllabus "calc"           # Markdown format
d2l --json syllabus "econ"         # JSON with all fields

# Updates
d2l updates                        # Unread counts across courses

# Full AI snapshot
d2l --md dump                      # Everything, markdown format
d2l --md dump --course "data structures"  # One course
d2l --md dump --shallow            # Just enrollments + due/overdue
d2l --md dump --since 24           # Only new stuff from last 24 hours
d2l --md dump --since 48           # Last 2 days
d2l --json dump                    # Machine-readable JSON

# First-time course workflow setup
d2l onboard                        # Interactive course SOP setup
d2l onboard --yes                  # Starter SOP, only if the user declines the interview
```

## First-Time Setup

Run `d2l --json doctor` before anything else. It reports every setup check
(config, token, API access, courses, onboarding) with a `next_step` command —
follow it instead of guessing state.

If no school is configured, ask the user which school they attend, then run
`d2l setup --school NAME` (see `d2l setup --list-schools`) or
`d2l setup --host <their Brightspace URL>`. Never edit source files to
configure a school.

## Agent Defaults

1. **Read-only only.** Use `d2l` only for read-only Brightspace data. Never submit assignments, post discussions, modify grades, change settings, mark items complete/read, or perform actions that mutate D2L state.
2. **Prefer structured output.** Use `--md` or `--json` when processing data. Human/table output is for display only.
3. **Put global flags before the command.** Use `d2l --md grades "calc"`, not `d2l grades --md "calc"`.
4. **Auth maintains itself.** The CLI silently refreshes expired tokens using the saved browser session before any command fails. If a command still reports a sign-in error, the saved session has fully expired — ask the user whether you may launch `d2l login`, then run it so they can log in interactively. Never ask them to copy tokens or open DevTools.
5. **No browser scraping.** Do not use browser automation, page scraping, or in-page JavaScript to retrieve D2L course data. Browser login is only for authentication; course data should come from the CLI/API paths.
6. **Resolve courses carefully.** Course arguments can be fuzzy names, course codes, or numeric org unit IDs. If multiple courses match, ask the user to disambiguate or use the numeric ID.
7. **Fetch policy sources first.** For grading policies, course rules, grading weights, prerequisites, or instructor policies, fetch the syllabus first with `d2l --md syllabus COURSE` when available.
8. **Stop on required-source blockers.** If required D2L data cannot be fetched because of auth, permissions, or missing access, stop and report the blocker. Do not answer from stale, partial, or guessed data unless the user explicitly accepts that tradeoff.

## Output Formats

- Default: human-readable aligned tables
- `--json`: structured JSON (use for programmatic analysis)
- `--md`: AI-optimized markdown with IDs, full text, ISO dates

**Always use `--md` or `--json` when you need to process the data.** Human format is for display only.

Put the flag before the command: `d2l --md grades "calc"`

## Course Name Resolution

Course arguments accept fuzzy names, codes, or numeric IDs:
- `"data structures"` → matches "Data Structures Section 04..."
- `"econ"` → matches "Contemporary Economic Issues..."
- `"calc"` → matches "Calculus II..."
- `3824526` → exact org unit ID

## When Token Expires

Tokens expire hourly, but you normally never notice: every `d2l` command
auto-refreshes the token in the background from the saved browser session.

If a command still fails with a sign-in error, the saved session itself has
expired. Ask the user whether you may launch the browser for them; if they
agree, run:

```bash
d2l login
```

The user completes browser/SSO login interactively, and the CLI saves the
refreshed token. (`d2l login --headless` and `D2L_NO_AUTO_LOGIN=1` exist for
manual control, but are rarely needed.)

## Important

- This tool is **strictly read-only**. It cannot submit assignments, post discussions, modify grades, or change D2L state.
- Browser login is allowed only for authentication. Do not inspect or scrape course data through the browser.
- The `d2l dump --md` command is the best way to get full context about the user's academic situation.

## Syllabus

`d2l syllabus COURSE` fetches the full syllabus from SimpleSyllabus (separate from D2L, no auth needed). It includes course description, grading breakdown, policies, instructor info, and learning outcomes. Use this when the user asks about course policies, grading weights, prerequisites, or what a course covers.

## Responding to the User

When the user asks about their classes:
1. Run the appropriate `d2l` command to fetch the data.
2. Parse the output and present it clearly.
3. Offer analysis (grade calculations, upcoming deadline warnings, etc.).
4. If they ask "what's going on with my classes" or similar broad questions, use `d2l --md dump --shallow` first for a quick overview, then drill into specific courses as needed.
5. If they ask about grading policies, what grade they need, or course rules, fetch the
````

## File: README.md
upstream: https://github.com/aaryan-kapoor/d2l-cli/blob/main/README.md

````text
<p align="center">
  <img src="https://raw.githubusercontent.com/Aaryan-Kapoor/d2l-cli/main/assets/banner.gif" alt="A student tells their AI agent: im cooked, calc exam friday — the agent reads the syllabus, downloads the lectures, and starts a quiz, then the scene zooms out to the d2l-cli banner" width="100%"/>
</p>

<p align="center">
  <a href="https://pypi.org/project/d2l-cli/"><img src="https://img.shields.io/pypi/v/d2l-cli?logo=pypi&logoColor=white&color=blue" alt="PyPI"/></a>
  <img src="https://img.shields.io/badge/python-3.10+-blue?logo=python&logoColor=white" alt="Python 3.10+"/>
  <img src="https://img.shields.io/badge/license-MIT-green" alt="MIT License"/>
  <img src="https://img.shields.io/badge/read--only-by%20design-brightgreen" alt="Read-only"/>
  <img src="https://github.com/Aaryan-Kapoor/d2l-cli/actions/workflows/ci.yml/badge.svg" alt="CI"/>
</p>

**d2l-cli** gives any AI agent — Claude Code, OpenClaw, Cursor, Copilot, Gemini CLI, anything that can run a command — read-only access to your D2L Brightspace courses. Grades, due dates, assignments, quizzes, syllabi, announcements, lecture files. You stop clicking through D2L and start asking questions.

Works at **any school on Brightspace**. Kennesaw State and Georgia State are one-word presets.

## Set up in one message

Paste this into your AI agent:

```text
Fetch and follow the instructions from
https://raw.githubusercontent.com/Aaryan-Kapoor/d2l-cli/main/INSTALL_FOR_AGENTS.md
Set up d2l-cli for me end to end — install it, set up my school, sign me in,
and interview me about my courses. Then show me something useful you found
and suggest what I should ask next.
```

That's the whole setup. The agent installs the CLI, installs its own d2l skill, configures your school, opens a browser for your normal SSO login (it never sees your password — the CLI just captures the API token), verifies everything with `d2l doctor`, interviews you once about your courses so future sessions already know how you work — and finishes by pulling your real deadlines and suggesting what to ask first.

After that, your login refreshes itself: the CLI silently renews the token from your saved session, so you'll rarely be asked to sign in again.

## Then just ask

> *"What are my grades this semester?"*

![Claude Code fetching grades from all courses and presenting a summary table](https://raw.githubusercontent.com/Aaryan-Kapoor/d2l-cli/main/assets/grades-demo.png)

> *"What's due next week?"*

![Claude Code checking due dates across courses and listing upcoming items](https://raw.githubusercontent.com/Aaryan-Kapoor/d2l-cli/main/assets/due-demo.png)

### Prompts worth stealing

The point of an agent is autonomy — don't ask for data, ask for outcomes. Copy these:

**The weekly plan**

```text
Check every one of my courses. Build me a plan for the next 7 days: everything
due or overdue, ranked by grade impact — pull each course's grading weights
from the syllabus before ranking. Tell me what to start first and why.
```

**The grade audit**

```text
Pull my grades for every course. For each one: where am I losing points, what's
my current standing, and exactly what do I need on the remaining work to finish
with an A? Check the syllabus for grading weights before doing any math.
```

**The study session**

```text
I have a data structures exam coming up. Find and download the relevant lecture
notes and study materials, read them, then quiz me one question at a time until
I stop missing. Track which topics I'm weakest on.
```

**The assignment kickoff**

```text
Download the starter files and instructions for the next assignment due in data
structures into a new folder. Read the instructions and walk me through a plan
of attack — but don't write any solution code for me.
```

**The policy cheat sheet**

```text
Read the syllabus for every one of my courses and make me a one-page cheat
sheet: grading weights, late policies, exam dates, and instructor contact info.
```

**The morning briefing** (works great as a scheduled/recurring agent task)

```text
Run `d2l --md dump --since 24` and brief me: new announcements, new grades,
anything newly due or changed. If nothing happened, just say so in one line.
```

## How it works

1. **Your agent runs `d2l`** — a small Python CLI that talks to Brightspace's own student API. Every call is a GET; the tool physically cannot submit, post, or change anything.
2. **Auth is your normal browser login.** `d2l login` opens a real browser window, you sign in through your school's SSO like always, and the CLI captures the short-lived API token. Tokens expire hourly, but the CLI silently refreshes them from your saved browser session — you sign in roughly once per device, not once per hour.
3. **The agent carries a skill.** The bundled skill (`d2l skill install`) teaches any agent the commands, the safety rules, and the onboarding workflow, so a brand-new session is productive immediately.

## Manual setup (no agent)

```bash
pipx install "d2l-cli[login]"
d2l setup     # pick your school
d2l login     # browser opens — log in like normal
d2l courses
```

No pipx? Use `python -m pip install --user "d2l-cli[login]"` (on Windows: `py -m pip install --user "d2l-cli[login]"`) and make sure Python's user scripts directory is on your PATH — pip prints its exact location in a warning if it isn't.

`d2l login` uses Playwright's bundled Chromium if you have it, and automatically falls back to your installed Chrome or Edge — so no 150 MB browser download is required on most machines.

## Commands

```
d2l [--json | --md] <command>

Setup:
  setup [--school NAME | --host URL]   Configure your school (~/.d2l/config.json)
  doctor                               Diagnose config/auth/API state + next step
  skill install DIR                    Install the bundled agent skill
  update [--ref REF]                   Update to the latest release

Identity:
  login [--headless] [--channel X]     Browser-based token capture
  token                                Token status (no API call)
  whoami                               Current user info

Courses:
  courses [--all]                      List enrolled courses

Academics:
  grades COURSE [--final]              Grades for a course or across all
  assignments COURSE                   Assignments + due dates
  quizzes COURSE                       Quiz list + dates
  syllabus COURSE                      Full syllabus from SimpleSyllabus

Content:
  content COURSE [--toc]               Course modules and topics
  discussions COURSE                   Forums, topics, posts
  news [COURSE] [--since DATE]         Announcements

Scheduling:
  calendar [--course X] [--days N]     Calendar events
  due [--days N]                       Items due soon
  overdue                              Overdue items
  updates [COURSE]                     Unread update counts

Downloads:
  download COURSE ASSIGNMENT [-o DIR]        Assignment attachments
  download-content COURSE MODULE [-o DIR]    Content files (notes, slides)

AI snapshot:
  dump [--course X] [--shallow] [--since N]  Full academic snapshot

Onboarding:
  onboard [--force] [--yes]            Create/update the course SOP + state
```

Every `COURSE` argument takes fuzzy names (`"data structures"`, `"calc"`), course codes, or numeric IDs. Output is human tables by default, `--json` for machines, `--md` for AI consumption — put the flag before the command.

## Your school

```bash
d2l setup                    # interactive picker
d2l setup --school ksu       # Kennesaw State preset (includes SimpleSyllabus)
d2l setup --school gsu       # Georgia State preset
d2l setup --host https://your-school.view.usg.edu     # any Brightspace school
d2l setup --syllabus-host https://your-school.simplesyllabus.com   # optional
```

Config lives in `~/.d2l/config.json`; `D2L_HOST` overrides it per-run. At a school that isn't a preset yet? It still works with `--host` — and a one-line PR to [`schools.py`](https://github.com/Aaryan-K
````
