Skip to content

Commit 12bf4f5

Browse files
authored
feat: add prompt request workflow for AI-assisted contributions (#71)
1 parent 9e2b516 commit 12bf4f5

File tree

7 files changed

+281
-0
lines changed

7 files changed

+281
-0
lines changed
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Prompt Request
2+
description: Propose a change via an AI prompt that can be reviewed and executed
3+
title: "[Prompt]: "
4+
labels: ["prompt-request", "ai-assisted"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
## What is a Prompt Request?
10+
11+
Instead of submitting code directly, share the **AI prompt** that generates the changes you want. This allows maintainers to:
12+
- Understand the **intent** behind changes
13+
- Review the **reasoning** before code is generated
14+
- Run the prompt themselves to verify and merge
15+
- Iterate on the prompt before implementation
16+
17+
This is especially useful for AI-assisted development where the prompt often captures intent better than the resulting code diff.
18+
19+
- type: checkboxes
20+
id: existing-issue
21+
attributes:
22+
label: Is there an existing issue or PR for this?
23+
description: Please search to see if this has already been addressed.
24+
options:
25+
- label: I have searched the existing issues and PRs
26+
required: true
27+
28+
- type: textarea
29+
id: context
30+
attributes:
31+
label: Context & Motivation
32+
description: What problem does this prompt solve? Why should this change be made?
33+
placeholder: |
34+
Describe the motivation for this change. Link to related issues if applicable.
35+
Ex: "The current search doesn't handle empty results gracefully..."
36+
validations:
37+
required: true
38+
39+
- type: textarea
40+
id: prompt
41+
attributes:
42+
label: AI Prompt
43+
description: |
44+
The exact prompt to run with an AI coding assistant (GitHub Copilot, Claude, Cursor, etc.).
45+
Include all necessary context the AI would need.
46+
placeholder: |
47+
Add graceful empty state handling to SearchView.swift.
48+
49+
Requirements:
50+
- Show an illustration when search returns no results
51+
- Display helpful message suggesting different search terms
52+
- Follow existing empty state patterns in LibraryView
53+
- Use SF Symbols for the illustration
54+
- Ensure VoiceOver accessibility
55+
validations:
56+
required: true
57+
58+
- type: dropdown
59+
id: ai-tool
60+
attributes:
61+
label: Recommended AI Tool
62+
description: Which AI tool is this prompt designed for?
63+
options:
64+
- GitHub Copilot (Agent Mode)
65+
- Claude (via Cursor/Claude Code)
66+
- Any compatible AI assistant
67+
- Not sure / Tool-agnostic
68+
validations:
69+
required: true
70+
71+
- type: textarea
72+
id: files
73+
attributes:
74+
label: Target Files (Optional)
75+
description: List specific files the prompt should modify, if known.
76+
placeholder: |
77+
- Views/macOS/Search/SearchView.swift
78+
- Views/macOS/Components/EmptyStateView.swift (new)
79+
80+
- type: textarea
81+
id: acceptance
82+
attributes:
83+
label: Acceptance Criteria
84+
description: How will we know the prompt produced correct results?
85+
placeholder: |
86+
- [ ] Empty state appears when search returns 0 results
87+
- [ ] Message is helpful and not generic
88+
- [ ] VoiceOver reads the empty state correctly
89+
- [ ] Unit tests pass
90+
- [ ] No SwiftLint warnings
91+
validations:
92+
required: true
93+
94+
- type: dropdown
95+
id: area
96+
attributes:
97+
label: Feature Area
98+
description: Which part of the app does this affect?
99+
options:
100+
- Playback / Audio
101+
- Library / Playlists
102+
- Search
103+
- Home / Browse
104+
- Now Playing / Player Bar
105+
- UI / Visual
106+
- Performance
107+
- Documentation
108+
- Testing
109+
- Build / CI
110+
- Other
111+
validations:
112+
required: true
113+
114+
- type: textarea
115+
id: alternatives
116+
attributes:
117+
label: Alternative Approaches
118+
description: Other prompts or approaches you considered.
119+
placeholder: Describe other ways this could be achieved.
120+
121+
- type: checkboxes
122+
id: verification
123+
attributes:
124+
label: Verification
125+
description: Please confirm the following.
126+
options:
127+
- label: I have tested this prompt locally (or explained why I couldn't)
128+
- label: The prompt follows project conventions in AGENTS.md
129+
- label: No secrets, API keys, or sensitive data are included in the prompt
130+
required: true
131+
132+
- type: textarea
133+
id: additional
134+
attributes:
135+
label: Additional Context
136+
description: Any other information that would help when running the prompt.
137+
placeholder: Screenshots, expected behavior, edge cases to consider, etc.

β€Ž.github/PULL_REQUEST_TEMPLATE.mdβ€Ž

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,30 @@
22

33
<!-- Provide a brief description of the changes in this PR -->
44

5+
## AI Prompt (Optional)
6+
7+
<!--
8+
If this PR was generated with AI assistance (GitHub Copilot, Claude, Cursor, etc.),
9+
share the prompt that created these changes. This helps reviewers:
10+
- Understand your intent better than code alone
11+
- Validate the approach before reviewing implementation
12+
- Run the prompt themselves to verify or iterate
13+
14+
If you want to submit a "prompt request" (prompt-only, no code), please open a
15+
new issue using the "Prompt Request" issue template instead of a pull request.
16+
-->
17+
18+
<details>
19+
<summary>πŸ€– AI Prompt Used</summary>
20+
21+
```
22+
<!-- Paste your prompt here, or write "N/A - Manual implementation" -->
23+
```
24+
25+
**AI Tool:** <!-- e.g., GitHub Copilot, Claude, Cursor -->
26+
27+
</details>
28+
529
## Type of Change
630

731
<!-- Mark the relevant option with an 'x' -->

β€ŽAGENTS.mdβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ If you discover new response structures or endpoint behaviors, update [docs/api-
119119
120120
> πŸ“ **Document Architectural Decisions** β€” For significant design changes, create an ADR in `docs/adr/` following the format in [docs/adr/README.md](docs/adr/README.md).
121121
122+
> πŸ€– **Document Your Prompts** β€” When completing a task, summarize the key prompt(s) used so the human can include them in the PR. This supports the project's "prompt request" workflow where prompts are reviewed alongside (or instead of) code. See [CONTRIBUTING.md](CONTRIBUTING.md#ai-assisted-contributions--prompt-requests).
123+
122124
> ⚑ **Performance Awareness** β€” For non-trivial features, run performance tests and verify no anti-patterns. When adding parsers or API calls, include `measure {}` tests.
123125
124126
> πŸ”§ **Improve API Explorer, Don't Write One-Off Scripts** β€” When exploring or debugging API-related functionality, **always enhance `Tools/api-explorer.swift`** instead of writing temporary scripts. This ensures the tool grows with the project, maintains consistency, and provides reusable functionality for future API work. If you need to fetch raw JSON, test a new endpoint, or debug response parsing, add that capability to the API explorer.

β€ŽCONTRIBUTING.mdβ€Ž

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,55 @@ final class MyServiceTests: XCTestCase {
186186
3. **Tests Must Pass** β€” Run `xcodebuild -scheme Kaset -destination 'platform=macOS' test`
187187
4. **Linting** β€” Run `swiftlint --strict && swiftformat .` before submitting
188188
5. **Small PRs** β€” Keep changes focused and reviewable
189+
6. **Share AI Prompts** β€” If you used AI assistance, include the prompt in your PR (see below)
190+
191+
## AI-Assisted Contributions & Prompt Requests
192+
193+
We embrace AI-assisted development! Whether you use GitHub Copilot, Claude, Cursor, or other AI tools, we welcome contributions that leverage these capabilities.
194+
195+
### What is a Prompt Request?
196+
197+
A **prompt request** is a contribution where you share the AI prompt that generates code, rather than (or in addition to) the code itself. This approach:
198+
199+
- **Captures intent** β€” The prompt often explains *why* better than a code diff
200+
- **Enables review before implementation** β€” Maintainers can validate the approach
201+
- **Supports iteration** β€” Prompts can be refined before code is generated
202+
- **Improves reproducibility** β€” Anyone can run the prompt to verify results
203+
204+
### Contributing with AI Assistance
205+
206+
#### Option 1: Traditional PR with AI Prompt Disclosure
207+
208+
Submit code as usual, but include the AI prompt in the PR template's "AI Prompt" section. This helps reviewers understand your approach and intent.
209+
210+
#### Option 2: Prompt Request (Prompt-Only)
211+
212+
Create an issue using the **Prompt Request** template if you:
213+
- Have a well-crafted prompt but haven't run it yet
214+
- Want feedback on your approach before implementation
215+
- Prefer maintainers to run and merge the prompt themselves
216+
217+
### Best Practices for AI Prompts
218+
219+
1. **Be specific** β€” Include file paths, function names, and concrete requirements
220+
2. **Reference project conventions** β€” Mention AGENTS.md and relevant patterns
221+
3. **Define acceptance criteria** β€” How will we know it worked?
222+
4. **Include context** β€” Link to issues, docs, or examples
223+
5. **Test locally when possible** β€” Verify the prompt produces working code
224+
225+
### Example Prompt
226+
227+
```
228+
Add haptic feedback to the shuffle button in PlayerBar.swift.
229+
230+
Requirements:
231+
- Use HapticService.toggle() on button tap
232+
- Only trigger haptic on state change (not when already shuffled)
233+
- Follow existing haptic patterns used in volume controls
234+
- Add unit test in PlayerServiceTests.swift
235+
236+
Reference: Core/Services/HapticService.swift for existing patterns
237+
```
189238

190239
## Testing
191240

β€ŽREADME.mdβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,7 @@ open "kaset://play?v=dQw4w9WgXcQ"
8484

8585
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, architecture, and coding guidelines.
8686

87+
We welcome AI-assisted contributions! You can submit traditional PRs or **prompt requests** β€” share the AI prompt that generates your changes, and maintainers can review the intent before running the code. See the [AI-Assisted Contributions](CONTRIBUTING.md#ai-assisted-contributions--prompt-requests) section for details.
88+
8789
## Disclaimer
8890
Kaset is an unofficial application and not affiliated with YouTube or Google Inc. in any way. "YouTube", "YouTube Music" and the "YouTube Logo" are registered trademarks of Google Inc.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# ADR-0009: Prompt Request Workflow
2+
3+
## Status
4+
5+
Accepted
6+
7+
## Context
8+
9+
AI coding assistants (GitHub Copilot, Claude, Cursor, etc.) are increasingly capable of generating high-quality code from natural language prompts. Traditional pull requests focus on reviewing the resulting code diff, but this approach has limitations in the AI-assisted development era:
10+
11+
1. **Code diffs hide intent** β€” A large code change doesn't clearly communicate *why* the change was made or what problem it solves.
12+
2. **Review friction** β€” Reviewers must reverse-engineer the contributor's goals from the code.
13+
3. **Reproducibility** β€” Others cannot easily regenerate or iterate on AI-generated code without knowing the original prompt.
14+
4. **Barrier to contribution** β€” Contributors comfortable with prompts but not Swift development may have valuable ideas they can't easily contribute.
15+
16+
The concept of "prompt requests" (attributed to Peter Steinberger / @steipete) proposes sharing the AI prompt that generates code changes, allowing review of intent before or alongside implementation.
17+
18+
## Decision
19+
20+
We adopt a **prompt request workflow** that allows contributions in three forms:
21+
22+
### 1. Traditional PRs (with optional prompt disclosure)
23+
24+
Standard code contributions where contributors may optionally share the AI prompt used to generate the code in the PR template.
25+
26+
### 2. PRs with Prompt Disclosure (Encouraged)
27+
28+
For AI-generated code, we encourage (but don't require) sharing the prompt that produced the changes. This helps reviewers:
29+
- Understand the contributor's intent
30+
- Validate the prompt logic before reviewing implementation details
31+
- Suggest improvements to the prompt rather than line-by-line code fixes
32+
33+
### 3. Prompt-Only Contributions (Prompt Requests)
34+
35+
Contributors can submit a prompt via the "Prompt Request" issue template without generating code. Maintainers can:
36+
- Review the prompt for feasibility and alignment with project goals
37+
- Iterate on the prompt with the contributor
38+
- Run the approved prompt to generate and merge the code
39+
40+
### Implementation
41+
42+
- **Issue Template**: New `prompt_request.yml` template for prompt-only contributions
43+
- **PR Template**: Added "AI Prompt" section for disclosing prompts used
44+
- **CONTRIBUTING.md**: New section documenting the workflow
45+
- **AGENTS.md**: Guidance for AI agents to document prompts for PR inclusion
46+
47+
## Consequences
48+
49+
### Positive
50+
51+
- **Faster contribution review** β€” Intent is clear from the prompt, reducing back-and-forth
52+
- **Lower barrier to entry** β€” Contributors can propose changes without writing Swift
53+
- **Better reproducibility** β€” Prompts can be re-run to verify or update changes
54+
- **Knowledge sharing** β€” Effective prompts become reusable patterns
55+
- **AI agent compatibility** β€” AI assistants can be instructed to document their prompts
56+
57+
### Negative
58+
59+
- **Additional overhead** β€” Contributors must document prompts (though this is optional for manual code)
60+
- **Prompt variation** β€” Same prompt may produce different results across AI tools or versions
61+
- **Security consideration** β€” Prompts must be reviewed to ensure they don't inadvertently request credential exposure
62+
63+
### Neutral
64+
65+
- **Not a replacement** β€” Prompt requests supplement, not replace, traditional code review
66+
- **Tool-agnostic** β€” The workflow doesn't mandate specific AI tools

β€Ždocs/adr/README.mdβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ What becomes easier or more difficult because of this change?
4343
| [0006](0006-swift-testing-migration.md) | Swift Testing Migration | Accepted |
4444
| [0007](0007-sparkle-auto-updates.md) | Sparkle Auto-Updates | Accepted |
4545
| [0008](0008-nonisolated-network-helpers.md) | Nonisolated Network Helpers for MainActor Classes | Accepted |
46+
| [0009](0009-prompt-request-workflow.md) | Prompt Request Workflow | Accepted |

0 commit comments

Comments
Β (0)