From 544cca8514d39dc8a4c265b98f1abca4d5e406a4 Mon Sep 17 00:00:00 2001 From: svincent240 <66322922+svincent240@users.noreply.github.com> Date: Fri, 6 Nov 2026 14:03:58 -0500 Subject: [PATCH] Set up any AI tool with one prompt; ship workflow skills in every project coursecode create and agent-setup now copy the plugin's outline, build-slides, review, and publish skills into projects as coursecode-* skills in .claude/skills/ (Claude Code) and .agents/skills/ (Codex, Cursor, VS Code). A project created with npx gets the same guided workflow as the plugin, so the plugin becomes optional. --plugin skips the copies, and existing skill files are never overwritten. The README, User Guide, and plugin docs now lead with one prompt that has the AI tool check Node.js and run `npx coursecode@latest create .`, followed by one restart. create tells an already-open AI tool to restart, and the project AGENTS.md says what to do when the tools are missing. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 2 +- CHANGELOG.md | 7 ++ README.md | 58 +++++++-------- bin/cli.js | 12 ++-- framework/docs/USER_GUIDE.md | 105 +++++++++++++++++----------- lib/agent-setup.js | 52 ++++++++++++-- lib/create.js | 3 +- package.json | 1 + plugin/CODEX.md | 6 +- plugin/README.md | 10 +-- plugin/skills/build-slides/SKILL.md | 2 +- plugin/skills/setup/SKILL.md | 2 +- tests/create.test.js | 3 + tests/lib/agent-setup.test.js | 38 +++++++++- tests/lib/plugin-manifests.test.js | 4 +- 15 files changed, 210 insertions(+), 95 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 67a5145..477ce69 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -35,7 +35,7 @@ This repo is both the framework source and the template for new course projects. - `template/course/` — doubles as the test course for framework development - `vite.framework-dev.config.js` — framework dev build (references `lib/` directly); `template/vite.config.js` is the course-author build (imports from the `coursecode` package) - `plugin/` — one plugin for Claude Code (`.claude-plugin/plugin.json`, `.mcp.json`, `hooks/`) and Codex (`plugin.json`, `mcp.json`), sharing `skills/` and the `mcp/coursecode-mcp.mjs` launcher. Both repo marketplaces (`.claude-plugin/marketplace.json`, `.agents/plugins/marketplace.json`) point at it. `npm run plugin:pack` builds the Codex directory package with a bundled runtime in ignored `artifacts/codex-plugin/`; see `plugin/CODEX.md`. -- `lib/agent-setup.js` — MCP settings and `AGENTS.md` that `coursecode create` and `coursecode agent-setup` write into course projects +- `lib/agent-setup.js` — MCP settings, `AGENTS.md`, and copies of the project-stage plugin skills (as `coursecode-*` in `.claude/skills/` and `.agents/skills/`) that `coursecode create` and `coursecode agent-setup` write into course projects. `plugin/skills/` ships in the npm package for this; the rest of `plugin/` does not. Changes under `template/` ship to every new course project. Keep framework-dev-only content out of it. diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e63b23..b7980d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- **Workflow skills in every project:** `coursecode create` and `coursecode agent-setup` now copy the plugin's `outline`, `build-slides`, `review`, and `publish` skills into the project as `coursecode-outline`, `coursecode-build-slides`, `coursecode-review`, and `coursecode-publish`, in `.claude/skills/` (Claude Code) and `.agents/skills/` (Codex, Cursor, VS Code). AI tools get the guided workflow without installing the plugin. Existing skill files are never overwritten, and `--plugin` skips them because the plugin provides the same skills. + +### Changed +- **Getting started:** The README, User Guide, and plugin docs lead with one prompt to paste into any AI tool, which runs `npx coursecode@latest create .`. The Claude Code and Codex plugin is described as optional. +- **First-run guidance:** `coursecode create` now says to quit and restart an AI tool that is already open, so it loads the project's CourseCode tools, and the project `AGENTS.md` tells the AI what to say when the tools are missing. + ## [0.4.4] - 2026-10-30 ### Added diff --git a/README.md b/README.md index 854ece5..a43c070 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Framework documentation lives at [coursecodeframework.com/docs](https://courseco ## Features -- **Works with your AI tool**: A plugin for Claude Code and Codex, and MCP settings for Claude Code, Codex, Cursor, and VS Code in every new project. Any other MCP client can run `coursecode mcp` +- **Works with your AI tool**: Every new project includes MCP settings and workflow skills for Claude Code, Codex, Cursor, and VS Code. Any other MCP client can run `coursecode mcp`, and an optional plugin is available for Claude Code and Codex - **No coding required to start**: Describe what you want and let AI help build slides, interactions, and structure - **Course modernization**: Use existing SCORM courses, PowerPoints, PDFs, Word docs, scripts, and SME notes as source material for upgraded courses - **LMS integration**: SCORM 1.2, SCORM 2004, and cmi5 packaging, plus an LTI 1.3 browser contract for trusted server-backed launches @@ -35,46 +35,46 @@ Framework documentation lives at [coursecodeframework.com/docs](https://courseco ## Quick Start -### With the plugin (recommended) +You need [Node.js](https://nodejs.org/) 22.15 or later and an AI tool that can run commands, such as Claude Code, Codex, Cursor, or VS Code with GitHub Copilot. Your AI tool can install Node.js for you. -The Claude Code and Codex plugin guides your AI tool from a new project to an LMS package, and it works before a project exists. It is not yet in the Claude Code or Codex plugin directories, so install it from this repository: +1. Create an empty folder for your course and start your AI tool in it. +2. Paste this: -```bash -# Claude Code -claude plugin marketplace add course-code-framework/coursecode -claude plugin install coursecode@coursecode - -# Codex -codex plugin marketplace add course-code-framework/coursecode -codex plugin add coursecode@coursecode -``` + ```text + Set up a CourseCode Framework course in this folder. Check that Node.js 22.15 or later is installed and help me install it if it isn't. Then run `npx coursecode@latest create .` and tell me what to do next. + ``` -Then start a new chat in your AI tool in an empty folder and describe the course you want. In Codex, ask it to set up CourseCode Framework first; see the [Codex setup guide](plugin/CODEX.md#install-from-github) for connection checks and updates. +3. When it's done, quit your AI tool and start it again in the same folder so it loads the CourseCode tools. Claude Code asks once to approve the `coursecode` server; Codex asks you to trust the folder. +4. Describe the course you want. +5. When the course is ready, ask your AI tool to export it for your LMS (SCORM 1.2, SCORM 2004, cmi5, or LTI 1.3), or to deploy it to [CourseCode Cloud](https://coursecodecloud.com) for hosting, share links, and analytics. Cloud is optional. -The plugin needs [Node.js](https://nodejs.org/) 22.15 or later but no global `coursecode` install. If Node.js is missing, its `setup` skill offers to install it. The plugin bundles the MCP server below and six skills: setup, new-course, outline, build-slides, review, and publish. See [plugin/README.md](plugin/README.md). +The project includes MCP settings for Claude Code, Codex, Cursor, and VS Code, an `AGENTS.md` with the authoring workflow, and four workflow skills (outline, build slides, review, publish). Nothing else needs installing, and no account is required. -### With npx - -With [Node.js](https://nodejs.org/) 22.15 or later installed, create a project: +### Without an AI tool ```bash -npx coursecode create my-course +npx coursecode@latest create my-course +cd my-course +npx coursecode preview ``` -Open the `my-course` folder in Claude Code, Codex, Cursor, or VS Code and describe the course you want. The project includes MCP settings for each of those tools and an `AGENTS.md` with the authoring workflow, so the AI tool connects on its own. Claude Code asks once to approve the project's MCP server; Codex reads project settings after you trust the folder. +Open `http://localhost:4173` to view and edit your course. The example course included with every new project is a complete guide to using CourseCode. -To preview without an AI tool: +### Claude Code and Codex plugin (optional) -```bash -cd my-course -npx coursecode preview -``` +The plugin runs the CourseCode tools in every folder, so your AI tool can start a course before a project exists. You don't need it, because projects already include the tools and skills. Install it from this repository: -Open `http://localhost:4173` to view and edit your course. +```bash +# Claude Code +claude plugin marketplace add course-code-framework/coursecode +claude plugin install coursecode@coursecode -The example course included with every new project is a complete guide to using CourseCode. +# Codex +codex plugin marketplace add course-code-framework/coursecode +codex plugin add coursecode@coursecode +``` -Start with the [User Guide](framework/docs/USER_GUIDE.md) for a complete walkthrough. +See [plugin/README.md](plugin/README.md). Start with the [User Guide](framework/docs/USER_GUIDE.md) for a complete walkthrough. --- @@ -100,7 +100,7 @@ Also recommended: CourseCode includes a built-in [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server. When your AI tool supports MCP, it connects directly to your course project, so you don't have to paste files into a chat. -New projects already include MCP settings for Claude Code (`.mcp.json`), Codex (`.codex/config.toml`), Cursor (`.cursor/mcp.json`), and VS Code (`.vscode/mcp.json`). To add them to an existing project, run `coursecode agent-setup`. Any other MCP client can start the server with: +New projects already include MCP settings for Claude Code (`.mcp.json`), Codex (`.codex/config.toml`), Cursor (`.cursor/mcp.json`), and VS Code (`.vscode/mcp.json`), plus workflow skills in `.claude/skills/` and `.agents/skills/`. To add them to an existing project, run `coursecode agent-setup`. Any other MCP client can start the server with: ```bash coursecode mcp @@ -243,7 +243,7 @@ Other ways to share it: | `coursecode export html` | Create one shareable course file that opens without an LMS or server | | `coursecode convert` | Convert PDFs, Word, PowerPoint to markdown | | `coursecode mcp` | Start the MCP server for AI integration | -| `coursecode agent-setup` | Add MCP settings for Claude Code, Codex, Cursor, and VS Code, plus `AGENTS.md`, to an existing project | +| `coursecode agent-setup` | Add MCP settings, `AGENTS.md`, and workflow skills for Claude Code, Codex, Cursor, and VS Code to an existing project | | `coursecode lint` | Validate course structure and content | | `coursecode build` | Build a package for LMS upload | | `coursecode narration` | Generate audio narration from text | diff --git a/bin/cli.js b/bin/cli.js index 7a949ad..6ee7c58 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -102,7 +102,7 @@ program .option('--blank', 'Create without example slides (clean starter)') .option('--no-install', 'Skip npm install') .option('--start', 'Start the preview server after creation') - .option('--plugin', 'Skip .mcp.json because the CourseCode plugin provides the Claude Code MCP server') + .option('--plugin', 'Skip .mcp.json and project skills because the CourseCode plugin provides them') .action(async (name, options) => { const { create } = await import('../lib/create.js'); await create(name, options); @@ -114,7 +114,7 @@ program .option('--blank', 'Create without example content (clean starter)') .option('--no-install', 'Skip npm install') .option('--start', 'Start the preview server after creation') - .option('--plugin', 'Skip .mcp.json because the CourseCode plugin provides the Claude Code MCP server') + .option('--plugin', 'Skip .mcp.json and project skills because the CourseCode plugin provides them') .action(async (name, options) => { const { create } = await import('../lib/create.js'); await create(name || '.', { ...options, currentDirectory: true }); @@ -243,7 +243,7 @@ program .option('-n, --name ', 'Project name (default: derived from filename)') .option('--slides-dir ', 'Use pre-exported slide images from this directory (skips PowerPoint)') .option('--no-install', 'Skip npm install') - .option('--plugin', 'Skip .mcp.json because the CourseCode plugin provides the Claude Code MCP server') + .option('--plugin', 'Skip .mcp.json and project skills because the CourseCode plugin provides them') .action(async (source, options) => { const { importPresentation } = await import('../lib/import.js'); await importPresentation(source, options); @@ -330,14 +330,14 @@ program // AI tool settings for an existing project program .command('agent-setup') - .description('Add MCP settings for Claude Code, Codex, Cursor, and VS Code, plus AGENTS.md, to this project') - .option('--plugin', 'Skip .mcp.json because the CourseCode plugin provides the Claude Code MCP server') + .description('Add MCP settings, AGENTS.md, and workflow skills for Claude Code, Codex, Cursor, and VS Code to this project') + .option('--plugin', 'Skip .mcp.json and project skills because the CourseCode plugin provides them') .action(async (options) => { const { validateProject } = await import('../lib/project-utils.js'); validateProject(); const { writeAgentSetup } = await import('../lib/agent-setup.js'); const written = writeAgentSetup(process.cwd(), { plugin: options.plugin === true }); - console.log(written.length ? `\n✅ Updated ${written.join(', ')}\n` : '\nAI tool settings are already in place.\n'); + console.log(written.length ? `\n✅ Updated:\n${written.map(file => ` ${file}`).join('\n')}\n` : '\nAI tool settings are already in place.\n'); }); // Token generation command program diff --git a/framework/docs/USER_GUIDE.md b/framework/docs/USER_GUIDE.md index 0426f35..da45ee9 100644 --- a/framework/docs/USER_GUIDE.md +++ b/framework/docs/USER_GUIDE.md @@ -8,8 +8,10 @@ A complete guide to creating interactive e-learning courses with AI assistance. 1. [Getting Started](#getting-started) - [What You'll Need](#what-youll-need) - - [Installation](#installation) - - [Creating Your First Project](#creating-your-first-project) + - [Setting Up With Your AI Tool](#setting-up-with-your-ai-tool) + - [Setting Up Without an AI Tool](#setting-up-without-an-ai-tool) + - [The Claude Code and Codex Plugin (Optional)](#the-claude-code-and-codex-plugin-optional) + - [Creating New Files](#creating-new-files) - [Importing a PowerPoint (Optional)](#importing-a-powerpoint-optional) 2. [Your Course Folder](#your-course-folder) - [Where Everything Lives](#where-everything-lives) @@ -66,33 +68,67 @@ A complete guide to creating interactive e-learning courses with AI assistance. ### What You'll Need -**Required:** -- [Node.js](https://nodejs.org/) (version 22.15 or later) +- **An AI tool that can run commands on your computer**, such as [Claude Code](https://claude.com/claude-code), [Codex](https://developers.openai.com/codex), [Cursor](https://cursor.com/), or VS Code with GitHub Copilot. Any tool that supports MCP works. You can also use CourseCode without one; see [Setting Up Without an AI Tool](#setting-up-without-an-ai-tool). +- **[Node.js](https://nodejs.org/) 22.15 or later.** If it's missing, your AI tool can install it for you. -**Recommended:** -- A text editor like [VS Code](https://code.visualstudio.com/) or [Notepad++](https://notepad-plus-plus.org/) -- An AI assistant like [Claude](https://claude.ai/), [ChatGPT](https://chat.openai.com/), or [GitHub Copilot](https://github.com/features/copilot) -- [GitHub Desktop](https://desktop.github.com/) for version control (optional) +No CourseCode account is needed. CourseCode Framework is open source and runs on your computer. [CourseCode Cloud](#coursecode-cloud-optional) is an optional hosting service you can add later. -### Installation +### Setting Up With Your AI Tool -After installing Node.js, open your terminal (Terminal on Mac, Command Prompt or PowerShell on Windows) and run: +1. Create an empty folder for your course and start your AI tool in it. For example, run `claude` or `codex` in that folder, or open it in Cursor or VS Code. +2. Paste this: + + ```text + Set up a CourseCode Framework course in this folder. Check that Node.js 22.15 or later is installed and help me install it if it isn't. Then run `npx coursecode@latest create .` and tell me what to do next. + ``` + +3. When it's done, quit your AI tool and start it again in the same folder, so it loads the CourseCode tools. Claude Code asks once to approve the `coursecode` server. Codex asks you to trust the folder. +4. Describe the course you want, for example "Build a 20-minute safety course from the PDFs I'm adding to course/references". Your AI tool starts the preview at `http://localhost:4173` so you can watch the course as it builds. +5. When the course is ready, ask your AI tool to export it for your LMS (SCORM 1.2, SCORM 2004, cmi5, or LTI 1.3), or to deploy it to [CourseCode Cloud](#coursecode-cloud-optional) for hosting, share links, and analytics. Cloud is optional. + +The new project contains everything your AI tool needs: + +- **MCP settings** for Claude Code, Codex, Cursor, and VS Code, so it can preview, screenshot, lint, and test the course. See [Connecting AI with MCP](#connecting-ai-with-mcp). +- **An `AGENTS.md`** that explains the authoring workflow. +- **Four workflow skills**: `coursecode-outline`, `coursecode-build-slides`, `coursecode-review`, and `coursecode-publish`, in `.claude/skills/` and `.agents/skills/`. + +The project starts with example slides that show what CourseCode can do. Ask your AI tool to remove them when you start your own course, or ask for a blank project in step 2 (`npx coursecode@latest create . --blank`). + +### Setting Up Without an AI Tool + +In a terminal (Terminal on Mac, PowerShell on Windows): + +```bash +npx coursecode@latest create my-course +cd my-course +npx coursecode preview +``` + +Open `http://localhost:4173` in your browser. You'll see an example course that teaches you how to use CourseCode and shows what it can do. You can open the same folder in an AI tool at any time. + +Every command works through `npx`. For the shorter `coursecode` command used in the rest of this guide, install the CLI globally: ```bash npm install -g coursecode ``` -This installs CourseCode globally so you can use it from any folder. +### The Claude Code and Codex Plugin (Optional) -### Creating Your First Project +The CourseCode plugin makes the tools available in every folder, so your AI tool can create a course before a project exists, and adds `setup` and `new-course` skills. In Claude Code it also checks Node.js at the start of each session. You don't need it: projects already include the MCP settings and workflow skills. Install it from GitHub: ```bash -coursecode create my-course -cd my-course -coursecode preview +# Claude Code +claude plugin marketplace add course-code-framework/coursecode +claude plugin install coursecode@coursecode + +# Codex +codex plugin marketplace add course-code-framework/coursecode +codex plugin add coursecode@coursecode ``` -Open `http://localhost:4173` in your browser. You'll see an example course that teaches you how to use CourseCode and shows what it can do. +Then start a new session in an empty folder and describe the course you want. Projects the plugin creates leave out the Claude Code MCP settings and the project skills, because the plugin provides both. See the [plugin README](https://github.com/course-code-framework/coursecode/blob/main/plugin/README.md). + +### Creating New Files #### Starting Fresh @@ -108,7 +144,7 @@ coursecode create my-course --blank coursecode clean ``` -#### Creating New Files +#### Scaffolding Slides and Quizzes Use these commands to scaffold new files quickly: @@ -230,41 +266,27 @@ Without MCP, you describe problems to your AI and paste code back and forth. Wit ### Setup -**Projects you create are already set up.** `coursecode create` writes MCP settings for Claude Code (`.mcp.json`), Codex (`.codex/config.toml`), Cursor (`.cursor/mcp.json`), and VS Code (`.vscode/mcp.json`), plus an `AGENTS.md` that tells the AI tool how to work on the course. Open the project folder in any of those tools and the CourseCode tools are available. Claude Code asks once to approve the project's MCP server, and Codex reads project settings after you trust the folder. For a project created before this, run `coursecode agent-setup` in the project folder. +**Projects you create are already set up.** `coursecode create` writes MCP settings for Claude Code (`.mcp.json`), Codex (`.codex/config.toml`), Cursor (`.cursor/mcp.json`), and VS Code (`.vscode/mcp.json`), an `AGENTS.md` that tells the AI tool how to work on the course, and four workflow skills in `.claude/skills/` and `.agents/skills/`. Start your AI tool in the project folder and the CourseCode tools are available. An AI tool that was already open when the project was created must be restarted in the folder first. -Projects the CourseCode plugin creates leave out `.mcp.json`, because the plugin already runs the CourseCode server in Claude Code and a project copy would list every tool twice. To open such a project in Claude Code without the plugin, run `coursecode agent-setup`. Pass `--plugin` to `create`, `init`, `import`, or `agent-setup` to get the same behavior yourself. - -To start a new course from inside your AI tool, before a project exists, install the plugin for Claude Code or Codex, or add the server to your tool's settings as shown below. +For a project created with an older version, run `npx coursecode agent-setup` in the project folder. It adds whatever is missing and never overwrites files you have changed. #### Claude Code -Install the CourseCode plugin. It sets up the MCP server and adds guided skills for each stage of the workflow: - -```bash -claude plugin marketplace add course-code-framework/coursecode -claude plugin install coursecode@coursecode -``` - -Start Claude Code from your course folder (or an empty folder for a new course). Run `/coursecode:new-course` to begin, or just describe what you want to build. +Run `claude` in the project folder and approve the `coursecode` server when asked. If you don't see the CourseCode tools, run `/mcp` to check the server. #### Codex -Install the plugin from GitHub (recommended for Codex). This includes the MCP server and six guided authoring skills: +Run `codex` in the project folder and trust the folder when asked, so Codex reads `.codex/config.toml`. -```bash -codex plugin marketplace add course-code-framework/coursecode -codex plugin add coursecode@coursecode -``` - -After installing, start a new Codex chat in your course folder and trust it when prompted. Ask it to set up CourseCode Framework and confirm the tools respond. First-time setup needs Node.js 22.15 or later and an internet connection; local authoring, Preview, and Export need no CourseCode Cloud account. See the [Codex setup and update guide](https://github.com/course-code-framework/coursecode/blob/main/plugin/CODEX.md#install-from-github). - -For an MCP-only setup without the six plugin skills, new projects already contain Codex settings. Alternatively, add a standalone global server with the Codex CLI (no global Framework install required): +To have the tools in every folder without a project, add a global server instead (no global CourseCode install needed). Use either this or the project settings, not both: ```bash codex mcp add coursecode -- npx -y coursecode mcp ``` -Start Codex from your course folder (or an empty folder for a new course). Use the plugin or the standalone global server; registering both is unnecessary. +#### The plugin + +The [Claude Code and Codex plugin](#the-claude-code-and-codex-plugin-optional) runs the same server in every folder. Projects the plugin creates leave out `.mcp.json` and the project skills, because a project copy would list every tool and skill twice. To open such a project without the plugin, run `npx coursecode agent-setup`. Pass `--plugin` to `create`, `init`, `import`, or `agent-setup` to get the plugin behavior yourself. #### Claude Desktop @@ -968,6 +990,11 @@ Audio files are generated to `course/assets/audio/`. A slide plays its narration ## Troubleshooting +**My AI tool doesn't have the CourseCode tools** +- Quit the AI tool and start it again in the course folder (the one that contains `course/`). AI tools load project settings only when they start. +- Claude Code: approve the `coursecode` server when asked, or run `/mcp` to check it. Codex: trust the folder. +- Run `npm install` if `node_modules/` is missing, and `npx coursecode agent-setup` if the project has no `.mcp.json` or `.codex/config.toml`. + **The preview won't start** - Make sure you're in your project folder (where `course/` exists) - Try `npm install` if you haven't already diff --git a/lib/agent-setup.js b/lib/agent-setup.js index 1b72753..5d0bf62 100644 --- a/lib/agent-setup.js +++ b/lib/agent-setup.js @@ -8,15 +8,25 @@ * Existing files are never overwritten: JSON settings gain a coursecode server * entry, TOML gains a table, and AGENTS.md / CLAUDE.md are left alone. * - * With the CourseCode plugin, Claude Code already starts a coursecode server, so - * plugin setup skips .mcp.json; a project server would give the agent every - * tool twice. + * Projects also get the plugin's project-stage skills (outline, build-slides, + * review, publish) as coursecode-* skills in .claude/skills/ (Claude Code) and + * .agents/skills/ (Codex, Cursor, VS Code), so the guided workflow does not + * depend on installing the plugin. + * + * With the CourseCode plugin, Claude Code already starts a coursecode server and + * the plugin provides the skills, so plugin setup skips .mcp.json and the skill + * folders; project copies would give the agent every tool and skill twice. */ import fs from 'fs'; import path from 'path'; +import { fileURLToPath } from 'url'; const PROJECT_CLI = 'node_modules/coursecode/bin/cli.js'; +const SKILLS_SOURCE = fileURLToPath(new URL('../plugin/skills/', import.meta.url)); +const PROJECT_SKILLS = ['outline', 'build-slides', 'review', 'publish']; +const SKILL_FOLDERS = ['.claude/skills', '.agents/skills']; + // Cursor and VS Code may start servers outside the workspace; the CLI moves to // COURSECODE_PROJECT_DIR first. const workspaceServer = { @@ -51,6 +61,7 @@ This folder is a CourseCode Framework course. Slides are JavaScript files in \`c The \`coursecode\` MCP server is configured for this folder. Run \`npm install\` first if \`node_modules/\` is missing. +- If the \`coursecode_*\` tools are not available, the AI tool has not loaded this folder's settings yet. Tell the author to quit and restart it in this folder (or start a new session here). Claude Code then asks once to approve the \`coursecode\` server; Codex reads the settings after the folder is trusted. - Call \`coursecode_workflow_status\` at the start of a session. It reports the authoring stage and what to do next. - Start the preview once, as a background process: \`npx coursecode preview\` (http://localhost:4173). Runtime tools such as \`coursecode_screenshot\` and \`coursecode_interact\` need it. - After editing slides, run \`coursecode_lint\`, then check the slide with \`coursecode_screenshot\`. @@ -63,6 +74,8 @@ The \`coursecode\` MCP server is configured for this folder. Run \`npm install\` 4. Review every slide at desktop and mobile sizes (\`coursecode_viewport\`) and answer each interaction with \`coursecode_interact\`. 5. Export with \`npx coursecode build --format scorm1.2\` (or \`scorm2004\`, \`cmi5\`, \`lti\`). Deploying to CourseCode Cloud is optional and only on request. +Steps 2 to 5 each have a detailed skill: \`coursecode-outline\`, \`coursecode-build-slides\`, \`coursecode-review\`, and \`coursecode-publish\` in \`.claude/skills/\` and \`.agents/skills/\`, or \`outline\`, \`build-slides\`, \`review\`, and \`publish\` from the CourseCode plugin. Use them when they apply. + ## Rules - Edit files in \`course/\`. Do not edit \`framework/\`, \`schemas/\`, or \`node_modules/\`. @@ -108,9 +121,37 @@ function writeIfMissing(projectDir, file, content) { return file; } +const SKILL_REFERENCE = new RegExp(`\`(${PROJECT_SKILLS.join('|')})\` skill`, 'g'); + +/** + * A plugin skill as a project skill: renamed to coursecode- so it doesn't + * collide with other tools' commands (Claude Code has its own /review), with + * references to its sibling skills renamed to match. + */ +export function projectSkill(name) { + const source = path.join(SKILLS_SOURCE, name, 'SKILL.md'); + if (!fs.existsSync(source)) return null; + return fs.readFileSync(source, 'utf-8') + .replace(/^name: .+$/m, `name: coursecode-${name}`) + .replace(SKILL_REFERENCE, '`coursecode-$1` skill'); +} + +function writeSkills(projectDir) { + return PROJECT_SKILLS.flatMap(name => { + const content = projectSkill(name); + if (!content) return []; + return SKILL_FOLDERS.map(folder => { + const file = `${folder}/coursecode-${name}/SKILL.md`; + fs.mkdirSync(path.join(projectDir, path.dirname(file)), { recursive: true }); + return writeIfMissing(projectDir, file, content); + }); + }); +} + /** * Write AI tool settings into a project. Returns the files written or updated. - * Pass { plugin: true } when the CourseCode plugin provides Claude Code's server. + * Pass { plugin: true } when the CourseCode plugin provides Claude Code's server + * and the skills. */ export function writeAgentSetup(projectDir, { plugin = false } = {}) { const jsonSettings = plugin ? JSON_SETTINGS.filter(setting => setting !== CLAUDE_SETTINGS) : JSON_SETTINGS; @@ -118,6 +159,7 @@ export function writeAgentSetup(projectDir, { plugin = false } = {}) { ...jsonSettings.map(setting => writeJsonSetting(projectDir, setting)), writeCodexSetting(projectDir), writeIfMissing(projectDir, 'AGENTS.md', AGENTS_MD), - writeIfMissing(projectDir, 'CLAUDE.md', CLAUDE_MD) + writeIfMissing(projectDir, 'CLAUDE.md', CLAUDE_MD), + ...(plugin ? [] : writeSkills(projectDir)) ].filter(Boolean); } diff --git a/lib/create.js b/lib/create.js index 2e13d89..f3fa060 100644 --- a/lib/create.js +++ b/lib/create.js @@ -198,7 +198,8 @@ export function formatNextSteps({ directoryName, currentDirectory = false, plugi if (plugin) return `\n ${preview}`; - return `\n Open the project in your AI tool and describe the course you want:\n\n ${changeDirectory}claude # or codex, or open the folder in Cursor or VS Code\n\n ${preview}`; + const folder = currentDirectory ? 'this folder' : `the ${directoryName} folder`; + return `\n Next, start your AI tool in ${folder} so it loads the CourseCode tools.\n An AI tool that is already open must be quit and started again there:\n\n ${changeDirectory}claude # or codex, or open the folder in Cursor or VS Code\n\n Claude Code asks once to approve the coursecode server; Codex needs the folder trusted.\n Then describe the course you want.\n\n ${preview}`; } /** diff --git a/package.json b/package.json index e929fa2..7d53c42 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "!framework/dist/**", "schemas", "template", + "plugin/skills", "!template/**/.gitkeep", "!template/.narration-cache.json", "!template/**/.narration-cache.json", diff --git a/plugin/CODEX.md b/plugin/CODEX.md index 0606e14..40dc482 100644 --- a/plugin/CODEX.md +++ b/plugin/CODEX.md @@ -2,7 +2,7 @@ The plugin in `plugin/` works in both Claude Code and Codex. Codex reads `plugin.json` and `mcp.json`; Claude Code reads `.claude-plugin/plugin.json` and `.mcp.json`. Both use the same skills (setup, new-course, outline, build-slides, review, publish) and the same launcher, `mcp/coursecode-mcp.mjs`. -It is not yet in OpenAI's public plugin directory. Until it is, install it from this repository. +Install it from this repository. It is not in OpenAI's public plugin directory, and you don't need the plugin: projects created with `npx coursecode create` include Codex MCP settings and the workflow skills in `.agents/skills/`. CourseCode Framework is open source and works without Cloud. CourseCode Cloud is an optional hosted layer for deployment, licensing, analytics, and managed services. @@ -36,9 +36,9 @@ The launcher runs the project's own `coursecode` dependency when there is one, s ### MCP-only alternative -Without the plugin, projects created with `npx coursecode create my-course` include `.codex/config.toml` and authoring instructions. Open the course folder in Codex and trust it. For older projects, run `npx coursecode agent-setup` in that folder. +Without the plugin, projects created with `npx coursecode create my-course` include `.codex/config.toml`, authoring instructions, and the `coursecode-outline`, `coursecode-build-slides`, `coursecode-review`, and `coursecode-publish` skills in `.agents/skills/`. Open the course folder in Codex and trust it. For older projects, run `npx coursecode agent-setup` in that folder. -For a standalone global MCP connection, use `codex mcp add coursecode -- npx -y coursecode mcp`. This does not require a global Framework installation and does not include the plugin's six skills. Choose the plugin or the standalone global connection; there is no need to register both. +For a standalone global MCP connection, use `codex mcp add coursecode -- npx -y coursecode mcp`. This does not require a global Framework installation and does not include any skills. Choose the plugin or the standalone global connection; there is no need to register both. ## Directory package diff --git a/plugin/README.md b/plugin/README.md index c93c5d3..93aef94 100644 --- a/plugin/README.md +++ b/plugin/README.md @@ -2,9 +2,11 @@ Build LMS-ready e-learning courses (SCORM 1.2, SCORM 2004, cmi5, LTI 1.3) by describing them to your AI coding tool. The plugin bundles the CourseCode MCP server and six skills that walk through the authoring workflow. The same plugin folder works in Claude Code and Codex. +The plugin is optional. Every project created with `npx coursecode create` already includes the MCP settings, an `AGENTS.md`, and the four project-stage skills (outline, build-slides, review, publish), so any AI tool works without it; see the [Quick Start](https://github.com/course-code-framework/coursecode#quick-start). The plugin adds the tools in every folder, so your AI tool can create a course before a project exists, plus the `setup` and `new-course` skills and, in Claude Code, a Node.js check at session start. + ## Install -The plugin is not yet listed in the Claude Code or Codex plugin directories. Install it from this GitHub repository. +Install it from this GitHub repository. **Claude Code** @@ -24,7 +26,7 @@ codex plugin add coursecode@coursecode After installing in Codex, start a new chat in your course folder and ask it to set up CourseCode Framework. See the [Codex setup and update guide](CODEX.md#install-from-github) for first-run checks, updates, and migration from an older local installation. -**Other AI tools.** You don't need a plugin. Projects created with `coursecode create` include MCP settings for Claude Code, Codex, Cursor, and VS Code, plus an `AGENTS.md` with the workflow. For any other MCP client, run `coursecode mcp`. See [Connecting AI with MCP](https://github.com/course-code-framework/coursecode/blob/main/framework/docs/USER_GUIDE.md#connecting-ai-with-mcp). +**Other AI tools.** You don't need a plugin. Projects created with `coursecode create` include MCP settings for Claude Code, Codex, Cursor, and VS Code, an `AGENTS.md` with the workflow, and the workflow skills. For any other MCP client, run `coursecode mcp`. See [Connecting AI with MCP](https://github.com/course-code-framework/coursecode/blob/main/framework/docs/USER_GUIDE.md#connecting-ai-with-mcp). ## Requirements @@ -50,8 +52,8 @@ The preview runs at http://localhost:4173, so you can watch the course change as ## What's included -- **MCP server** (`coursecode`): headless preview, screenshots, navigation, interaction testing, lint, live diagnostics, builds, and catalogs of components, interactions, CSS classes, and icons. Projects the plugin creates leave out `.mcp.json` so Claude Code doesn't list each tool twice; run `npx coursecode agent-setup` in a project to add it for people who don't have the plugin. -- **Skills**: the six workflows above. They follow the guides in each project's `framework/docs/`, so they stay in step with the framework version the course uses. +- **MCP server** (`coursecode`): headless preview, screenshots, navigation, interaction testing, lint, live diagnostics, builds, and catalogs of components, interactions, CSS classes, and icons. Projects the plugin creates leave out `.mcp.json` and the project skills so Claude Code doesn't list each tool and skill twice; run `npx coursecode agent-setup` in a project to add them for people who don't have the plugin. +- **Skills**: the six workflows above. They follow the guides in each project's `framework/docs/`, so they stay in step with the framework version the course uses. `coursecode create` copies `outline`, `build-slides`, `review`, and `publish` into projects as `coursecode-*` skills, so edit them here, not in a project. - **Session check** (Claude Code only): a `SessionStart` hook, `hooks/check-node.cmd`, that needs no Node.js and works in `sh`, Git Bash, and PowerShell. The same file holds a shell version and a Windows batch version of the check, so update both. ## What it downloads and sends diff --git a/plugin/skills/build-slides/SKILL.md b/plugin/skills/build-slides/SKILL.md index c8555c8..34e89df 100644 --- a/plugin/skills/build-slides/SKILL.md +++ b/plugin/skills/build-slides/SKILL.md @@ -9,7 +9,7 @@ description: Build or edit CourseCode slides, interactions, assessments, and cou 1. Read `framework/docs/COURSE_AUTHORING_GUIDE.md` in full. It defines the slide format, interactions, assessments, engagement tracking, styling, and config. Do not guess framework APIs. 2. Read `course/COURSE_OUTLINE.md`. If it does not exist or is not approved, use the `outline` skill first. For small edits to an existing course, the outline is optional. -3. Call `coursecode_workflow_status` and make sure the preview is running (see the `new-course` skill). +3. Call `coursecode_workflow_status` and make sure the preview is running. Start it once as a background process with `npx coursecode preview` (http://localhost:4173), and reuse it if a runtime tool says it is already running. 4. Example slides: if `course/slides/` still has `example-*` files and the author is building their own course, ask before running `npx coursecode clean`. It deletes the examples and resets `course-config.js` to a minimal starter. ## Rules that the linter will enforce diff --git a/plugin/skills/setup/SKILL.md b/plugin/skills/setup/SKILL.md index 4d79822..18e36bc 100644 --- a/plugin/skills/setup/SKILL.md +++ b/plugin/skills/setup/SKILL.md @@ -10,7 +10,7 @@ CourseCode runs on this computer. Node.js 22.15 or later is required. A CourseCo 1. Check `node --version`. If Node is missing or older than 22.15, follow [Install Node.js](#install-nodejs) below, then stop: the CourseCode tools start only after the AI tool restarts. 2. Confirm the folder. The MCP tools work on the folder this session started in. Never create a course inside the plugin's own install folder. If the course lives somewhere else, the author needs a new session started in that folder. 3. Check the CLI. In an existing project, run `npx --no-install coursecode --version`. Outside a project, run the plugin's launcher: `node "/mcp/coursecode-mcp.mjs" --version`, where `` is two folders above this skill's folder. It uses a bundled runtime when the plugin has one and otherwise downloads the pinned CourseCode version. -4. In Claude Code, check for duplicate tools. If the project's `.mcp.json` also defines a `coursecode` server, every CourseCode tool is listed twice. Offer to remove that entry; the plugin's server runs the project's own CLI, so nothing is lost. +4. Check for duplicates from a project created without the plugin. In Claude Code, if the project's `.mcp.json` also defines a `coursecode` server, every CourseCode tool is listed twice. If the project has `coursecode-*` folders in `.claude/skills/` or `.agents/skills/`, every workflow skill is listed twice. Offer to remove that entry and those folders; the plugin's server runs the project's own CLI and the plugin has the same skills, so nothing is lost. 5. Call `coursecode_workflow_status`. For an existing course it reports the current stage. For an empty folder, continue with the `new-course` skill. 6. Explain that Preview is a local simulated LMS on `127.0.0.1`. It runs as a separate terminal process; the MCP server never starts it. Reuse a Preview that is already running for this course. diff --git a/tests/create.test.js b/tests/create.test.js index cce08d5..1fd6d73 100644 --- a/tests/create.test.js +++ b/tests/create.test.js @@ -72,7 +72,9 @@ describe('formatNextSteps', () => { it('sends new projects to an AI tool and keeps the preview command', () => { const message = formatNextSteps({ directoryName: 'my-course' }); + expect(message).toContain('the my-course folder'); expect(message).toContain('cd my-course\n claude'); + expect(message).toContain('quit and started again'); expect(message).toContain('Cursor or VS Code'); expect(message).toContain('npx coursecode preview'); }); @@ -142,6 +144,7 @@ describe('create', () => { const projectDir = path.join(tempDir, 'plugin-course'); expect(fs.existsSync(path.join(projectDir, '.mcp.json'))).toBe(false); + expect(fs.existsSync(path.join(projectDir, '.claude', 'skills'))).toBe(false); expect(fs.existsSync(path.join(projectDir, '.codex', 'config.toml'))).toBe(true); expect(fs.existsSync(path.join(projectDir, 'AGENTS.md'))).toBe(true); }); diff --git a/tests/lib/agent-setup.test.js b/tests/lib/agent-setup.test.js index ec69eeb..8444f56 100644 --- a/tests/lib/agent-setup.test.js +++ b/tests/lib/agent-setup.test.js @@ -2,7 +2,7 @@ import { describe, expect, it, afterEach } from 'vitest'; import fs from 'fs'; import os from 'os'; import path from 'path'; -import { writeAgentSetup, AGENTS_MD } from '../../lib/agent-setup.js'; +import { writeAgentSetup, projectSkill, AGENTS_MD } from '../../lib/agent-setup.js'; const temporary = []; function project() { @@ -11,12 +11,17 @@ function project() { return dir; } const read = (dir, file) => fs.readFileSync(path.join(dir, file), 'utf-8'); +const SKILL_FILES = ['outline', 'build-slides', 'review', 'publish'] + .flatMap(name => ['.agents/skills', '.claude/skills'].map(folder => `${folder}/coursecode-${name}/SKILL.md`)); +const settingsOnly = files => files.filter(file => !file.includes('/skills/')); afterEach(() => temporary.splice(0).forEach(dir => fs.rmSync(dir, { recursive: true, force: true }))); describe('AI tool settings for course projects', () => { it('writes MCP settings for each tool and the shared agent instructions', () => { const dir = project(); - expect(writeAgentSetup(dir).sort()).toEqual(['.codex/config.toml', '.cursor/mcp.json', '.mcp.json', '.vscode/mcp.json', 'AGENTS.md', 'CLAUDE.md']); + const written = writeAgentSetup(dir); + expect(settingsOnly(written).sort()).toEqual(['.codex/config.toml', '.cursor/mcp.json', '.mcp.json', '.vscode/mcp.json', 'AGENTS.md', 'CLAUDE.md']); + expect(written.filter(file => file.includes('/skills/')).sort()).toEqual([...SKILL_FILES].sort()); expect(JSON.parse(read(dir, '.mcp.json')).mcpServers.coursecode).toEqual({ command: 'node', args: ['node_modules/coursecode/bin/cli.js', 'mcp'] }); expect(JSON.parse(read(dir, '.cursor/mcp.json')).mcpServers.coursecode.env).toEqual({ COURSECODE_PROJECT_DIR: '${workspaceFolder}' }); @@ -26,10 +31,37 @@ describe('AI tool settings for course projects', () => { expect(read(dir, 'CLAUDE.md')).toBe('@AGENTS.md\n'); }); - it('skips the Claude Code project server when the plugin provides it', () => { + it('skips the Claude Code project server and the skills when the plugin provides them', () => { const dir = project(); expect(writeAgentSetup(dir, { plugin: true }).sort()).toEqual(['.codex/config.toml', '.cursor/mcp.json', '.vscode/mcp.json', 'AGENTS.md', 'CLAUDE.md']); expect(fs.existsSync(path.join(dir, '.mcp.json'))).toBe(false); + expect(fs.existsSync(path.join(dir, '.claude', 'skills'))).toBe(false); + expect(fs.existsSync(path.join(dir, '.agents', 'skills'))).toBe(false); + }); + + it('copies the project-stage plugin skills under coursecode- names', () => { + const dir = project(); + writeAgentSetup(dir); + + for (const name of ['outline', 'build-slides', 'review', 'publish']) { + const skill = read(dir, `.claude/skills/coursecode-${name}/SKILL.md`); + expect(skill).toBe(projectSkill(name)); + expect(read(dir, `.agents/skills/coursecode-${name}/SKILL.md`)).toBe(skill); + expect(skill).toMatch(new RegExp(`^---\nname: coursecode-${name}\ndescription: `)); + expect(skill).not.toMatch(/`(outline|build-slides|review|publish)` skill/); + } + expect(read(dir, '.claude/skills/coursecode-outline/SKILL.md')).toContain('use the `coursecode-build-slides` skill'); + expect(fs.existsSync(path.join(dir, '.claude', 'skills', 'coursecode-setup'))).toBe(false); + expect(fs.existsSync(path.join(dir, '.claude', 'skills', 'coursecode-new-course'))).toBe(false); + }); + + it('leaves an author-edited skill alone', () => { + const dir = project(); + fs.mkdirSync(path.join(dir, '.claude', 'skills', 'coursecode-review'), { recursive: true }); + fs.writeFileSync(path.join(dir, '.claude', 'skills', 'coursecode-review', 'SKILL.md'), 'custom\n'); + + expect(writeAgentSetup(dir)).not.toContain('.claude/skills/coursecode-review/SKILL.md'); + expect(read(dir, '.claude/skills/coursecode-review/SKILL.md')).toBe('custom\n'); }); it('adds to existing settings without overwriting them', () => { diff --git a/tests/lib/plugin-manifests.test.js b/tests/lib/plugin-manifests.test.js index dfde495..9661164 100644 --- a/tests/lib/plugin-manifests.test.js +++ b/tests/lib/plugin-manifests.test.js @@ -74,9 +74,9 @@ describe('Claude Code and Codex plugin', () => { expect(readJson('plugin/plugin.json').extensions['com.openai'].onboardingSkill).toBe('./skills/setup/SKILL.md'); }); - it('keeps the plugin out of the npm package', () => { + it('ships only the plugin skills in the npm package, for project copies', () => { const { files } = readJson('package.json'); - expect(files.some(entry => entry.replace(/^!/, '').startsWith('plugin'))).toBe(false); + expect(files.filter(entry => entry.replace(/^!/, '').startsWith('plugin'))).toEqual(['plugin/skills']); }); });