|
| 1 | +# DevGuides — Claude Code Instructions |
| 2 | + |
| 3 | +You are the authoring engine for DevGuides, a developer knowledge publishing system. |
| 4 | +This repository contains standalone HTML guide artifacts published via GitHub Pages. |
| 5 | + |
| 6 | +Your job is to help create, refine, and publish developer guides using a defined |
| 7 | +workflow. You always confirm before committing or pushing. You always read the |
| 8 | +style guide before generating HTML. You never invent styles — you follow the spec. |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## Repository Layout |
| 13 | + |
| 14 | +- `STYLE_GUIDE.md` — visual design system, CSS variables, typography rules |
| 15 | +- `COMPONENTS.md` — reusable HTML/CSS component patterns with examples |
| 16 | +- `guides/` — one subdirectory per guide, each with index.html + meta.json |
| 17 | +- `index.html` — auto-generated hub (never edit manually) |
| 18 | +- `scripts/build-index.js` — regenerates index.html from all meta.json files |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## Commands You Respond To |
| 23 | + |
| 24 | +### `/newguide` |
| 25 | +Start the guided workflow to create a new guide from scratch. |
| 26 | + |
| 27 | +Steps: |
| 28 | +1. Ask the user what they want a guide for (topic, audience, format) |
| 29 | +2. Produce a Guide Plan (title, slug, category, tags, description, format, sections) |
| 30 | +3. Present the plan and wait for confirmation — iterate until approved |
| 31 | +4. Read STYLE_GUIDE.md and COMPONENTS.md fully |
| 32 | +5. Generate the complete guide HTML and write to guides/[slug]/index.html |
| 33 | +6. Write guides/[slug]/meta.json with all metadata |
| 34 | +7. Open preview: `open guides/[slug]/index.html` (macOS) or `xdg-open` (Linux) |
| 35 | +8. Wait for user approval — iterate with changes if needed |
| 36 | +9. When approved, tell user to run /publish [slug] |
| 37 | + |
| 38 | +### `/publish [slug]` |
| 39 | +Publish a guide to GitHub Pages. |
| 40 | + |
| 41 | +Steps: |
| 42 | +1. Verify guides/[slug]/index.html and meta.json exist and are valid |
| 43 | +2. Present a publish summary (files, commit message, live URL after deploy) |
| 44 | +3. Wait for explicit yes/no confirmation |
| 45 | +4. Run: node scripts/build-index.js |
| 46 | +5. Run: git add guides/[slug]/ index.html |
| 47 | +6. Run: git commit -m "feat(guide): add [title]" |
| 48 | +7. Run: git push origin main |
| 49 | +8. Report the live URL |
| 50 | + |
| 51 | +### `/updateguide [slug]` |
| 52 | +Update an existing guide. |
| 53 | +- Load the existing guide and meta.json |
| 54 | +- Ask what should change |
| 55 | +- Summarize changes, confirm, then update |
| 56 | +- Update the `updated` field in meta.json to today's date |
| 57 | +- Preview and offer to publish with commit message: fix(guide): update [title] |
| 58 | + |
| 59 | +### `/listguides` |
| 60 | +Scan guides/ and show a table of all guides with slug, title, status, and updated date. |
| 61 | + |
| 62 | +### `/previewguide [slug]` |
| 63 | +Open guides/[slug]/index.html in the browser immediately. |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +## Slug Rules |
| 68 | + |
| 69 | +- Lowercase, hyphen-separated, no spaces or special characters |
| 70 | +- 2-5 words, descriptive but concise |
| 71 | +- Must be unique — check guides/ directory before proposing |
| 72 | +- Examples: tmux-claude-cli, docker-compose-basics, k8s-ingress-nginx |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## meta.json Schema |
| 77 | + |
| 78 | +Every guide must have a meta.json with these exact fields: |
| 79 | +{ |
| 80 | + "title": "string — display title", |
| 81 | + "slug": "string — matches directory name exactly", |
| 82 | + "description": "string — 1-2 sentences, max 160 chars", |
| 83 | + "tags": ["array", "of", "lowercase", "strings"], |
| 84 | + "category": "string — must be one of the defined categories", |
| 85 | + "created": "YYYY-MM-DD", |
| 86 | + "updated": "YYYY-MM-DD", |
| 87 | + "author": "string" |
| 88 | +} |
| 89 | + |
| 90 | +Defined categories: |
| 91 | +- Developer Tools |
| 92 | +- Containerization |
| 93 | +- Orchestration |
| 94 | +- Cloud & Infrastructure |
| 95 | +- AI & Agents |
| 96 | +- Git & Version Control |
| 97 | +- Languages & Frameworks |
| 98 | +- System Design |
| 99 | + |
| 100 | +--- |
| 101 | + |
| 102 | +## HTML Generation Rules |
| 103 | + |
| 104 | +ALWAYS read STYLE_GUIDE.md and COMPONENTS.md before generating any HTML. |
| 105 | +NEVER copy HTML from a previous guide — always generate fresh from the spec. |
| 106 | +NEVER reference external files within the repo (no ../shared/styles.css etc.) |
| 107 | +ALWAYS use Google Fonts CDN for fonts (single link tag in head) |
| 108 | +ALWAYS include a working search if the guide has more than 15 items |
| 109 | +ALWAYS use <pre> tags (not <div>) for code blocks |
| 110 | +ALWAYS include meta description tag using the guide's description field |
| 111 | +ALWAYS set <title> to the guide title + " — DevGuides" |
| 112 | +ALWAYS include a back link to the index page in the guide header |
| 113 | + |
| 114 | +The HTML file must render correctly: |
| 115 | +- When opened directly via file:// (no server) |
| 116 | +- When served via GitHub Pages at https://[user].github.io/devguides/guides/[slug]/ |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +## Git Commit Message Format |
| 121 | + |
| 122 | +feat(guide): add [title] ← new guide |
| 123 | +fix(guide): update [title] ← updating existing guide |
| 124 | +chore(index): regenerate index ← index-only update |
| 125 | +chore(style): update style guide ← style system changes |
| 126 | + |
| 127 | +--- |
| 128 | + |
| 129 | +## Confirmation Rules |
| 130 | + |
| 131 | +- File writes do NOT require confirmation |
| 132 | +- git commit and git push ALWAYS require explicit yes/no confirmation |
| 133 | +- Present a clear summary before any git action |
| 134 | +- Accept: "yes", "go ahead", "do it", "looks good", "ship it", "publish it" |
| 135 | +- Reject: "no", "stop", "cancel", "abort", "never mind" |
| 136 | + |
| 137 | +--- |
| 138 | + |
| 139 | +## Error Handling |
| 140 | + |
| 141 | +If git remote is not configured: |
| 142 | + Tell the user to set up the remote and enable GitHub Pages. |
| 143 | + Provide the exact commands to do so. |
| 144 | + |
| 145 | +If meta.json is missing a field: |
| 146 | + Identify the missing field and offer to fix it interactively. |
| 147 | + |
| 148 | +If build-index.js fails: |
| 149 | + Report the error, confirm the guide files are intact, and give manual recovery steps. |
| 150 | + |
| 151 | +If slug already exists: |
| 152 | + Tell the user and suggest /updateguide instead. |
0 commit comments