원클릭으로
serve-md-by-mkdocs
Serve markdown/docs/text notes with MkDocs using a specified work directory as the output folder (scripts/config/site).
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Serve markdown/docs/text notes with MkDocs using a specified work directory as the output folder (scripts/config/site).
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Prepare and run a user-confirmed interactive execution or test session for a source file, executable, script, demo, or directory. This skill must be invoked manually: use it only when the user explicitly invokes step-interactive-execution by name or clearly asks for this exact manual workflow. Read the target first without pausing, then switch to a strict step-by-step loop where the agent prints the exact CLI command to run next, waits for confirmation such as "continue", executes only that approved command, and reports the result before proposing the next step.
Manual invocation only. Drive a crashy, hanging, or half-broken system forward along a real production user path using real data. Two subskills: `prepare` to analyze the target and set up `<htt-home>/` with infrastructure dirs (logs, runs, issues); optionally creates `<htt-home>/autotest/` with automatic scripts and interactive guides only when the developer explicitly requests test-case generation. `run` drives testing — with or without autotest artifacts — patching forward through blockers. Run subskill operates in-place by default (stash + test on current branch) or in a disposable snapshot worktree when explicitly requested. Supports automatic and interactive driving. Default when ambiguous: both subskills, in-place, automatic. Not for CI-oriented unit, smoke, or mock-based integration tests.
Programmatically invoke Codex via the `codex` CLI for headless, non-interactive runs using `codex exec`, machine-readable JSONL via `--json`, final-message capture via `-o/--output-last-message`, and multi-turn continuation via `codex exec resume`. Use when you need scriptable Codex automation for repo reviews, issue investigation, implementation planning, or structured one-shot outputs.
Create and resume Codex CLI sessions with a persistent session-name-to-thread_id mapping plus last-used model stored in a workspace-scoped JSON file under system temp. Invoke only when the user explicitly names `$codex-cli-invoke-persist` or otherwise clearly requests this exact skill. Use it for deterministic, session-persistent Codex automation across turns and processes.
Manual invocation only. OpenSpec-specific hack-through-testing workflow targeting production-level end-to-end paths using real data and real user workflows — not CI smoke/unit/integration tests. Three subskills: `propose` to create an OpenSpec change with HTT-ready test cases (automatic scripts and interactive guides) by invoking `openspec-propose` or `openspec-ff-change`, `revise` to update an existing OpenSpec change so its artifacts support hack-through-testing-driven implementation and testing, and `run` to exercise an implemented OpenSpec change through the full hack-through-testing loop (in-place by default, or in a disposable snapshot worktree when requested). Use when the user explicitly asks for `openspec-ext-hack-through-test`, points to `openspec/changes/...` while asking to propose, revise, run, exercise, or prepare work under hack-through-testing principles, or wants OpenSpec work shaped for fast blocker discovery through patch-forward testing.
Review an OpenSpec change (or a single OpenSpec change artifact file) for completeness, coherence, and alignment with existing system design; capture actionable feedback plus open questions; write a review report under the change directory (review/review-YYYYMMDD-HHMMSS.md).
| name | serve-md-by-mkdocs |
| description | Serve markdown/docs/text notes with MkDocs using a specified work directory as the output folder (scripts/config/site). |
Use this skill when you want a quick, web-based viewer for Markdown scattered across a repo (not necessarily docs/), while preserving the original directory structure.
Typical user phrasing that should trigger this skill:
<work_dir> as the work dir”Interpretation:
<work_dir> is the work directory (create it if missing; reuse it if it exists). This folder holds the refresh script, a scanner script, a YAML manifest, the MkDocs config (if needed), a staged symlink tree, and site/ build output.<work_dir>/_staged/) so you can ignore them with a local <work_dir>/.gitignore while keeping scripts/config tracked if you want.This skill’s default approach is:
<work_dir>/_staged/ (typically symlinks; can be adapted to copying)<work_dir>/mkdocs.yml only if missing (existing config is preserved)pymdown-extensions + KaTeX/Mermaid JS/CSS includes)<mkdocs_cmd> serve (use MkDocs defaults unless you specify otherwise)This skill must locate an existing mkdocs first. Do not auto-install it.
Resolution order (stop at the first one that works):
pixi run mkdocs --version
If that works, use <mkdocs_cmd> = pixi run mkdocs.
mkdocs --version
python -m mkdocs --version
If either works, use <mkdocs_cmd> = mkdocs (or python -m mkdocs if the console script is not available).
pixi global and exposed them on PATH):pixi global list
mkdocs --version
If that works, use <mkdocs_cmd> = mkdocs.
mkdocs is already installed as a tool; do not trigger installs):uv tool list
uv tool dir
mkdocs --version
If uv tool list shows mkdocs but mkdocs is not on PATH, run it via the uv tools directory:
tool_dir="$(uv tool dir)"
"${tool_dir}/mkdocs/bin/mkdocs" --version
If that works, use <mkdocs_cmd> = mkdocs (or use the explicit path from above).
python3 -m mkdocs --version
python -m mkdocs --version
If either works, use <mkdocs_cmd> = python3 -m mkdocs (or python -m mkdocs).
If none of the above finds a working mkdocs, fail fast and report “missing dependency: mkdocs”. Never attempt to install mkdocs automatically; let the user install it in their preferred environment manager.
Once mkdocs is found, the agent may auto-install any MkDocs plugins/themes/markdown extensions needed by <work_dir>/mkdocs.yml, but must install them into the same environment that provides <mkdocs_cmd>.
Guidance:
<mkdocs_cmd> build -f <work_dir>/mkdocs.yml (or <mkdocs_cmd> serve -f <work_dir>/mkdocs.yml) and look for missing-module errors (for example: No module named ..., missing mkdocs-material, missing pymdown-extensions, missing mkdocs-extrafiles, etc).mkdocs itself automatically.Notes:
extra_javascript/extra_css plus pymdown-extensions (pymdownx.superfences and pymdownx.arithmatex).Environment-specific install strategy:
<mkdocs_cmd> is pixi run mkdocs (project Pixi):pip install directly):pixi add --pypi mkdocs-material pymdown-extensions
Add other required plugins similarly (example):
pixi add --pypi mkdocs-extrafiles mkdocs-include-markdown-plugin
Then re-run <mkdocs_cmd> build -f <work_dir>/mkdocs.yml to verify.
<mkdocs_cmd> comes from a venv / system Python:python -m pip install mkdocs-material pymdown-extensions
Then re-run <mkdocs_cmd> build -f <work_dir>/mkdocs.yml to verify.
<mkdocs_cmd> comes from a uv tool install:tool_dir="$(uv tool dir)"
ls -la "${tool_dir}/mkdocs/bin" # inspect this directory to find the tool's python
"${tool_dir}/mkdocs/bin/python" -m pip install mkdocs-material pymdown-extensions
Then re-run the uv-provided MkDocs command to verify.
nav: in the main mkdocs.yml.docview-prd, docview-reports, tmp/docview-issuesPRD View127.0.0.1:8000)0.0.0.0 (for example 0.0.0.0:8000 or 0.0.0.0:<port>)<docs_dir> <notes_dir> or <docs_dir>/** or **/*.md<work_dir> already exists, look for “refresh” cues firstIf the user points to an existing <work_dir>, they may mean “refresh/rebuild” rather than “re-scaffold”.
Before generating anything, check for these files inside <work_dir>:
refresh-docs-tree.sh: if present, prefer running it to recreate the staged tree (typically under _staged/, or your chosen --staging-dir), while preserving existing rules and defaults.mkdocs.yml: if present, prefer reusing it (preserves dev_addr / ports, theme/plugins, etc).docview.yml: if present, prefer reusing it (preserves the default scan patterns, exclusions, and gitignore policy).README.md: often documents the env var names (like *_DIRS / *_REPO_ROOT) and default scan patterns.Typical “refresh intent” actions:
bash <work_dir>/refresh-docs-tree.sh
<mkdocs_cmd> serve -f <work_dir>/mkdocs.yml
Only re-scaffold (and overwrite) if the user explicitly asks to “regenerate config/script” (use --force).
Run the scaffolder (writes a new service folder with a refresh-docs-tree.sh, .gitignore, and README):
pixi run python magic-context/skills/devel/serve-md-by-mkdocs/scripts/scaffold_docview_service.py \
--work-dir <work_dir> \
--site-name "Reports View" \
--staging-dir _staged \
--default-target .
Then run:
bash <work_dir>/refresh-docs-tree.sh
<mkdocs_cmd> serve -f <work_dir>/mkdocs.yml
If you want a non-default bind address/port, either:
--dev-addr <addr:port> (bakes it into <work_dir>/mkdocs.yml), or--public (bakes 0.0.0.0:8000 into <work_dir>/mkdocs.yml), or<mkdocs_cmd> serve -f <work_dir>/mkdocs.yml -a 0.0.0.0:<port>Once <work_dir>/refresh-docs-tree.sh exists, you can point it at specific paths:
bash <work_dir>/refresh-docs-tree.sh <docs_dir> <notes_dir>*_DIRS env var shown in <work_dir>/README.md<work_dir>/docview.yml to change the default patterns used when you run bash <work_dir>/refresh-docs-tree.sh with no args/env override<work_dir>/docview.yml)<work_dir>/docview.yml captures your “what should be staged” intent for symlink creation.
Schema:
magic-context/skills/devel/serve-md-by-mkdocs/schemas/docview.schema.jsonKey fields:
mkdocs.dev_addr: records the intended bind address/port (and is used to generate <work_dir>/mkdocs.yml only when that file is missing)scan.include_globs: glob patterns used to discover Markdown (repo-relative)scan.exclude_globs: glob patterns excluded from Markdown discoveryscan.force_globs: glob patterns to scan even if gitignored (explicit user intent)scan.auto_exclude_generated: if true (default), avoid scanning DocView/MDView workdirs and their generated treesscan.respect_gitignore: default true (do not scan gitignored dirs/files for Markdown discovery)assets.include_images: default true (stage local images referenced by selected Markdown)Example (abridged):
version: 1
scan:
auto_exclude_generated: true
respect_gitignore: true
include_globs: ["**/*.md"]
exclude_globs: ["<big_dir>/**"]
force_globs: ["<gitignored_dir>/**"]
assets:
include_images: true
Rules:
.gitignore and uses scan.include_globs from the manifest.. (controlled by scan.include_hidden: false)._staged/ or docs/, and site/) using file/dir-structure heuristics, to avoid self-indexing loops and duplicate pages.scan.force_globs (or pass it as an explicit arg to refresh-docs-tree.sh, which is treated as strong intent).Default scan behavior (when you don’t specify scan locations): the scaffolder writes scan.include_globs so the refresh script scans the whole workspace for Markdown (for example **/*.md) while respecting .gitignore.
Add three tasks under [tool.pixi.tasks]:
<task_prefix>-refresh: bash <work_dir>/refresh-docs-tree.sh<task_prefix>-serve: bash <work_dir>/refresh-docs-tree.sh && mkdocs serve -f <work_dir>/mkdocs.yml<task_prefix>-build: bash <work_dir>/refresh-docs-tree.sh && mkdocs build -f <work_dir>/mkdocs.ymlPick a port based on your local context (or rely on MkDocs defaults).
Note: Pixi tasks run inside the project Pixi environment. Only add these tasks if mkdocs (and any referenced theme/plugins/extensions from <work_dir>/mkdocs.yml) are available in that environment.
After running bash <work_dir>/refresh-docs-tree.sh, verify that all symlinks under the staging directory are valid (no broken links):
find <work_dir>/<staging_dir> -xtype l -print
Expected: no output.
<staging_dir> is usually _staged (or whatever you set via --staging-dir; it should match docs_dir in <work_dir>/mkdocs.yml).
If there is output, rerun the refresh and/or check whether the target source files were moved/deleted, or whether your selected paths/patterns (*_DIRS or CLI args) include paths that no longer exist.
Note: refresh may emit warnings like “missing asset referenced by …” when Markdown references images that don’t exist on disk; those files won’t be staged.
Also verify that the work dir contains the scanner script which decides what gets staged (Markdown + referenced image assets):
<work_dir>/scan-files-to-stage.py<work_dir>/.gitignore ignores the staging subdir (like _staged/), site/, mkdocs.yml, and repo-root.txt. Keep or change this based on whether you want staged symlinks tracked..gitignore (gitignored files/dirs won’t be scanned). However, if a selected Markdown page references a gitignored image file, it will still be staged (symlinked) as long as the file exists.scan.auto_exclude_generated: false in <work_dir>/docview.yml if you intentionally want to index those directories.<work_dir>/docview.yml is always created by this skill, and <work_dir>/scan-files-to-stage.py treats a missing manifest as an error.mkdocs-extrafiles plugin to map external src paths into virtual dest paths under docs_dir.pymdownx.superfences with a mermaid fence + Material integration (the scaffolder emits this).pymdownx.arithmatex + KaTeX auto-render via extra_javascript/extra_css (you can swap to MathJax if preferred).<work_dir>/javascripts/mermaid-init.js and <work_dir>/javascripts/katex-init.js, and refresh-docs-tree.sh stages them into docs_dir so MkDocs can serve them.