|
| 1 | +# Copilot Instructions for AI Coding Agents |
| 2 | + |
| 3 | +This guide provides essential knowledge for AI agents working in the GitHub Docs codebase. Follow these conventions and workflows to be immediately productive. |
| 4 | + |
| 5 | +## Architecture Overview |
| 6 | +- **Monorepo structure**: Contains Markdown content, custom site code, data, and reusable templates for [docs.github.com]. |
| 7 | +- **Major directories**: |
| 8 | + - `content/`: All English Markdown documentation. Uses YAML frontmatter for metadata (see below). |
| 9 | + - `components/`: React components for site UI. |
| 10 | + - `data/`: YAML/Markdown files for variables, reusables, glossaries, and learning tracks. Accessible via `{% data ... %}` in content. |
| 11 | + - `includes/`: HTML partials ("includes") for layouts/pages, injected via `{% include ... %}`. |
| 12 | + - `lib/`: Site logic, custom Liquid tags, and rendering code. |
| 13 | + - `contributing/`: Contributor guides, markup/style references, and workflow docs. |
| 14 | + |
| 15 | +## Content Authoring Patterns |
| 16 | +- **YAML frontmatter**: Each Markdown file in `content/` starts with frontmatter. Key fields: |
| 17 | + - `versions`: Controls product/version visibility (see `contributing/liquid-helpers.md`). |
| 18 | + - `permissions`, `redirect_from`, `title`, `intro`, etc. (see `content/README.md`). |
| 19 | +- **Liquid tags**: Use `{% note %}...{% endnote %}` for callouts, `{% ifversion ... %}` for versioned content, and `{% data ... %}` for variables/reusables. |
| 20 | +- **Reusables/Variables**: Reference long strings from `data/reusables/` and short strings from `data/variables/` using `{% data ... %}`. |
| 21 | +- **Custom markup**: See `contributing/content-markup-reference.md` for supported tags and syntax. |
| 22 | + |
| 23 | +## Developer Workflows |
| 24 | +- **Local development**: |
| 25 | + - Requires Node.js v16. |
| 26 | + - Install dependencies: `npm ci` |
| 27 | + - Build static assets: `npm run build` |
| 28 | + - Start server: `npm start` (serves at http://localhost:4000) |
| 29 | +- **Debugging**: VS Code Node Debugger is pre-configured. |
| 30 | +- **Testing**: See `jest.config.js` and `tests/` for test setup. |
| 31 | +- **Search**: Powered by Algolia (see `contributing/search.md`). |
| 32 | +- **Versioning**: Managed via Liquid tags and frontmatter (see `contributing/liquid-helpers.md`). |
| 33 | + |
| 34 | +## Project-Specific Conventions |
| 35 | +- **Markdown**: Use GitHub Flavored Markdown. Syntax highlighting for shell commands uses triple backticks + `shell`. |
| 36 | +- **Callouts**: Use `{% note %}`, `{% warning %}`, `{% danger %}` for important info. |
| 37 | +- **Versioning**: Always use `{% ifversion %}` (not `{% if %}`) and `{% elsif %}` (not `else if`). |
| 38 | +- **Includes**: Only `.html` files in `includes/` are valid includes. |
| 39 | +- **Localization**: All data files in `data/` are Crowdin-translated by default. |
| 40 | + |
| 41 | +## Key References |
| 42 | +- `README.md` (project overview) |
| 43 | +- `content/README.md` (content structure) |
| 44 | +- `contributing/content-markup-reference.md` (markup) |
| 45 | +- `contributing/content-style-guide.md` (style) |
| 46 | +- `contributing/liquid-helpers.md` (versioning) |
| 47 | +- `contributing/development.md` (local dev) |
| 48 | +- `data/reusables/README.md`, `data/variables/README.md` (reusables/variables) |
| 49 | +- `includes/README.md` (includes) |
| 50 | + |
| 51 | +--- |
| 52 | +For unclear or missing conventions, consult the referenced files or ask for clarification. |
0 commit comments