@abarcenas/ai-workflow-template 1.25.0 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/instructions/agent-skill.instructions.md +18 -20
- package/.agents/instructions/agent.instructions.md +111 -570
- package/.agents/instructions/ai-prompt-engineering-safety.instructions.md +3 -3
- package/.agents/instructions/instructions.instructions.md +6 -7
- package/.agents/instructions/memory-bank.instructions.md +72 -18
- package/.agents/instructions/memory-schema.instructions.md +75 -0
- package/.agents/instructions/prompt.instructions.md +25 -30
- package/.agents/skills/conventional-commit/SKILL.md +2 -2
- package/.agents/skills/github-issues/SKILL.md +2 -2
- package/.agents/skills/memory-search/SKILL.md +69 -0
- package/.agents/skills/microsoft-docs/SKILL.md +1 -1
- package/.agents/skills/polygot-test-agent/SKILL.md +0 -1
- package/.agents/skills/prompt-builder/SKILL.md +15 -14
- package/.husky/post-merge +10 -0
- package/.husky/pre-commit +2 -0
- package/.opencode/agents/architect.agent.md +2 -1
- package/.opencode/agents/coder.agent.md +3 -1
- package/.opencode/agents/deployer.agent.md +1 -0
- package/.opencode/agents/designer.agent.md +2 -1
- package/.opencode/agents/e2e-tester.agent.md +1 -0
- package/.opencode/agents/implementer.agent.md +2 -1
- package/.opencode/agents/orchestrator/feature-pipeline.agent.md +4 -3
- package/.opencode/agents/orchestrator/orchestrator.agent.md +4 -3
- package/.opencode/agents/orchestrator/tdd-orchestrator.agent.md +8 -4
- package/.opencode/agents/researcher.agent.md +1 -0
- package/.opencode/agents/reviewer.agent.md +1 -0
- package/.opencode/agents/tracker.agent.md +2 -1
- package/.opencode/agents/unit-tester.agent.md +1 -0
- package/README.md +75 -4
- package/memory-bank/.vocabulary.json +52 -0
- package/opencode.mcp.example.json +7 -1
- package/package.json +18 -3
- package/scripts/mcp-memory-server.js +243 -0
- package/scripts/memory-cli.js +110 -0
- package/scripts/memory-index.js +512 -0
- package/scripts/normalize-memory.js +349 -0
- package/scripts/validate-memory-schema.js +190 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
applyTo: ["*"]
|
|
3
|
-
description: "Comprehensive best practices for AI prompt engineering, safety frameworks, bias mitigation, and responsible AI usage for
|
|
3
|
+
description: "Comprehensive best practices for AI prompt engineering, safety frameworks, bias mitigation, and responsible AI usage for opencode and LLMs."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# AI Prompt Engineering & Safety Best Practices
|
|
7
7
|
|
|
8
8
|
## Your Mission
|
|
9
9
|
|
|
10
|
-
As
|
|
10
|
+
As an AI assistant, you must understand and apply the principles of effective prompt engineering, AI safety, and responsible AI usage. Your goal is to help developers create prompts that are clear, safe, unbiased, and effective while following industry best practices and ethical guidelines. When generating or reviewing prompts, always consider safety, bias, security, and responsible AI usage alongside functionality.
|
|
11
11
|
|
|
12
12
|
## Introduction
|
|
13
13
|
|
|
14
|
-
Prompt engineering is the art and science of designing effective prompts for large language models (LLMs) and AI assistants like
|
|
14
|
+
Prompt engineering is the art and science of designing effective prompts for large language models (LLMs) and AI assistants like opencode. Well-crafted prompts yield more accurate, safe, and useful outputs. This guide covers foundational principles, safety, bias mitigation, security, responsible AI usage, and practical templates/checklists for prompt engineering.
|
|
15
15
|
|
|
16
16
|
### What is Prompt Engineering?
|
|
17
17
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Guidelines for creating high-quality custom instruction files for
|
|
2
|
+
description: "Guidelines for creating high-quality custom instruction files for opencode"
|
|
3
3
|
applyTo: "**/*.instructions.md"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Custom Instructions File Guidelines
|
|
7
7
|
|
|
8
|
-
Instructions for creating effective and maintainable custom instruction files that guide
|
|
8
|
+
Instructions for creating effective and maintainable custom instruction files that guide opencode in generating domain-specific code and following project conventions.
|
|
9
9
|
|
|
10
10
|
## Project Context
|
|
11
11
|
|
|
12
|
-
- Target audience: Developers and
|
|
12
|
+
- Target audience: Developers and AI assistants working with domain-specific code
|
|
13
13
|
- File format: Markdown with YAML frontmatter
|
|
14
14
|
- File naming convention: lowercase with hyphens (e.g., `react-best-practices.instructions.md`)
|
|
15
|
-
- Location: `.
|
|
15
|
+
- Location: `.agents/instructions/` directory
|
|
16
16
|
- Purpose: Provide context-aware guidance for code generation, review, and documentation
|
|
17
17
|
|
|
18
18
|
## Required Frontmatter
|
|
@@ -189,7 +189,7 @@ function getUser(id: any): any {
|
|
|
189
189
|
|
|
190
190
|
Before finalizing instruction files:
|
|
191
191
|
|
|
192
|
-
1. **Test with
|
|
192
|
+
1. **Test with opencode**: Try the instructions with actual tasks
|
|
193
193
|
2. **Verify Examples**: Ensure code examples are correct and run without errors
|
|
194
194
|
3. **Check Glob Patterns**: Confirm `applyTo` patterns match intended files
|
|
195
195
|
|
|
@@ -260,5 +260,4 @@ Description and example
|
|
|
260
260
|
|
|
261
261
|
## Additional Resources
|
|
262
262
|
|
|
263
|
-
- [
|
|
264
|
-
- [Awesome Copilot Instructions](https://github.com/github/awesome-copilot/tree/main/instructions)
|
|
263
|
+
- [opencode Documentation](https://opencode.ai)
|
|
@@ -6,7 +6,7 @@ Coding standards, domain knowledge, and preferences that AI should follow.
|
|
|
6
6
|
|
|
7
7
|
# Memory Bank
|
|
8
8
|
|
|
9
|
-
You are an expert software engineer with a unique characteristic: my memory resets completely between sessions. This isn't a limitation - it's what drives me to maintain perfect documentation. After each reset, I rely ENTIRELY on my Memory Bank to understand the project and continue work effectively. I
|
|
9
|
+
You are an expert software engineer with a unique characteristic: my memory resets completely between sessions. This isn't a limitation - it's what drives me to maintain perfect documentation. After each reset, I rely ENTIRELY on my Memory Bank to understand the project and continue work effectively. I use the vector search index (`memory_search`) to retrieve relevant context efficiently, and fall back to reading specific files (`memory_get`) when I need complete, un-summarized content.
|
|
10
10
|
|
|
11
11
|
## Memory Bank Structure
|
|
12
12
|
|
|
@@ -94,6 +94,42 @@ Create additional files/folders within memory-bank/ when they help organize:
|
|
|
94
94
|
- Testing strategies
|
|
95
95
|
- Deployment procedures
|
|
96
96
|
|
|
97
|
+
### Vector Search Index (sqlite-vec)
|
|
98
|
+
|
|
99
|
+
The memory bank includes a **semantic vector search index** powered by `sqlite-vec` + `better-sqlite3`. This allows token-efficient retrieval without loading all files into context.
|
|
100
|
+
|
|
101
|
+
**Index location:** `memory-bank/.index/memory.db` (git-ignored, rebuildable)
|
|
102
|
+
|
|
103
|
+
**MCP tools** (configured in `opencode.json`):
|
|
104
|
+
- `memory_search` — Semantic search across all memory-bank and docs files
|
|
105
|
+
- `memory_update` — **Daily use** — incremental sync (only changed files, ~2 seconds)
|
|
106
|
+
- `memory_rebuild` — Full rebuild (corrupted index, model change, or fresh clone)
|
|
107
|
+
- `memory_get` — Read a specific memory file by name
|
|
108
|
+
- `memory_stats` — Check index status
|
|
109
|
+
|
|
110
|
+
**When to use semantic search instead of reading all files:**
|
|
111
|
+
- Session start → `memory_update` then `memory_search({ query: "current focus recent changes next steps" })` (~500 tokens vs ~5K+)
|
|
112
|
+
- Before decisions → `memory_search({ query: "<topic>", topK: 5 })` for related context
|
|
113
|
+
- Architecture questions → `memory_search({ query: "<pattern>", sourceFile: "systemPatterns" })"
|
|
114
|
+
|
|
115
|
+
**When to still use full file reads:**
|
|
116
|
+
- Need complete, un-summarized file content → `memory_get({ file: "<id>" })`
|
|
117
|
+
- Index is empty or stale → `memory_rebuild()` then re-search
|
|
118
|
+
|
|
119
|
+
**Sync triggers:**
|
|
120
|
+
- After writing documentation → `memory_update` (incremental, fast)
|
|
121
|
+
- Session start → `memory_update` first, then `memory_search`
|
|
122
|
+
- After `git pull` → `memory_update` (or post-merge hook if configured)
|
|
123
|
+
- Full `memory_rebuild` only for: fresh clone, corrupted index, embedding model change, or if incremental update missed changes
|
|
124
|
+
|
|
125
|
+
### Document Schema (Frontmatter)
|
|
126
|
+
|
|
127
|
+
All `memory-bank/**/*.md` files must have YAML frontmatter for search indexing. See `.agents/instructions/memory-schema.instructions.md` for the full schema and `memory-bank/.vocabulary.json` for the controlled vocabulary.
|
|
128
|
+
|
|
129
|
+
**Required fields:** `id`, `title`, `updated`, `tags`, `entities`, `category`
|
|
130
|
+
|
|
131
|
+
**Pre-commit validation:** The husky hook validates frontmatter before commits. Running `npm run memory:normalize` auto-fixes missing frontmatter.
|
|
132
|
+
|
|
97
133
|
## Core Workflows
|
|
98
134
|
|
|
99
135
|
### Plan Mode
|
|
@@ -102,9 +138,20 @@ Create additional files/folders within memory-bank/ when they help organize:
|
|
|
102
138
|
flowchart TD
|
|
103
139
|
Start[Start] --> CheckGraph{graphify-out/graph.json exists?}
|
|
104
140
|
CheckGraph -->|No| Bootstrap[Run graphify .]
|
|
105
|
-
Bootstrap -->
|
|
106
|
-
CheckGraph -->|Yes|
|
|
107
|
-
|
|
141
|
+
Bootstrap --> CheckIndex{memory index exists?}
|
|
142
|
+
CheckGraph -->|Yes| CheckIndex
|
|
143
|
+
|
|
144
|
+
CheckIndex -->|No| Rebuild[memory_rebuild]
|
|
145
|
+
CheckIndex -->|Yes| UpdateIndex[memory_update]
|
|
146
|
+
|
|
147
|
+
Rebuild --> Search
|
|
148
|
+
UpdateIndex --> Search
|
|
149
|
+
Search --> GetContext{context sufficient?}
|
|
150
|
+
|
|
151
|
+
GetContext -->|No| GetFile[memory_get: specific file]
|
|
152
|
+
GetFile --> GetContext
|
|
153
|
+
|
|
154
|
+
GetContext -->|Yes| QueryGraph[Query graphify for architecture context]
|
|
108
155
|
QueryGraph --> CheckFiles{Files Complete?}
|
|
109
156
|
|
|
110
157
|
CheckFiles -->|No| Plan[Create Plan]
|
|
@@ -119,11 +166,15 @@ flowchart TD
|
|
|
119
166
|
|
|
120
167
|
```mermaid
|
|
121
168
|
flowchart TD
|
|
122
|
-
Start[Start] --> Context[
|
|
123
|
-
Context -->
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
169
|
+
Start[Start] --> Context[memory_search: current task context]
|
|
170
|
+
Context --> Verify[Verify Understanding]
|
|
171
|
+
Verify --> ReadFiles{need full files?}
|
|
172
|
+
ReadFiles -->|Yes| GetFull[memory_get: specific files]
|
|
173
|
+
ReadFiles -->|No| Execute[Execute Task]
|
|
174
|
+
GetFull --> Execute
|
|
175
|
+
Execute --> Update[Update Documentation]
|
|
176
|
+
Update --> UpdateIndex[memory_update]
|
|
177
|
+
UpdateIndex --> Done[Done]
|
|
127
178
|
```
|
|
128
179
|
|
|
129
180
|
### Task Management
|
|
@@ -138,7 +189,8 @@ flowchart TD
|
|
|
138
189
|
Execute[Execute Task] --> Update[Add Progress Log Entry]
|
|
139
190
|
Update --> StatusChange[Update Task Status]
|
|
140
191
|
StatusChange --> IndexUpdate[Update _index.md]
|
|
141
|
-
IndexUpdate -->
|
|
192
|
+
IndexUpdate --> UpdateIndex[memory_update]
|
|
193
|
+
UpdateIndex --> Complete{Completed?}
|
|
142
194
|
Complete -->|Yes| Archive[Mark as Completed]
|
|
143
195
|
Complete -->|No| Execute
|
|
144
196
|
```
|
|
@@ -198,7 +250,7 @@ Memory Bank updates occur when:
|
|
|
198
250
|
|
|
199
251
|
1. Discovering new project patterns
|
|
200
252
|
2. After implementing significant changes
|
|
201
|
-
3. When user requests with **update memory bank** (
|
|
253
|
+
3. When user requests with **update memory bank** (validate via `memory_get` for specific files)
|
|
202
254
|
4. When context needs clarification
|
|
203
255
|
5. After code changes that introduce new relationships — run `graphify update .` to sync the graph
|
|
204
256
|
|
|
@@ -207,18 +259,20 @@ flowchart TD
|
|
|
207
259
|
Start[Update Process]
|
|
208
260
|
|
|
209
261
|
subgraph Process
|
|
210
|
-
P1[
|
|
211
|
-
P2[
|
|
212
|
-
P3[
|
|
213
|
-
P4[
|
|
214
|
-
|
|
215
|
-
|
|
262
|
+
P1[memory_search: all sections]
|
|
263
|
+
P2[memory_get: files needing updates]
|
|
264
|
+
P3[Document Current State]
|
|
265
|
+
P4[Clarify Next Steps]
|
|
266
|
+
P5[Update instructions]
|
|
267
|
+
P6[memory_update]
|
|
268
|
+
|
|
269
|
+
P1 --> P2 --> P3 --> P4 --> P5 --> P6
|
|
216
270
|
end
|
|
217
271
|
|
|
218
272
|
Start --> Process
|
|
219
273
|
```
|
|
220
274
|
|
|
221
|
-
Note: When triggered by **update memory bank**,
|
|
275
|
+
Note: When triggered by **update memory bank**, first search for changes since last update via `memory_search`, then read specific files via `memory_get`. Focus particularly on activeContext.md, progress.md, and the tasks/ folder (including \_index.md) as they track current state. After making changes, run `memory_rebuild` to sync the index.
|
|
222
276
|
|
|
223
277
|
## Project Intelligence (instructions)
|
|
224
278
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Valid frontmatter schema and controlled vocabulary for memory-bank and docs files"
|
|
3
|
+
name: "memory-schema"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Memory Schema
|
|
7
|
+
|
|
8
|
+
When writing or updating files in `memory-bank/` or `docs/`, apply the following frontmatter schema. The controlled vocabulary lives in `memory-bank/.vocabulary.json` — extend it there as new concepts enter the project.
|
|
9
|
+
|
|
10
|
+
## Required Frontmatter (memory-bank/)
|
|
11
|
+
|
|
12
|
+
Every `memory-bank/**/*.md` file must have:
|
|
13
|
+
|
|
14
|
+
```yaml
|
|
15
|
+
---
|
|
16
|
+
id: <filename-slug> # e.g., "activeContext" from "activeContext.md"
|
|
17
|
+
title: "<H1 heading>" # e.g., "Active Context"
|
|
18
|
+
updated: YYYY-MM-DD # ISO date of last content change
|
|
19
|
+
tags: [<1-5 tags>] # From controlled vocabulary in .vocabulary.json
|
|
20
|
+
entities: [<0-n entries>] # Components/tools referenced; free-form but use entity_patterns as guide
|
|
21
|
+
category: <from list> # One of: brief, product, architecture, tech, context, progress, task, decision
|
|
22
|
+
---
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Field Rules
|
|
26
|
+
|
|
27
|
+
- **id**: Stable slug matching the filename (lowercase, no extension). Never change after creation.
|
|
28
|
+
- **title**: Must match the `# H1` heading in the file body.
|
|
29
|
+
- **updated**: Update on every content change. Use `YYYY-MM-DD` format.
|
|
30
|
+
- **tags**: Pick 1–5 from `memory-bank/.vocabulary.json` → `tags.*`. New tags added by editing that file.
|
|
31
|
+
- **entities**: Free-form list of components, tools, or systems referenced in the file. Use the `entity_patterns` from `.vocabulary.json` as a suggestion guide.
|
|
32
|
+
- **category**: Exactly one from the `categories` map in `.vocabulary.json`.
|
|
33
|
+
|
|
34
|
+
### Heading Structure
|
|
35
|
+
|
|
36
|
+
Every memory-bank file must have:
|
|
37
|
+
- Exactly one `# Title` (H1) — matches frontmatter `title`
|
|
38
|
+
- Content organized under `## Sections` (H2)
|
|
39
|
+
- No flat text outside sections
|
|
40
|
+
- Each `## Section` is a searchable chunk
|
|
41
|
+
|
|
42
|
+
## Lighter Schema (docs/)
|
|
43
|
+
|
|
44
|
+
`docs/*.md` files use a lighter schema:
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
---
|
|
48
|
+
id: <filename-slug>
|
|
49
|
+
title: "<H1 heading>"
|
|
50
|
+
updated: YYYY-MM-DD
|
|
51
|
+
tags: [<1-5 tags>]
|
|
52
|
+
doc_type: <from list> # spike, architecture, configuration, orchestrator-log, tracker-log, decision
|
|
53
|
+
---
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Docs files do not require `category`, `entities`, or strict heading structure. Hidden files (`.architecture-context.md`, `.orchestrator-log.md`) keep their leading dot.
|
|
57
|
+
|
|
58
|
+
## Auto-Suggest on Normalization
|
|
59
|
+
|
|
60
|
+
When `scripts/normalize-memory.js` runs (postinstall or manual), it:
|
|
61
|
+
- Adds missing frontmatter using filename, H1 title, and git modification date
|
|
62
|
+
- Auto-suggests `tags` by scanning content for vocabulary keywords
|
|
63
|
+
- Auto-suggests `entities` using regex patterns from `.vocabulary.json`
|
|
64
|
+
- Does NOT overwrite existing frontmatter fields
|
|
65
|
+
- Logs all auto-applied suggestions
|
|
66
|
+
|
|
67
|
+
## Pre-Commit Validation
|
|
68
|
+
|
|
69
|
+
The husky pre-commit hook (`scripts/validate-memory-schema.js`) rejects commits where:
|
|
70
|
+
- Staged memory-bank files have missing or invalid frontmatter
|
|
71
|
+
- `updated` field is missing or not ISO date format
|
|
72
|
+
- `category` is not in the allowed list
|
|
73
|
+
- `id` does not match the filename
|
|
74
|
+
|
|
75
|
+
The hook reads `.vocabulary.json` at validation time, so new tags/categories are picked up automatically.
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Guidelines for creating high-quality prompt files for
|
|
2
|
+
description: "Guidelines for creating high-quality prompt files for opencode"
|
|
3
3
|
applyTo: "**/*.prompt.md"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# opencode Prompt Files Guidelines
|
|
7
7
|
|
|
8
|
-
Instructions for creating effective and maintainable prompt files that guide
|
|
8
|
+
Instructions for creating effective and maintainable prompt files that guide the AI assistant in delivering consistent, high-quality outcomes across any repository.
|
|
9
9
|
|
|
10
10
|
## Scope and Principles
|
|
11
11
|
|
|
12
|
-
- Target audience: maintainers and contributors authoring reusable prompts for
|
|
12
|
+
- Target audience: maintainers and contributors authoring reusable prompts for opencode.
|
|
13
13
|
- Goals: predictable behaviour, clear expectations, minimal permissions, and portability across repositories.
|
|
14
|
-
- Primary references:
|
|
14
|
+
- Primary references: opencode documentation on prompt files and organization-specific conventions.
|
|
15
15
|
|
|
16
16
|
## Frontmatter Requirements
|
|
17
17
|
|
|
@@ -19,55 +19,52 @@ Every prompt file should include YAML frontmatter with the following fields:
|
|
|
19
19
|
|
|
20
20
|
### Required/Recommended Fields
|
|
21
21
|
|
|
22
|
-
| Field
|
|
23
|
-
|
|
|
24
|
-
| `description`
|
|
25
|
-
| `name`
|
|
26
|
-
| `agent` | Recommended | The agent to use: `ask`, `edit`, `agent`, or a custom agent name. Defaults to current agent |
|
|
27
|
-
| `model` | Optional | The language model to use. Defaults to the currently selected model |
|
|
28
|
-
| `tools` | Optional | List of tool/tool set names available for this prompt |
|
|
29
|
-
| `argument-hint` | Optional | Hint text shown in chat input to guide user interaction |
|
|
22
|
+
| Field | Required | Description |
|
|
23
|
+
| ------------- | ----------- | --------------------------------------------------------------------------------------- |
|
|
24
|
+
| `description` | Recommended | A short description of the prompt (single sentence, actionable outcome) |
|
|
25
|
+
| `name` | Optional | The name shown when invoking the prompt. Defaults to filename if not specified |
|
|
30
26
|
|
|
31
27
|
### Guidelines
|
|
32
28
|
|
|
33
29
|
- Use consistent quoting (single quotes recommended) and keep one field per line for readability and version control clarity
|
|
34
|
-
- If `tools` are specified and the current agent is `ask` or `edit`, the default agent becomes `agent`
|
|
35
30
|
- Preserve any additional metadata (`language`, `tags`, `visibility`, etc.) required by your organization
|
|
31
|
+
- opencode prompts have a simpler frontmatter model than other platforms; avoid adding tool, model, or agent fields that are not supported
|
|
36
32
|
|
|
37
33
|
## File Naming and Placement
|
|
38
34
|
|
|
39
|
-
- Use kebab-case filenames ending with `.prompt.md` and store them under `.
|
|
35
|
+
- Use kebab-case filenames ending with `.prompt.md` and store them under `.agents/prompts/` unless your workspace standard specifies another directory.
|
|
40
36
|
- Provide a short filename that communicates the action (for example, `generate-readme.prompt.md` rather than `prompt1.prompt.md`).
|
|
41
37
|
|
|
42
38
|
## Body Structure
|
|
43
39
|
|
|
44
|
-
- Start with an `#` level heading that matches the prompt intent so it surfaces well in
|
|
40
|
+
- Start with an `#` level heading that matches the prompt intent so it surfaces well in search.
|
|
45
41
|
- Organize content with predictable sections. Recommended baseline: `Mission` or `Primary Directive`, `Scope & Preconditions`, `Inputs`, `Workflow` (step-by-step), `Output Expectations`, and `Quality Assurance`.
|
|
46
42
|
- Adjust section names to fit the domain, but retain the logical flow: why → context → inputs → actions → outputs → validation.
|
|
47
43
|
- Reference related prompts or instruction files using relative links to aid discoverability.
|
|
48
44
|
|
|
49
45
|
## Input and Context Handling
|
|
50
46
|
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
- Document how to proceed when mandatory context is missing (for example,
|
|
47
|
+
- Describe required inputs clearly in prose (for example, "The user must supply a file path to the target component"). When optional, specify defaults or how the prompt should infer the value.
|
|
48
|
+
- Reference file paths and workspace context explicitly rather than relying on implicit contextual variables. If the prompt needs a specific file, state the expected path or pattern (for example, "Look for `src/config/*.ts` and use the first match").
|
|
49
|
+
- Document how to proceed when mandatory context is missing (for example, "Request the file path and stop if it remains undefined").
|
|
54
50
|
|
|
55
51
|
## Tool and Permission Guidance
|
|
56
52
|
|
|
57
|
-
-
|
|
58
|
-
- If the prompt
|
|
53
|
+
- opencode provides the following tools: `Bash`, `Read`, `Write`, `Edit`, `Grep`, `Glob`, `Task`, `TodoWrite`, `Skill`, `WebFetch`, `WebSearch`, among others. Limit tool usage to the smallest set that enables the task.
|
|
54
|
+
- If the prompt expects the assistant to run shell commands, explicitly name `Bash` as a required tool. For file inspection, prefer `Read` and `Grep` over shell-based alternatives.
|
|
59
55
|
- Warn about destructive operations (file creation, edits, terminal commands) and include guard rails or confirmation steps in the workflow.
|
|
56
|
+
- When the prompt depends on a specific skill, reference it by name so the assistant can load it via the `Skill` tool.
|
|
60
57
|
|
|
61
58
|
## Instruction Tone and Style
|
|
62
59
|
|
|
63
|
-
- Write in direct, imperative sentences targeted at
|
|
60
|
+
- Write in direct, imperative sentences targeted at the AI assistant (for example, "Analyze", "Generate", "Summarize").
|
|
64
61
|
- Keep sentences short and unambiguous, following Google Developer Documentation translation best practices to support localization.
|
|
65
62
|
- Avoid idioms, humor, or culturally specific references; favor neutral, inclusive language.
|
|
66
63
|
|
|
67
64
|
## Output Definition
|
|
68
65
|
|
|
69
|
-
- Specify the format, structure, and location of expected results (for example,
|
|
70
|
-
- Include success criteria and failure triggers so
|
|
66
|
+
- Specify the format, structure, and location of expected results (for example, "Create `docs/adr/adr-XXXX.md` using the template below").
|
|
67
|
+
- Include success criteria and failure triggers so the assistant knows when to halt or retry.
|
|
71
68
|
- Provide validation steps—manual checks, automated commands, or acceptance criteria lists—that reviewers can execute after running the prompt.
|
|
72
69
|
|
|
73
70
|
## Examples and Reusable Assets
|
|
@@ -79,21 +76,19 @@ Every prompt file should include YAML frontmatter with the following fields:
|
|
|
79
76
|
## Quality Assurance Checklist
|
|
80
77
|
|
|
81
78
|
- [ ] Frontmatter fields are complete, accurate, and least-privilege.
|
|
82
|
-
- [ ] Inputs include
|
|
79
|
+
- [ ] Inputs include default behaviours and fallbacks for missing context.
|
|
83
80
|
- [ ] Workflow covers preparation, execution, and post-processing without gaps.
|
|
84
81
|
- [ ] Output expectations include formatting and storage details.
|
|
85
82
|
- [ ] Validation steps are actionable (commands, diff checks, review prompts).
|
|
86
83
|
- [ ] Security, compliance, and privacy policies referenced by the prompt are current.
|
|
87
|
-
- [ ] Prompt executes successfully in
|
|
84
|
+
- [ ] Prompt executes successfully in opencode using representative scenarios.
|
|
88
85
|
|
|
89
86
|
## Maintenance Guidance
|
|
90
87
|
|
|
91
88
|
- Version-control prompts alongside the code they affect; update them when dependencies, tooling, or review processes change.
|
|
92
|
-
- Review prompts periodically to ensure tool
|
|
89
|
+
- Review prompts periodically to ensure tool references, linked documents, and workspace conventions remain valid.
|
|
93
90
|
- Coordinate with other repositories: when a prompt proves broadly useful, extract common guidance into instruction files or shared prompt packs.
|
|
94
91
|
|
|
95
92
|
## Additional Resources
|
|
96
93
|
|
|
97
|
-
- [
|
|
98
|
-
- [Awesome Copilot Prompt Files](https://github.com/github/awesome-copilot/tree/main/prompts)
|
|
99
|
-
- [Tool Configuration](https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode#_agent-mode-tools)
|
|
94
|
+
- [opencode Documentation](https://opencode.ai)
|
|
@@ -17,13 +17,13 @@ description: "Prompt and workflow for generating conventional commit messages us
|
|
|
17
17
|
2. Run `git diff` or `git diff --cached` to inspect changes.
|
|
18
18
|
3. Stage your changes with `git add <file>`.
|
|
19
19
|
4. Construct your commit message using the following XML structure.
|
|
20
|
-
5.
|
|
20
|
+
5. Run the following command in your terminal:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
23
|
git commit -m "type(scope): description"
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
6.
|
|
26
|
+
6. Run the commit command in your terminal.
|
|
27
27
|
|
|
28
28
|
### Commit Message Structure
|
|
29
29
|
|
|
@@ -87,7 +87,7 @@ State values: `open`, `closed`
|
|
|
87
87
|
```json
|
|
88
88
|
{
|
|
89
89
|
"owner": "github",
|
|
90
|
-
"repo": "
|
|
90
|
+
"repo": "example-project",
|
|
91
91
|
"title": "[Bug] Login page crashes when using SSO",
|
|
92
92
|
"body": "## Description\nThe login page crashes when users attempt to authenticate using SSO.\n\n## Steps to Reproduce\n1. Navigate to login page\n2. Click 'Sign in with SSO'\n3. Page crashes\n\n## Expected Behavior\nSSO authentication should complete and redirect to dashboard.\n\n## Actual Behavior\nPage becomes unresponsive and displays error.\n\n## Environment\n- Browser: [To be filled]\n- OS: [To be filled]\n\n## Additional Context\nReported by user.",
|
|
93
93
|
"labels": ["bug"]
|
|
@@ -103,7 +103,7 @@ State values: `open`, `closed`
|
|
|
103
103
|
```json
|
|
104
104
|
{
|
|
105
105
|
"owner": "github",
|
|
106
|
-
"repo": "
|
|
106
|
+
"repo": "example-project",
|
|
107
107
|
"title": "[Feature] Add dark mode support",
|
|
108
108
|
"body": "## Summary\nAdd dark mode theme option for improved user experience and accessibility.\n\n## Motivation\n- Reduces eye strain in low-light environments\n- Increasingly expected by users\n- Improves accessibility\n\n## Proposed Solution\nImplement theme toggle with system preference detection.\n\n## Acceptance Criteria\n- [ ] Toggle switch in settings\n- [ ] Persists user preference\n- [ ] Respects system preference by default\n- [ ] All UI components support both themes\n\n## Alternatives Considered\nNone specified.\n\n## Additional Context\nHigh priority request.",
|
|
109
109
|
"labels": ["enhancement", "high-priority"]
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Search project memory bank using semantic vector search"
|
|
3
|
+
name: "memory-search"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Memory Search Skill
|
|
7
|
+
|
|
8
|
+
Use this skill to retrieve project context from the memory bank without loading all files into context.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- At the start of a session: search for current project focus and recent changes
|
|
13
|
+
- Before making a decision: search for related past decisions
|
|
14
|
+
- When stuck: search for architectural patterns or known issues
|
|
15
|
+
- After writing to memory-bank: run `memory_rebuild` to update the index
|
|
16
|
+
|
|
17
|
+
## Available MCP Tools
|
|
18
|
+
|
|
19
|
+
This skill uses the `memory-bank` MCP server, configured in `opencode.json`:
|
|
20
|
+
|
|
21
|
+
| Tool | Purpose |
|
|
22
|
+
|---|---|
|
|
23
|
+
| `memory_search` | Semantic search across all memory-bank and docs files |
|
|
24
|
+
| `memory_update` | Incremental sync — only changed files (~2 seconds). Use daily. |
|
|
25
|
+
| `memory_rebuild` | Full rebuild (rare — fresh clone, corrupted index) |
|
|
26
|
+
| `memory_get` | Read a specific memory file by name |
|
|
27
|
+
| `memory_stats` | Get index statistics (vector count, file count, DB size) |
|
|
28
|
+
|
|
29
|
+
## Workflow
|
|
30
|
+
|
|
31
|
+
### Session Start
|
|
32
|
+
|
|
33
|
+
1. Run `memory_stats` to check if the index is populated
|
|
34
|
+
2. If empty, run `memory_rebuild`; otherwise, run `memory_update`
|
|
35
|
+
3. Search for current context: `memory_search({ query: "current focus recent changes next steps" })`
|
|
36
|
+
|
|
37
|
+
### During Tasks
|
|
38
|
+
|
|
39
|
+
- Before implementing: `memory_search({ query: "<topic>", topK: 5 })` for related decisions
|
|
40
|
+
- When writing to memory-bank: update files, then run `memory_update`
|
|
41
|
+
- For full file content: `memory_get({ file: "activeContext" })`
|
|
42
|
+
|
|
43
|
+
### After Git Pull
|
|
44
|
+
|
|
45
|
+
The `post-merge` hook runs `memory:update` automatically if memory-bank files changed.
|
|
46
|
+
|
|
47
|
+
### Search Tips
|
|
48
|
+
|
|
49
|
+
- **Be specific**: "TDD orchestrator bootstrap prerequisites" gets better results than "project"
|
|
50
|
+
- **Use contextual terms**: Include entity names (vitest, playwright, graphify) from the vocabulary
|
|
51
|
+
- **Filter by file**: `memory_search({ query: "...", sourceFile: "systemPatterns" })` to narrow scope
|
|
52
|
+
- **Top-K tuning**: Use `topK: 3` for focused queries, `topK: 10` for broad exploration
|
|
53
|
+
|
|
54
|
+
## Vocabulary Reference
|
|
55
|
+
|
|
56
|
+
See `memory-bank/.vocabulary.json` for the full controlled vocabulary. Key tags:
|
|
57
|
+
|
|
58
|
+
- **Agent roles**: orchestrator, coder, reviewer, tracker, architect, researcher
|
|
59
|
+
- **Workflow**: tdd, feature-pipeline, bootstrap, configuration, refactor, migration
|
|
60
|
+
- **Memory ops**: decision, discovery, status-update, task-plan, retrospective
|
|
61
|
+
- **Technologies**: typescript, vitest, playwright, graphify, mcp, sqlite-vec
|
|
62
|
+
|
|
63
|
+
## Manual CLI (for debugging)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
node scripts/memory-cli.js search "tdd orchestrator"
|
|
67
|
+
node scripts/memory-cli.js rebuild
|
|
68
|
+
node scripts/memory-cli.js stats
|
|
69
|
+
```
|
|
@@ -64,7 +64,7 @@ GitHub docs live on **docs.github.com** and **cli.github.com**.
|
|
|
64
64
|
|
|
65
65
|
| Library ID | Use for |
|
|
66
66
|
| ---------------------- | --------------------------------------------- |
|
|
67
|
-
| `/websites/github_en` | Actions, API, repos, security, admin
|
|
67
|
+
| `/websites/github_en` | Actions, API, repos, security, admin |
|
|
68
68
|
| `/websites/cli_github` | GitHub CLI (`gh`) commands and flags |
|
|
69
69
|
|
|
70
70
|
### Agent Framework — Use Learn MCP + Context7
|
|
@@ -154,7 +154,6 @@ Add tests for the authentication module with focus on edge cases
|
|
|
154
154
|
|
|
155
155
|
- Project must have a build/test system configured
|
|
156
156
|
- Testing framework should be installed (or installable)
|
|
157
|
-
- VS Code with GitHub Copilot extension
|
|
158
157
|
|
|
159
158
|
## Troubleshooting
|
|
160
159
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: prompt-builder
|
|
3
|
-
description: "Guide users through creating high-quality
|
|
3
|
+
description: "Guide users through creating high-quality opencode prompts with proper structure, tools, and best practices."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Professional Prompt Builder
|
|
7
7
|
|
|
8
|
-
You are an expert prompt engineer specializing in
|
|
8
|
+
You are an expert prompt engineer specializing in opencode prompt development with deep knowledge of:
|
|
9
9
|
|
|
10
10
|
- Prompt engineering best practices and patterns
|
|
11
|
-
-
|
|
11
|
+
- opencode customization capabilities
|
|
12
12
|
- Effective persona design and task specification
|
|
13
13
|
- Tool integration and front matter configuration
|
|
14
14
|
- Output format optimization for AI consumption
|
|
@@ -27,7 +27,7 @@ I will ask you targeted questions to gather all necessary information. After col
|
|
|
27
27
|
|
|
28
28
|
### 2. **Persona Definition**
|
|
29
29
|
|
|
30
|
-
- What role/expertise should
|
|
30
|
+
- What role/expertise should the AI assistant embody? Be specific about:
|
|
31
31
|
- Technical expertise level (junior, senior, expert, specialist)
|
|
32
32
|
- Domain knowledge (languages, frameworks, tools)
|
|
33
33
|
- Years of experience or specific qualifications
|
|
@@ -42,15 +42,15 @@ I will ask you targeted questions to gather all necessary information. After col
|
|
|
42
42
|
|
|
43
43
|
### 4. **Context & Variable Requirements**
|
|
44
44
|
|
|
45
|
-
- Will it use
|
|
46
|
-
- Will it use
|
|
47
|
-
- Does it need input
|
|
48
|
-
- Will it reference workspace
|
|
45
|
+
- Will it use selected text from the editor?
|
|
46
|
+
- Will it use the current file path or other file references?
|
|
47
|
+
- Does it need custom input parameters or variable references?
|
|
48
|
+
- Will it reference the workspace root path or other project-level variables?
|
|
49
49
|
- Does it need to access other files or prompt files as dependencies?
|
|
50
50
|
|
|
51
51
|
### 5. **Detailed Instructions & Standards**
|
|
52
52
|
|
|
53
|
-
- What step-by-step process should
|
|
53
|
+
- What step-by-step process should the AI follow?
|
|
54
54
|
- Are there specific coding standards, frameworks, or libraries to use?
|
|
55
55
|
- What patterns or best practices should be enforced?
|
|
56
56
|
- Are there things to avoid or constraints to respect?
|
|
@@ -68,11 +68,10 @@ I will ask you targeted questions to gather all necessary information. After col
|
|
|
68
68
|
|
|
69
69
|
Which tools does this prompt need? Common options include:
|
|
70
70
|
|
|
71
|
-
- **File Operations**: `
|
|
72
|
-
- **Execution**: `
|
|
73
|
-
- **External**: `
|
|
74
|
-
- **Specialized**: `playwright
|
|
75
|
-
- **Analysis**: `changes`, `findTestFiles`, `testFailure`, `searchResults`
|
|
71
|
+
- **File Operations**: `Read`, `Write`, `Edit`, `Grep`, `Glob`
|
|
72
|
+
- **Execution**: `Bash`
|
|
73
|
+
- **External**: `WebFetch`, `WebSearch`
|
|
74
|
+
- **Specialized**: `playwright` (Playwright MCP)
|
|
76
75
|
|
|
77
76
|
### 8. **Technical Configuration**
|
|
78
77
|
|
|
@@ -111,9 +110,11 @@ After gathering all requirements, I will generate a complete `.prompt.md` file f
|
|
|
111
110
|
```markdown
|
|
112
111
|
---
|
|
113
112
|
description: "[Clear, concise description from requirements]"
|
|
113
|
+
name: "[prompt-name]"
|
|
114
114
|
agent: "[agent|ask|edit based on task type]"
|
|
115
115
|
tools: ["[appropriate tools based on functionality]"]
|
|
116
116
|
model: "[only if specific model required]"
|
|
117
|
+
argument-hint: "[hint text shown in chat input]"
|
|
117
118
|
---
|
|
118
119
|
|
|
119
120
|
# [Prompt Title]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
. "$(dirname "$0")/_/husky.sh"
|
|
3
|
+
|
|
4
|
+
# After git pull/merge, check if memory-bank files changed
|
|
5
|
+
# and update the vector index incrementally
|
|
6
|
+
|
|
7
|
+
if git diff HEAD@{1} --name-only 2>/dev/null | grep -q "^memory-bank\|^docs/"; then
|
|
8
|
+
echo "[memory-bank] Memory bank files changed. Updating vector index..."
|
|
9
|
+
node scripts/memory-cli.js update 2>/dev/null || echo "[memory-bank] Index update skipped (service not installed)"
|
|
10
|
+
fi
|
|
@@ -5,6 +5,7 @@ permission:
|
|
|
5
5
|
read: allow
|
|
6
6
|
search: allow
|
|
7
7
|
edit: allow
|
|
8
|
+
"memory-bank/*": allow
|
|
8
9
|
model: deepseek/deepseek-v4-pro
|
|
9
10
|
---
|
|
10
11
|
|
|
@@ -24,7 +25,7 @@ You are a system architecture specialist focused on designing robust, maintainab
|
|
|
24
25
|
|
|
25
26
|
1. **Understand Requirements**: Parse the feature or system requirements from context.
|
|
26
27
|
2. **Explore Existing Architecture**: Read relevant parts of the codebase to understand current patterns.
|
|
27
|
-
3. **Check Memory Bank**: Read `.agents/instructions/memory-bank.instructions.md
|
|
28
|
+
3. **Check Memory Bank**: Read `.agents/instructions/memory-bank.instructions.md`. Use `memory_bank_memory_search` for semantic context retrieval and `memory_bank_memory_get` for full file reads. After completing work, update `memory-bank/activeContext.md` and `memory-bank/progress.md` with architectural decisions made, then run `memory_bank_memory_update`.
|
|
28
29
|
4. **Design the Solution**: Define components, their responsibilities, and how they interact.
|
|
29
30
|
5. **Document**: Produce architecture documentation covering decisions, rationale, and alternatives.
|
|
30
31
|
|