Skip to content

Commit 6d21ccb

Browse files
pinin4fjordsclaude
andauthored
Add Claude configuration for training materials development (#681)
* Add Claude configuration for training materials development This commit adds comprehensive Claude AI assistant configuration to help future materials developers create and maintain Nextflow training content. Configuration includes: - .clinerules: Core conventions for Nextflow scripts, markdown docs, and repo structure - README.md: Developer guide explaining available tools and workflow - Custom slash commands for common tasks: - Content creation: /new-module, /new-lesson, /add-exercise - Quality assurance: /validate, /review-lesson, /test-example - Development workflow: /preview, /update-nav, /find-todos These configurations encode best practices from CONTRIBUTING.md and patterns observed throughout the existing training materials. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Add stop-preview command and improve preview command - Add /stop-preview command to stop running MkDocs preview servers - Remove -it flags from preview Docker command to fix background execution - Add note about initial build time for multiple languages - Reference /stop-preview command in preview documentation - Improve structure and clarity of preview command options 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Prettier * Refactor Claude config: Convert validation tasks to skills Based on feedback, this commit refines the Claude configuration to better separate concerns between commands (interactive, template-based) and skills (autonomous, multi-step). Changes: - Converted to skills: validate, test-example, find-todos (These are autonomous tasks requiring search, analysis, and reporting) - Kept as commands: new-lesson, new-module, add-exercise, review-lesson (These are interactive, template-based tasks requiring user input) - Removed: preview, update-nav (too simple to warrant commands/skills) - Updated README with clear rationale for commands vs skills design decisions - Added UserPromptSubmit hook to run heading validation automatically Skills are better for validation/testing as they can work autonomously across multiple files and make decisions. Commands are better for content creation where the expanded template prompt is valuable to see. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Add back /preview command for starting Docker preview server Restores the /preview command from initial commit that starts the MkDocs preview server. Includes Docker and Python options with troubleshooting tips. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Improve /preview command to check for running servers Add check for existing Docker containers before attempting to start a new preview server. This prevents "port already allocated" errors when a server is already running. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Prettier * Fix markdown list indentation in .clinerules Corrects list indentation to use 4 spaces (multiple of 4) as required by the heading validation script. The hook caught these issues! 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Fix spacing again * Remove invalid 'tags' field from stop-preview command frontmatter Only 'description' is valid in command frontmatter. Removed the 'tags' field as noted in review feedback. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Fix spacing again * Add CLAUDE.md for project context CLAUDE.md is automatically pulled into context by Claude Code, providing: - Quick facts about the training repository - Common commands and workflows - Repository structure and conventions - Gotchas and important warnings - Testing and validation procedures This is distinct from .clinerules (behavior rules) and .claude/README.md (documentation about the Claude configuration). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Fix Claude skills implementation Skills were incorrectly named and missing required YAML frontmatter: - Rename skill.md → SKILL.md (required naming convention) - Add YAML frontmatter with name and description fields - Update README to clarify skills are model-invoked, not user-invoked Skills are now properly configured to be automatically invoked by Claude when relevant, rather than requiring manual activation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Fix CLAUDE.md reference to skill invocation Update outdated @Validate syntax to clarify that skills are automatically invoked by Claude when relevant, not manually triggered with @ prefix. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Consolidate validation: merge review-lesson into validate skill Changes: - Remove /review-lesson slash command - Merge lesson review checklist into validate skill - Validate skill now handles both automated checks and deep reviews - Update README to reflect new organization Rationale: review-lesson was functionally a skill (autonomous, multi-step validation) but implemented as a slash command. This consolidates all validation and review functionality into a single skill that activates automatically when relevant. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Strengthen validate skill description to match 'review' queries Add 'reviewing' explicitly to trigger phrases so the skill activates when users say "review this lesson" not just "validate". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Prettier * Remove obsolete .clinerules file The .clinerules file was for Cline (a different AI coding tool). Claude Code uses CLAUDE.md in the repo root instead. All conventions from .clinerules are already documented in CLAUDE.md, making this file redundant. Update .claude/README.md to reference CLAUDE.md instead. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Prettier * Document before/after tabbed comparison pattern Add documentation for the before/after tabbed block pattern used in debugging side quest to both CLAUDE.md and /new-lesson command. This pattern uses === "After" / === "Before" tabs with hl_lines and linenums to clearly show code fixes, making it easier to understand what changed and why. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Prettier * Prettier --------- Co-authored-by: Claude <[email protected]>
1 parent 718ff42 commit 6d21ccb

File tree

10 files changed

+1120
-0
lines changed

10 files changed

+1120
-0
lines changed

.claude/README.md

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
# Claude Configuration for Nextflow Training Materials
2+
3+
This directory contains Claude AI assistant configuration to help developers create and maintain Nextflow training materials.
4+
5+
## Files Overview
6+
7+
### `CLAUDE.md` (in repository root)
8+
9+
Core rules and conventions for this repository. Claude automatically follows these guidelines for:
10+
11+
- Nextflow script development (DSL2, process naming, params)
12+
- Markdown documentation formatting (heading numbering, admonitions, code blocks)
13+
- Repository structure and organization
14+
- Content style and best practices
15+
- Common commands and gotchas
16+
17+
### `commands/` Directory
18+
19+
Slash commands for interactive content creation tasks that use templates and require user input.
20+
21+
### `skills/` Directory
22+
23+
Skills for autonomous multi-step tasks like validation, testing, and analysis.
24+
25+
## Commands vs Skills: Design Rationale
26+
27+
### Commands (Interactive, Template-Based)
28+
29+
Commands are used for **content creation** tasks that:
30+
31+
- Follow a template or standard structure
32+
- Need user questions/answers for customization
33+
- Benefit from showing the full prompt/checklist to the user
34+
- Are step-by-step guided workflows
35+
36+
### Skills (Autonomous, Multi-Step)
37+
38+
Skills are used for **validation and testing** tasks that:
39+
40+
- Require searching across multiple files
41+
- Need to run commands and analyze outputs
42+
- Make decisions based on what they find
43+
- Can work independently without constant user input
44+
45+
## Available Commands
46+
47+
### `/new-module`
48+
49+
**Why a command**: Template-based scaffolding requiring user input about module name, location, and content.
50+
51+
Creates a complete training module with standard structure:
52+
53+
- index.md (overview)
54+
- 00_orientation.md (prerequisites and intro)
55+
- Numbered lesson files
56+
- survey.md and next_steps.md
57+
- solutions/ directory
58+
59+
### `/new-lesson`
60+
61+
**Why a command**: Guided workflow that asks questions and fills in a template structure.
62+
63+
Creates a new lesson page within an existing module with:
64+
65+
- Proper heading numbering (1., 1.1., etc.)
66+
- Takeaway and What's next? sections
67+
- Placeholder code blocks with proper formatting
68+
- Standard structure
69+
70+
### `/add-exercise`
71+
72+
**Why a command**: Interactive insertion requiring decisions about placement, content, and difficulty level.
73+
74+
Adds an exercise with solution to an existing lesson:
75+
76+
- Uses `??? exercise` and `??? solution` admonitions
77+
- Creates corresponding solution files if needed
78+
- Proper formatting and structure
79+
80+
### `/preview`
81+
82+
**Why a command**: One-command convenience to start the preview server.
83+
84+
Starts the Docker-based MkDocs preview server:
85+
86+
- Runs the training-specific Docker image
87+
- Serves on http://0.0.0.0:8000/
88+
- Auto-refreshes on file changes
89+
90+
## Available Skills
91+
92+
### `validate`
93+
94+
**Why a skill**: Autonomous multi-step validation requiring searches, tool execution, and analysis.
95+
96+
Runs comprehensive validation and review checks:
97+
98+
- Heading numbering validation (runs check_headings.py)
99+
- TODO/FIXME comment search and categorization
100+
- Nextflow script convention checking
101+
- Orphaned file detection
102+
- Admonition syntax verification
103+
- Deep lesson review (structure, formatting, content accuracy, teaching effectiveness)
104+
105+
Outputs structured report with actionable recommendations. Includes lesson review functionality.
106+
107+
### `test-example`
108+
109+
**Why a skill**: Complex autonomous task requiring script execution, output verification, and comparison with docs.
110+
111+
Tests a Nextflow script and verifies documentation accuracy:
112+
113+
- Runs the script and captures output
114+
- Tests resume functionality
115+
- Tests with different parameters
116+
- Compares actual behavior with documented behavior
117+
- Reports discrepancies and suggests fixes
118+
119+
### `find-todos`
120+
121+
**Why a skill**: Search and analysis task that works autonomously across the codebase.
122+
123+
Searches for TODO/FIXME comments:
124+
125+
- Markdown files, Nextflow scripts, config files
126+
- Categorizes by priority (high, medium, low)
127+
- Groups by file and provides context
128+
- Recommends prioritization
129+
130+
## Quick Examples
131+
132+
**Create content:**
133+
134+
```
135+
/new-lesson
136+
/add-exercise
137+
/new-module
138+
```
139+
140+
**Preview locally:**
141+
142+
```
143+
/preview
144+
```
145+
146+
**Validate and review (skills - Claude invokes these automatically when relevant):**
147+
148+
Claude will automatically use these skills when appropriate, or you can mention them by name:
149+
150+
- "Can you validate the training materials?"
151+
- "Please review this lesson for quality"
152+
- "Test the example script"
153+
- "Find all the TODOs in the codebase"
154+
155+
## Key Repository Conventions
156+
157+
### Markdown Files
158+
159+
- Each sentence on new line (cleaner git diffs)
160+
- Numbered headings with trailing periods: `## 1. Section`, `### 1.1. Subsection`
161+
- Takeaway and What's next? sections at end of major sections
162+
- Use admonitions: `!!! note`, `!!! tip`, `!!! warning`, `??? exercise`, `??? solution`
163+
164+
### Nextflow Scripts
165+
166+
- DSL2 syntax only
167+
- UPPERCASE process names
168+
- Always include shebang: `#!/usr/bin/env nextflow`
169+
- Use params for configurable values: `params.input = 'default'`
170+
171+
### Code Blocks
172+
173+
Include line numbers, titles, and highlighting:
174+
175+
```groovy title="example.nf" linenums="1" hl_lines="3"
176+
#!/usr/bin/env nextflow
177+
178+
params.greeting = 'Hello' // highlighted
179+
```
180+
181+
## Hooks
182+
183+
### User Prompt Submit Hook
184+
185+
Automatically runs heading validation when you submit a prompt:
186+
187+
- Executes: `uv run .github/check_headings.py docs/**/*.md`
188+
- Provides immediate feedback on heading numbering issues
189+
- Non-blocking (allows operation to continue even if issues found)
190+
191+
## Development Workflow
192+
193+
1. **Create/Edit Content**
194+
195+
- Use `/new-lesson` or `/new-module` for structure
196+
- Follow conventions in `CLAUDE.md`
197+
- Add exercises with `/add-exercise`
198+
199+
2. **Review Quality**
200+
201+
- Ask Claude to validate and review: "Can you review this lesson?"
202+
- The validate skill runs automated checks and deep lesson reviews
203+
204+
3. **Test Examples**
205+
206+
- Ask Claude to test scripts: "Can you test this Nextflow example?"
207+
- The test-example skill verifies scripts and compares with documentation
208+
209+
4. **Update Navigation**
210+
211+
- Manually edit mkdocs.yml to add new content
212+
- Or just ask Claude to update it
213+
214+
5. **Preview Locally**
215+
216+
- Run: `mkdocs serve` or use Docker (see CONTRIBUTING.md)
217+
- View at http://127.0.0.1:8000/
218+
219+
6. **Commit**
220+
- Heading validation runs automatically
221+
- Write clear commit message
222+
- Push to fork and open PR
223+
224+
## Additional Tools
225+
226+
Consider also using:
227+
228+
- **Vale**: Linting for docs (can be added as separate PR/hook)
229+
- **Prettier**: Markdown formatting (install VSCode extension)
230+
- **Todo Tree**: VSCode extension to track TODO comments
231+
- **Excalidraw**: VSCode extension for editing diagrams
232+
233+
## Additional Resources
234+
235+
- **CONTRIBUTING.md** - Full contribution guidelines
236+
- **Training Site** - https://training.nextflow.io
237+
- **Nextflow Docs** - https://www.nextflow.io/docs/latest/

.claude/commands/add-exercise.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
description: Add an exercise with solution to an existing lesson
3+
---
4+
5+
Add an exercise with solution to an existing training lesson. Follow these steps:
6+
7+
1. Ask the user:
8+
9+
- Which lesson file to add the exercise to
10+
- What the exercise should teach/practice
11+
- Difficulty level (beginner, intermediate, advanced)
12+
13+
2. Read the lesson file to understand context
14+
15+
3. Create the exercise using the `??? exercise` admonition:
16+
17+
```markdown
18+
??? exercise "Exercise: [Title]"
19+
20+
Brief description of what to do.
21+
22+
1. First step
23+
2. Second step
24+
3. Expected outcome
25+
26+
!!! tip
27+
28+
Helpful hint if needed
29+
```
30+
31+
4. Create the corresponding solution using `??? solution` or `??? result`:
32+
33+
````markdown
34+
??? solution "Solution"
35+
36+
Explanation of the solution approach.
37+
38+
```groovy title="filename.nf" linenums="1"
39+
[solution code]
40+
```
41+
42+
Expected output:
43+
44+
```console title="Output"
45+
[expected output]
46+
```
47+
````
48+
49+
5. If the exercise requires a solution file:
50+
51+
- Create the solution script in `[module]/solutions/`
52+
- Follow naming convention matching the exercise
53+
- Ensure the solution script is complete and tested
54+
- Add comments explaining key parts
55+
56+
6. Insert the exercise at an appropriate point in the lesson:
57+
58+
- After explaining the relevant concept
59+
- Before the section's Takeaway
60+
- With clear connection to learning objectives
61+
62+
7. Test the exercise:
63+
64+
- Verify instructions are clear
65+
- Confirm solution code works
66+
- Check that exercise difficulty is appropriate
67+
- Ensure expected output is correct
68+
69+
8. Remind the user to:
70+
- Test the solution code themselves
71+
- Consider if hints are needed
72+
- Preview how it renders in the docs
73+
- Check that file paths in exercise are correct

0 commit comments

Comments
 (0)