Ingest course content from markdown files into the database. Parses manifest + module files, validates, and upserts course_lessons, reflection_questions, discussion_prompts, and exercises.
Extract per-lesson: id (from heading), title, type (from **Type:** line), body content
Convert markdown body to HTML using the same approach as existing scripts
Handle special blocks:
Blockquotes with > ... followed by — [reference] → scripture blocks
Numbered lists → exercise steps
Reflection questions marked with **Question N:** or numbered items under reflection headings
Child Item Extraction
From lesson content, extract structured child items:
Reflection questions: Look for numbered questions in reflection-type sections. Create reflection_questions rows with question text, question_type, block_order.
Discussion prompts: Look for prompts in discussion/cohort sections. Map to prompt_type (conceptual, application, integration, general) based on E/E/E/J structure.
Exercises: Look for exercise blocks with title, instructions, purpose, estimated time. Create exercises rows.
Validation (Pre-Insert)
Before writing to the database, validate:
All manifest lesson IDs exist in the markdown files
No empty lesson bodies (flag but allow override)
No placeholder text ("[Content TBD]", "[TODO]", "Lorem ipsum")
All lesson types are valid SECTION_TYPES
8 weeks present (numbered 1-8, no Week 0)
Reflection sections have 6-8 questions each (warn if outside range)
Report validation results and ask for confirmation before proceeding.
Suggest running /course-validate [slug] for Charter compliance
Output Format
## Course Ingestion Report: [title] ([slug])
### Source: [path]
### Validation: PASS / FAIL (with details)
### Ingested:
- Course: [title] (id: [id])
- Weeks: 8
- Sections: N total
- Week 1: X sections
- Week 2: X sections
- ...
- Reflection questions: N
- Discussion prompts: N
- Exercises: N
### Warnings:
- [any non-blocking issues]
### Next Steps:
- Run `/course-validate [slug]` to check Charter compliance
- Review draft sections in the learn view at /content/courses/[slug]/learn
Rules
8 weeks, numbered 1-8. No Week 0.
Always upsert (idempotent) — running twice should not create duplicates
Set ingested content to status: "draft" unless the user says otherwise
Never delete existing data — only insert or update
Preserve existing content if a lesson already has non-empty content (warn and skip)
Use the project's existing Drizzle patterns — check src/lib/services/simplified/courses.service.ts for query conventions
1---2name: course-ingest3description: Ingest course content from markdown files into the database. Parses manifest + module files, validates, and upserts course_lessons, reflection_questions, discussion_prompts, and exercises.4user-invocable: true5allowed-tools: Read, Write, Edit, Bash, Grep, Glob6metadata:7 source: https://skillmd.com/skills/joshuashepherd/course-ingest8---910Ingest course content: $ARGUMENTS1112$ARGUMENTS should be a course slug or path to the content directory. If empty, ask the user.1314## Before Starting15161. Read any existing ingestion scripts in `scripts/` to understand patterns (e.g., `scripts/ingest-forgotten-ways-course.ts`)172. Read `src/lib/database/schema.ts` for table definitions (courses, courseWeeks, courseLessons, reflectionQuestions, discussionPrompts, exercises)183. Read `src/lib/schemas/course-learn.ts` for SECTION_TYPES194. Read `src/lib/config/lesson-types.ts` for type mapping2021## Locate Content Source2223Search for content in these locations (in order):24251. `content-library/courses/[slug]/` — project content library262. `/Users/joshuashepherd/Desktop/dev/repos/forgotten-ways-course/docs/` — standalone course repo (for forgotten-ways)273. A path provided directly by the user2829Look for:30- `course-manifest.json` — lesson order, types, week structure31- `module-*.md` or `week-*.md` — lesson body content32- Any structured markdown with `## Lesson` or `## M.N.X` headings3334## Content Parsing3536### Manifest Format (expected)3738```json39{40 "courseTitle": "The Forgotten Ways",41 "weeks": [42 {43 "id": 1,44 "title": "Introduction & Orientation",45 "outcomes": ["..."],46 "lessons": [47 { "id": "lesson-01", "title": "Course Overview", "type": "welcome", "sidebarLabel": "Welcome" }48 ]49 }50 ]51}52```5354### Markdown Parsing5556For each `module-*.md` or `week-*.md` file:571. Split on `## Lesson` or `## M` headings582. Extract per-lesson: id (from heading), title, type (from `**Type:**` line), body content593. Convert markdown body to HTML using the same approach as existing scripts604. Handle special blocks:61 - Blockquotes with `> ...` followed by `— [reference]` → scripture blocks62 - Numbered lists → exercise steps63 - Reflection questions marked with `**Question N:**` or numbered items under reflection headings6465### Child Item Extraction6667From lesson content, extract structured child items:6869- **Reflection questions**: Look for numbered questions in reflection-type sections. Create `reflection_questions` rows with question text, question_type, block_order.70- **Discussion prompts**: Look for prompts in discussion/cohort sections. Map to prompt_type (conceptual, application, integration, general) based on E/E/E/J structure.71- **Exercises**: Look for exercise blocks with title, instructions, purpose, estimated time. Create `exercises` rows.7273## Validation (Pre-Insert)7475Before writing to the database, validate:76771. [ ] All manifest lesson IDs exist in the markdown files782. [ ] No empty lesson bodies (flag but allow override)793. [ ] No placeholder text ("[Content TBD]", "[TODO]", "Lorem ipsum")804. [ ] All lesson types are valid SECTION_TYPES815. [ ] 8 weeks present (numbered 1-8, no Week 0)826. [ ] Reflection sections have 6-8 questions each (warn if outside range)8384Report validation results and ask for confirmation before proceeding.8586## Database Operations8788### Create or update the ingestion script8990Create/update `scripts/ingest-[slug]-course.ts` that:91921. Connects via project Drizzle setup (`src/lib/database/`)932. Uses `getTenantOrgId()` for organization scoping943. Upserts in this order:95 - `courses` row (find by slug, update if exists, insert if not)96 - `courseWeeks` rows (find by course_id + week_number, upsert)97 - `courseLessons` rows (find by course_id + slug or section_order, upsert)98 - `reflectionQuestions` rows (find by lesson_id + block_order, upsert)99 - `discussionPrompts` rows (find by lesson_id + block_order, upsert)100 - `exercises` rows (find by lesson_id + block_order, upsert)1014. Reports: rows created, rows updated, rows skipped102103### Run the script104105Execute with: `pnpm tsx scripts/ingest-[slug]-course.ts`106107## Post-Ingest Verification108109After ingestion:1101. Query the course to verify section count matches manifest1112. Verify child items (reflection questions, discussion prompts, exercises) are linked correctly1123. Suggest running `/course-validate [slug]` for Charter compliance113114## Output Format115116```117## Course Ingestion Report: [title] ([slug])118119### Source: [path]120### Validation: PASS / FAIL (with details)121122### Ingested:123- Course: [title] (id: [id])124- Weeks: 8125- Sections: N total126 - Week 1: X sections127 - Week 2: X sections128 - ...129- Reflection questions: N130- Discussion prompts: N131- Exercises: N132133### Warnings:134- [any non-blocking issues]135136### Next Steps:137- Run `/course-validate [slug]` to check Charter compliance138- Review draft sections in the learn view at /content/courses/[slug]/learn139```140141## Rules142143- 8 weeks, numbered 1-8. No Week 0.144- Always upsert (idempotent) — running twice should not create duplicates145- Set ingested content to status: "draft" unless the user says otherwise146- Never delete existing data — only insert or update147- Preserve existing content if a lesson already has non-empty content (warn and skip)148- Use the project's existing Drizzle patterns — check `src/lib/services/simplified/courses.service.ts` for query conventions
Run npx get-skill add joshuashepherd/course-ingest in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Ingest course content from markdown files into the database. Parses manifest + module files, validates, and upserts course_lessons, reflection_questions, discussion_prompts, and exercises. It is listed under Docs & Writing on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. Capability flags: docs only. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
JoshuaShepherd (@joshuashepherd) published this skill. Their other Agent Skills are listed on their SkillMD profile.