Part 4 of 10
Hier is iets dat me opviel na een paar weken Claude Code gebruiken: ik bleef steeds dezelfde prompts typen. "Review deze code op beveiligingsproblemen." "Genereer tests volgens onze projectpatronen." "Maak een commit met een goed bericht."

Elke herhaalde prompt zijn verspilde toetsaanslagen. Aangepaste slash-commando's (custom slash commands) lossen dat op.
Wat Zijn Aangepaste Commando's?
Aangepaste commando's zijn markdown-bestanden die slash-commando's worden. Zet een bestand genaamd review.md in de juiste map, en opeens is /review een commando dat je op elk moment kunt uitvoeren.
.claude/commands/├── review.md → /review├── test.md → /test└── git/├── commit.md → /git:commit└── pr.md → /git:pr
De magie: deze commando's kunnen argumenten accepteren, specificeren welke tools Claude mag gebruiken, hooks definiëren die automatisch draaien, en zelfs een specifiek model afdwingen. Het zijn niet zomaar opgeslagen prompts—het zijn programmeerbare workflows.
Je Eerste Commando in 60 Seconden
Stap 1: Maak de Map Aan
Mkdir -p .claude/commands
Stap 2: Maak een Commandobestand
Cat > .claude/commands/review.md << 'EOF'Review the staged changes for:- Security vulnerabilities- Performance issues- Missing error handling- Type safety problemsFormat as: Critical (must fix) → Warnings → SuggestionsEOF
Stap 3: Gebruik Het
/review
Dat is alles. Claude voert je instructies uit alsof je ze had uitgetypt.
Argumenten: Commando's Dynamisch Maken
Statische commando's zijn handig, maar dynamische commando's zijn krachtig. De $ARGUMENTS-placeholder vangt alles op na de commandonaam.
Basis Argumenten
# .claude/commands/explain.mdExplain how $ARGUMENTS works in this codebase.Show me the key files, the data flow, and any gotchas.
Gebruik:
/explain the authentication system/explain the payment processing flow/explain how websockets connect to the backend
Alles wat je typt na /explain wordt $ARGUMENTS.
Positionele Argumenten
Meer controle nodig? Gebruik $1, $2, $3 voor specifieke posities:
# .claude/commands/fix-issue.mdFix GitHub issue #$1.Priority: $2Additional context: $31. Read the issue description2. Find the relevant code3. Implement the fix4. Write tests5. Create a commit referencing the issue
Gebruik:
/fix-issue 1234 high "user reported login failures on mobile"
Hier is $1 = "1234", $2 = "high", $3 = "user reported login failures on mobile".
Frontmatter: Superkrachten voor Commando's
De echte kracht komt van YAML-frontmatter bovenaan je commandobestand. Hiermee configureer je rechten, hints, modellen en meer.
De Basis
---Description: Review code for security issuesArgument-hint: [file-or-directory]---Review $ARGUMENTS for security vulnerabilities including:- SQL injection- XSS- Authentication bypasses
De description verschijnt wanneer je /help uitvoert. De argument-hint vertelt gebruikers wat ze moeten meegeven.
Tools Vooraf Goedkeuren
Moe van het steeds goedkeuren van dezelfde git-commando's? Gebruik allowed-tools:
---Description: Smart git commitAllowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*), Bash(git diff:*)Argument-hint: [optional message]---Analyze the staged changes and create a commit.If a message is provided, use it: $ARGUMENTSOtherwise, generate a descriptive message following conventional commits.Requirements:- Use format: type(scope): description- Keep summary under 72 characters- Body explains WHY, not WHAT
Nu draait /git:commit zonder toestemmingsprompts voor die specifieke git-commando's.
Een Specifiek Model Afdwingen
Sommige commando's werken beter met specifieke modellen:
---Description: Deep architecture analysisModel: claude-sonnet-4-5-20250929---Analyze the architecture of $ARGUMENTS.Consider:- Design patterns in use- Coupling between modules- Scalability implications- Technical debt indicators
Gebruik Haiku voor snelle taken, Sonnet voor gebalanceerd werk, Opus voor complex redeneren:
---Description: Quick code explanationModel: claude-3-5-haiku-20241022---Briefly explain what $ARGUMENTS does in 2-3 sentences.
Hooks in Commando's
Commando's kunnen hun eigen hooks definiëren die tijdens de uitvoering draaien:
---Description: Format and commitHooks:PostToolUse:- matcher: "Edit|Write"hooks:- type: commandcommand: "npx prettier --write $FILE_PATH"---Make the requested changes to $ARGUMENTS.After each edit, files will be auto-formatted.
Dit draait Prettier na elke bestandsbewerking—maar alleen zolang dit commando actief is.
Namespacing met Mappen
Organiseer gerelateerde commando's in submappen. De mapnaam wordt een namespace:
.claude/commands/├── git/│ ├── commit.md → /git:commit│ ├── pr.md → /git:pr│ ├── branch.md → /git:branch│ └── squash.md → /git:squash├── test/│ ├── unit.md → /test:unit│ ├── e2e.md → /test:e2e│ └── coverage.md → /test:coverage└── docs/├── readme.md → /docs:readme└── api.md → /docs:api
Dit houdt je /help-uitvoer overzichtelijk en commando's makkelijk vindbaar.
Globale vs Projectcommando's
Projectcommando's (Team)
Your-project/.claude/commands/
- Alleen beschikbaar in dit project
- Commit naar git—iedereen in het team krijgt ze
- Ideaal voor projectspecifieke workflows
Persoonlijke Commando's (Jij)
~/.claude/commands/
- Beschikbaar in elk project
- Persoonlijke productiviteitsboosters
- Niet gedeeld met het team
Aanbevolen Verdeling
Houd globaal (persoonlijk):
/explain— Universele code-uitleg/debug— Systematisch debugproces/review— Algemene code-review checklist
Houd projectspecifiek (team):
/deploy— Jullie deploymentstappen/test:e2e— Jullie testopzet/git:commit— De commitconventies van jullie team/onboard— Projectspecifieke context voor nieuwe ontwikkelaars
10 Commando's die het Stelen Waard Zijn
Hier zijn beproefde commando's. Kopieer ze, pas ze aan, maak ze van jou.

1. /review — Code Review
---Description: Comprehensive code reviewArgument-hint: [file or leave empty for staged changes]---Review $ARGUMENTS (or staged changes if not specified).## Check For- Security: OWASP Top 10, auth issues, data exposure- Performance: N+1 queries, memory leaks, blocking calls- Correctness: Edge cases, error handling, type safety- Maintainability: Complexity, naming, duplication## Output Format### 🚨 Critical (blocks merge)### ⚠️ Warnings (should fix)### 💡 Suggestions (nice to have)
2. /git:commit — Slimme Commits
---Description: Analyze changes and create commitAllowed-tools: Bash(git *)---1. Run `git diff --staged` to see changes2. Analyze what was changed and why3. Create a commit message:- Format: type(scope): description- Types: feat, fix, refactor, docs, test, chore- Under 72 chars- Body explains WHY if non-obvious4. Execute the commit
3. /test:generate — Tests Genereren
---Description: Generate comprehensive testsArgument-hint: [file-to-test]---Generate tests for $ARGUMENTS.## Include- Happy path (expected usage)- Edge cases (empty, null, boundaries)- Error scenarios (invalid input, failures)- Integration points (mocks for external deps)## Requirements- Match existing test patterns in this project- Use the testing framework already in use- Clear test names: "should [expected] when [condition]"
4. /debug — Systematisch Debuggen
---Description: Debug an issue systematicallyArgument-hint: [description of the problem]---Debug: $ARGUMENTS## Process1. Clarify: What's expected vs actual behavior?2. Reproduce: What triggers the issue?3. Isolate: Which component/function is responsible?4. Trace: Follow the data flow5. Fix: Implement and verify the solution## Output- Root cause- Affected code paths- Fix with explanation- Prevention strategy
5. /security — Beveiligingsaudit
---Description: Security vulnerability scanArgument-hint: [file, directory, or leave empty for full scan]Allowed-tools: Read, Grep, Glob---Audit $ARGUMENTS for security vulnerabilities.## Check For- Injection: SQL, command, XSS, template- Auth: Weak passwords, session issues, CSRF- Data: Exposure, logging secrets, insecure storage- Config: Debug mode, default creds, missing headers- Dependencies: Known CVEs## OutputSeverity-ranked findings with:- Location (file:line)- Risk explanation- Remediation steps
6. /refactor — Code Verbeteren
---Description: Refactor while maintaining behaviorArgument-hint: [file-or-function]---Refactor $ARGUMENTS.## Goals- Reduce complexity- Improve readability- Apply DRY- Better naming- Smaller functions (single responsibility)## Constraints- NO behavior changes- Keep public API intact- Existing tests must passExplain each change.
7. /explain — Code Uitleg
---Description: Explain code for someone newArgument-hint: [file, function, or concept]Model: claude-3-5-haiku-20241022---Explain $ARGUMENTS.## Cover- What it does (purpose)- How it works (step by step)- Why it's designed this way- Dependencies and side effects- Potential gotchasAssume reader knows the language but not this codebase.
8. /optimize — Performanceanalyse
---Description: Analyze and optimize performanceArgument-hint: [file-or-function]---Analyze $ARGUMENTS for performance.## Examine- Time complexity (Big O)- Space complexity- I/O operations- Database queries (N+1?)- Unnecessary allocations## Output- Current bottlenecks- Specific optimizations- Expected improvement- Trade-offs involved
9. /ship — Pre-Deploy Checklist
---Description: Pre-deployment verificationAllowed-tools: Bash(npm *), Bash(git *)---Pre-deploy checklist:- [ ] Tests pass (`npm test`)- [ ] Lint clean (`npm run lint`)- [ ] Build succeeds (`npm run build`)- [ ] No console.log/debugger statements- [ ] Env vars documented- [ ] No hardcoded secrets- [ ] Error handling complete- [ ] Migrations readyRun checks and report: Ready 🚀 or Blocked 🛑 with issues.
10. /catchup — Context Herstellen
Dit commando implementeert het /clear + /catchup-patroon uit Deel 2 voor efficiënt contextbeheer.
---Description: Rebuild context after /clearAllowed-tools: Bash(git *)---I just cleared context. Help me catch up.1. Run `git diff main...HEAD --stat` to see what's changed2. Summarize the changes on this branch3. Read the key modified files4. Tell me where we likely are in this feature$ARGUMENTS (if any additional context)
Verder dan Code: Creatieve Commando's
Commando's zijn niet beperkt tot code-workflows. Je kunt elke API of service integreren die Claude kan aanroepen. Hier zijn er twee die ik heb gebruikt bij het schrijven van deze blogserie:
/meme — Memes Genereren
---Description: Generate a meme using Imgflip APIArgument-hint: "top text" "bottom text" [template]---Generate a meme using the Imgflip API.## API Details- Endpoint: https://api.imgflip.com/caption_image- Username: $IMGFLIP_USER- Password: $IMGFLIP_PASS## Popular Templates- drake (181913649) - Drake Hotline Bling- distracted (112126428) - Distracted Boyfriend- changemymind (129242436) - Change My Mind- twobuttons (87743020) - Two Buttons- pikachu (155067746) - Surprised Pikachu## Instructions1. Parse the arguments: $ARGUMENTS2. Use curl to POST to the API with template_id, text0, text13. Return the generated meme URL4. Download to ./public/assets/blog/ if requested
Ik heb dit gebruikt om de "distracted boyfriend"-meme in Deel 5 te genereren—ontwikkelaar afgeleid door "gewoon shippen" terwijl "eerst tests schrijven" verwijtend toekijkt.
/imagen — AI-Beeldgeneratie
Dit is een van mijn favorieten. De Imagen API van Google laat je afbeeldingen rechtstreeks vanuit Claude Code genereren. Hier is een complete implementatie:
---Description: Generate an image using Google ImagenArgument-hint: "prompt" [output-path]Allowed-tools: Bash(node *)---Generate an image using Google Imagen.## Instructions1. Parse the prompt from: $ARGUMENTS2. Run: node ~/.claude/scripts/generate-image.js "prompt" "./output.png"3. Report the saved file path
De echte magie zit in het script. Hier is een complete implementatie die je kunt plaatsen in ~/.claude/scripts/generate-image.js:
#!/usr/bin/env nodeConst https = require('https');Const fs = require('fs');Const path = require('path');Const API_KEY = process.env.GOOGLE_AI_API_KEY || 'your-api-key-here';// Note: Check https://ai.google.dev/gemini-api/docs/imagen for the latest model IDConst MODEL = 'imagen-4.0-generate-001';Async function generateImage(prompt, outputPath) {const requestBody = {instances: [{ prompt }],parameters: {sampleCount: 1,aspectRatio: '16:9',personGeneration: 'dont_allow'}};const body = JSON.stringify(requestBody);const options = {hostname: 'generativelanguage.googleapis.com',port: 443,path: `/v1beta/models/${MODEL}:predict?key=${API_KEY}`,method: 'POST',headers: {'Content-Type': 'application/json','Content-Length': Buffer.byteLength(body)}};return new Promise((resolve, reject) => {const req = https.request(options, (res) => {let data = '';res.on('data', chunk => data += chunk);res.on('end', () => {const response = JSON.parse(data);if (response.error) {reject(new Error(response.error.message));return;}if (response.predictions?.[0]) {const imageData = response.predictions[0].bytesBase64Encoded;const dir = path.dirname(outputPath);if (dir && !fs.existsSync(dir)) {fs.mkdirSync(dir, { recursive: true });}fs.writeFileSync(outputPath, Buffer.from(imageData, 'base64'));resolve(outputPath);}});});req.on('error', reject);req.write(body);req.end();});}Const [prompt, outputPath = `./generated-${Date.now()}.png`] = process.argv.slice(2);GenerateImage(prompt, outputPath).then(p => console.log(`Saved: ${p}`));
Een API-key verkrijgen:
- Ga naar Google AI Studio
- Maak een nieuwe API-key aan
- Stel
GOOGLE_AI_API_KEYals omgevingsvariabele in of plak het direct in het script
Gebruiksvoorbeelden:
/imagen "a minimalist logo for a coding blog, orange and white"/imagen "abstract geometric pattern" ./public/hero.png/imagen "futuristic terminal interface, dark theme, neon accents"
API-parameters:
sampleCount— Aantal te genereren afbeeldingen (1-4, standaard:4)aspectRatio— Uitvoerafmetingen:1:1,3:4,4:3,9:16,16:9(standaard:1:1)personGeneration— Bepaalt personen in afbeeldingen:dont_allow— Blokkeer personen volledigallow_adult— Alleen volwassenen (standaard)allow_all— Volwassenen en kinderen
imageSize— Resolutie:1Kof2K(alleen Standard/Ultra-modellen)
Beschikbare modellen:
imagen-4.0-generate-001— Standard, beste kwaliteitimagen-4.0-ultra-generate-001— Ultra, hoogste kwaliteitimagen-4.0-fast-generate-001— Fast, lagere latentieimagen-3.0-generate-001— Vorige generatie
Sommige omslagafbeeldingen en illustraties in deze serie? Gegenereerd met /imagen. De memes die je hier ziet? Gemaakt met /meme.
Het punt: als er een API is, kun je er een commando omheen bouwen. Berichten posten op social media, vertalingen, beeldgeneratie, data-opzoekingen—alles wordt een slash-commando.
Ontwerpprincipes voor Commando's
Eén doel — Eén commando doet één ding goed. /review reviewt, /test test. Maak geen Zwitserse zakmessen.
Duidelijk uitvoerformaat — Vertel Claude precies hoe resultaten gepresenteerd moeten worden. Opsommingstekens? Categorieën? Ernstniveaus? Wees expliciet.
Beperkingen opnemen — Wat moet Claude NIET doen? "Geen gedragswijzigingen" of "Pas geen tests aan" voorkomt dat het te ver gaat.
Gebruik het juiste model — Haiku voor snelle opzoekingen, Sonnet voor de meeste taken, Opus voor complex redeneren. Match het model aan de taak.
Veilige tools vooraf goedkeuren — Als een commando altijd git of npm nodig heeft, gebruik dan allowed-tools om toestemmingsprompts over te slaan.
Commando's Debuggen
Als een commando niet werkt:
- Controleer het pad — Staat het in
.claude/commands/of~/.claude/commands/? - Controleer de extensie — Moet
.mdzijn - Draai
/help— Je commando zou in de lijst moeten staan - Controleer de frontmatter — YAML moet geldig zijn (juiste inspringing, aanhalingstekens rond strings met speciale tekens)
Wat Komt er Hierna
Aangepaste commando's zetten je workflows om in herbruikbare acties. Maar wat als je commando's wilt delen buiten je team? Wat als je commando's wilt die werken over verschillende projecten zonder overal bestanden te kopiëren?
Dan komen Skills in beeld. In Deel 5: Skills verkennen we hoe je commando's kunt verpakken voor bredere distributie en geavanceerdere automatisering kunt creëren.
Commando's aanmaken
mkdir -p .claude/commands — Map aanmaken
.claude/commands/name.md — Basiscommando
.claude/commands/git/commit.md — Met namespace (/git:commit)
Frontmatter-velden
Description — Verschijnt in /help
Argument-hint — Gebruikshint
Allowed-tools — bijv. Bash(git *), Read, Write
Model — Model overschrijven
Argument-placeholders
$ARGUMENTS — Alles na het commando
$1, $2, $3 — Positionele argumenten
Commando's bekijken — /help
Stay Updated
Get notified about new posts on automation, productivity tips, indie hacking, and web3.
No spam, ever. Unsubscribe anytime.

