10 CodeContext Commands That'll Make You Look Like a Documentation Wizard
From zero to documented in 60 seconds. These commands will transform how you think about documentation forever.
Last week, a developer DM'd me: "I installed CodeContext but don't know where to start."
60 seconds later, they had documented their entire codebase.
Here are the 10 commands that changed their life (and will change yours).
1. The "Holy Shit" Command
This one command documents your entire project:
$ codecontext generate
Analyzing your codebase...
✓ Found 1,234 functions across 156 files
✓ Detected Express.js REST API
✓ Identified PostgreSQL database layer
✓ Recognized React component patterns
Generating documentation...
✓ Created 156 documentation blocks
✓ Generated 34 README sections
✓ Built 12 architecture diagrams
✓ Added 89 code examples
Time saved: ~312 hours
Documentation coverage: 0% → 94%
Your code is now self-explanatory. You're welcome. 🎩
Real developer reaction: "I just documented 6 months of work in 30 seconds. What kind of sorcery is this?"
2. The "Where The Hell Is That Function" Command
We've all been there. You know the function exists, but finding it is like archaeology.
$ codecontext how "calculate order totals"
Found 3 relevant implementations:
1. /api/orders/calculator.js:calculateTotal()
Computes order totals with discounts
Used by: cart.js, checkout.js
Example: calculateTotal({ items: [...], discount: 0.1 })
2. /services/pricing/handler.js:processPricing()
Orchestrates pricing workflow
Calls: calculateTotal, applyTax, formatCurrency
3. /lib/math-utils.js:validateNumbers()
Validates numeric inputs
Used by: All calculation endpoints
Need more details? Run: codecontext explain calculateTotal
Time saved: 20 minutes of grep-ing and swearing.
Ready to save 30+ hours monthly?
Get early access to CodeContext during our alpha phase.
3. The "New Dev Onboarding" Command
New developer joins. Instead of a week of meetings:
$ codecontext learn
Welcome to the codebase! Let me show you around...
📁 Project Structure:
├── /api → REST endpoints (Express.js)
├── /services → Business logic layer
├── /models → Database models (Sequelize)
├── /utils → Shared utilities
└── /tests → Jest test suites
🏗️ Architecture:
- Pattern: MVC with service layer
- Database: PostgreSQL with Redis cache
- Auth: JWT with refresh tokens
- External APIs: Email Service, SMS Service, Analytics
🔧 Key Workflows:
1. User Registration → /docs/workflows/registration.md
2. Data Processing → /docs/workflows/processing.md
3. Email Notifications → /docs/workflows/emails.md
🚀 Quick Start:
$ npm install
$ npm run dev
$ open http://localhost:3000
💡 Pro tip: Run 'codecontext how' for any specific questions!
4. The "Oh Fuck, Production Is Down" Command
It's 3 AM. Pager going off. You need answers fast.
$ codecontext incident "search feature not working, returning empty results"
🚨 INCIDENT ANALYSIS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Analyzing search functionality...
LIKELY CAUSE: Search index out of sync
Evidence:
- /api/search/query.js calls searchIndex()
- searchIndex() returns empty array
- Index last updated: 48 hours ago
- Cron job appears to have failed
- Missing environment variable
IMMEDIATE FIX:
$ npm run search:rebuild-index
AFFECTED FILES:
- /config/search.js (line 42)
- /api/search/query.js (line 18-35)
- /services/indexer.js (line 67)
RECENT CHANGES:
- 2 hours ago: Deployed commit a4f3b2
- Changed: Search algorithm updated
- Impact: Index rebuild required
ROLLBACK COMMAND:
$ git revert a4f3b2 && npm run deploy:emergency
Crisis averted in: 2 minutes vs 2 hours.
5. The "Make Me Look Smart in Code Review" Command
Before pushing your PR:
$ codecontext review --uncommitted
Analyzing uncommitted changes...
📝 DOCUMENTATION NEEDED:
- formatData() - Missing parameter descriptions
- calculateSum() - No return type specified
- DataService class - No class-level documentation
🎯 SUGGESTIONS APPLIED:
✓ Added JSDoc to 3 functions
✓ Included usage examples
✓ Documented error scenarios
✓ Added type definitions
🔍 REVIEW CHECKLIST:
□ All public methods documented
□ Complex logic has inline comments
□ API changes reflected in README
□ Breaking changes noted in CHANGELOG
View diff: git diff
Commit when ready: git commit -m "feat: Add order processing with full documentation"
Your reviewer: "This is the best documented PR I've ever seen."
6. The "I Inherited This Mess" Command
Just joined a project with zero documentation? I got you.
$ codecontext archaeology
🏺 CODEBASE ARCHAEOLOGY REPORT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Age: ~3 years (oldest commit: 2022-01-15)
Original authors: 4 (2 still active)
Total commits: 3,847
Documentation coverage: 3% 😱
DECODING THE MYSTERIES:
1. Weird function names explained:
- doTheThing() → Processes async job queue
- handleStuff() → Main request router
- fixIt() → Database migration repair tool
2. Hidden features discovered:
- Admin panel at /secret-admin (undocumented)
- API v2 endpoints (disabled but working)
- Test mode with ?debug=true
3. Architecture reconstruction:
[Generated architecture diagram]
4. Danger zones identified:
- /legacy/* - Don't touch, powers 30% of revenue
- utils/oldParser.js - Has bugs but required
- models/user.js:L234 - DO NOT REMOVE (breaks prod)
Full report saved to: /docs/archaeology-report.md
7. The "Sync Docs With Reality" Command
Documentation drift is real. Keep it fresh:
$ codecontext sync
Comparing documentation with code...
🔄 OUT OF SYNC:
1. /api/users/create.js
Docs say: Returns user object
Reality: Returns { user, token }
2. Database schema changed:
Added: users.last_login_ip
Missing from: /docs/database.md
3. Deprecated but documented:
- /api/v1/* endpoints (removed 2 months ago)
✅ AUTOMATICALLY UPDATED:
- Fixed 23 parameter descriptions
- Updated 5 return types
- Removed 8 deprecated methods
- Added 12 new endpoints
⚠️ NEEDS HUMAN REVIEW:
- Business logic in OrderService changed significantly
- Authentication flow has new security steps
Review changes: git diff docs/
8. The "Generate Runnable Examples" Command
Documentation without examples is like a recipe without ingredients.
$ codecontext examples formatData
Analyzing formatData function...
🔧 GENERATED EXAMPLES:
// Basic usage
const result = await formatData({
input: rawData,
format: 'json',
pretty: true
});
// With custom options
const csvData = await formatData({
input: dataArray,
format: 'csv',
delimiter: ',',
headers: ['name', 'value', 'date']
});
// Batch processing
const results = await Promise.all(
files.map(file => formatData({
input: file.content,
format: file.type,
validate: true
}))
);
// Error handling
try {
await formatData({ input: null });
} catch (error) {
if (error.code === 'INVALID_INPUT') {
console.log('Please provide valid data');
}
}
Examples added to: /docs/examples/formatting.md
Ready to Document at Light Speed?
Finally, documentation that writes itself while you focus on what matters - building amazing software.
Free forever for individuals. Team plans available.
9. The "WTF Does This Regex Do" Command
We all have that one regex that nobody dares to touch.
$ codecontext explain "const EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;"
🧙 REGEX TRANSLATION:
This matches valid email addresses according to RFC 5322.
BREAKDOWN:
┌─ Start of string
│ ┌─ Local part (before @)
│ │ - Alphanumeric characters
│ │ - Special chars: .!#$%&'*+/=?^_`{|}~-
│ │ - At least one character
│ │
^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+
│
└─ @ symbol (required)
@[a-zA-Z0-9]
│
└─ Domain must start with alphanumeric
(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?
│ │
└─ Optional: subdomain └─ Must end with alphanumeric
(up to 63 chars total)
(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$
│ │ │
└─ Domain extension (.com, .co.uk, etc) │ └─ End of string
└─ Can have multiple extensions
VALID EXAMPLES:
✓ user@example.com
✓ john.doe+filter@company.co.uk
✓ admin@localhost
INVALID EXAMPLES:
✗ @example.com (missing local part)
✗ user@.com (domain starts with dot)
✗ user@domain (missing extension)
SUGGESTED SIMPLIFICATION:
Consider using: /^[^\s@]+@[^\s@]+\.[^\s@]+$/
(Covers 99% of real-world cases)
10. The "Ship It With Confidence" Command
Before any deployment:
$ codecontext preflight
🚀 PRE-DEPLOYMENT CHECKLIST
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Documentation Coverage: 94%
✅ All public APIs documented
✅ Breaking changes: None
✅ README up to date
✅ Examples run successfully
⚠️ WARNINGS:
- 3 TODO comments in production code
- Database migration pending
- Environment variable needed: API_KEY
📊 IMPACT ANALYSIS:
- 23 files changed
- 4 new endpoints added
- 2 endpoints modified (backward compatible)
{/* - ~150 users affected */}
- Users may be affected by changes
🔍 GENERATED:
- API changelog entry
- Migration guide (if needed)
- Deployment notes
Ready to deploy? All systems green! 🟢
Bonus: The "Make Documentation Fun" Command
Because who said documentation has to be boring?
$ codecontext motivate
🎉 DOCUMENTATION ACHIEVEMENT UNLOCKED!
You've documented 1,000 functions! Here's your reward:
⭐️ Documentation Wizard ⭐️
_______________
| |
| 94% COVERAGE |
| ⭐️⭐️⭐️⭐️ |
|_______________|
| |
| |
__|_|__
|_______|
Fun fact: You've saved approximately 167 hours
that would've been spent explaining code!
Keep it up! Next achievement at 95% coverage! 🎯
Your Turn
These 10 commands will transform you from documentation-hater to documentation hero. But here's the secret: The best documentation tool is the one you actually use.
CodeContext makes it so easy, you'll actually want to document your code.
Try it for one week. Your future self (and your team) will thank you.
Start Your Documentation Revolution
Install CodeContext and become the developer everyone wants on their team.
Free forever for individuals. Team plans available.
Got a favorite CodeContext command? Share it: @yonasvalentin
Related Posts
Ready to transform your documentation?
Stop dreading documentation. Let AI handle the tedious parts while you ship features.
Get Started Free