Spec-Driven Collaboration
Generate a self-contained collaboration document that packages an issue with actual code, constitutional constraints, analysis, and targeted questions for an external AI to review.
Constitution files are THE LAW: tech-stack.md, source-tree.md, dependencies.md, coding-standards.md, architecture-constraints.md, anti-patterns.md
If ambiguous or conflicts detected: HALT and use AskUserQuestion
Execution Model
This skill expands inline. After invocation, execute Phase 01 immediately. Do not wait passively, ask permission, or offer execution options.
Self-Check (if ANY box is true = VIOLATION):
IF any box checked: EXECUTION MODEL VIOLATION. Go directly to Phase 01 now.
Anti-Skip Enforcement Contract
This skill enforces structural anti-skip at every step using the Execute-Verify-Record pattern. Every mandatory step in every phase has three parts:
- EXECUTE: The exact action to perform (Read, Write, AskUserQuestion, Glob, Grep)
- VERIFY: How to confirm the action happened (file exists, content matches, count correct)
- RECORD: Confirmation that the step completed successfully
Token Optimization Bias is PROHIBITED. Do not skip, compress, or shortcut any step. Every phase step exists because a previous failure proved it necessary.
Prohibited rationalizations:
- "The template is simple enough to populate from memory" — Load the template file fresh.
- "I already read the constitution files" — Read them again in Phase 02.
- "The document is short, no need to verify" — Read it back to verify in Phase 05.
- "Phase 06 is just a display, I can skip it" — Execute it fully.
- "I can combine Phases 04 and 05" — Execute them separately, in order.
Parameter Extraction
Extract parameters from conversation context set by the /collaborate command:
| Context Marker |
Set By |
Description |
ISSUE_DESCRIPTION |
/collaborate |
Issue description from user argument or AskUserQuestion |
TARGET_AI |
/collaborate |
Target AI platform (default: "Gemini") |
Extraction Method:
- Search conversation for
**Issue Description:** marker → ISSUE_DESCRIPTION
- Search conversation for
**Target AI:** marker → TARGET_AI
- If markers not found, search for natural language context about the issue
- If still not found: AskUserQuestion to gather missing parameters
Phase Table
| Phase |
Name |
File |
Steps |
Key Tools |
| 01 |
Context Gathering |
phases/phase-01-context-gathering.md |
4 |
AskUserQuestion, Glob, Grep |
| 02 |
Constitution Loading |
phases/phase-02-constitution-loading.md |
3 |
Read (×6 parallel) |
| 03 |
Code Collection |
phases/phase-03-code-collection.md |
4 |
Read, Glob, Grep |
| 04 |
Analysis & Template Population |
phases/phase-04-analysis-template.md |
4 |
Read |
| 05 |
Document Generation |
phases/phase-05-document-generation.md |
3 |
Write, Read |
| 06 |
Completion Report |
phases/phase-06-completion-report.md |
2 |
Display |
Phase Orchestration Loop
FOR phase_num in [01, 02, 03, 04, 05, 06]:
1. LOAD: Read(file_path="src/claude/skills/spec-driven-collaboration/phases/{phase_file}")
Do NOT rely on memory of previous reads. Load the phase file FRESH.
2. EXECUTE: Follow every step in the phase file (EXECUTE-VERIFY-RECORD triplets)
- Each step's EXECUTE instruction tells you exactly what to do
- Each step's VERIFY instruction tells you how to confirm it happened
- Each step's RECORD instruction confirms completion
3. GATE: Verify all gate conditions before proceeding to next phase
IF any gate condition fails: HALT
Critical: Load each phase file fresh using Read(). Do not execute phases from memory.
Success Criteria
Reference Files
| File |
Purpose |
Loaded In |
references/collaboration-prompt-template.md |
10-section output document template |
Phase 04 |
references/context-gathering-guide.md |
Interactive context gathering patterns |
Phase 01 |
references/code-collection-patterns.md |
File discovery, test finding, error capture |
Phase 03 |
references/analysis-reasoning-guide.md |
Hypothesis ranking, constraint analysis, question crafting |
Phase 04 |
Error Handling
| Error |
Phase |
Resolution |
| No issue description from command |
01 |
AskUserQuestion for description |
| Affected file not found |
03 |
Warn user, skip file, continue |
| Constitution file missing |
02 |
HALT — constitution files are required |
| Template reference missing |
04 |
HALT — verify skill installation |
tmp/ directory missing |
05 |
Create it, then write |
| Write fails |
05 |
Report error path, suggest manual creation |
| Document verification fails |
05 |
HALT — re-examine document content |
1---2name: spec-driven-collaboration3description: Generate self-contained collaboration documents for sharing issues with external AI systems (Gemini, ChatGPT, etc.) with structural anti-skip enforcement (Execute-Verify-Record pattern at every step). Interactively gathers context, reads actual code files, loads constitutional constraints, and produces a complete 10-section package ready to paste into the target LLM. Use when the user wants to collaborate with another AI, share an issue for joint problem-solving, get a fresh perspective from a peer LLM, or needs help from an external AI that doesn't have access to the codebase. Make sure to use this skill whenever the user mentions cross-AI collaboration, sharing issues with Gemini/ChatGPT/Copilot, peer review from another AI, or wants a second opinion from an external LLM.4---5
6# Spec-Driven Collaboration
7
8Generate a self-contained collaboration document that packages an issue with actual code, constitutional constraints, analysis, and targeted questions for an external AI to review.
9
10**Constitution files are THE LAW:** tech-stack.md, source-tree.md, dependencies.md, coding-standards.md, architecture-constraints.md, anti-patterns.md
11
12**If ambiguous or conflicts detected: HALT and use AskUserQuestion**
13
14---
15
16## Execution Model
17
18This skill expands inline. After invocation, execute Phase 01 immediately. Do not wait passively, ask permission, or offer execution options.
19
20**Self-Check (if ANY box is true = VIOLATION):**
21
22- [ ] Stopping to ask about token budget
23- [ ] Stopping to offer execution options
24- [ ] Waiting passively after skill invocation
25- [ ] Asking "should I execute this?"
26- [ ] Skipping a phase because it "seems simple"
27- [ ] Combining multiple phases into one
28- [ ] Summarizing instead of loading a reference file
29- [ ] Skipping verification because "I already wrote the file"
30
31**IF any box checked:** EXECUTION MODEL VIOLATION. Go directly to Phase 01 now.
32
33---
34
35## Anti-Skip Enforcement Contract
36
37This skill enforces structural anti-skip at every step using the Execute-Verify-Record pattern. Every mandatory step in every phase has three parts:
38
39- **EXECUTE:** The exact action to perform (Read, Write, AskUserQuestion, Glob, Grep)
40- **VERIFY:** How to confirm the action happened (file exists, content matches, count correct)
41- **RECORD:** Confirmation that the step completed successfully
42
43**Token Optimization Bias is PROHIBITED.** Do not skip, compress, or shortcut any step. Every phase step exists because a previous failure proved it necessary.
44
45Prohibited rationalizations:
46- "The template is simple enough to populate from memory" — Load the template file fresh.
47- "I already read the constitution files" — Read them again in Phase 02.
48- "The document is short, no need to verify" — Read it back to verify in Phase 05.
49- "Phase 06 is just a display, I can skip it" — Execute it fully.
50- "I can combine Phases 04 and 05" — Execute them separately, in order.
51
52---
53
54## Parameter Extraction
55
56Extract parameters from conversation context set by the `/collaborate` command:
57
58| Context Marker | Set By | Description |
59|----------------|--------|-------------|
60| `ISSUE_DESCRIPTION` | /collaborate | Issue description from user argument or AskUserQuestion |
61| `TARGET_AI` | /collaborate | Target AI platform (default: "Gemini") |
62
63**Extraction Method:**
641. Search conversation for `**Issue Description:**` marker → `ISSUE_DESCRIPTION`
652. Search conversation for `**Target AI:**` marker → `TARGET_AI`
663. If markers not found, search for natural language context about the issue
674. If still not found: AskUserQuestion to gather missing parameters
68
69---
70
71## Phase Table
72
73| Phase | Name | File | Steps | Key Tools |
74|-------|------|------|-------|-----------|
75| 01 | Context Gathering | `phases/phase-01-context-gathering.md` | 4 | AskUserQuestion, Glob, Grep |
76| 02 | Constitution Loading | `phases/phase-02-constitution-loading.md` | 3 | Read (×6 parallel) |
77| 03 | Code Collection | `phases/phase-03-code-collection.md` | 4 | Read, Glob, Grep |
78| 04 | Analysis & Template Population | `phases/phase-04-analysis-template.md` | 4 | Read |
79| 05 | Document Generation | `phases/phase-05-document-generation.md` | 3 | Write, Read |
80| 06 | Completion Report | `phases/phase-06-completion-report.md` | 2 | Display |
81
82---
83
84## Phase Orchestration Loop
85
86```
87FOR phase_num in [01, 02, 03, 04, 05, 06]:
88
89 1. LOAD: Read(file_path="src/claude/skills/spec-driven-collaboration/phases/{phase_file}")
90 Do NOT rely on memory of previous reads. Load the phase file FRESH.
91
92 2. EXECUTE: Follow every step in the phase file (EXECUTE-VERIFY-RECORD triplets)
93 - Each step's EXECUTE instruction tells you exactly what to do
94 - Each step's VERIFY instruction tells you how to confirm it happened
95 - Each step's RECORD instruction confirms completion
96
97 3. GATE: Verify all gate conditions before proceeding to next phase
98 IF any gate condition fails: HALT
99```
100
101**Critical:** Load each phase file fresh using Read(). Do not execute phases from memory.
102
103---
104
105## Success Criteria
106
107- [ ] All 6 phases executed in sequence
108- [ ] ISSUE_DESCRIPTION and TARGET_AI extracted
109- [ ] AFFECTED_FILES identified (≥1 file)
110- [ ] All 6 constitution files loaded and constraints extracted
111- [ ] All affected files read with actual code captured
112- [ ] Template loaded fresh from reference file
113- [ ] All 10 sections populated (no empty sections, no placeholders)
114- [ ] Document written to `tmp/collaborate-{target}-{slug}-{date}.md`
115- [ ] Document verified by read-back (≥100 lines, all 10 section headers present)
116- [ ] Completion report displayed to user
117
118---
119
120## Reference Files
121
122| File | Purpose | Loaded In |
123|------|---------|-----------|
124| `references/collaboration-prompt-template.md` | 10-section output document template | Phase 04 |
125| `references/context-gathering-guide.md` | Interactive context gathering patterns | Phase 01 |
126| `references/code-collection-patterns.md` | File discovery, test finding, error capture | Phase 03 |
127| `references/analysis-reasoning-guide.md` | Hypothesis ranking, constraint analysis, question crafting | Phase 04 |
128
129---
130
131## Error Handling
132
133| Error | Phase | Resolution |
134|-------|-------|------------|
135| No issue description from command | 01 | AskUserQuestion for description |
136| Affected file not found | 03 | Warn user, skip file, continue |
137| Constitution file missing | 02 | HALT — constitution files are required |
138| Template reference missing | 04 | HALT — verify skill installation |
139| `tmp/` directory missing | 05 | Create it, then write |
140| Write fails | 05 | Report error path, suggest manual creation |
141| Document verification fails | 05 | HALT — re-examine document content |