Skip to content

Commit 56df3ef

Browse files
committed
docs: Add Copilot instructions
1 parent 438edd6 commit 56df3ef

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed

.github/copilot-instructions.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Coding Guidelines
2+
3+
## Indentation
4+
5+
We use tabs, not spaces.
6+
7+
## Naming Conventions
8+
9+
- Use PascalCase for `type` names
10+
- Use camelCase for `function` and `method` names
11+
- Use camelCase for `property` names and `local variables`
12+
- Use whole words in names when possible
13+
14+
## Comments
15+
16+
- When there are comments for `functions`, `interfaces`, `enums`, and `classes` use JSDoc style comments
17+
18+
## Strings
19+
20+
- Use "double quotes" for strings
21+
22+
## Style
23+
24+
- Use arrow functions `=>` over anonymous function expressions
25+
- Only surround arrow function parameters when necessary. For example, `(x) => x + x` is wrong but the following are correct:
26+
27+
```javascript
28+
x => x + x
29+
(x, y) => x + y
30+
<T>(x: T, y: T) => x === y
31+
```
32+
33+
- Always surround loop and conditional bodies with curly braces
34+
- Open curly braces always go on the same line as whatever necessitates them
35+
- Parenthesized constructs should have no surrounding whitespace. A single space follows commas, colons, and semicolons in those constructs. For example:
36+
37+
```javascript
38+
for (let i = 0, n = str.length; i < 10; i++) {
39+
if (x < 10) {
40+
foo();
41+
}
42+
}
43+
44+
function f(x: number, y: string): void { }
45+
```
46+
47+
## OpenAI API
48+
49+
For OpenAI API calls, we use the Responses API.
50+
51+
Here's an example using CURL:
52+
53+
```shell
54+
curl https://api.openai.com/v1/responses \
55+
-H "Content-Type: application/json" \
56+
-H "Authorization: Bearer $OPENAI_API_KEY" \
57+
-d '{
58+
"model": "gpt-4o-mini",
59+
"instructions": "You are a mom of a three-year-old girl.",
60+
"input": "Tell me a three sentence bedtime story about a unicorn.",
61+
"previous_response_id": "resp_123456abcdef"
62+
}'
63+
```
64+
65+
We only use `previous_response_id` when we need to retry the request.
66+
67+
And here's an example response:
68+
69+
```json
70+
{
71+
"id": "resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b",
72+
"object": "response",
73+
"created_at": 1741476542,
74+
"status": "completed",
75+
"error": null,
76+
"incomplete_details": null,
77+
"instructions": null,
78+
"max_output_tokens": null,
79+
"model": "gpt-4o-2024-08-06",
80+
"output": [
81+
{
82+
"type": "message",
83+
"id": "msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
84+
"status": "completed",
85+
"role": "assistant",
86+
"content": [
87+
{
88+
"type": "output_text",
89+
"text": "In a peaceful grove beneath a silver moon, a unicorn named Lumina discovered a hidden pool that reflected the stars. As she dipped her horn into the water, the pool began to shimmer, revealing a pathway to a magical realm of endless night skies. Filled with wonder, Lumina whispered a wish for all who dream to find their own hidden magic, and as she glanced back, her hoofprints sparkled like stardust.",
90+
"annotations": []
91+
}
92+
]
93+
}
94+
],
95+
"parallel_tool_calls": true,
96+
"previous_response_id": null,
97+
"reasoning": {
98+
"effort": null,
99+
"summary": null
100+
},
101+
"store": true,
102+
"temperature": 1.0,
103+
"text": {
104+
"format": {
105+
"type": "text"
106+
}
107+
},
108+
"tool_choice": "auto",
109+
"tools": [],
110+
"top_p": 1.0,
111+
"truncation": "disabled",
112+
"usage": {
113+
"input_tokens": 36,
114+
"input_tokens_details": {
115+
"cached_tokens": 0
116+
},
117+
"output_tokens": 87,
118+
"output_tokens_details": {
119+
"reasoning_tokens": 0
120+
},
121+
"total_tokens": 123
122+
},
123+
"user": null,
124+
"metadata": {}
125+
}
126+
```

0 commit comments

Comments
 (0)