[AI] Github Copliot 워크플로우

1. 구조화된 바이브 코딩을 위한 3-file system 전략

성공적으로 ai agent를 다루기 위해서 3개의 파일을 활용한다.

  • 생성 규칙 파일
    : 에이전트가 PRD(Product Requirements Document)(제품 요구사항 명세서)를 작성하도록 안내한다.
  • 태스크 생성 규칙 파일
    : 최종 목표를 달성하기 위해서 필요한 중간 목표로서 세분화된 태스크 목록을 생성한다.
    : 체크박스로 진행사항 표시한다.
  • 태스크 실행 규칙 파일
    : 한 번에 하나의 태스크만 실행하도록 제한한다.
    : 태스크를 마무리한 후 개발자에게 검토받는다.
    : 승인 후 태스크에 완료 표시를 한다.

GitHub – snarktank/ai-dev-tasks: A simple task management system for managing AI dev agents

A simple task management system for managing AI dev agents – snarktank/ai-dev-tasks

3 file system을 추천하는 Ryan Carson이 공개한 프롬프트다. 조금 살펴보자.

AI로 복잡한 기능을 구축하는 것은 때때로 블랙박스처럼 느껴질 수 있습니다.

이 워크플로는 다음을 통해 프로세스에 구조, 명확성 및 제어 기능을 제공하는 것을 목표로 합니다:

  1. 범위 정의: 제품 요구 사항 문서(PRD)로 구축해야 할 사항을 명확하게 설명합니다.
  2. 상세한 계획: PRD를 세분화하고 실행 가능한 작업 목록으로 세분화하기.
  3. 반복적 구현: AI가 한 번에 하나의 작업을 처리하도록 안내하여 각 변경 사항을 검토하고 승인할 수 있도록 합니다.

이 구조화된 접근 방식은 AI가 정상 궤도를 유지하도록 보장하고, 문제를 더 쉽게 디버깅할 수 있게 하며, 생성된 코드에 대한 신뢰를 제공합니다.

3개의 파일에 저장된 정보를 바탕으로 에이전트의 동작을 예측가능하게 제한하는 것이 핵심이다.


2. 행동 지침

Ryan carson이 공개한 create-prd.md, generate-tasks.md, process-task-list.md/ai-dev-tasks에 저장한다.

이후 Agent(=Copilot)의 행동 지침을 초기화한다.

Your task is to "onboard" this repository to Copilot coding agent by adding a .github/copilot-instructions.md file in the repository that contains information describing how a coding agent seeing i for the first time can work most efficiently.

You will do this task only one time per repository and doing a good job can SIGNIFICANTLY improve the quality of the agent's work, so take your time, think carefully, and search thoroughly before writing the instructions.

<Goals>
- Reduce the likelihood of a coding agent pull request getting rejected by the user due to
generating code that fails the continuous integration build, fails a validation pipeline, or
having misbehavior.
- Minimize bash command and build failures.
- Allow the agent to complete its task more quickly by minimizing the need for exploration using grep, find, str_replace_editor, and code search tools.
</Goals>

<Limitations>
- Instructions must be no longer than 2 pages.
- Instructions must not be task specific.
</Limitations>

<WhatToAdd>

Add the following high level details about the codebase to reduce the amount of searching the agent has to do to understand the codebase each time:
<HighLevelDetails>

- A summary of what the repository does.
- High level repository information, such as the size of the repo, the type of the project, the languages, frameworks, or target runtimes in use.
</HighLevelDetails>

Add information about how to build and validate changes so the agent does not need to search and find it each time.
<BuildInstructions>

- For each of bootstrap, build, test, run, lint, and any other scripted step, document the sequence of steps to take to run it successfully as well as the versions of any runtime or build tools used.
- Each command should be validated by running it to ensure that it works correctly as well as any preconditions and postconditions.
- Try cleaning the repo and environment and running commands in different orders and document errors and and misbehavior observed as well as any steps used to mitigate the problem.
- Run the tests and document the order of steps required to run the tests.
- Make a change to the codebase. Document any unexpected build issues as well as the workarounds.
- Document environment setup steps that seem optional but that you have validated are actually required.
- Document the time required for commands that failed due to timing out.
- When you find a sequence of commands that work for a particular purpose, document them in detail.
- Use language to indicate when something should always be done. For example: "always run npm install before building".
- Record any validation steps from documentation.
</BuildInstructions>

List key facts about the layout and architecture of the codebase to help the agent find where to make changes with minimal searching.
<ProjectLayout>

- A description of the major architectural elements of the project, including the relative paths to the main project files, the location
of configuration files for linting, compilation, testing, and preferences.
- A description of the checks run prior to check in, including any GitHub workflows, continuous integration builds, or other validation pipelines.
- Document the steps so that the agent can replicate these itself.
- Any explicit validation steps that the agent can consider to have further confidence in its changes.
- Dependencies that aren't obvious from the layout or file structure.
- Finally, fill in any remaining space with detailed lists of the following, in order of priority: the list of files in the repo root, the
contents of the README, the contents of any key source files, the list of files in the next level down of directories, giving priority to the more structurally important and snippets of code from key source files, such as the one containing the main method.
</ProjectLayout>
</WhatToAdd>

<StepsToFollow>
- Perform a comprehensive inventory of the codebase. Search for and view:
- README.md, CONTRIBUTING.md, and all other documentation files.
- Search the codebase for build steps and indications of workarounds like 'HACK', 'TODO', etc.
- All scripts, particularly those pertaining to build and repo or environment setup.
- All build and actions pipelines.
- All project files.
- All configuration and linting files.
- For each file:
- think: are the contents or the existence of the file information that the coding agent will need to implement, build, test, validate, or demo a code change?
- If yes:
   - Document the command or information in detail.
   - Explicitly indicate which commands work and which do not and the order in which commands should be run.
   - Document any errors encountered as well as the steps taken to workaround them.
- Document any other steps or information that the agent can use to reduce time spent exploring or trying and failing to run bash commands.
- Finally, explicitly instruct the agent to trust the instructions and only perform a search if the information in the instructions is incomplete or found to be in error.
</StepsToFollow>
   - Document any errors encountered as well as the steps taken to work-around them.

해당 프롬프트를 입력해서 초기 copilot-instructions.md를 생성한다.

생성된 지침을 검토하고 적절하게 수정한다.

# AI Dev Tasks

When the user requests structured feature development, always follow these **3 mandatory steps** in order.  

The following files must be referenced during each step:

1. **Generate PRD**(Product Requirement Document)  
   - Command example:  
     ```
     Use @create-prd.md  
     Here's the feature I want to build: [Describe your feature in detail]  
     Reference these files to help you: [Optional: @file1.py @file2.ts]  
     ```  
   - You must use: `/ai-dev-tasks/create-prd.md`  
   - Output: A complete PRD document (e.g., `prd-user-profile-editing.md`)
       - Output Format: Markdown (`.md`)
       - Output Location: `/tasks/`
       - Output Filename: `prd-[feature-name].md`

2. **Generate Task List**  
   - Command example:  
     ```
     Now take @prd-[feature-name].md and create tasks using @generate-tasks.md  
     ```  
   - You must use: `/ai-dev-tasks/generate-tasks.md` and `/tasks/prd-[feature-name].md`
   - Output: A structured task list based on the PRD  
       - Output Format: Markdown (`.md`)
       - Output Location: `/tasks/`
       - Output Filename: `tasks-[prd-file-name].md` (e.g., `tasks-prd-user-profile-editing.md`)

3. **Process Task**  
   - Command example:  
     ```
     Please start on task 1.1 in @tasks-[prd-file-name].md and use @process-task-list.md  
     ```
     또는 한국어로  
     ```
     @process-task-list.md를 참고하여 @tasks-[prd-file-name].md에 정의된 1.1번 task를 처리해줘.
     ```  
   - You must use: `/ai-dev-tasks/process-task-list.md` and `/tasks/tasks-[prd-file-name].md`
   - Output: Processed result of the specified task  

---

## Notes
- The filenames in commands (`@prd-[feature-name].md`, `@tasks-[prd-file-name].md`,  and so on) may change depending on context, but the **workflow order must always remain the same**:  
  **PRD → Tasks → Process Tasks**  
- `@` means adding a particular file to the context. It may vary depending on the tool you are using.
- Always reference the correct base files in `/ai-dev-tasks/` when executing each step.

이때 copilot-instructions.md에 위 내용을 잘 보이는 곳에 추가하고 강조한다.

반.드.시 앞서 생성한 3개의 파일을 참조하도록 작성해야 한다.


3. 생성 규칙

처음 프로젝트를 시작하거나 기존 프로젝트를 처음 열었다고 생각하자.

어떻게 하면 될까? 무엇부터 해야 할까?

우선 PRD(제품 요구사항 명세서)를 작성한다.

  • create-prd.md:
# Rule: Generating a Product Requirements Document (PRD)

## Goal

To guide an AI assistant in creating a detailed Product Requirements Document (PRD) in Markdown format, based on an initial user prompt. The PRD should be clear, actionable, and suitable for a junior developer to understand and implement the feature.

## Process

1.  **Receive Initial Prompt:** The user provides a brief description or request for a new feature or functionality.
2.  **Ask Clarifying Questions:** Before writing the PRD, the AI *must* ask clarifying questions to gather sufficient detail. The goal is to understand the "what" and "why" of the feature, not necessarily the "how" (which the developer will figure out). Make sure to provide options in letter/number lists so I can respond easily with my selections.
3.  **Generate PRD:** Based on the initial prompt and the user's answers to the clarifying questions, generate a PRD using the structure outlined below.
4.  **Save PRD:** Save the generated document as `prd-[feature-name].md` inside the `/tasks` directory.

## Clarifying Questions (Examples)

The AI should adapt its questions based on the prompt, but here are some common areas to explore:

*   **Problem/Goal:** "What problem does this feature solve for the user?" or "What is the main goal we want to achieve with this feature?"
*   **Target User:** "Who is the primary user of this feature?"
*   **Core Functionality:** "Can you describe the key actions a user should be able to perform with this feature?"
*   **User Stories:** "Could you provide a few user stories? (e.g., As a [type of user], I want to [perform an action] so that [benefit].)"
*   **Acceptance Criteria:** "How will we know when this feature is successfully implemented? What are the key success criteria?"
*   **Scope/Boundaries:** "Are there any specific things this feature *should not* do (non-goals)?"
*   **Data Requirements:** "What kind of data does this feature need to display or manipulate?"
*   **Design/UI:** "Are there any existing design mockups or UI guidelines to follow?" or "Can you describe the desired look and feel?"
*   **Edge Cases:** "Are there any potential edge cases or error conditions we should consider?"

## PRD Structure

The generated PRD should include the following sections:

1.  **Introduction/Overview:** Briefly describe the feature and the problem it solves. State the goal.
2.  **Goals:** List the specific, measurable objectives for this feature.
3.  **User Stories:** Detail the user narratives describing feature usage and benefits.
4.  **Functional Requirements:** List the specific functionalities the feature must have. Use clear, concise language (e.g., "The system must allow users to upload a profile picture."). Number these requirements.
5.  **Non-Goals (Out of Scope):** Clearly state what this feature will *not* include to manage scope.
6.  **Design Considerations (Optional):** Link to mockups, describe UI/UX requirements, or mention relevant components/styles if applicable.
7.  **Technical Considerations (Optional):** Mention any known technical constraints, dependencies, or suggestions (e.g., "Should integrate with the existing Auth module").
8.  **Success Metrics:** How will the success of this feature be measured? (e.g., "Increase user engagement by 10%", "Reduce support tickets related to X").
9.  **Open Questions:** List any remaining questions or areas needing further clarification.

## Target Audience

Assume the primary reader of the PRD is a **junior developer**. Therefore, requirements should be explicit, unambiguous, and avoid jargon where possible. Provide enough detail for them to understand the feature's purpose and core logic.

## Output

*   **Format:** Markdown (`.md`)
*   **Location:** `/tasks/`
*   **Filename:** `prd-[feature-name].md`

## Final instructions

1. Do NOT start implementing the PRD
2. Make sure to ask the user clarifying questions
3. Take the user's answers to the clarifying questions and improve the PRD

/ai-dev-tasks/ 아래에 저장한다.

Use @create-prd.md
Here's the feature I want to build: [Describe your feature in detail]
Reference these files to help you: [Optional: @file1.py @file2.ts]

해당 프롬프트를 입력하여 PRD를 획득하면 된다.

Ryan Carson은 이때 최대한 똑똑한 모델을 사용할 것을 추천한다.


4. 태스크 생성

  • generate-tasks.md:
# Rule: Generating a Task List from a PRD

## Goal

To guide an AI assistant in creating a detailed, step-by-step task list in Markdown format based on an existing Product Requirements Document (PRD). The task list should guide a developer through implementation.

## Output

- **Format:** Markdown (`.md`)
- **Location:** `/tasks/`
- **Filename:** `tasks-[prd-file-name].md` (e.g., `tasks-prd-user-profile-editing.md`)

## Process

1.  **Receive PRD Reference:** The user points the AI to a specific PRD file
2.  **Analyze PRD:** The AI reads and analyzes the functional requirements, user stories, and other sections of the specified PRD.
3.  **Assess Current State:** Review the existing codebase to understand existing infrastructre, architectural patterns and conventions. Also, identify any existing components or features that already exist and could be relevant to the PRD requirements. Then, identify existing related files, components, and utilities that can be leveraged or need modification.
4.  **Phase 1: Generate Parent Tasks:** Based on the PRD analysis and current state assessment, create the file and generate the main, high-level tasks required to implement the feature. Use your judgement on how many high-level tasks to use. It's likely to be about 
5. **Inform the user:** Present these tasks to the user in the specified format (without sub-tasks yet) For example, say "I have generated the high-level tasks based on the PRD. Ready to generate the sub-tasks? Respond with 'Go' to proceed." . 
6.  **Wait for Confirmation:** Pause and wait for the user to respond with "Go".
7.  **Phase 2: Generate Sub-Tasks:** Once the user confirms, break down each parent task into smaller, actionable sub-tasks necessary to complete the parent task. Ensure sub-tasks logically follow from the parent task, cover the implementation details implied by the PRD, and consider existing codebase patterns where relevant without being constrained by them.
8.  **Identify Relevant Files:** Based on the tasks and PRD, identify potential files that will need to be created or modified. List these under the `Relevant Files` section, including corresponding test files if applicable.
9.  **Generate Final Output:** Combine the parent tasks, sub-tasks, relevant files, and notes into the final Markdown structure.
10.  **Save Task List:** Save the generated document in the `/tasks/` directory with the filename `tasks-[prd-file-name].md`, where `[prd-file-name]` matches the base name of the input PRD file (e.g., if the input was `prd-user-profile-editing.md`, the output is `tasks-prd-user-profile-editing.md`).

## Output Format

The generated task list _must_ follow this structure:

```markdown
## Relevant Files

- `path/to/potential/file1.ts` - Brief description of why this file is relevant (e.g., Contains the main component for this feature).
- `path/to/file1.test.ts` - Unit tests for `file1.ts`.
- `path/to/another/file.tsx` - Brief description (e.g., API route handler for data submission).
- `path/to/another/file.test.tsx` - Unit tests for `another/file.tsx`.
- `lib/utils/helpers.ts` - Brief description (e.g., Utility functions needed for calculations).
- `lib/utils/helpers.test.ts` - Unit tests for `helpers.ts`.

### Notes

- Unit tests should typically be placed alongside the code files they are testing (e.g., `MyComponent.tsx` and `MyComponent.test.tsx` in the same directory).
- Use `npx jest [optional/path/to/test/file]` to run tests. Running without a path executes all tests found by the Jest configuration.

## Tasks

- [ ] 1.0 Parent Task Title
  - [ ] 1.1 [Sub-task description 1.1]
  - [ ] 1.2 [Sub-task description 1.2]
- [ ] 2.0 Parent Task Title
  - [ ] 2.1 [Sub-task description 2.1]
- [ ] 3.0 Parent Task Title (may not require sub-tasks if purely structural or configuration)
```

## Interaction Model

The process explicitly requires a pause after generating parent tasks to get user confirmation ("Go") before proceeding to generate the detailed sub-tasks. This ensures the high-level plan aligns with user expectations before diving into details.

## Target Audience

Assume the primary reader of the task list is a **junior developer** who will implement the feature with awareness of the existing codebase context.

/ai-dev-tasks/ 아래에 저장한다.

Now take @prd-[feature-name].md and create tasks using @generate-tasks.md

파일을 생성하고 프롬프트를 입력한다.

@prd-[feature-name].md 같은 것은 상황에 따라서 수정하면 된다.


5. 태스크 실행

  • process-task-list.md:
# Task List Management

Guidelines for managing task lists in markdown files to track progress on completing a PRD

## Task Implementation
- **One sub-task at a time:** Do **NOT** start the next sub‑task until you ask the user for permission and they say "yes" or "y"
- **Completion protocol:**  
  1. When you finish a **sub‑task**, immediately mark it as completed by changing `[ ]` to `[x]`.
  2. If **all** subtasks underneath a parent task are now `[x]`, follow this sequence:
    - **First**: Run the full test suite (`pytest`, `npm test`, `bin/rails test`, etc.)
    - **Only if all tests pass**: Stage changes (`git add .`)
    - **Clean up**: Remove any temporary files and temporary code before committing
    - **Commit**: Use a descriptive commit message that:
      - Uses conventional commit format (`feat:`, `fix:`, `refactor:`, etc.)
      - Summarizes what was accomplished in the parent task
      - Lists key changes and additions
      - References the task number and PRD context
      - **Formats the message as a single-line command using `-m` flags**, e.g.:

        ```
        git commit -m "feat: add payment validation logic" -m "- Validates card type and expiry" -m "- Adds unit tests for edge cases" -m "Related to T123 in PRD"
        ```
  3. Once all the subtasks are marked completed and changes have been committed, mark the **parent task** as completed.
- Stop after each sub‑task and wait for the user's go‑ahead.

## Task List Maintenance

1. **Update the task list as you work:**
   - Mark tasks and subtasks as completed (`[x]`) per the protocol above.
   - Add new tasks as they emerge.

2. **Maintain the "Relevant Files" section:**
   - List every file created or modified.
   - Give each file a one‑line description of its purpose.

## AI Instructions

When working with task lists, the AI must:

1. Regularly update the task list file after finishing any significant work.
2. Follow the completion protocol:
   - Mark each finished **sub‑task** `[x]`.
   - Mark the **parent task** `[x]` once **all** its subtasks are `[x]`.
3. Add newly discovered tasks.
4. Keep "Relevant Files" accurate and up to date.
5. Before starting work, check which sub‑task is next.
6. After implementing a sub‑task, update the file and then pause for user approval.

/ai-dev-tasks/ 아래에 저장한다.

Please start on task 1.1 in @tasks-[prd-file-name].md and use @process-task-list.md

또는 한국어로

@process-task-list.md를 참고하여 @tasks-[prd-file-name].md에 정의된 1.1번 task를 처리해줘.

@tasks-[prd-file-name].md, 1.1, @process-task-list.md 등 context를 언급하여 확실하게 명령한다.


6. 유용한 커스텀 명령어

Claude code는 /.Claude/commands/ 아래에 추가하면 된다.

나머지는 복사해서 붙여 넣자.


가. 문서화

  • document.md
# Document Code

please add comprehensive documentation to the code in $ARGUMENTS.

For each function and class:
- Add a clear description of what it does
- Document all parameters and their types
- Explain the return value
- Include usage examples where helpful

Follow the project's existing documentation style.

작업물에 대하여 새로운 기록을 남기거나 기존의 문서를 업데이트한다.


나. 청소

  • cleanup.md
# Code Cleanup

Look through the $ARGUMENTS files and clean up any leftover debug logs, commented code, or unused imports.

다. 설명

  • explain.md
# Explain Code

Explain how $ARGUMENTS works as if I'm a new developer on the team. Show me the execution flow and usage examples.

라. 코드 리뷰

  • review.md
# Code Review

Review the $ARGUMENTS code for bugs, security problems, and performance issues. Be specific about what could go wrong.

마. Claude Code Template

GitHub – davila7/claude-code-templates: CLI tool for configuring and monitoring Claude Code

CLI tool for configuring and monitoring Claude Code – davila7/claude-code-templates

커스텀 agents, commands, settings, hooks, MCPs, project templates 제공.

직접 프롬프트 작성하기 전에 먼저 찾아보자.


댓글 남기기