Copilot instructions
extensions/copilot/.github/instructions/prompt-tsx.instructions.mdPrompt-TSX coding guidelines
Copilot instructions
Quality
58/100
Scores the file, not the repository.Length
484 words
17 headings · 10 code blocksRepository
188k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.123456Guidelines for TSX files using [prompt-tsx](https://github.com/microsoft/vscode-prompt-tsx) focusing on specific patterns and token budget management for AI prompt engineering.78## Component Structure910### Base Pattern11- Extend `PromptElement<Props>` or `PromptElement<Props, State>` for all prompt components12- Props interfaces must extend `BasePromptElementProps`1314```tsx15interface MyPromptProps extends BasePromptElementProps {16 readonly userQuery: string;17}1819class MyPrompt extends PromptElement<MyPromptProps> {20 render() {21 return (22 <>23 <SystemMessage priority={1000}>...</SystemMessage>24 <UserMessage priority={900}>{this.props.userQuery}</UserMessage>25 </>26 );27 }28}29```3031### Async Components32- The `render` method can be async for components that need to perform async operations33- All async work should be done directly in the `render` method3435```tsx36class FileContextPrompt extends PromptElement<FileContextProps> {37 async render() {38 const fileContent = await readFileAsync(this.props.filePath);39 return (40 <>41 <SystemMessage priority={1000}>File content:</SystemMessage>42 <UserMessage priority={900}>{fileContent}</UserMessage>43 </>44 );45 }46}47```4849## Prompt-Specific JSX5051### Line Breaks52- **CRITICAL**: Use `<br />` for line breaks - newlines are NOT preserved in JSX53- Never rely on whitespace or string literal newlines5455```tsx56// ✅ Correct57<SystemMessage>58 You are an AI assistant.<br />59 Follow these guidelines.<br />60</SystemMessage>6162// ❌ Wrong - newlines will be collapsed63<SystemMessage>64 You are an AI assistant.65 Follow these guidelines.66</SystemMessage>67```6869## Priority System7071### Priority Values72- Higher numbers = higher priority (like z-index)73- Use consistent ranges:74 - System messages: 100075 - User queries: 90076 - Recent history: 700-80077 - Context/attachments: 600-70078 - Background info: 0-5007980```tsx81<SystemMessage priority={1000}>...</SystemMessage>82<UserMessage priority={900}>{query}</UserMessage>83<HistoryMessages priority={700} />84<ContextualData priority={500} />85```8687### Flex Properties for Token Budget88- `flexGrow={1}` - expand to fill remaining token space89- `flexReserve` - reserve tokens before rendering90- `passPriority` - pass-through containers that don't affect child priorities9192```tsx93<FileContext priority={70} flexGrow={1} files={this.props.files} />94<History passPriority older={0} newer={80} flexGrow={2} flexReserve="/5" />95```9697## Content Handling9899### TextChunk for Truncation100- Use `TextChunk` for content that may exceed token budget101- Set `breakOn` patterns for intelligent truncation102103```tsx104<TextChunk breakOnWhitespace priority={100}>105 {longUserQuery}106</TextChunk>107108<TextChunk breakOn=" " priority={80}>109 {documentContent}110</TextChunk>111```112113### Tag Component for Structured Content114- Use `Tag` for XML-like structured content with attributes115- Validates tag names and properly formats attributes116117```tsx118<Tag name="attachments" attrs={{ id: variableName, type: "file" }}>119 {content}120</Tag>121```122123## References and Metadata124125### Prompt References126- Use `<references>` for tracking variable usage127- Use `<meta>` for metadata that survives pruning128129```tsx130<references value={[new PromptReference({ variableName })]} />131<meta value={new ToolResultMetadata(id, result)} />132```133134### Keep-With Pattern135- Use `useKeepWith()` for content that should be pruned together136137```tsx138const KeepWith = useKeepWith();139return (140 <>141 <KeepWith priority={2}>142 <ToolCallRequest>...</ToolCallRequest>143 </KeepWith>144 <KeepWith priority={1}>145 <ToolCallResponse>...</ToolCallResponse>146 </KeepWith>147 </>148);149```150151## Token Budget Management152153### Sizing-Aware Rendering154- Use `PromptSizing` parameter for budget-aware content generation155- Implement cooperative token usage156157```tsx158async render(sizing: PromptSizing): Promise<PromptPiece> {159 const content = await this.generateContent(sizing.tokenBudget);160 return <>{content}</>;161}162```163164### Performance165- Avoid expensive work in `render` methods when possible166- Cache computations when appropriate167- Use async `render` for all async operations168
Also in microsoft/vscode
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| microsoft/vscode.github/instructions/accessibility.instructions.md · 188k | Copilot instructions | styledo-not | 61/100 | 3 days ago | |
| microsoft/vscode.github/instructions/chat.instructions.md · 188k | Copilot instructions | no sections | 39/100 | 3 days ago | |
| microsoft/vscodeextensions/copilot/src/platform/authentication/common/AGENTS.md · 188k | AGENTS.md | archsecurityagent-behaviour | 58/100 | 3 days ago | |
| microsoft/vscode.github/copilot-instructions.md · 188k | Copilot instructions | stylearchtypesui+2 | 74/100 | 2 days ago | |
| microsoft/vscode.github/instructions/agentHostTesting.instructions.md · 188k | Copilot instructions | teststyletesting-strategyagent-behaviour | 55/100 | 3 days ago | |
| microsoft/vscode.github/instructions/ai-customization.instructions.md · 188k | Copilot instructions | archtypesui | 58/100 | 3 days ago | |
| microsoft/vscode.github/instructions/best-practices.instructions.md · 188k | Copilot instructions | styleui | 60/100 | 3 days ago | |
| microsoft/vscode.github/instructions/buildNext.instructions.md · 188k | Copilot instructions | setupbuildtestarch+1 | 66/100 | 3 days ago | |
| microsoft/vscode.github/instructions/coding-guidelines.instructions.md · 188k | Copilot instructions | styletypesuidocs | 60/100 | 3 days ago | |
| microsoft/vscode.github/instructions/committing.instructions.md · 188k | Copilot instructions | do-not | 23/100 | 3 days ago | |
| microsoft/vscode.github/instructions/css-best-practices.instructions.md · 188k | Copilot instructions | styleui | 29/100 | 3 days ago | |
| microsoft/vscode.github/instructions/design-philosophy.instructions.md · 188k | Copilot instructions | style | 34/100 | 3 days ago | |
| microsoft/vscode.github/instructions/design-tokens.instructions.md · 188k | Copilot instructions | styledo-not | 65/100 | 3 days ago | |
| microsoft/vscode.github/instructions/disposable.instructions.md · 188k | Copilot instructions | no sections | 16/100 | 3 days ago | |
| microsoft/vscode.github/instructions/interactive.instructions.md · 188k | Copilot instructions | ui | 43/100 | 3 days ago | |
| microsoft/vscode.github/instructions/kusto.instructions.md · 188k | Copilot instructions | agent-behaviour | 16/100 | 3 days ago | |
| microsoft/vscode.github/instructions/learnings.instructions.md · 188k | Copilot instructions | style | 40/100 | 3 days ago | |
| microsoft/vscode.github/instructions/notebook.instructions.md · 188k | Copilot instructions | no sections | 48/100 | 3 days ago | |
| microsoft/vscode.github/instructions/observables.instructions.md · 188k | Copilot instructions | no sections | 40/100 | 3 days ago | |
| microsoft/vscode.github/instructions/oss-third-party-notices.instructions.md · 188k | Copilot instructions | buildgitdependenciesdeployment+1 | 65/100 | 3 days ago |
Diff against .github/instructions/accessibility.instructions.md Diff against .github/instructions/chat.instructions.md Diff against extensions/copilot/src/platform/authentication/common/AGENTS.md Diff against .github/copilot-instructions.md Diff against .github/instructions/agentHostTesting.instructions.md Diff against .github/instructions/ai-customization.instructions.md Diff against .github/instructions/best-practices.instructions.md Diff against .github/instructions/buildNext.instructions.md Diff against .github/instructions/coding-guidelines.instructions.md Diff against .github/instructions/committing.instructions.md Diff against .github/instructions/css-best-practices.instructions.md Diff against .github/instructions/design-philosophy.instructions.md Diff against .github/instructions/design-tokens.instructions.md Diff against .github/instructions/disposable.instructions.md Diff against .github/instructions/interactive.instructions.md Diff against .github/instructions/kusto.instructions.md Diff against .github/instructions/learnings.instructions.md Diff against .github/instructions/notebook.instructions.md Diff against .github/instructions/observables.instructions.md Diff against .github/instructions/oss-third-party-notices.instructions.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| chihebnabil/lovable-boilerplate.github/instructions/global.instructions.md · 63 | Copilot instructions | buildlint-formatstylearch+4 | 100/100 | 3 days ago | |
| HerringtonDarkholme/megarepo.github/copilot-instructions.md · 17 | Copilot instructions | setupbuildtestlint-format+7 | 100/100 | 3 days ago | |
| louislam/uptime-kuma.github/copilot-instructions.md · 90k | Copilot instructions | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-template.github/copilot-instructions.md · 31k | Copilot instructions | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| bagisto/bagisto.github/copilot-instructions.md · 28k | Copilot instructions | setupbuildteststyle+5 | 97/100 | 3 days ago | |
| nerolis-lab/nerolis-lab.github/copilot-instructions.md · 32 | Copilot instructions | setupbuildtestlint-format+11 | 96/100 | 3 days ago | |
| thangaram611/second-brain.github/copilot-instructions.md · 0 | Copilot instructions | setupteststylearch+4 | 96/100 | 3 days ago | |
| darkmatter/nixmac.github/copilot-instructions.md · 24 | Copilot instructions | setupbuildtestlint-format+8 | 96/100 | 3 days ago |
