Files
tendril/docs/PROMPTS/Prompt-Creation-Guide.md
Gitea Actions 6a4683022f docs(prompts): implement Phase 4 LLM Usage Guides Setup
This commit implements the complete LLM Usage Guides system for the Tendril
project, establishing reusable prompt documents for AI-assisted workflows.

## What Was Implemented

### 1. Core Guide Documents

**docs/PROMPTS/LLM-Usage-Guide.md** - Comprehensive LLM execution instructions:
- Recognizing prompt documents (naming convention, structure, location)
- Step-by-step execution process (5 phases: recognize, gather info, execute, handle errors, validate)
- Information gathering requirements and best practices
- Error handling procedures and common error patterns
- Validation steps (pre-execution, during execution, post-execution)
- Providing feedback (progress updates, error reporting, completion summaries)
- Best practices for execution, communication, and quality
- Special instructions for Tendril-specific context
- Troubleshooting guide for common prompt execution issues
- Customized for Tendril project structure and Gitea platform

**docs/PROMPTS/Prompt-Creation-Guide.md** - Guide for creating effective prompts:
- Naming convention (NN-Descriptive-Name-Prompt.md format)
- Complete prompt structure template with all required sections
- Best practices for writing effective instructions
- Information gathering guidelines
- Error handling documentation standards
- Testing procedures for new prompts
- Common patterns (status check, search, sync patterns)
- Decision criteria for when to create new prompts
- Update procedures for existing prompts
- Comprehensive checklist for new prompts
- Examples customized for Tendril project
- References to Gitea-specific workflows and features

### 2. Initial Prompt Documents

**docs/PROMPTS/00-Project-Status-Check-Prompt.md** - Project status overview:
- Purpose: Check current status of all project phases
- Reads all phase blueprints in tendril/phases/
- Extracts phase status, deliverables, milestones
- Organizes by status (Complete, In Progress, Planned)
- Provides comprehensive status summary with counts
- Highlights issues or blockers
- Error handling for missing files, invalid formats
- Validation checklist for completion
- Customized for Tendril phase structure

**docs/PROMPTS/01-KB-Content-Search-Prompt.md** - KB system search:
- Purpose: Search KB system for relevant content
- Supports multiple search types: topics, tags, phase relevance, keywords
- Uses kb/_index.md for efficient searching
- Reads matching KB files and extracts metadata
- Presents organized search results with summaries
- Handles missing index, invalid criteria, empty results
- Provides helpful suggestions for refining searches
- Customized for Tendril KB structure and categories

**docs/PROMPTS/02-Phase-Documentation-Sync-Prompt.md** - Phase documentation synchronization:
- Purpose: Ensure phase documentation consistency
- Reads all four phase documents (blueprint, tasks, decisions, changelog)
- Compares and identifies discrepancies
- Syncs tasks.md with blueprint deliverables and Definition of Done
- Updates changelog.md with sync entry
- Reviews decisions.md for missing ADRs
- Verifies consistency across all documents
- Follows Cursor rules for phase documentation synchronization
- Error handling for missing files, format issues, unresolvable discrepancies
- Customized for Tendril phase structure and documentation system

## Why This Implementation

### Standardized AI Workflows
   LLM Usage Guides enable consistent, repeatable AI-assisted workflows. Instead
   of explaining the same tasks repeatedly, prompts provide standardized
   instructions that work reliably every time.

### Reusability and Efficiency
   Prompt documents can be dragged into Cursor chat sessions and executed
   immediately. This saves time and ensures tasks are performed consistently
   across different sessions and users.

### Quality and Reliability
   Well-structured prompts include validation checklists, error handling, and
   best practices. This reduces errors and ensures high-quality results.

### Knowledge Preservation
   Prompts document how to perform complex tasks, preserving institutional
   knowledge and making it accessible to anyone who needs to perform the task.

### Integration with Project Systems
   Prompts are designed to work with Tendril's phase documentation system, KB
   system, and Gitea workflows, providing seamless integration with existing
   project infrastructure.

## Technical Details

### Prompt Document Structure

All prompts follow a consistent structure:
1. **Title and Purpose** - Clear description of what the prompt does
2. **How to Use** - Instructions for using the prompt
3. **CRITICAL: Information Gathering** - Required information section
4. **Step-by-Step Process** - Phased execution instructions
5. **Error Handling** - Common issues and solutions
6. **Validation Checklist** - Completion verification
7. **Important Notes** - Critical instructions for AI assistant

### Naming Convention

Prompts follow strict naming:
- 00-09: Core system prompts
- 10-19: Phase management prompts
- 20-29: KB system prompts
- 30-39: Workflow and automation prompts
- 40-49: Documentation prompts
- 50+: Project-specific prompts

### Customization for Tendril

All prompts and guides are customized for:
- **Project Name**: Tendril (not "pairs" or placeholders)
- **Platform**: Gitea (not GitHub)
- **Repository**: https://git.parkingmeter.info/Mycelium/tendril
- **Directory Structure**: tendril/phases/, kb/ with category directories
- **Workflows**: Gitea Actions (with GitHub Actions compatibility notes)

### Integration Points

Prompts integrate with:
- **Phase Documentation**: tendril/phases/phase-XX-name/ files
- **KB System**: kb/ directory with index and category structure
- **Workflows**: .github/workflows/ (Gitea Actions)
- **Documentation**: docs/ directory structure

## Files Added

- docs/PROMPTS/LLM-Usage-Guide.md - LLM execution instructions (~400 lines)
- docs/PROMPTS/Prompt-Creation-Guide.md - Prompt creation guide (~600 lines)
- docs/PROMPTS/00-Project-Status-Check-Prompt.md - Status check prompt (~180 lines)
- docs/PROMPTS/01-KB-Content-Search-Prompt.md - KB search prompt (~240 lines)
- docs/PROMPTS/02-Phase-Documentation-Sync-Prompt.md - Documentation sync prompt (~250 lines)

**Total**: 5 files, ~1,670 lines of prompt documentation

## Validation

All Phase 4 requirements met:
-  LLM Usage Guide created and comprehensive
-  Prompt Creation Guide created with complete template
-  Three initial prompt documents created
-  All prompts follow naming convention
-  All prompts include required sections
-  All files reference "Tendril" (42 references found)
-  All files use "Gitea" terminology (10 references, no GitHub)
-  Examples relevant to Tendril project structure
-  Documentation is clear and actionable

## Next Steps

Phase 4 complete. LLM Usage Guides system is ready for use. Prompts can be
dragged into Cursor chat sessions to perform standardized tasks. Ready for
Phase 5: Validation and Testing.

## Related

- Phase 4 Plan: kb/_guides/PROJECT-SETUP-GUIDE/PHASE-4-PLAN.md
- Replication Guide: kb/_guides/PROJECT-SETUP-GUIDE/COMPLETE-SYSTEM-REPLICATION-GUIDE.md
- Gitea LLM Guidelines: docs/GITEA/LLM-Gitea-Guidelines.md
2025-11-11 12:25:52 -07:00

647 lines
14 KiB
Markdown

# Prompt Creation Guide
**Purpose**: Guide for creating effective, reusable prompt documents for AI-assisted workflows in the Tendril project.
**Last Updated**: 2025-11-11
---
## Overview
This guide provides step-by-step instructions for creating prompt documents that enable consistent, reliable AI-assisted workflows. Prompt documents are reusable instructions that can be dragged into Cursor chat sessions to accomplish specific tasks.
**Key Principles**:
- **Clarity**: Instructions must be unambiguous
- **Completeness**: All required information must be specified
- **Reusability**: Prompts should work for similar tasks
- **Validation**: Include checklists to verify completion
---
## Naming Convention
### Format
Prompt documents must follow this naming pattern:
```
NN-Descriptive-Name-Prompt.md
```
Where:
- **`NN`** is a zero-padded two-digit number (00, 01, 02, etc.)
- **`Descriptive-Name`** uses kebab-case (lowercase with hyphens)
- Always ends with **`-Prompt.md`**
### Examples
- `00-Project-Status-Check-Prompt.md`
- `01-KB-Content-Search-Prompt.md`
- `02-Phase-Documentation-Sync-Prompt.md`
- `10-Create-New-Phase-Prompt.md`
- `20-Update-KB-Entry-Prompt.md`
### Numbering Strategy
- **00-09**: Core system prompts (status checks, searches, syncs)
- **10-19**: Phase management prompts
- **20-29**: KB system prompts
- **30-39**: Workflow and automation prompts
- **40-49**: Documentation prompts
- **50+**: Project-specific prompts
---
## Prompt Structure Template
Every prompt document must include these sections in order:
### 1. Title and Purpose
```markdown
# [Task Name] Prompt
**Purpose:** [One sentence describing what this prompt accomplishes]
**How to Use:** Drag this entire document into a Cursor chat session, then [provide context/information]. The AI assistant will follow these instructions to [accomplish the task].
```
### 2. CRITICAL: Information Gathering
```markdown
## CRITICAL: Information Gathering
### Required Information (You should provide this)
Before starting, **ASK THE USER** for the following information if not already provided:
1. **[Information Item 1]** (REQUIRED)
- Format/constraints
- Examples
- Why it's needed
2. **[Information Item 2]** (REQUIRED)
- Format/constraints
- Examples
- Why it's needed
### If Information is Missing
**ALWAYS ASK** for missing required information before proceeding. Do not make assumptions about:
- [List of things not to assume]
```
### 3. Step-by-Step Process
```markdown
## Step-by-Step Process
### Phase 1: [Phase Name]
[Description of what this phase accomplishes]
1. **Step description:**
```bash
# Commands or code
```
2. **Validation:**
- How to verify this step succeeded
- What to check
### Phase 2: [Phase Name]
[Description of what this phase accomplishes]
1. **Step description:**
[Instructions]
2. **Validation:**
- How to verify this step succeeded
- What to check
```
### 4. Error Handling
```markdown
## Error Handling
### Common Issues
#### [Issue Name]
- **Error message**: What you'll see
- **Fix**: How to resolve it
- **Prevention**: How to avoid it
#### [Another Issue]
- **Error message**: What you'll see
- **Fix**: How to resolve it
- **Prevention**: How to avoid it
```
### 5. Validation Checklist
```markdown
## Validation Checklist
Before completing, verify:
- [ ] [Checklist item 1]
- [ ] [Checklist item 2]
- [ ] [Checklist item 3]
- [ ] ...
```
### 6. Important Notes for AI Assistant
```markdown
## Important Notes for AI Assistant
1. **[Critical instruction 1]**
2. **[Critical instruction 2]**
3. **[Critical instruction 3]**
4. ...
```
---
## Best Practices
### Writing Effective Instructions
1. **Be Specific**
- Use exact commands and paths
- Specify file names and locations
- Include expected outputs
2. **Be Complete**
- Include all necessary steps
- Don't assume prior knowledge
- Provide context for each step
3. **Be Clear**
- Use simple, direct language
- Avoid ambiguity
- Use examples where helpful
4. **Be Structured**
- Organize steps logically
- Group related steps into phases
- Number steps sequentially
5. **Be Validated**
- Include validation for each step
- Provide completion checklist
- Specify success criteria
### Information Gathering
1. **List All Requirements**
- Don't assume any information
- Be explicit about what's needed
- Provide format examples
2. **Explain Why**
- Help users understand why information is needed
- Provide context for requirements
- Show how information will be used
3. **Provide Examples**
- Give sample values
- Show format requirements
- Include valid/invalid examples
### Error Handling
1. **Anticipate Common Errors**
- Think about what could go wrong
- Document likely errors
- Provide clear fixes
2. **Include Prevention**
- Explain how to avoid errors
- Provide best practices
- Note common pitfalls
3. **Provide Clear Fixes**
- Step-by-step error resolution
- Explain what each fix does
- Verify fix effectiveness
---
## Writing Effective Instructions
### Command Instructions
When providing commands:
```markdown
1. **Run the command:**
```bash
git status
```
2. **Verify output:**
- Should show list of modified files
- Should indicate current branch
- Should show no uncommitted changes (if clean)
```
### File Operations
When working with files:
```markdown
1. **Read the file:**
- Path: `tendril/phases/phase-01-name/blueprint.md`
- Extract: Project name, status, deliverables
2. **Update the file:**
- Modify: Status field
- Add: New deliverable entry
- Verify: Format is correct
```
### Multi-Step Processes
When breaking down complex tasks:
```markdown
### Phase 1: Preparation
1. **Gather information:**
- [What to gather]
- [Where to find it]
- [How to verify it]
2. **Validate prerequisites:**
- [Check 1]
- [Check 2]
- [Check 3]
### Phase 2: Execution
1. **Perform action:**
- [Step 1]
- [Step 2]
- [Step 3]
2. **Verify results:**
- [Verification 1]
- [Verification 2]
```
---
## Testing Your Prompt
### Test Process
1. **Create the prompt document**
- Follow the structure template
- Include all required sections
- Customize for your task
2. **Test with a simple case**
- Use minimal, clear inputs
- Verify all steps work
- Check validation checklist
3. **Test with edge cases**
- Missing information
- Invalid inputs
- Error conditions
4. **Refine based on results**
- Add missing steps
- Clarify ambiguous instructions
- Improve error handling
### Testing Checklist
- [ ] Prompt executes successfully with valid inputs
- [ ] Prompt handles missing information correctly
- [ ] Prompt provides clear error messages
- [ ] Validation checklist is complete
- [ ] All steps are clear and unambiguous
- [ ] Examples are helpful and accurate
---
## Common Patterns
### Status Check Pattern
```markdown
# [System] Status Check Prompt
**Purpose:** Check current status of [system/component]
## Step-by-Step Process
### Phase 1: Gather Current State
1. Read [status file]
2. Extract [status indicators]
3. List [current items]
### Phase 2: Analyze Status
1. Compare with [baseline/expected]
2. Identify [issues/discrepancies]
3. Summarize findings
### Phase 3: Report
1. Present status summary
2. Highlight issues
3. Suggest next steps
```
### Search Pattern
```markdown
# Search [Content Type] Prompt
**Purpose:** Search [system] for [content type] matching [criteria]
## CRITICAL: Information Gathering
1. **Search criteria** (REQUIRED)
- Format: [format]
- Examples: [examples]
## Step-by-Step Process
### Phase 1: Prepare Search
1. Read [index/reference]
2. Identify [search targets]
3. Prepare [search parameters]
### Phase 2: Execute Search
1. Search by [method 1]
2. Search by [method 2]
3. Combine results
### Phase 3: Present Results
1. List matches
2. Summarize findings
3. Provide references
```
### Sync Pattern
```markdown
# Synchronize [Documents] Prompt
**Purpose:** Ensure [documents] are synchronized and consistent
## Step-by-Step Process
### Phase 1: Read All Documents
1. Read [document 1]
2. Read [document 2]
3. Read [document 3]
### Phase 2: Compare and Identify Discrepancies
1. Compare [field 1] across documents
2. Compare [field 2] across documents
3. List all discrepancies
### Phase 3: Update Documents
1. Update [document 1] with [changes]
2. Update [document 2] with [changes]
3. Verify consistency
```
---
## When to Create a New Prompt
### Create a Prompt When:
1. **Task is Repetitive**
- You find yourself doing the same task multiple times
- Task has clear, repeatable steps
- Task would benefit from standardization
2. **Task is Complex**
- Task involves multiple phases
- Task requires specific information gathering
- Task has validation requirements
3. **Task Needs Consistency**
- Different people perform the task
- Task must follow specific rules
- Task has quality requirements
4. **Task Has Common Errors**
- Task frequently encounters errors
- Errors have known solutions
- Error handling would be helpful
### Don't Create a Prompt When:
1. **Task is One-Time**
- Task will only be done once
- Task is highly specific
- Task doesn't need standardization
2. **Task is Too Simple**
- Task is a single command
- Task requires no validation
- Task has no error handling needs
3. **Task is Too Variable**
- Task changes significantly each time
- Task has no clear pattern
- Task can't be standardized
---
## Updating Existing Prompts
### When to Update
1. **Process Changes**
- Workflow has changed
- New steps are required
- Steps are no longer needed
2. **Error Discovery**
- New common errors found
- Existing fixes don't work
- Prevention methods needed
3. **Clarity Improvements**
- Instructions are ambiguous
- Examples are unclear
- Validation is incomplete
### Update Process
1. **Test Current Prompt**
- Verify it still works
- Identify issues
- Note improvements needed
2. **Make Updates**
- Update affected sections
- Maintain structure
- Preserve working parts
3. **Test Updated Prompt**
- Verify updates work
- Check all sections
- Validate completeness
4. **Document Changes**
- Note what changed
- Explain why
- Update version/date if applicable
---
## Checklist for New Prompts
Before considering a prompt complete, verify:
### Structure
- [ ] Title follows naming convention
- [ ] Purpose is clear and concise
- [ ] "How to Use" section is present
- [ ] Information gathering section is complete
- [ ] Step-by-step process is detailed
- [ ] Error handling section exists
- [ ] Validation checklist is present
- [ ] Important notes section included
### Content
- [ ] All required information is listed
- [ ] Information formats are specified
- [ ] Examples are provided
- [ ] Steps are clear and unambiguous
- [ ] Validation criteria are specified
- [ ] Common errors are documented
- [ ] Error fixes are provided
### Quality
- [ ] Instructions are testable
- [ ] Prompt has been tested
- [ ] Examples are accurate
- [ ] Validation checklist is complete
- [ ] Error handling is comprehensive
- [ ] Customized for Tendril project
- [ ] Uses Gitea terminology (not GitHub)
### Tendril-Specific
- [ ] References "Tendril" (not "pairs")
- [ ] Uses Gitea terminology
- [ ] References correct repository URL
- [ ] Uses Tendril directory structure
- [ ] References Tendril-specific paths
---
## Examples
### Example 1: Simple Status Check
```markdown
# Project Status Check Prompt
**Purpose:** Check current status of all project phases
**How to Use:** Drag this document into Cursor chat. The AI will read all phase blueprints and provide a status summary.
## CRITICAL: Information Gathering
No additional information required. The AI will read phase blueprints automatically.
## Step-by-Step Process
### Phase 1: Read Phase Blueprints
1. Find all `blueprint.md` files in `tendril/phases/`
2. Read each blueprint
3. Extract: phase name, status, key deliverables
### Phase 2: Summarize Status
1. List all phases with status
2. Count: Complete, In Progress, Planned
3. Identify any issues or blockers
## Validation Checklist
- [ ] All phase blueprints read
- [ ] Status summary provided
- [ ] Phase counts are accurate
```
### Example 2: Complex Sync Task
```markdown
# Phase Documentation Sync Prompt
**Purpose:** Ensure phase documentation (blueprint, tasks, decisions, changelog) is synchronized
## CRITICAL: Information Gathering
1. **Phase name or path** (REQUIRED)
- Format: `phase-XX-name` or full path
- Example: `phase-01-foundation` or `tendril/phases/phase-01-foundation/`
- Why: Need to know which phase to sync
## Step-by-Step Process
### Phase 1: Read All Documents
1. Read `blueprint.md`
2. Read `tasks.md`
3. Read `decisions.md`
4. Read `changelog.md`
### Phase 2: Compare and Identify Discrepancies
1. Compare project name across all documents
2. Compare status indicators
3. Compare deliverables/tasks
4. List all discrepancies
### Phase 3: Update Documents
1. Update `tasks.md` to match blueprint
2. Update `changelog.md` with sync entry
3. Review `decisions.md` for missing ADRs
4. Verify all documents are consistent
## Error Handling
### Phase Directory Not Found
- **Error**: Directory doesn't exist
- **Fix**: Verify phase name/path is correct
- **Prevention**: Use exact phase name from phases directory
## Validation Checklist
- [ ] All four documents read
- [ ] Discrepancies identified
- [ ] Documents updated
- [ ] Consistency verified
```
---
## Summary
Creating effective prompt documents requires:
1. **Follow the structure template** - Include all required sections
2. **Be specific and complete** - Don't leave room for interpretation
3. **Include validation** - Verify completion at each step
4. **Handle errors** - Anticipate and document common issues
5. **Test thoroughly** - Verify prompt works before using
6. **Customize for Tendril** - Use project-specific context
**Remember**: Good prompts are reusable, reliable, and reduce errors. Invest time in creating quality prompts to save time in the long run.
---
**Location**: `docs/PROMPTS/Prompt-Creation-Guide.md`
**Related**:
- `docs/PROMPTS/LLM-Usage-Guide.md`
- `docs/GITEA/LLM-Gitea-Guidelines.md`
- `kb/_guides/PROJECT-SETUP-GUIDE/PHASE-4-PLAN.md`