Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ chances of your issue being dealt with quickly:
- **Version** - what version is affected (e.g. 0.1.2)
- **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you
- **Browsers and Operating System** - is this a problem with all browsers?
- **Reproduce the Error** - provide a live example or a unambiguous set of steps
- **Reproduce the Error** - provide a live example or an unambiguous set of steps
- **Related Issues** - has a similar issue been reported before?
- **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be
causing the problem (line of code or commit)
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ But here's the situation...

- Build applications using GitHub Copilot Agent Mode.
- Add custom instruction to GitHub Copilot so that you have more control over GitHub Copilot.
- Add various MCP servers to GitHub Copilot에 so that you build the applications more precisely.
- Add various MCP servers to GitHub Copilot so that you build the applications more precisely.

## Prerequisites

During this workshop, [GitHub Codespaces](https://docs.github.com/ko/codespaces/about-codespaces/what-are-codespaces) is highly recommended because there's no need for preparation, except a web browser. However, if you really need to use your machine, make sure you've installed everything identified below.
During this workshop, [GitHub Codespaces](https://docs.github.com/en/codespaces/about-codespaces/what-are-codespaces) is highly recommended because there's no need for preparation, except a web browser. However, if you really need to use your machine, make sure you've installed everything identified below.

### Common

Expand Down Expand Up @@ -61,7 +61,7 @@ During this workshop, [GitHub Codespaces](https://docs.github.com/ko/codespaces/

## Product Requirements Document

First and the foremost place for you to start is this [PRD (Product Requirements Document)](./product-requirements.md). This document will give you better understanding what todo and how to do.
First and foremost, the place for you to start is this [PRD (Product Requirements Document)](./product-requirements.md). This document will give you a better understanding of what to do and how to do it.

## Workshop Instructions

Expand Down Expand Up @@ -90,9 +90,9 @@ Check out the complete example of each application. They're also vibe-coded with

## Read More...

- [GitHub Codespaces](https://docs.github.com/ko/codespaces/about-codespaces/what-are-codespaces)
- [GitHub Copilot](https://docs.github.com/ko/copilot/about-github-copilot/what-is-github-copilot)
- [GitHub Codespaces](https://docs.github.com/en/codespaces/about-codespaces/what-are-codespaces)
- [GitHub Copilot](https://docs.github.com/en/copilot/about-github-copilot/what-is-github-copilot)
- [GitHub Copilot: Agent Mode](https://code.visualstudio.com/blogs/2025/04/07/agentMode)
- [GitHub Copilot: MCP](https://code.visualstudio.com/blogs/2025/05/12/agent-mode-meets-mcp)
- [GitHub Copilot: Custom Instructions](https://code.visualstudio.com/docs/copilot/copilot-customization)
- [GitHub Copilot: Changing AI Models](https://docs.github.com/ko/copilot/using-github-copilot/ai-models/changing-the-ai-model-for-copilot-chat?tool=vscode)
- [GitHub Copilot: Changing AI Models](https://docs.github.com/en/copilot/using-github-copilot/ai-models/changing-the-ai-model-for-copilot-chat?tool=vscode)
2 changes: 1 addition & 1 deletion complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Refer to the [README](../README.md) doc for preparation.

1. Open a web browser and navigate to `http://localhost:3000`.
1. Verify if the web application is running properly.
1. μ•„λž˜ λͺ…λ Ήμ–΄λ₯Ό μ‹€ν–‰μ‹œμΌœ μ»¨ν…Œμ΄λ„ˆ 앱을 μ‚­μ œν•©λ‹ˆλ‹€.
1. Clean up by running the following command to remove the containerized apps.

```bash
docker compose down --rmi all
Expand Down
100 changes: 50 additions & 50 deletions complete/java/demo/.github/code-instructions.md
Original file line number Diff line number Diff line change
@@ -1,112 +1,112 @@
# Spring Boot 기반 μžλ°” κ°œλ°œμ„ μœ„ν•œ μ½”λ“œ 생성 κ°€μ΄λ“œ (VSCode + GitHub Copilot)
# Spring Boot Java Development Code Generation Guide (VSCode + GitHub Copilot)

이 λ¬Έμ„œλŠ” VSCodeμ—μ„œ GitHub Copilot을 ν™œμš©ν•΄ Spring Boot 기반 μžλ°” ν”„λ‘œμ νŠΈλ₯Ό κ°œλ°œν•  λ•Œ λ”°λ₯Ό μ½”λ“œ 생성 κ·œμΉ™κ³Ό κ°€μ΄λ“œλ₯Ό μ •μ˜ν•©λ‹ˆλ‹€.
This document defines code generation rules and guidelines to follow when developing Spring Boot-based Java projects using GitHub Copilot in VSCode.

---

## 1. κΈ°λ³Έ μ„€μ •
## 1. Basic Configuration

- **μ‚¬μš© μ–Έμ–΄**: Java 17 이상
- **ν”„λ ˆμž„μ›Œν¬**: Spring Boot 3.x
- **λΉŒλ“œ 도ꡬ**: Gradle (Kotlin DSL) λ˜λŠ” Maven
- **ν”„λ‘œμ νŠΈ ꡬ쑰**: `src/main/java`, `src/main/resources` ν‘œμ€€ ꡬ쑰 μ‚¬μš©
- **이름 κ·œμΉ™**: 클래슀 및 λ©”μ„œλ“œλŠ” `CamelCase`, λ³€μˆ˜λŠ” `lowerCamelCase`
- **Language**: Java 17 or higher
- **Framework**: Spring Boot 3.x
- **Build Tool**: Gradle (Kotlin DSL) or Maven
- **Project Structure**: Use standard `src/main/java`, `src/main/resources` structure
- **Naming Convention**: Classes and methods use `CamelCase`, variables use `lowerCamelCase`

---

## 2. νŒ¨ν‚€μ§€ ꡬ쑰 μ˜ˆμ‹œ
## 2. Package Structure Example

```
com.example.project
β”œβ”€β”€ controller // REST 컨트둀러
β”œβ”€β”€ service // λΉ„μ¦ˆλ‹ˆμŠ€ 둜직
β”œβ”€β”€ repository // JPA λ ˆν¬μ§€ν† λ¦¬
β”œβ”€β”€ domain // μ—”ν‹°ν‹° 및 도메인 λͺ¨λΈ
β”œβ”€β”€ dto // DTO (데이터 전솑 객체)
β”œβ”€β”€ config // μ„€μ • 클래슀
β”œβ”€β”€ exception // μ»€μŠ€ν…€ μ˜ˆμ™Έ 및 ν•Έλ“€λŸ¬
β”œβ”€β”€ controller // REST controllers
β”œβ”€β”€ service // Business logic
β”œβ”€β”€ repository // JPA repositories
β”œβ”€β”€ domain // Entities and domain models
β”œβ”€β”€ dto // Data Transfer Objects
β”œβ”€β”€ config // Configuration classes
β”œβ”€β”€ exception // Custom exceptions and handlers
```

---

## 3. μ½”λ“œ μŠ€νƒ€μΌ
## 3. Code Style

- **μƒμ„±μž μ£Όμž…** μ‚¬μš© (`@RequiredArgsConstructor`)
- **Lombok**으둜 λ³΄μΌλŸ¬ν”Œλ ˆμ΄νŠΈ 제거:
- Use **constructor injection** (`@RequiredArgsConstructor`)
- Remove boilerplate with **Lombok**:
- `@Getter`, `@Setter`, `@ToString`, `@NoArgsConstructor`, `@AllArgsConstructor`
- λͺ¨λ“  **public 클래슀 및 λ©”μ„œλ“œμ— JavaDoc** μž‘μ„±
- λ‘œκ·ΈλŠ” `@Slf4j`둜 처리
- Write **JavaDoc for all public classes and methods**
- Handle logs with `@Slf4j`

---

## 4. REST API μž‘μ„± κ·œμΉ™
## 4. REST API Writing Rules

- `@RestController`, `@RequestMapping` μ‚¬μš©
- 응닡은 `ResponseEntity<>`둜 감싸기
- μš”μ²­ λ°”λ”” 검증은 `@Valid`와 ν•¨κ»˜ `@RequestBody` μ‚¬μš©
- μ˜ˆμ™ΈλŠ” `@ControllerAdvice`둜 μ „μ—­ 처리
- Use `@RestController`, `@RequestMapping`
- Wrap responses with `ResponseEntity<>`
- Use `@Valid` with `@RequestBody` for request body validation
- Handle exceptions globally with `@ControllerAdvice`

---

## 5. JPA μž‘μ„± κ·œμΉ™
## 5. JPA Writing Rules

- `@Entity`, `@Table`, `@Id` ν•„μˆ˜ μ‚¬μš©
- `@ManyToOne(fetch = FetchType.LAZY)` μ„ ν˜Έ
- μ–‘λ°©ν–₯ 맀핑은 κΌ­ ν•„μš”ν•  λ•Œλ§Œ μ‚¬μš©
- μ—”ν‹°ν‹°λŠ” 직접 λ°˜ν™˜ν•˜μ§€ 말고 DTOλ₯Ό μ‚¬μš©
- Required use of `@Entity`, `@Table`, `@Id`
- Prefer `@ManyToOne(fetch = FetchType.LAZY)`
- Use bidirectional mapping only when necessary
- Don't return entities directly; use DTOs

---

## 6. ν…ŒμŠ€νŠΈ μž‘μ„± κ·œμΉ™
## 6. Testing Rules

- 톡합 ν…ŒμŠ€νŠΈ: `@SpringBootTest`, 컨트둀러 ν…ŒμŠ€νŠΈ: `@WebMvcTest`
- μ˜μ‘΄μ„± λͺ©ν‚Ή: `@MockBean` λ˜λŠ” `Mockito`
- ν…ŒμŠ€νŠΈ 클래슀 이름: `클래슀λͺ… + Test.java`
- ν…ŒμŠ€νŠΈλŠ” `src/test/java` μ•„λž˜μ— μœ„μΉ˜
- Integration tests: `@SpringBootTest`, controller tests: `@WebMvcTest`
- Dependency mocking: `@MockBean` or `Mockito`
- Test class naming: `ClassName + Test.java`
- Tests should be located under `src/test/java`

---

## 7. Copilot ν™œμš© 팁
## 7. Copilot Usage Tips

- `// 생성: μ„€λͺ…` ν˜•νƒœμ˜ μ£Όμ„μœΌλ‘œ Copilotμ—κ²Œ λͺ…λ Ή
- λ©”μ„œλ“œ μ‹œκ·Έλ‹ˆμ²˜λ‚˜ 클래슀 μ„ μ–Έλ§Œ λ¨Όμ € μž‘μ„±ν•΄λ„ μžλ™ μ™„μ„± μœ λ„ κ°€λŠ₯
- μƒμ„±λœ μ½”λ“œλŠ” λ°˜λ“œμ‹œ **λ¦¬νŒ©ν† λ§ 및 κ²€ν† **ν•  것
- ν•„μš”ν•œ 둜직 흐름에 λŒ€ν•΄ 인라인 주석 μ‚¬μš© (예: `// μ‚¬μš©μž 쑴재 μ—¬λΆ€ 확인`)
- Use comments in the format `// Generate: description` to command Copilot
- Writing just method signatures or class declarations can induce auto-completion
- Always **refactor and review** generated code
- Use inline comments for required logic flow (e.g., `// Check if user exists`)

---

## μ˜ˆμ‹œ ν”„λ‘¬ν”„νŠΈ
## Example Prompts

```java
// 생성: μ‚¬μš©μž(User) μ—”ν‹°ν‹°λ₯Ό κ΄€λ¦¬ν•˜λŠ” REST 컨트둀러
// Generate: REST controller that manages User entities
```

```java
// 생성: μ΄λ©”μΌλ‘œ μ‚¬μš©μž μ‘°νšŒν•˜λŠ” μ„œλΉ„μŠ€ λ©”μ„œλ“œ
// Generate: Service method that finds user by email
```

---

## 8. μ˜μ‘΄μ„± μ„€μ • μ˜ˆμ‹œ (Gradle Kotlin DSL κΈ°μ€€)
## 8. Dependency Configuration Example (Gradle Kotlin DSL)

```kotlin
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.projectlombok:lombok")
runtimeOnly("com.h2database:h2") // λ˜λŠ” μ‚¬μš© 쀑인 DBMS
runtimeOnly("com.h2database:h2") // or your DBMS in use
testImplementation("org.springframework.boot:spring-boot-starter-test")
}
```

---

## 9. API λ¬Έμ„œν™”
## 9. API Documentation

- Swagger(OpenAPI) λ¬Έμ„œλ₯Ό μœ„ν•΄ `springdoc-openapi` μ‚¬μš©
- μ»¨νŠΈλ‘€λŸ¬μ— `@Operation`, DTOλ‚˜ 엔티티에 `@Schema` ν™œμš©
- Use `springdoc-openapi` for Swagger (OpenAPI) documentation
- Use `@Operation` in controllers, `@Schema` in DTOs or entities

---

**끝.**
**End.**
76 changes: 38 additions & 38 deletions complete/java/demo/diagram.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# SNS API μ„œλΉ„μŠ€ λ‹€μ΄μ–΄κ·Έλž¨
# SNS API Service Diagram

## 전체 μ‹œμŠ€ν…œ ꡬ쑰
## Overall System Architecture

```
+--------------------------------------------+
| FastAPI μ• ν”Œλ¦¬μΌ€μ΄μ…˜ |
| FastAPI Application |
+--------------------------------------------+
| - title: "Simple SNS API" |
| - CORS 미듀웨어 μΆ”κ°€ |
| - API λΌμš°ν„° μ„€μ • (/api) |
| - title: "Simple SNS API" |
| - CORS middleware added |
| - API router configuration (/api) |
+--------------------------------------------+
|
| μ‚¬μš©
| uses
v
+--------------------------------------------+
| λ°μ΄ν„°λ² μ΄μŠ€ |
| Database |
+--------------------------------------------+
| - SQLite |
| - ν…Œμ΄λΈ”: posts, comments, likes |
| - Tables: posts, comments, likes |
+--------------------------------------------+
|
| 포함
| contains
v
+--------------------------------------------+
| 데이터 λͺ¨λΈ |
| Data Models |
+--------------------------------------------+
| | | | |
| v v v |
Expand All @@ -32,32 +32,32 @@
+----------+ +------+ +------+ |
+--------------------------------------------+
|
| κ΅¬ν˜„
| implements
v
+--------------------------------------------+
| API μ—”λ“œν¬μΈνŠΈ |
| API Endpoints |
+--------------------------------------------+
| 포슀트 κ΄€λ ¨: |
| Post-related: |
| - GET /api/posts |
| - POST /api/posts |
| - GET /api/posts/{postId} |
| - PATCH /api/posts/{postId} |
| - DELETE /api/posts/{postId} |
| |
| λŒ“κΈ€ κ΄€λ ¨: |
| Comment-related: |
| - GET /api/posts/{postId}/comments |
| - POST /api/posts/{postId}/comments |
| - GET /api/posts/{postId}/comments/{id} |
| - PATCH /api/posts/{postId}/comments/{id} |
| - DELETE /api/posts/{postId}/comments/{id}|
| |
| μ’‹μ•„μš” κ΄€λ ¨: |
| Like-related: |
| - POST /api/posts/{postId}/likes |
| - DELETE /api/posts/{postId}/likes |
+--------------------------------------------+
```

## 데이터 λͺ¨λΈ 상세 λ‹€μ΄μ–΄κ·Έλž¨
## Detailed Data Model Diagram

```
+----------------+ +----------------+ +----------------+
Expand Down Expand Up @@ -89,7 +89,7 @@
+----------------+ +----------------+
```

## λ°μ΄ν„°λ² μ΄μŠ€ μŠ€ν‚€λ§ˆ λ‹€μ΄μ–΄κ·Έλž¨
## Database Schema Diagram

```
+----------------+ +----------------+ +----------------+
Expand All @@ -107,32 +107,32 @@
| +------------------------+
| | |
+-----------------------+------------------------+
μ™Έλž˜ ν‚€ 관계
Foreign Key Relationships
```

## API 흐름 λ‹€μ΄μ–΄κ·Έλž¨
## API Flow Diagram

```
ν΄λΌμ΄μ–ΈνŠΈ β†’ HTTP μš”μ²­ β†’ FastAPI μ• ν”Œλ¦¬μΌ€μ΄μ…˜ β†’ API λΌμš°ν„° β†’ λΉ„μ¦ˆλ‹ˆμŠ€ 둜직 β†’
SQLite λ°μ΄ν„°λ² μ΄μŠ€ β†’ κ²°κ³Ό β†’ Pydantic λͺ¨λΈ λ³€ν™˜ β†’ JSON 응닡 β†’ ν΄λΌμ΄μ–ΈνŠΈ
Client β†’ HTTP Request β†’ FastAPI Application β†’ API Router β†’ Business Logic β†’
SQLite Database β†’ Results β†’ Pydantic Model Conversion β†’ JSON Response β†’ Client
```

## API μ—”λ“œν¬μΈνŠΈ μ„€λͺ…
## API Endpoint Descriptions

1. **포슀트 κ΄€λ ¨ API**
- `GET /api/posts`: λͺ¨λ“  포슀트 λͺ©λ‘ 쑰회
- `POST /api/posts`: μƒˆ 포슀트 μž‘μ„±
- `GET /api/posts/{postId}`: νŠΉμ • 포슀트 쑰회
- `PATCH /api/posts/{postId}`: νŠΉμ • 포슀트 μˆ˜μ •
- `DELETE /api/posts/{postId}`: νŠΉμ • 포슀트 μ‚­μ œ
1. **Post-related APIs**
- `GET /api/posts`: Retrieve all posts
- `POST /api/posts`: Create a new post
- `GET /api/posts/{postId}`: Retrieve a specific post
- `PATCH /api/posts/{postId}`: Update a specific post
- `DELETE /api/posts/{postId}`: Delete a specific post

2. **λŒ“κΈ€ κ΄€λ ¨ API**
- `GET /api/posts/{postId}/comments`: νŠΉμ • 포슀트의 λŒ“κΈ€ λͺ©λ‘ 쑰회
- `POST /api/posts/{postId}/comments`: νŠΉμ • ν¬μŠ€νŠΈμ— λŒ“κΈ€ μž‘μ„±
- `GET /api/posts/{postId}/comments/{commentId}`: νŠΉμ • λŒ“κΈ€ 쑰회
- `PATCH /api/posts/{postId}/comments/{commentId}`: νŠΉμ • λŒ“κΈ€ μˆ˜μ •
- `DELETE /api/posts/{postId}/comments/{commentId}`: νŠΉμ • λŒ“κΈ€ μ‚­μ œ
2. **Comment-related APIs**
- `GET /api/posts/{postId}/comments`: Retrieve comments for a specific post
- `POST /api/posts/{postId}/comments`: Create a comment on a specific post
- `GET /api/posts/{postId}/comments/{commentId}`: Retrieve a specific comment
- `PATCH /api/posts/{postId}/comments/{commentId}`: Update a specific comment
- `DELETE /api/posts/{postId}/comments/{commentId}`: Delete a specific comment

3. **μ’‹μ•„μš” κ΄€λ ¨ API**
- `POST /api/posts/{postId}/likes`: νŠΉμ • ν¬μŠ€νŠΈμ— μ’‹μ•„μš” μΆ”κ°€
- `DELETE /api/posts/{postId}/likes`: νŠΉμ • 포슀트의 μ’‹μ•„μš” μ·¨μ†Œ
3. **Like-related APIs**
- `POST /api/posts/{postId}/likes`: Add a like to a specific post
- `DELETE /api/posts/{postId}/likes`: Remove a like from a specific post
6 changes: 3 additions & 3 deletions docs/00-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ Refer to the [README](../README.md) doc for preparation.
You should be able to see the following. If you see `microsoft` in `origin`, you should clone it again from your forked repository.

```bash
origin https://github.com/<μžμ‹ μ˜ GitHub ID>/github-copilot-vibe-coding-workshop.git (fetch)
origin https://github.com/<μžμ‹ μ˜ GitHub ID>/github-copilot-vibe-coding-workshop.git (push)
origin https://github.com/<your GitHub ID>/github-copilot-vibe-coding-workshop.git (fetch)
origin https://github.com/<your GitHub ID>/github-copilot-vibe-coding-workshop.git (push)
upstream https://github.com/microsoft/github-copilot-vibe-coding-workshop.git (fetch)
upstream https://github.com/microsoft/github-copilot-vibe-coding-workshop.git (push)
```
Expand Down Expand Up @@ -305,7 +305,7 @@ Refer to the [README](../README.md) doc for preparation.
```text
Here's the PRD for you. Carefully read through the entire PRD and do the following for me.

- Identify all the steps first, which is you're going to do.
- Identify all the steps first, which you're going to do.
- Generate an OpenAPI document in YAML format.
- The OpenAPI document should capture all API endpoints, parameters and request/response payloads.
- Assume the API server is `http://localhost:8080` and the base URL is `/api`.
Expand Down
4 changes: 2 additions & 2 deletions docs/01-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Refer to the [README](../README.md) doc for preparation.
I'd like to write a Python application. But before that, I need to set up a virtual environment. Follow the instructions below.

- Your working directory is `python`.
- Identify all the steps first, which is you're going to do.
- Identify all the steps first, which you're going to do.
- Use `.venv` for the virtual environment.
- Use `uv` as the Python package manager.
```
Expand All @@ -82,7 +82,7 @@ Refer to the [README](../README.md) doc for preparation.
I'd like to build a FastAPI application as a backend API. Carefully read the entire PRD and `openapi.yaml`. Then, follow the instructions below.

- Your working directory is `python`.
- Identify all the steps first, which is you're going to do.
- Identify all the steps first, which you're going to do.
- Use FastAPI as the API app framework.
- Use SQLite as the database.
- Use in-memory feature of SQLite.
Expand Down
Loading