-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate.sh
More file actions
1814 lines (1484 loc) · 55 KB
/
Copy pathgenerate.sh
File metadata and controls
1814 lines (1484 loc) · 55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# PromptLoom Framework Setup Script
# Creates the complete directory structure and template files
set -euo pipefail
IFS=$'\n\t'
# Default values
YES_FLAG=false
FORCE_FLAG=false
PROJECT_NAME=""
TEAM_NAME=""
TECH_STACK=""
SPECIALIZATIONS=""
CUSTOM_TAGS=""
# Capability bindings (default: unbound/null)
CAP_UNIT_CMD=""
CAP_E2E_CMD=""
CAP_CONTRACT_CMD=""
CAP_PERF_CMD=""
CAP_DOCS_CMD=""
CAP_LINT_CMD=""
SUGGEST_FLAG=false
# Parse command-line arguments
while [[ $# -gt 0 ]]; do
case $1 in
-y|--yes)
YES_FLAG=true
shift
;;
--force)
FORCE_FLAG=true
shift
;;
--project)
PROJECT_NAME="$2"
shift 2
;;
--team)
TEAM_NAME="$2"
shift 2
;;
--stack)
TECH_STACK="$2"
shift 2
;;
--specializations)
SPECIALIZATIONS="$2"
shift 2
;;
--tags)
CUSTOM_TAGS="$2"
shift 2
;;
--cap-unit)
CAP_UNIT_CMD="$2"
shift 2
;;
--cap-e2e)
CAP_E2E_CMD="$2"
shift 2
;;
--cap-contract)
CAP_CONTRACT_CMD="$2"
shift 2
;;
--cap-perf)
CAP_PERF_CMD="$2"
shift 2
;;
--cap-docs)
CAP_DOCS_CMD="$2"
shift 2
;;
--cap-lint)
CAP_LINT_CMD="$2"
shift 2
;;
--suggest)
SUGGEST_FLAG=true
shift
;;
-h|--help)
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " --cap-unit CMD Bind unit test capability to a command (optional)"
echo " --cap-e2e CMD Bind end-to-end/UI test capability to a command (optional)"
echo " --cap-contract CMD Bind contract test capability to a command (optional)"
echo " --cap-perf CMD Bind performance/load capability to a command (optional)"
echo " --cap-docs CMD Bind docs generation capability to a command (optional)"
echo " --cap-lint CMD Bind linting/static analysis capability to a command (optional)"
echo " --suggest Write capability_suggestions.yml (no binding; review-only)"
echo " -y, --yes Skip all prompts and use defaults"
echo " --force Overwrite existing files without asking"
echo " --project NAME Set project name"
echo " --team NAME Set team name"
echo " --stack STACK Set tech stack"
echo " --specializations LIST Set specializations (comma-separated)"
echo " --tags LIST Set custom tags (comma-separated)"
echo " -h, --help Show this help message"
exit 0
;;
*)
echo "Unknown option: $1"
echo "Use --help for usage information"
exit 1
;;
esac
done
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
PURPLE='\033[0;35m'
NC='\033[0m' # No Color
# Helper functions
confirm_write() {
local path="$1"
if [[ -f "$path" ]] && [[ "$FORCE_FLAG" != true ]]; then
if [[ "$YES_FLAG" == true ]]; then
echo -e "${YELLOW}Overwriting existing file: $path${NC}"
return 0
fi
echo -e "${YELLOW}File exists: $path${NC}"
read -p "Overwrite? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
return 1
fi
fi
return 0
}
write_file() {
local path="$1"
local dir=$(dirname "$path")
if ! confirm_write "$path"; then
echo -e "${RED}Skipping: $path${NC}"
return 1
fi
mkdir -p "$dir"
cat > "$path"
echo -e "${GREEN}Created: $path${NC}"
return 0
}
echo -e "${PURPLE}"
cat <<'EOB'
_ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( P | r | o | m | p | t | L | o | o | m )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
EOB
echo -e "${NC}"
# Get project configuration
if [[ "$YES_FLAG" != true && -z "$PROJECT_NAME" ]]; then
read -p "Project Name (default: My Project): " PROJECT_NAME
fi
PROJECT_NAME=${PROJECT_NAME:-"My Project"}
if [[ "$YES_FLAG" != true && -z "$TEAM_NAME" ]]; then
read -p "Team Name (default: Development Team): " TEAM_NAME
fi
TEAM_NAME=${TEAM_NAME:-"Development Team"}
if [[ "$YES_FLAG" != true && -z "$TECH_STACK" ]]; then
read -p "Tech Stack (default: TypeScript/React/Node.js): " TECH_STACK
fi
TECH_STACK=${TECH_STACK:-"TypeScript/React/Node.js"}
if [[ "$YES_FLAG" != true && -z "$SPECIALIZATIONS" ]]; then
read -p "Team Specializations (comma-separated, default: Frontend,Backend,Testing): " SPECIALIZATIONS
fi
SPECIALIZATIONS=${SPECIALIZATIONS:-"Frontend,Backend,Testing"}
if [[ "$YES_FLAG" != true && -z "$CUSTOM_TAGS" ]]; then
read -p "Custom Tags (comma-separated, default: Performance,UX,Security): " CUSTOM_TAGS
fi
CUSTOM_TAGS=${CUSTOM_TAGS:-"Performance,UX,Security"}
# Lightweight language detection (advisory only)
DETECTED_LANGS=()
DETECTION_BASIS=()
detect_file() { [[ -f "$1" ]] && DETECTION_BASIS+=("$1"); }
detect_glob() { compgen -G "$1" >/dev/null 2>&1 && DETECTION_BASIS+=("$1"); }
detect_file "package.json" && DETECTED_LANGS+=("javascript/typescript")
detect_file "tsconfig.json" && DETECTED_LANGS+=("typescript")
detect_file "pyproject.toml" && DETECTED_LANGS+=("python")
detect_file "requirements.txt" && DETECTED_LANGS+=("python")
detect_file "go.mod" && DETECTED_LANGS+=("go")
detect_glob "*.csproj" && DETECTED_LANGS+=(".net")
detect_file "Cargo.toml" && DETECTED_LANGS+=("rust")
detect_file "pom.xml" && DETECTED_LANGS+=("java")
detect_glob "build.gradle*" && DETECTED_LANGS+=("java")
detect_file "composer.json" && DETECTED_LANGS+=("php")
detect_file "Gemfile" && DETECTED_LANGS+=("ruby")
STACK_HINT="$(echo "$TECH_STACK" | tr '[:upper:]' '[:lower:]')"
# Prepare capability bindings (commands optional; tool names intentionally omitted)
CAP_UNIT_VAL="${CAP_UNIT_CMD:-null}"
CAP_E2E_VAL="${CAP_E2E_CMD:-null}"
CAP_CONTRACT_VAL="${CAP_CONTRACT_CMD:-null}"
CAP_PERF_VAL="${CAP_PERF_CMD:-null}"
CAP_DOCS_VAL="${CAP_DOCS_CMD:-null}"
CAP_LINT_VAL="${CAP_LINT_CMD:-null}"
echo -e "${BLUE}Setting up Copilot Framework for: ${PROJECT_NAME}${NC}"
# Create directory structure
echo -e "${YELLOW}Creating directory structure...${NC}"
mkdir -p .github/{prompts,config}
mkdir -p docs/{adr,framework,memory,memory-archive}
# Generate capabilities.yml
echo -e "${YELLOW}Creating capabilities.yml...${NC}"
write_file .github/config/capabilities.yml << EOF
capabilities:
unit_test:
tool: null
command: ${CAP_UNIT_VAL}
notes: "Runs fast, isolated tests; target ≥80% coverage"
e2e_test:
tool: null
command: ${CAP_E2E_VAL}
notes: "Covers critical user journeys end-to-end"
contract_test:
tool: null
command: ${CAP_CONTRACT_VAL}
notes: "Verifies producer/consumer API contracts"
performance_test:
tool: null
command: ${CAP_PERF_VAL}
notes: "Establishes baseline throughput/latency with thresholds"
docs_generator:
tool: null
command: ${CAP_DOCS_VAL}
notes: "Builds API/code docs; fallback to Markdown stubs if unbound"
linter:
tool: null
command: ${CAP_LINT_VAL}
notes: "Static analysis and style checks"
policies:
coverage_threshold: 0.80
allow_unbound_capabilities: true
EOF
# Optionally generate capability_suggestions.yml (advisory only)
if [[ "$SUGGEST_FLAG" == true ]]; then
echo -e "${YELLOW}Creating capability_suggestions.yml...${NC}"
write_file .github/config/capability_suggestions.yml << EOF
suggestions:
unit_test:
- { tool: "pytest", command: "pytest -q" }
- { tool: "jest", command: "npx jest --ci" }
- { tool: "go test", command: "go test ./..." }
e2e_test:
- { tool: "playwright", command: "npx playwright test" }
- { tool: "selenium", command: "selenium-standalone start # then run tests" }
contract_test:
- { tool: "pact", command: "pact-broker verify # adjust to stack" }
- { tool: "schemathesis", command: "schemathesis run openapi.yaml" }
performance_test:
- { tool: "k6", command: "k6 run tests/perf/*.js" }
- { tool: "jmeter", command: "jmeter -n -t tests/perf/test.jmx" }
docs_generator:
- { tool: "markdown-stubs", command: "scripts/docs-stubs.sh" }
- { tool: "pdoc", command: "pdoc -o docs/api <package>" }
- { tool: "typedoc", command: "npx typedoc --out docs/api ./src" }
- { tool: "gomarkdoc", command: "gomarkdoc ./... > docs/api/GO_API.md" }
linter:
- { tool: "generic-lint", command: "scripts/lint.sh" }
- { tool: "eslint", command: "npx eslint ." }
- { tool: "ruff", command: "ruff check ." }
evidence:
languages:
$(printf "%s\n" "${DETECTED_LANGS[@]}" | sed 's/^/ - "/' | sed 's/$/"/')
files:
$(printf "%s\n" "${DETECTION_BASIS[@]}" | sed 's/^/ - "/' | sed 's/$/"/')
confidence:
unit_test: 0.6
e2e_test: 0.6
contract_test: 0.5
performance_test: 0.5
docs_generator: 0.5
linter: 0.6
EOF
fi
# Create stubs for referenced files
echo -e "${YELLOW}Creating stubs for referenced files...${NC}"
touch README.md
write_file docs/requirements.md << EOF
# Requirements Document
## Stakeholder Analysis
## Functional Requirements
## Non-functional Requirements
## Constraints and Dependencies
EOF
write_file docs/user-stories.md << EOF
## Epics
# List of high-level epics for the project
### Example Epics
- As a Sales Rep, I want to manage my leads and opportunities so that I can close deals efficiently.
- As an Account Manager, I want to track customer interactions so that I can improve retention.
## User Stories
# Detailed user stories for each epic
### Example User Stories
- **As a Sales Rep, I want to add new leads, so that I can track potential clients.**
- [ ] Can add lead with name, company, contact info
- [ ] Validation for required fields
- [ ] Accessible form fields
- **As a Sales Rep, I want to update opportunity status, so that I can reflect deal progress.**
- [ ] Status options: New, In Progress, Won, Lost
- [ ] Activity log for changes
- **As an Account Manager, I want to view customer history, so that I can personalize outreach.**
- [ ] Timeline of interactions
- [ ] Exportable data
## Story Map
# Mapping of user journeys and dependencies
Lead Management → Opportunity Tracking → Customer History
## Prioritization
# Prioritization of user stories and epics
1. Lead Management (Critical)
2. Opportunity Tracking (High)
3. Customer History (Medium)
EOF
write_file docs/architecture/overview.md << EOF
# Architecture Overview
## System Overview
EOF
write_file docs/architecture/components.md << EOF
# Architecture Components
## Component Details
EOF
write_file docs/architecture/integrations.md << EOF
# Architecture Integrations
## Integration Points
EOF
write_file docs/architecture/deployment.md << EOF
# Deployment Architecture
## Deployment Details
EOF
# Generate .github/copilot-instructions.md
echo -e "${YELLOW}Creating copilot-instructions.md...${NC}"
write_file .github/copilot-instructions.md << EOF
# ${PROJECT_NAME} - Development Instructions
# Project Context
This is ${PROJECT_NAME} built with ${TECH_STACK}.
Team: ${TEAM_NAME}
Specializations: ${SPECIALIZATIONS}
# Development Standards
- Follow project language and markdown style conventions
- Update README and docs when adding code or changing behavior
- Generate inline documentation for public APIs where applicable
- Run security checks appropriate to the stack (e.g., dependency and secret scans)
- Enforce ADR conventions in docs/adr/
- Bind and use capabilities from .github/config/capabilities.yml (tools are suggestions, not mandates)
# Memory Management
- Before starting any phase, read the relevant **per-phase** memory file under \`docs/memory/\` (e.g., \`03-architecture.md\`) and skim \`docs/memory/index.md\` "Recent Activity"
- Load only the **last few entries** from the current phase file to reduce context bloat
- When you finish a phase, **append a new entry** to that phase's file using the schema at the top of the file
- Include \`sources:\` links (ADRs, PRs, docs) and set a \`confidence\` level
- Add a one-line summary + link in \`docs/memory/index.md\` under "Recent Activity"
- Use tags from \`.github/config/tags.yml\`
- Prune or archive older content into \`docs/memory-archive/\` when entries get large
# Phase Workflow
1. Load current phase prompt from .github/prompts/
2. Check dependencies listed in phase frontmatter
3. Execute phase instructions following role guidance
4. Update memory and documentation
5. Run self-critique if enabled in frontmatter
# Quality Gates
- All code must pass linting and tests as bound in capabilities.yml; if unbound, propose and record
- Documentation must be updated for new features
- Security scans must pass before merging
- ADRs required for architectural changes
# Capabilities
Current bindings (null = unbound; agents should propose options but not assume a specific tool):
- Unit tests command: ${CAP_UNIT_CMD:-null}
- E2E tests command: ${CAP_E2E_CMD:-null}
- Contract tests command: ${CAP_CONTRACT_CMD:-null}
- Performance tests command: ${CAP_PERF_CMD:-null}
- Docs generator command: ${CAP_DOCS_CMD:-null}
- Linter command: ${CAP_LINT_CMD:-null}
(Edit .github/config/capabilities.yml to bind or change these. Optionally run with --suggest to generate capability_suggestions.yml for review.)
EOF
# Generate team-config.yml
echo -e "${YELLOW}Creating team-config.yml...${NC}"
write_file .github/config/team-config.yml << EOF
team:
name: "${TEAM_NAME}"
project: "${PROJECT_NAME}"
techStack: "${TECH_STACK}"
specializations:
$(echo "${SPECIALIZATIONS}" | tr ',' '\n' | sed 's/^/ - "/' | sed 's/$/"/')
customizations:
tags:
custom:
$(echo "${CUSTOM_TAGS}" | tr ',' '\n' | sed 's/^/ - "/' | sed 's/$/"/')
memory:
retention:
critical: 60 # days
normal: 14 # days
ephemeral: 7 # days
phases:
all:
additionalStandards:
- "Follow ${TECH_STACK} best practices"
- "Ensure accessibility compliance"
EOF
# Generate phase-config.yml
echo -e "${YELLOW}Creating phase-config.yml...${NC}"
write_file .github/config/phase-config.yml << EOF
phases:
"01-requirements":
priority: critical
estimatedTokens: 2000
dependencies: []
"02-user-stories":
priority: high
estimatedTokens: 1500
dependencies: ["01-requirements"]
"03-architecture":
priority: critical
estimatedTokens: 3000
dependencies: ["01-requirements", "02-user-stories"]
"04-architecture-docs":
priority: medium
estimatedTokens: 1500
dependencies: ["03-architecture"]
"05-implementation":
priority: high
estimatedTokens: 4000
dependencies: ["03-architecture"]
"06-code-docs":
priority: medium
estimatedTokens: 1500
dependencies: ["05-implementation"]
"07-testing":
priority: high
estimatedTokens: 2500
dependencies: ["05-implementation"]
"08-deployment":
priority: high
estimatedTokens: 2000
dependencies: ["07-testing"]
"09-release-notes":
priority: medium
estimatedTokens: 1000
dependencies: ["08-deployment"]
"10-security":
priority: critical
estimatedTokens: 2500
dependencies: ["05-implementation"]
"11-memory":
priority: low
estimatedTokens: 500
dependencies: []
"12-memory-window":
priority: low
estimatedTokens: 500
dependencies: ["11-memory"]
"13-memory-sync":
priority: medium
estimatedTokens: 1000
dependencies: ["11-memory"]
"14-error-recovery":
priority: high
estimatedTokens: 1500
dependencies: []
"15-integration-test":
priority: high
estimatedTokens: 2000
dependencies: []
"16-customize":
priority: medium
estimatedTokens: 1500
dependencies: []
EOF
# Generate tags.yml
echo -e "${YELLOW}Creating tags.yml...${NC}"
write_file .github/config/tags.yml << EOF
# Tag Taxonomy for Memory Management
phases:
- Requirements
- UserStories
- Architecture
- Implementation
- Testing
- Deployment
- Security
- Release
- Memory
- Recovery
domains:
- Frontend
- Backend
- Database
- Infrastructure
- DevOps
- Security
priorities:
- Critical
- High
- Medium
- Low
custom:
$(echo "${CUSTOM_TAGS}" | tr ',' '\n' | sed 's/^/ - /')
EOF
# Generate prompt templates
echo -e "${YELLOW}Creating prompt templates...${NC}"
# 01-requirements.prompt.md
write_file .github/prompts/01-requirements.prompt.md << 'PROMPT1'
---
mode: "agent"
tools: ["codebase"]
description: "Gather project requirements and analyze stakeholders"
---
# Requirements Gathering Phase
You are a Business Analyst working on the project.
## Context Loading
Read recent entries from docs/memory/01-requirements.md and skim docs/memory/index.md "Recent Activity".
## Your Task
1. **Stakeholder Analysis**: Identify key stakeholders and their needs
2. **Functional Requirements**: Document what the system must do
3. **Non-functional Requirements**: Performance, security, usability standards
4. **Constraints**: Technical, business, and regulatory limitations
## Input Processing
- Review existing documentation: #file:README.md
- Check for existing requirements in docs/
- Look for related GitHub issues or discussions
## Output Format
Create a comprehensive requirements document with:
### Stakeholder Analysis
- Primary users and their goals
- Secondary stakeholders and their interests
- Key decision makers
### Functional Requirements
- Core system capabilities
- User workflows and use cases
- Integration requirements
### Non-functional Requirements
- Performance benchmarks
- Security requirements
- Scalability needs
- Compliance requirements
### Constraints and Dependencies
- Technical constraints
- Business constraints
- External dependencies
## Memory Update Instructions
After completion, append a new entry to docs/memory/01-requirements.md (use the file's schema) and add a one-line summary + link in docs/memory/index.md:
- Key stakeholders identified
- Major requirements categories
- Critical constraints discovered
- Next phase preparation items
Tag the entry with: #Requirements #Planning
## Self-Critique
Review your output for:
- ✅ Complete stakeholder coverage
- ✅ Clear, testable requirements
- ✅ Realistic constraints identification
- ✅ Proper prioritization
- ✅ Consistency with project context
## Workflow Context
```mermaid
graph LR
A[01-Requirements] --> B[02-User Stories]
B --> C[03-Architecture]
A -.-> D[Memory Update]
style A fill:#4caf50,stroke:#2e7d32,stroke-width:3px
```
You are here: **Requirements Gathering** (Phase 1 of 16)
Next: User Stories Creation
Dependencies: None
PROMPT1
# 02-user-stories.prompt.md
write_file .github/prompts/02-user-stories.prompt.md << 'PROMPT2'
---
mode: "agent"
tools: ["codebase"]
description: "Convert requirements into user stories with acceptance criteria"
---
# User Stories Creation
You are a Product Owner creating user stories for the project.
## Context
Review the requirements document: #docs/requirements.md
Check project memory: #docs/memory/index.md and #docs/memory/02-user-stories.md
## Your Task
Convert the documented requirements into well-structured user stories following the format:
**As a** [user type]
**I want** [functionality]
**So that** [business value]
## Deliverables
1. **Epic Overview** - High-level user journeys
2. **Detailed User Stories** - Individual stories with acceptance criteria
3. **Story Map** - Organized by user journey
4. **Prioritization** - Ranked by business value
## Acceptance Criteria Format
For each story include:
- [ ] Specific, testable criteria
- [ ] Edge cases considered
- [ ] Performance requirements
- [ ] Accessibility requirements
## Memory Update
Append to #docs/memory/02-user-stories.md (schema at top) and add a one-line summary in #docs/memory/index.md:
- Number of stories created
- Key epics identified
- Prioritization rationale
- Dependencies noted
Tag: #UserStories #Product
PROMPT2
# 03-architecture.prompt.md
write_file .github/prompts/03-architecture.prompt.md << 'PROMPT3'
---
mode: "agent"
tools: ["codebase"]
description: "Design system architecture and create technical decisions"
---
# System Architecture Design Phase
You are a Software Architect designing the system.
## Context Loading
Read recent entries from docs/memory/03-architecture.md and docs/memory/01-requirements.md; skim docs/memory/index.md "Recent Activity".
## Your Task
1. **High-Level Design**: Define system components and relationships
2. **Technology Decisions**: Select and justify technology choices
3. **Architecture Patterns**: Choose appropriate patterns
4. **Integration Strategy**: Define component communication
## Input Processing
- Review requirements: #file:docs/requirements.md
- Consider user stories: #file:docs/user-stories.md
- Analyze non-functional requirements
## Output Format
### 1. Architecture Decision Record
Create ADR at docs/adr/$(date +%Y%m%d)-system-architecture.md:
```markdown
---
status: proposed
date: $(date +%Y-%m-%d)
title: "System Architecture"
---
## Context
[Architectural forces and requirements]
## Decision
[Architecture chosen with rationale]
## Consequences
[Positive and negative impacts]
```
### 2. Component Diagram
```mermaid
graph TD
A[Client Layer] --> B[API Gateway]
B --> C[Business Logic]
C --> D[Data Layer]
D --> E[Database]
```
### 3. Technology Stack
- **Frontend**: [Specific technologies]
- **Backend**: [API and services]
- **Database**: [Data storage solutions]
- **Infrastructure**: [Deployment platform]
## Memory Update Instructions
Append to docs/memory/03-architecture.md (use the file's schema) and add a one-line summary + link in docs/memory/index.md:
- Architecture decisions made
- Technology choices and rationale
- Key components identified
- Integration patterns selected
Tag with: #Architecture #Design #TechStack
## Architecture Diagram Template
When creating your component diagram, use this structure:
```mermaid
graph TD
subgraph "Presentation Layer"
A[User Interface]
B[API Gateway]
end
subgraph "Business Layer"
C[Business Logic]
D[Services]
end
subgraph "Data Layer"
E[Data Access]
F[Database]
end
A --> B
B --> C
C --> D
D --> E
E --> F
classDef presentation fill:#e3f2fd,stroke:#1976d2
classDef business fill:#e8f5e8,stroke:#388e3c
classDef data fill:#fce4ec,stroke:#c2185b
class A,B presentation
class C,D business
class E,F data
```
Customize this template for the chosen architecture.
PROMPT3
# Continue with remaining prompts (4-16) with proper content
echo -e "${YELLOW}Creating remaining prompt files...${NC}"
# 04-architecture-docs.prompt.md
write_file .github/prompts/04-architecture-docs.prompt.md << 'PROMPT4'
---
mode: "agent"
tools: ["codebase"]
description: "Create comprehensive architecture documentation"
---
# Architecture Documentation
You are a Technical Writer documenting the architecture.
## Context
Review the architecture ADR: #docs/adr/
Check existing documentation: #docs/
Reference memory: #docs/memory/index.md and #docs/memory/04-architecture-docs.md
## Your Task
Create comprehensive architecture documentation including:
1. System Overview
2. Component Details
3. Data Flow
4. Integration Points
5. Deployment Architecture
## Output Files
- docs/architecture/overview.md
- docs/architecture/components.md
- docs/architecture/integrations.md
- docs/architecture/deployment.md
## Memory Update
Append to #docs/memory/04-architecture-docs.md and add a one-line summary in #docs/memory/index.md:
- Key accomplishments from this phase
- Important decisions made
- Next steps identified
Tag: #Documentation #Architecture
## Self-Critique
Review your output for:
- ✅ Complete documentation coverage
- ✅ Consistency with architecture decisions
- ✅ Clear, organized structure
- ✅ Proper tagging and memory update
PROMPT4
# 05-implementation.prompt.md
write_file .github/prompts/05-implementation.prompt.md << 'PROMPT5'
---
mode: "agent"
tools: ["codebase"]
description: "Implement code based on architecture and requirements"
---
# Implementation Phase
You are a Developer implementing the core functionality.
## Context
Review architecture: #docs/adr/
Check user stories: #docs/user-stories.md
Reference codebase: #codebase
## Your Task
1. Setup Project Structure
2. Implement Core Components
3. Create API Endpoints
4. Implement Data Models
5. Add Integration Logic
## Quality Requirements
- Follow established best practices
- Include error handling and logging
- Write clean, maintainable code
- Add inline documentation
- Implement proper validation
## Memory Update
Append to #docs/memory/05-implementation.md and add a one-line summary in #docs/memory/index.md:
- Key accomplishments from this phase
- Important decisions made
- Next steps identified
Tag: #Implementation #Development
## Self-Critique
Review your output for:
- ✅ Code matches architecture and requirements
- ✅ Error handling and validation present
- ✅ Documentation included
- ✅ Proper tagging and memory update
PROMPT5
# 06-code-docs.prompt.md (language-agnostic)
write_file .github/prompts/06-code-docs.prompt.md << 'PROMPT6'
---
mode: "agent"
tools: ["codebase"]
description: "Generate comprehensive code documentation with language-agnostic goals and optional stack-specific steps"
---
# Code Documentation Phase
You are a Developer producing code-level documentation that is **language-agnostic** and repeatable.
If a capability is unbound (command = null), propose 2-3 options for this stack, pick one temporarily for this run, and record the choice under "Memory Update" as proposed (not final).
## Inputs
- Source code: #codebase
- Architecture docs: #docs/architecture/
- Memory context: #docs/memory/index.md and #docs/memory/06-code-docs.md
- Team/stack hints: #.github/config/team-config.yml
- Capabilities config: #.github/config/capabilities.yml
## Stack Detection (do this first)
1) Detect primary languages by scanning file extensions and build files (e.g., `go.mod`, `package.json`, `pyproject.toml`, `pom.xml`, `build.gradle`, `Cargo.toml`, `.csproj`, `composer.json`, `Gemfile`).
2) Read `techStack` from `team-config.yml` if available.
3) Decide on a **docs strategy**:
- Strategy A (preferred): Use a stack-appropriate generator to produce HTML/Markdown API docs.
- Strategy B (fallback): Generate Markdown stubs by extracting public symbols from source files and organizing by module/package.
Record your chosen strategy in the output.
## Core Tasks (language-agnostic)
1) **Public API Surface**
- Document public entry points: modules/packages, exported functions/types/classes, CLI commands, HTTP endpoints, configuration, environment variables.
2) **Module Overviews**
- For each module/package: brief purpose, key types/functions, invariants, error behaviors, dependencies.
3) **Usage Examples**
- Add runnable examples/snippets for the top 10 most-used APIs or endpoints.
4) **Architecture Links**
- Cross-link relevant sections in `docs/architecture/*` and any ADRs that shaped the API.
5) **Developer Guide**
- Update `README.md` with local dev, build, test, and docs instructions, plus a link to the generated API docs.
## Optional Stack-Specific Suggestions (use only if applicable)
- Go: `gomarkdoc ./... > docs/api/GO_API.md` or `godoc -http=:6060`
- TypeScript/JavaScript: `npx typedoc --out docs/api ./src` or `npx documentation build src -f html -o docs/api`
- Python: `pdoc -o docs/api <package>` or `sphinx-apidoc -o docs/api <package> && make -C docs/api html`
- Java: Maven `mvn javadoc:javadoc` or Gradle `./gradlew javadoc` -> copy to `docs/api`
- .NET: `docfx docfx.json` -> `docs/api` (or XML docs as fallback)
- Rust: `cargo doc --no-deps --target-dir target && cp -r target/doc docs/api`
- Ruby: `yard doc --output-dir docs/api`
- PHP: `phpDocumentor -d src -t docs/api`
If none fit, proceed with **Strategy B** (fallback Markdown stubs).
## Deliverables
- `docs/api/` (HTML site or Markdown set) **or** `docs/api/*_API.md` stubs (fallback).
- Updated `README.md` with “API Docs” link and docs build instructions.
- Examples demonstrating common use.
## Acceptance Criteria (agnostic)
- Public API surface documented.
- Module overviews exist for each non-trivial module/package.
- Examples compile/run where applicable.
- A single documented command builds docs or stubs.
- Architecture/ADR cross-links included; no broken links.
## Memory Update
Append to #docs/memory/06-code-docs.md (schema at top) and add a one-line summary in #docs/memory/index.md:
- Chosen strategy and rationale.
- Gaps identified and follow-ups.
- Link to `docs/api` and updated `README.md`.
Tags: #CodeDocs #Documentation
## Self-Critique
- ✅ Tool-agnostic with graceful fallback
- ✅ Public surface and examples complete
- ✅ Cross-linked to architecture/ADRs
PROMPT6
# 07-testing.prompt.md (language-agnostic)
write_file .github/prompts/07-testing.prompt.md << 'PROMPT7'
---
mode: "agent"
tools: ["codebase"]
description: "Define and execute unit, integration, e2e, contract, and performance tests with language-agnostic thresholds"