Skip to content

Commit 36b1ac1

Browse files
authored
Update JS instruction materials with custom instructions (microsoft#8)
* Update JS instruction materials with custom instructions * Fix typos
1 parent 975e64f commit 36b1ac1

6 files changed

Lines changed: 210 additions & 32 deletions

File tree

docs/.vscode/mcp.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"inputs": [
3+
{
4+
"type": "promptString",
5+
"id": "figma-api-key",
6+
"description": "MCP server access key for Figma",
7+
"password": true
8+
}
9+
],
10+
"servers": {
11+
"Framelink Figma MCP": {
12+
"command": "npx",
13+
"args": [
14+
"-y",
15+
"figma-developer-mcp",
16+
"--figma-api-key=${inputs.figma-api-key}",
17+
"--stdio"
18+
],
19+
"type": "stdio",
20+
"env": {}
21+
}
22+
}
23+
}

docs/01-python.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Refer to the [README](../README.md) doc for preparation.
1212

1313
## Getting Started
1414

15-
- [Check GitHub Copilot Agent Mode](#check-github-copilot-agent-mode)
16-
- [Prepare Custom Instructions](#prepare-custom-instructions)
17-
- [Prepare Virtual Environment](#prepare-virtual-environment)
18-
- [Build FastAPI Backend App](#build-fastapi-backend-app)
15+
- [Check GitHub Copilot Agent Mode](#check-github-copilot-agent-mode)
16+
- [Prepare Custom Instructions](#prepare-custom-instructions)
17+
- [Prepare Virtual Environment](#prepare-virtual-environment)
18+
- [Build FastAPI Backend App](#build-fastapi-backend-app)
1919

2020
### Check GitHub Copilot Agent Mode
2121

@@ -96,16 +96,16 @@ Refer to the [README](../README.md) doc for preparation.
9696
- DO NOT modify anything defined in `openapi.yaml`.
9797
```
9898

99+
1. Click the `[keep]` button of GitHub Copilot to take the changes.
99100
1. Once the application is built, verify if it's written properly or not.
100101
101102
```text
102-
Run the Python app and verify if the app is properly running. Also verify the OpenAPI endpoint renders exactly the same content as `openapi.yaml`.
103+
Run the FastAPI app and verify if the app is properly running. Also verify the OpenAPI endpoint renders exactly the same content as `openapi.yaml`.
103104
104105
If app running fails, analyze the issues and fix them.
105106
```
106107
107108
1. Open a web browser and navigate to `http://localhost:5050`.
108-
109109
1. Click the `[keep]` button of GitHub Copilot to take the changes.
110110
111111
---

docs/02-javascript.md

Lines changed: 135 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,168 @@
11
# 02: JavaScript Frontend Development
22

3-
## 시나리오
3+
## Scenario
44

5-
Contoso 아웃도어 컴파니의 마케팅 팀에서는 제품 홍보를 위한 마이크로 소셜 미디어 웹사이트를 빠르게 론칭하고 싶어 합니다. 개발팀의 JavaScript 개발자인 당신은 GitHub Codespaces 안에서 GitHub Copilot을 이용해 간단한 프론트엔드 웹 UI를 React 기반으로 만들어 달라는 요청을 받았습니다.
5+
Contoso is a company that sells products for various outdoor activities. A marketing department of Contoso would like to launch a micro social media website to promote their products for existing and potential customers.
66

7-
## 사전 준비사항
7+
As a JavaScript developer, you're going to build a JavaScript frontend app using React communicating to the Python backend API app.
88

9-
[README](../README.md) 문서를 참조하여 개발 환경을 준비합니다.
9+
## Prerequisites
1010

11-
## 순서
11+
Refer to the [README](../README.md) doc for preparation.
1212

13-
- [개발 과정 프롬프트](#개발-과정-프롬프트)
14-
- [React 앱 프로젝트 준비](#react-앱-프로젝트-준비)
15-
- [React 앱 프로젝트 구축](#react-앱-프로젝트-구축)
13+
## Getting Started
1614

17-
## 개발 과정 프롬프트
15+
- [Check GitHub Copilot Agent Mode](#check-github-copilot-agent-mode)
16+
- [Prepare Custom Instructions](#prepare-custom-instructions)
17+
- [Prepare Application Project](#prepare-application-project)
18+
- [Set-up Figma MCP Server](#set-up-figma-mcp-server)
19+
- [Generate UI Components from Figma](#generate-ui-components-from-figma)
20+
- [Build React Frontend App](#build-react-frontend-app)
21+
- [Verify React Frontend App](#verify-react-frontend-app)
1822

19-
### React 앱 프로젝트 준비
23+
### Check GitHub Copilot Agent Mode
2024

21-
1. GitHub Copilot이 현재 에이전트모드인지 확인합니다. 모델은 `Claude 3.7 Sonnet`을 선택하세요.
25+
1. Click the GitHub Copilot icon on the top of GitHub Codespace or VS Code and open GitHub Copilot window.
2226

23-
1. React 앱을 스캐폴딩(프로젝트 기본 구조 자동 생성)합니다. 아래와 같은 프롬프트를 이용해 보세요.
27+
![Open GitHub Copilot Chat](./images/setup-02.png)
2428

25-
```text
26-
`javascript` 폴더 안에 React를 사용한 프론트엔드 앱을 구성하려합니다. 패키지매니저는 `npm`, 빌드 툴은 `vite`, 언어는 JavaScript를 사용할 예정이고 AI를 사용한 빠른 마크업 개발을 위해 CSS 프레임워크론 Tailwind CSS를 사용할 예정입니다. 새로운 폴더를 만들지 말고 `javascript` 폴더에 React 앱 스캐폴딩을 시작해주세요.
29+
1. If you're asked to login or sign up, do it. It's free of charge.
30+
1. Make sure you're using GitHub Copilot Agent Mode.
31+
32+
![GitHub Copilot Agent Mode](./images/setup-03.png)
33+
34+
1. Select model to either `GPT-4.1` or `Claude Sonnet 4`.
35+
36+
### Prepare Custom Instructions
37+
38+
1. Set the environment variable of `$REPOSITORY_ROOT`.
39+
40+
```bash
41+
# bash/zsh
42+
REPOSITORY_ROOT=$(git rev-parse --show-toplevel)
43+
```
44+
45+
```powershell
46+
# PowerShell
47+
$REPOSITORY_ROOT = git rev-parse --show-toplevel
48+
```
49+
50+
1. Copy custom instructions.
51+
52+
```bash
53+
# bash/zsh
54+
cp -r $REPOSITORY_ROOT/docs/custom-instructions/javascript/. \
55+
$REPOSITORY_ROOT/.github/
56+
```
57+
58+
```powershell
59+
# PowerShell
60+
Copy-Item -Path $REPOSITORY_ROOT/docs/custom-instructions/javascript/* `
61+
-Destination $REPOSITORY_ROOT/.github/ -Recurse -Force
2762
```
2863

29-
1. 스캐폴딩이 잘 마무리 되었는지 확인합니다.
64+
### Prepare Application Project
65+
66+
1. Make sure that you're using GitHub Copilot Agent Mode with the model of `Claude Sonnet 4` or `GPT-4.1`.
67+
1. Use prompt like below to scaffold a React web app project.
3068
3169
```text
32-
React 개발 서버를 실행해 애플리케이션이 잘 작동하는지 확인해주세요.
70+
I'd like to scaffold a React web app. Follow the instructions below.
71+
72+
- Your working directory is `javascript`.
73+
- Identify all the steps first, which is you're going to do.
74+
- Use ViteJS as the frontend app framework.
75+
- Use default settings when initializing the project.
76+
- Use `SimpleSocialMediaApplication` as the name of the project while initializing.
77+
- Use the port number of `3030`.
3378
```
3479
35-
1. 프로젝트에 필요한 `.gitignore` 파일을 추가합니다.
80+
### Set-up Figma MCP Server
3681
37-
```text
38-
`.gitignore`같은 필수 파일이 빠져있으니 추가해주세요.
82+
1. Get the personal access token (PAT) from [Figma](https://www.figma.com/).
83+
1. Set the environment variable of `$REPOSITORY_ROOT`.
84+
85+
```bash
86+
# bash/zsh
87+
REPOSITORY_ROOT=$(git rev-parse --show-toplevel)
88+
```
89+
90+
```powershell
91+
# PowerShell
92+
$REPOSITORY_ROOT = git rev-parse --show-toplevel
93+
```
94+
95+
1. Copy MCP server settings.
96+
97+
```bash
98+
# bash/zsh
99+
cp -r $REPOSITORY_ROOT/docs/.vscode/. \
100+
$REPOSITORY_ROOT/.vscode/
101+
```
102+
103+
```powershell
104+
# PowerShell
105+
Copy-Item -Path $REPOSITORY_ROOT/docs/.vscode/* `
106+
-Destination $REPOSITORY_ROOT/.vscode/ -Recurse -Force
39107
```
40108
41-
### React 앱 프로젝트 구축
109+
1. Open Command Palette by typing F1 or `Ctrl`+`Shift`+`P` on Windows or `Cmd`+`Shift`+`P` on Mac OS, and search `MCP: List Servers`.
110+
1. Choose `Framelink Figma MCP` then click `Start Server`.
111+
1. Enter the PAT you get issued from Figma.
112+
113+
### Generate UI Components from Figma
114+
115+
1. Make sure that you're using GitHub Copilot Agent Mode with the model of `Claude Sonnet 4` or `GPT-4.1`.
116+
1. Make sure that you're running the Figma MCP server.
117+
1. Copy the [Figma design template](https://www.figma.com/community/file/1495954632647006209) to your account.
118+
119+
![Figma design template page](./images/javascript-01.png)
120+
121+
1. Right-click each section - `Home`, `Search`, `Post Details`, `Post Modal` and `Name Input Modal` 👉 Select `Copy/Paste as` 👉 Select `Copy link to selection` to get the link to each section. Take note all five links.
122+
123+
### Build React Frontend App
42124
43-
1. 이제 Contoso 아웃도어 컴파니의 제품 홍보를 위한 마이크로 소셜 미디어 웹사이트의 기능을 구현합니다. 백엔드와 연동 전 먼저 UI 작업을 시작합니다. (API 스키마를 컨택스트로 주입)
125+
1. Make sure that you're using GitHub Copilot Agent Mode with the model of `Claude Sonnet 4` or `GPT-4.1`.
126+
1. Make sure that you have all the Figma section links of 5 retrieved from the [previous section](#generate-ui-components-from-figma).
127+
1. Add [`product-requirements.md`](../product-requirements.md) and [`openapi.yaml`](../openapi.yaml) to GitHub Copilot.
128+
1. Use prompt like below to build the application based on the requirements and OpenAPI document.
44129

45130
```text
46-
백엔드 개발자에게 전달받은 API 스키마 정보를 바탕으로 구현 가능한 기능을 스스로 판단하여 UI를 먼저 구현해주세요. 반응형 디자인으로 모바일과 데스크탑 모두를 지원해야하고, TailwindCSS를 활용해 깔끔하고 현대적인 UI를 구현해주세요.
131+
I'd like to build a React web app. Follow the instructions below.
132+
133+
- Your working directory is `javascript`.
134+
- Identify all the steps first, which is you're going to do.
135+
- There's a backend API app running on `http://localhost:5050`.
136+
- Use `openapi.yaml` that describes all the endpoints and data schema.
137+
- Create all the UI components defined in this link: {{FIGMA_SECTION_LINK}}.
138+
- DO NOT add anything not defined in `openapi.yaml`.
139+
- DO NOT modify anything defined in `openapi.yaml`.
140+
- Give visual indication when the backend API is unavailable or unreachable for any reason.
141+
```
142+
143+
1. Repeat four more times for the rest four Figma design links.
144+
1. Click the `[keep]` button of GitHub Copilot to take the changes.
145+
146+
### Verify React Frontend App
147+
148+
1. Make sure that the FastAPI backend app is up and running.
47149
48-
모든 작업은 `javascript`폴더 안에서 진행되어야 합니다.
150+
```text
151+
Run the FastAPI backend API, which is located at the `python` directory.
49152
```
50153
51-
2. 백엔드 port 정보를 받아 실제 백엔드 연동을 진행합니다.
154+
1. Verify if it's built properly or not.
52155
53156
```text
54-
백엔드 엔지니어에게 받은 포트 번호는 `8000`이야. 우리는 모노레포로 작업중이니까 포트번호만 변경해서 실제 연동을 진행해줘.
157+
Run the React app and verify if the app is properly running.
158+
159+
If app running fails, analyze the issues and fix them.
55160
```
56161
162+
1. Open a web browser and navigate to `http://localhost:3030`.
163+
1. Verify if both frontend and backend apps are running properly.
164+
1. Click the `[keep]` button of GitHub Copilot to take the changes.
165+
57166
---
58167
59-
축하합니다! **JavaScript 앱 개발** 실습이 끝났습니다. 이제 [STEP 03: Java 앱 개발](./03-java.md) 단계로 넘어가세요.
168+
OK. You've completed the "JavaScript" step. Let's move onto [STEP 03: Java Migration from Python](./03-java.md).
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# JavaScript Development Rules
2+
3+
You are a Senior Front-End Developer and an Expert in ReactJS, NextJS, ViteJS, JavaScript, TypeScript, HTML, CSS and modern UI/UX frameworks (e.g., TailwindCSS, Shadcn, Radix).
4+
5+
You are thoughtful, give nuanced answers, and are brilliant at reasoning. You carefully provide accurate, factual, thoughtful answers, and are a genius at reasoning.
6+
7+
## Key Principles
8+
9+
- Follow the user’s requirements carefully & to the letter.
10+
- First think step-by-step - describe your plan for what to build in pseudocode, written out in great detail.
11+
- Confirm, then write code!
12+
- Always write correct, best practice, DRY principle (Don't Repeat Yourself), bug free, fully functional and working code also it should be aligned to listed rules down below at Code Implementation Guidelines .
13+
- Focus on easy and readability code, over being performant.
14+
- Fully implement all requested functionality.
15+
- Leave NO todo’s, placeholders or missing pieces.
16+
- Ensure code is complete! Verify thoroughly finalised.
17+
- Include all required imports, and ensure proper naming of key components.
18+
- Be concise Minimize any other prose.
19+
- If you think there might not be a correct answer, you say so.
20+
- If you do not know the answer, say so, instead of guessing.
21+
22+
## Coding Environment
23+
24+
The user asks questions about the following coding languages:
25+
26+
- ReactJS
27+
- NextJS
28+
- ViteJS
29+
- JavaScript
30+
- TypeScript
31+
- TailwindCSS
32+
- HTML
33+
- CSS
34+
35+
## Code Implementation Guidelines
36+
37+
Follow these rules when you write code:
38+
39+
- TypeScript is preferred over JavaScript, unless the user specifically requests JavaScript.
40+
- Choose either NextJS or ViteJS for the project, depending on the requirements.
41+
- Use early returns whenever possible to make the code more readable.
42+
- Always use Tailwind classes for styling HTML elements; avoid using CSS or tags.
43+
- Use "class:" instead of the ternary operator in class tags whenever possible.
44+
- Use descriptive variable and function/const names. Also, event functions should be named with a "handle" prefix, like "handleClick" for onClick and "handleKeyDown" for onKeyDown.
45+
- Implement accessibility features on elements. For example, a tag should have a tabindex="0", aria-label, on:click, and on:keydown, and similar attributes.
46+
- Use consts instead of functions, for example, "const toggle = () =>". Also, define a type if possible.

docs/images/javascript-01.png

439 KB
Loading

docs/images/javascript-02.png

445 KB
Loading

0 commit comments

Comments
 (0)