{"meta":{"title":"코드 변경 내용과 설명서 동기화","intro":"공동 파일럿 채팅는 코드 문서를 최신 상태로 유지하는 데 도움을 줄 수 있습니다.","product":"GitHub Copilot","breadcrumbs":[{"href":"/ko/copilot","title":"GitHub Copilot"},{"href":"/ko/copilot/tutorials","title":"자습서"},{"href":"/ko/copilot/tutorials/copilot-cookbook","title":"GitHub Copilot 활용 안내서"},{"href":"/ko/copilot/tutorials/copilot-cookbook/document-code","title":"문서 코드"},{"href":"/ko/copilot/tutorials/copilot-cookbook/document-code/sync-documentation","title":"동기화 설명서"}],"documentType":"article"},"body":"# 코드 변경 내용과 설명서 동기화\n\n공동 파일럿 채팅는 코드 문서를 최신 상태로 유지하는 데 도움을 줄 수 있습니다.\n\n코드를 변경하여 문서를 최신 상태로 유지하는 것은 어려울 수 있습니다. 그러나 코드베이스를 유지 관리하고 개발자가 코드를 효과적으로 사용할 수 있도록 하려면 좋은 설명서가 필요합니다.\n공동 파일럿 채팅 는 기존 코드 설명서를 업데이트하는 데 도움이 될 수 있습니다.\n\n## 예제 시나리오\n\n범주 이름으로 제품을 검색하는 TypeScript 함수가 있지만 설명서가 최신 상태가 아닌 시나리오를 상상해 보세요.\n\n```typescript id=fetch-products-by-category\n/**\n * Retrieves all products belonging to a specific category.\n * * @param categoryId - The unique identifier of the product category\n * @returns Promise that resolves to an array of Product objects\n * * @example\n * const products = await getByCategoryName(5);\n * // Returns: [{id: 1, name: \"Product 1\", categoryId: 5}, ...]\n * * @throws {PrismaClientKnownRequestError} If database query fails\n * @see {@link https://www.prisma.io/docs/reference/api-reference/prisma-client-reference#findmany}\n */\nasync getByCategoryName(categoryId: number, page = 1, pageSize = 10): Promise<Products[]> {\n  return await prisma.products.findMany({\n    where: { categoryId },\n    skip: (page - 1) * pageSize,\n    take: pageSize,\n    include: {\n      reviews: {\n        orderBy: { date: 'desc' },\n        take: 5,\n      },\n    },\n  });\n}\n```\n\n## 예제 프롬프트\n\n현재 코드에 따라 설명서를 업데이트하도록 요청할 공동 파일럿 채팅 수 있습니다.\n\n```copilot copy prompt ref=fetch-products-by-category\nUpdate the existing documentation for the getByCategoryName function to reflect the current implementation.\n```\n\n## 응답 예제\n\n> \\[!NOTE] 다음 응답이 예제입니다. 공동 파일럿 채팅 응답은 비결정적이므로 여기에 표시된 응답과 다른 응답을 얻을 수 있습니다.\n\nCopilot는 `getByCategoryName` 함수에 대한 업데이트된 문서를 생성할 것이라고 설명합니다. 그런 다음, `page` 및 `pageSize` 매개 변수와 발생할 수 있는 `PrismaClientKnownRequestError` 오류가 포함된 업데이트된 문서를 제공합니다.\n\n다음은 그 예입니다.\n\n```typescript\n/**\n * Retrieves all products belonging to a specific category with pagination and recent reviews.\n * * @param categoryId - The unique identifier of the product category\n * @param page - The page number for pagination (default: 1)\n * @param pageSize - Number of products per page (default: 10)\n * @returns Promise that resolves to an array of Product objects with their 5 most recent reviews\n * * @example\n * const products = await getByCategoryName(5, 2, 20);\n * // Returns: [{id: 1, name: \"Product 1\", categoryId: 5, reviews: [...5 recent reviews]}, ...]\n * * @throws {PrismaClientKnownRequestError} If database query fails\n * @see {@link https://www.prisma.io/docs/reference/api-reference/prisma-client-reference#findmany}\n */\n```\n\n## 추가 읽기\n\n* [GitHub Copilot 채팅에 대한 프롬프트 엔지니어링](/ko/copilot/using-github-copilot/prompt-engineering-for-github-copilot)\n* [GitHub 부필로트 사용에 대한 모범 사례](/ko/copilot/using-github-copilot/best-practices-for-using-github-copilot)"}