Automate article validation, semantic commit generation, and git publishing for MDX documentation. Validates syntax, runs build checks, creates semantic commits, and pushes to remote repositories.
This skill automates the complete article publishing workflow: MDX syntax validation, build verification, semantic commit generation, and git push. Use this to ensure documentation quality and maintain consistent git history.
This is a comprehensive publishing skill that validates and publishes MDX articles with automated semantic commits and git push.
First, identify what needs to be published:
For single article: Provide path to specific .mdx file
content/docs/en/development/my-article.mdx
For multiple articles: Provide directory containing changes
content/docs/en/development/
The skill will automatically detect:
Before publishing, understand the current state:
Check git status:
git status
Review changes:
git diff --staged
Ensure all MDX files are saved and ready for validation.
Run validation script:
cd .claude/skills/skill-article-publisher
python scripts/validate_mdx.py /path/to/article.mdx
Or validate directory:
python scripts/validate_mdx.py content/docs/en/development/
What it checks:
Critical checks for Claude skills:
> and < instead of > and < in text>80% accuracy>80% accuracytitle, description, lang fieldsen, zh, or fr for standard Claude skillsRun build to verify MDX compilation:
npm run build
Why this matters:
Important note on validation: The MDX validation script focuses on common issues (comparison operators, frontmatter), while complex MDX component syntax validation is best handled by the build process. Always run build validation for complete assurance.
Or use validation script with build:
python scripts/validate_mdx.py content/docs/en/development/article.mdx --build
Build timeout: 5 minutes (adjust in script if needed)
Interpret results:
Validation report structure:
MDX VALIDATION REPORT
================================================================================
ā ERRORS (2):
File: content/docs/en/development/article.mdx:730
Error: Unescaped comparison operator found. Use > instead of > in: Typical benchmarks: >80% accuracy
ā ļø WARNINGS (1):
File: content/docs/en/development/article.mdx:1
Warning: Lang code "ko" may not be supported.
š SUMMARY:
Files checked: 1
Files valid: 0
Errors: 2
Warnings: 1
ā Validation failed due to errors
Fix errors before proceeding:
> with > and < with <Warnings are acceptable but should be reviewed.
After fixing issues, re-run validation:
python scripts/validate_mdx.py content/docs/en/development/article.mdx
Continue until: "All files passed validation"
The publisher automatically detects:
Change type from file path:
analyzing-mcp-builder ā feat (new skill analysis)analyzing-skill-name ā feat (skill analysis)tutorial-* ā docs (documentation/tutorial)docs (default)Change type from branch:
feature/* ā featfix/* ā fixdocs/* ā docsmain ā docs (default)Languages detected from path:
/en/ ā English/zh/ ā Chinese/fr/ ā FrenchSingle file:
feat: publish analyzing-mcp-builder (en, zh, fr)
Multiple files:
feat: publish multiple articles (3 skill-analysis, 2 tutorial)
skill-analysis: analyzing-mcp-builder, analyzing-webapp-testing
tutorial: tutorial-usage-patterns, tutorial-best-practices
Languages: en, zh, fr
Test without actual push:
python scripts/publish_article.py content/docs/en/development/article.mdx
What happens:
--push flag)Output includes:
š Changes detected (3 files):
- content/docs/en/development/analyzing-mcp-builder.mdx [en]
- content/docs/zh/development/analyzing-mcp-builder.mdx [zh]
- content/docs/fr/development/analyzing-mcp-builder.mdx [fr]
š Generated commit message:
feat: publish analyzing-mcp-builder (en, zh, fr)
skill-analysis: analyzing-mcp-builder
Languages: en, zh, fr
š¦ Actions:
ā
Validate MDX
ā
Create semantic commit (dry run)
āļø Push (use --push to enable)
With interactive confirmation:
# Shows summary and asks for confirmation
python scripts/publish_article.py content/docs/en/development/article.mdx --push
Automatically stage, commit, and push:
python scripts/publish_article.py content/docs/en/development/article.mdx --push --type feat
Available commit types:
docs ā Documentation only (default)feat ā New feature/skill analysisfix ā Bug fix or correctionchore ā Maintenance, refactoringWith --push flag:
python scripts/publish_article.py content/docs/en/development/article.mdx --push
What happens:
Output:
š Pushing to remote...
ā
Changes pushed to origin/main
ā
Publish complete!
If not using --push, manually push later:
git push origin $(git branch --show-current)
Or create PR from GitHub/GitLab interface.
For one article with confirmation:
cd .claude/skills/skill-article-publisher
python scripts/publish_article.py content/docs/en/development/analyzing-mcp-builder.mdx
Review output, then rerun with --push if satisfied.
For all articles in a directory:
python scripts/publish_article.py content/docs/en/development/
Automatically detects:
.mdx filesFor automated pipelines:
python scripts/publish_article.py content/docs/en/development/ \
--push \
--type docs \
--skip-build # If build already ran in CI
GitHub Actions example:
- name: Publish articles
run: |
cd .claude/skills/skill-article-publisher
python scripts/publish_article.py content/docs/ --push
When you know files are valid:
python scripts/publish_article.py content/docs/en/development/article.mdx \
--push \
--skip-build \
--skip-mdx
Use with caution - only when certain files are valid.
ā Wrong:
Typical benchmarks:
- **Good**: >80% accuracy
- **Excellent**: >90% accuracy
ā Correct:
Typical benchmarks:
- **Good**: >80% accuracy
- **Excellent**: >90% accuracy
ā Don't commit without validation:
git add . && git commit -m "add article" && git push
# May fail if MDX has syntax errors
ā Do use skill-article-publisher:
python scripts/publish_article.py content/docs/ --push
# Validates, builds, commits, and pushes safely
Publishing one skill analysis:
python scripts/publish_article.py \
content/docs/en/development/analyzing-mcp-builder.mdx \
--push \
--type feat
Generated commit:
feat: publish analyzing-mcp-builder (en, zh, fr)
skill-analysis: analyzing-mcp-builder
Languages: en, zh, fr
Publishing directory of changes:
python scripts/publish_article.py \
content/docs/en/development/ \
--push \
--type docs
Generated commit:
docs: publish multiple articles (2 skill-analysis, 1 tutorial)
skill-analysis: analyzing-mcp-builder, analyzing-webapp-testing
tutorial: creating-first-skill
Languages: en, zh, fr
GitHub Actions workflow:
name: Publish Articles
on:
push:
branches: [main]
paths: ['content/docs/**/*.mdx']
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
npm ci
pip install -r requirements.txt
- name: Publish articles
run: |
cd .claude/skills/skill-article-publisher
python scripts/publish_article.py content/docs/ --push --type docs
Problem: Build succeeds but validation shows errors
Error: Unescaped comparison operator found. Use > instead of >
Solution:
# Find and replace all > with > in text
# Find and replace all < with < in text
# Rerun validation
python scripts/validate_mdx.py path/to/file.mdx
Problem: Frontmatter validation warnings
Warning: Missing recommended field in frontmatter: description
Solution: Add missing field to YAML frontmatter at top of file.
Problem: "No changes to commit"
Cause: Files not staged or already committed
Solution:
git status # Check current state
git add content/docs/ # Stage changes
python scripts/publish_article.py content/docs/ --push
Problem: Push fails with "rejected"
Cause: Remote has changes you don't have locally
Solution:
git pull --rebase origin $(git branch --show-current)
python scripts/publish_article.py content/docs/ --push
Problem: Authentication fails during push
Cause: Git credentials not configured
Solution:
# Configure git credentials
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
# For HTTPS: use credential helper
git config --global credential.helper store
# For SSH: ensure SSH key is set up
ssh-keygen -t ed25519 -C "your.email@example.com"
Problem: Build timeout (5 minutes)
Cause: Large project or slow machine
Solution:
# Skip build validation for faster publishing
python scripts/publish_article.py content/docs/ --push --skip-build
Problem: Build fails with MDX errors
Cause: Invalid MDX syntax
Solution:
# Run validation to see specific errors
python scripts/validate_mdx.py content/docs/
# Or check build output directly
npm run build 2>&1 | grep -A 5 -B 5 Error
skill-article-publisher works well with:
To use skill-article-publisher:
git clone https://github.com/anthropics/skillscd .claude/skills/skill-article-publisherpython scripts/validate_mdx.py path/to/article.mdxpython scripts/publish_article.py path/to/article.mdxpython scripts/publish_article.py path/to/article.mdx --pushskill-article-publisher demonstrates exceptional Claude skill design by:
ā Automating Quality Assurance: Systematic MDX validation prevents syntax errors ā Enforcing Best Practices: Built-in rules for comparison operators and structure ā Semantic Commit Generation: Intelligent detection of change types and languages ā Git Workflow Integration: Seamless staging, committing, and pushing ā Safety Features: Dry run mode, confirmation prompts, comprehensive validation ā Error Prevention: Catches issues before they reach production
The key insights from this skill ensure that every article is validated, properly committed, and safely published with minimal manual intervention.
This comprehensive guide covered:
Ready to automate your publishing workflow?
Created: 2025-01-17 Skill: skill-article-publisher Author: Anthropic
This skill provides production-ready automation for MDX article publishing with comprehensive validation and semantic commit generation.
validate_mdx.py (250+ lines):
publish_article.py (350+ lines):
Before publishing, ensure:
| Raw | Escaped | Context |
|---|---|---|
> |
> |
Text, comparisons, arrows |
< |
< |
Text, comparisons, arrows |
& |
& |
Text (not in entities) |
" |
" |
In HTML attributes |
Note: Always use escapes in text content, never in code blocks or YAML frontmatter.