// Creates expert consultation documents with code extraction, git diffs, and size tracking (125KB limit). Use when user wants to prepare comprehensive technical documentation for external review, gather code context for architecture consultations, or create detailed technical analysis documents with full source context. Requires Node.js 18+.
| name | ask-expert |
| description | Creates expert consultation documents with code extraction, git diffs, and size tracking (125KB limit). Use when user wants to prepare comprehensive technical documentation for external review, gather code context for architecture consultations, or create detailed technical analysis documents with full source context. Requires Node.js 18+. |
| allowed-tools | ["Bash","Read","Write","Edit"] |
Create comprehensive technical consultation documents by extracting code, diffs, and architectural context within LLM token limits (125KB).
Follow this proven structure:
Create descriptive filename like {topic}-consultation.md:
cat > feature-consultation.md << 'EOF'
# Expert Consultation: [Feature Name]
## 1. Problem
[Describe the issue]
## 2. Our Solution
[What was implemented]
## 3. Concerns
[Technical concerns]
## 4. Alternatives
[Other approaches considered]
## 5. Architecture Overview
[ASCII diagram]
---
# Complete Architecture Context
EOF
Use the bundled extraction script with size tracking.
💡 The script accepts multiple files in one call - batch files for efficiency:
node scripts/extract-code.js \
--track-size --output=doc.md \
--section="Core Files" \
file1.ts file2.ts file3.ts \
--section="Tests" \
test1.ts test2.ts
File format options:
src/Service.cssrc/Service.cs:100-200 or src/Service.cs:1-30,100-150src/Service.cs:diff or src/Service.cs:diff=master..HEADPrefer FULL files over chunks for better expert analysis. Use chunks only for very large files.
cat >> consultation.md << 'EOF'
---
# Expert Guidance Request
## Questions
1. [Specific question about architecture]
2. [Question about trade-offs]
3. [Question about refactoring approach]
## Success Criteria
- [Required constraints]
- [Priorities]
**Please answer in English**
EOF
wc -c consultation.md # Should be 100-125 KB
DO NOT read the full file back (exceeds context).
See EXAMPLES.md for detailed usage patterns.
Basic extraction:
node scripts/extract-code.js \
--track-size --output=doc.md \
src/Component.vue tests/Component.test.ts
With sections:
node scripts/extract-code.js \
--track-size --output=doc.md \
--section="What Changed" \
src/Service.cs:diff \
--section="Implementation" \
src/Service.cs src/Model.cs
Using config file:
node scripts/extract-code.js \
--config=extraction-plan.json
Create reusable extraction plans:
{
"output": "consultation.md",
"trackSize": true,
"sections": [
{
"header": "What Changed",
"files": ["src/Service.cs:diff"]
},
{
"header": "Core Implementation",
"files": ["src/Service.cs", "src/Model.cs"]
}
]
}
See scripts/extract-code-example.json for complete example.
--track-size to stay within 125 KBScript not found:
# Verify script exists
ls scripts/extract-code.js
# Show help
node scripts/extract-code.js --help
Git diff errors:
git status # Verify git repo
git rev-parse master # Verify branch exists
Exceeding 125 KB:
Must include:
Skip if tight on space: