Skip to main content
rule official · GitHub

update-code-from-shorthand — GitHub Copilot rule

Converts shorthand notes and pseudocode between edit markers into fully written code. It turns rough logic sketches into working implementations.

Install into GitHub Copilot · Manually: put the files in place All methods and platforms ↓
.github/instructions/update-code-from-shorthand.instructions.md
Open on GitHub

What update-code-from-shorthand does

This rule instructs the agent to process quick notes and pseudocode embedded directly in code files. You wrap the draft logic inside start-shorthand and end-shorthand marker comments. Lines starting with ()=> signal shorthand pseudo-syntax. The agent reads the file context, expands the outline into proper syntax, and cleans up the marker comments afterward.

When handling data files like JSON or XML with instructions to leave code untouched, the model focuses on structure. It formats entries and appends new data matching the schema. In addition, comments marked REMOVE COMMENT or NOTE get stripped out and replaced with working code.

Activation is strict. The prompt must start with UPDATE CODE FROM SHORTHAND. If that exact phrase is missing at the beginning, the assistant discards the shorthand logic entirely.

What it helps with

  • Turn ()=> pseudocode and notes into working code for the target language
  • Strip shorthand markers and temporary comments after generating code
  • Append and format records in JSON or XML files without modifying code
  • Expand sketched logic directly inside the target source file

Example prompts for the agent

  • UPDATE CODE FROM SHORTHAND #file:script.js: expand shorthand blocks between markers into production functions.
  • UPDATE CODE FROM SHORTHAND #file:data.json no need to edit code add data: insert new records matching the current schema.
  • UPDATE CODE FROM SHORTHAND #file:app.ts: replace comments marked REMOVE COMMENT with working syntax.

How to install update-code-from-shorthand

Manually: put the files in place

.github/instructions/update-code-from-shorthand.instructions.md

The applyTo field sets which files it applies to

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about update-code-from-shorthand

How do I install update-code-from-shorthand in GitHub Copilot?

Place the instruction file at .github/instructions/update-code-from-shorthand.instructions.md in your repository root.

What does update-code-from-shorthand do?

It looks for code blocks enclosed by start-shorthand and end-shorthand markers, generates real code from ()=> pseudocode, and removes the markers.

Why is the rule ignored during normal prompts?

The rule requires UPDATE CODE FROM SHORTHAND at the very beginning of the prompt. If that trigger phrase is omitted, the instructions do not apply.

Source text

update-code-from-shorthand.instructions.md · MIT
---
description: "Shorthand code will be in the file provided from the prompt or raw data in the prompt, and will be used to update the code file when the prompt has the text `UPDATE CODE FROM SHORTHAND`."
applyTo: "**/${input:file}"
---

# Update Code from Shorthand

One or more files will be provided in the prompt. For each file in the prompt, look for the markers
`${openMarker}` and `${closeMarker}`.

All the content between the edit markers may include natural language and shorthand; convert it into
valid code appropriate for the target file type and its extension.

## Role

Expert 10x software engineer. Great at problem solving and generating creative solutions when given
shorthand instructions, similar to brainstorming. The shorthand is like a hand-drawn sketch a client
gives an architect. You extract the big picture and apply expert judgment to produce a complete,
high-quality implementation.

## Rules for Updating Code File from Shorthand

- The text `${openPrompt}` at the very start of the prompt.
- The `${REQUIRED_FILE}` following the `${openPrompt}`.
- Edit markers in the code file or prompt - like:

```text
 ${openMarker} 
 ()=> shorthand code 
 ${closeMarker}
```

- Use the shorthand to edit, or sometimes essentially create the contents of a code file.
- If any comment has the text `REMOVE COMMENT`, `NOTE`, or similar within the comment, that
**comment** is to be removed; and in all probability that line will need the correct syntax,
function, method, or blocks of code.
- If any text, following the file name implies `no need to edit code`, then in all probability this
is to update a data file i.e. `JSON` or `XML` and means the edits should be focused on formatting
the data.
- If any text, following the file name implies `no need to edit code` and `add data`, then in all
probability this is to update a data file i.e. `JSON` or `XML` and means the edits should be focused
on formatting and adding additional data matching the existing format of the data file.

### When to Apply Instructions and Rules

- This is only relevant when the text `${openPrompt}` is at the start of the prompt.
  - If the text `${openPrompt}` is not at the start of the prompt, discard these instructions for
  that prompt.
- The `${REQUIRED_FILE}` will have two markers:
  1. Opening `${openMarker}`
  2. Closing `${closeMarker}`
  - Call these `edit markers`.
- The content between the edit markers determines what to update in the `${REQUIRED_FILE}` or other
referenced files.
- After applying the updates, remove the `${openMarker}` and `${closeMarker}` lines from the
affected file(s).

#### Prompt Back Following Rules

```bash
[user]
> Edit the code file ${REQUIRED_FILE}.
[agent]
> Did you mean to prepend the prompt with "${openPrompt}"?
[user]
> ${openMarker} - edit the code file ${REQUIRED_FILE}.
```

## Remember to

- Remove all occurrences of the openMarker or `${language:comment} start-shorthand`.
  - e.g. `// start-shorthand`.
- Remove all occurrences of the closeMarker or `${language:comment} end-shorthand`.
  - e.g. `// end-shorthand`.

## Shorthand Key

- **`()=>`** = 90% comment and 10% pseudo code blocks of mixed languages.
  - When lines have `()=>` as the starting set of characters, use your **role** to determine a
solution for the goal.

## Variables

- REQUIRED_FILE = `${input:file}`;
- openPrompt = "UPDATE CODE FROM SHORTHAND";
- language:comment = "Single or multi-line comment of programming language.";
- openMarker = "${language:comment} start-shorthand";
- closeMarker = "${language:comment} end-shorthand";

## Use Example

### Prompt Input

```bash
[user prompt]
UPDATE CODE FROM SHORTHAND 
#file:script.js 
Use #file:index.html:94-99 to see where converted
markdown to html will be parsed `id="a"`.
```

### Code File

```js
// script.js
// Parse markdown file, applying HTML to render output.

var file = "file.md";
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
 if (this.readyState == 4 && this.status == 200) {
  let data = this.responseText;
  let a = document.getElementById("a");
  let output = "";
  // start-shorthand
  ()=> let apply_html_to_parsed_markdown = (md) => {
   ()=> md.forEach(line => {
    // Depending on line data use a regex to insert html so markdown is converted to html
    ()=> output += line.replace(/^(regex to add html elements from markdonw line)(.*)$/g, $1$1);
   });
   // Output the converted file from markdown to html.
   return output;
  };
  ()=>a.innerHTML = apply_html_to_parsed_markdown(data);
  // end-shorthand
 }
};
xhttp.open("GET", file, true);
xhttp.send();
```

© github · MIT · github/awesome-copilot

Similar IDE rules

All IDE rules for Agent setup: memory, context, orchestration →

From the same set928

The whole set →
vue A Copilot instruction file that sets Vue 3 conventions: Composition API, <script setup>, reactivity, Pinia and Vue Router. Useful when the agent writes components your way. ★ 40,418repo stars vsixtoolkit Instructs GitHub Copilot to write Visual Studio extensions using Community.VisualStudio.Toolkit. Enforces .NET Framework 4.8 constraints and thread-safe UI rules. ★ 40,418repo stars use-cliche-data-in-docs This rule keeps real values from local files and prompts out of docs, replacing them with plausible fictional examples. Use it when writing or revising documentation. ★ 40,418repo stars update-docs-on-code-change A GitHub Copilot rule that flags when README.md and other docs need updating after code changes. Useful when your docs drift behind the code. ★ 40,418repo stars typespec-m365-copilot A rule for authoring TypeSpec agents and API plugins for Microsoft 365 Copilot. It applies while you edit .tsp files. ★ 40,418repo stars typescript-mcp-server A Copilot instruction file for writing MCP servers with the TypeScript SDK: server classes, zod schemas, transports. ★ 40,418repo stars terraform Sets standards for writing **/*.tf manifests in GitHub Copilot. It enforces secure AWS secret handling, clean module layout, and strict formatting. ★ 40,418repo stars terraform-sap-btp This rule guides Terraform work on SAP BTP, covering file layout, provider dependencies, and state security. Use it while writing or reviewing infrastructure configuration. ★ 40,418repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor