This document provides practical examples of how to use Claude Code effectively with this template.
Scenario: You're starting a new Node.js API project
Steps:
- Use this template to create your repository
- Update
.claude/CLAUDE.md:# My API Project ## Tech Stack - Node.js 18+ with Express.js - PostgreSQL database - Jest for testing - TypeScript ## Conventions - Use async/await, not callbacks - Follow REST API best practices - All endpoints must have tests - Use dependency injection pattern
- Ask Claude: "Set up the basic Express.js project structure with TypeScript"
- Claude will create the project structure following your conventions
Scenario: You want Claude to review your pull request
What you say:
"Review this pull request for code quality, security, and performance issues"
What happens:
- Claude's code-review skill is automatically matched to your request
- You confirm loading the skill
- Claude performs a comprehensive review using the skill's checklist
- You get structured feedback with severity levels and actionable suggestions
Scenario: You have a new function that needs tests
What you say:
"Generate comprehensive tests for the userController.js file"
What happens:
- The testing skill is matched and loaded
- Claude analyzes your function
- Generates unit tests covering:
- Happy path
- Edge cases
- Error conditions
- Mocking external dependencies
- Provides test coverage summary
Complete workflow for adding a new feature:
-
Planning:
You: "I need to add user authentication with JWT tokens" Claude: [Analyzes requirements, proposes architecture] -
Implementation:
You: "Implement the JWT authentication middleware" Claude: [Creates middleware with token validation, error handling] -
Testing:
You: "Generate tests for the auth middleware" Claude: [Uses testing skill to create comprehensive test suite] -
Documentation:
You: "Document the authentication flow" Claude: [Uses documentation skill to create API docs] -
Review:
You: "Review all the authentication code" Claude: [Uses code-review skill for final check]
Debugging and fixing an issue:
-
Analyze:
You: "Users are getting 500 errors on /api/posts/:id" Claude: [Examines code, identifies potential issues] -
Fix:
You: "Fix the null pointer issue in the posts controller" Claude: [Implements fix with proper error handling] -
Test:
You: "Add tests to prevent this regression" Claude: [Creates tests for the bug scenario] -
Document:
You: "Add inline comments explaining the fix" Claude: [Adds clear documentation]
Improving existing code:
-
Assessment:
You: "Review src/utils/dataProcessor.js for refactoring opportunities" Claude: [Uses code-review skill, identifies issues] -
Refactor:
You: "Refactor this to follow SOLID principles" Claude: [Restructures code, extracts classes/functions] -
Verify:
You: "Ensure all existing tests still pass" Claude: [Runs tests, updates if needed] -
Document Changes:
You: "Update the README to reflect the new structure" Claude: [Updates documentation]
Need: Standardized, informative commit messages
Create skill:
---
name: git-commit-message
description: Generate conventional commit messages following team standards with proper formatting and scope
---
# Git Commit Message Generator
## Format():
```- feat: New feature
- fix: Bug fix
- docs: Documentation
- refactor: Code refactoring
- test: Adding tests
- chore: Maintenance
- Subject: 50 chars max, imperative mood
- Body: Wrap at 72 chars, explain what and why
- Footer: Reference issues (Closes #123)
feat(auth): add JWT token refresh mechanism
Implement automatic token refresh to improve UX.
Tokens refresh 5 minutes before expiration.
Closes #42
**Usage**:
You: "Create a commit message for the authentication changes" Claude: [Generates properly formatted commit message]
### Example: Creating a PR Description Skill
```markdown
---
name: pr-description
description: Generate comprehensive pull request descriptions with changes summary, testing notes, and review checklist
---
# Pull Request Description Generator
## Template
```markdown
## Changes
- List of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- How tested
- Edge cases covered
## Screenshots
[If UI changes]
## Checklist
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] No lint errors
- [ ] Follows code style
## Related Issues
Closes #[issue number]
- Analyze git diff to list changes
- Categorize type of change
- Describe testing approach
- Generate appropriate checklist
## Integration Examples
### Example: CI/CD Pipeline Setup
**Scenario**: Set up automated testing and deployment
**Conversation**:
You: "Set up GitHub Actions for testing and deployment"
Claude: [Creates .github/workflows/ci.yml with:
- Automated testing on PRs
- Code coverage reporting
- Deployment to staging/production
- Following project conventions from CLAUDE.md]
### Example: Database Integration
**Scenario**: Add database with migrations
**Conversation**:
You: "Set up PostgreSQL with Prisma ORM and create migrations"
Claude: [
- Installs dependencies
- Creates prisma/schema.prisma
- Sets up migration scripts
- Creates example models
- Adds database connection code
- Generates tests
- Updates documentation ]
## Tips for Effective Prompts
### ✅ Good Prompts
- **Specific**: "Generate Jest tests for the validateEmail function with edge cases"
- **Contextual**: "Following our REST API conventions, create an endpoint for user profile updates"
- **Clear Intent**: "Refactor the data processing module to improve performance"
### ❌ Poor Prompts
- **Too Vague**: "Make it better"
- **No Context**: "Add a function" (which function? where?)
- **Ambiguous**: "Fix it" (fix what?)
## Common Patterns
### Pattern 1: Read-Understand-Implement
- "Show me the current auth implementation"
- [Claude reads and explains code]
- "Add OAuth support following the same pattern"
- [Claude implements consistently]
### Pattern 2: Example-Based
You: "Create a user model similar to posts.model.js" Claude: [Analyzes example, creates consistent new model]
### Pattern 3: Iterative Refinement
You: "Create a data validation utility" Claude: [Creates basic version] You: "Add custom validation rules support" Claude: [Extends with new feature] You: "Add TypeScript types" Claude: [Adds type safety]
## Troubleshooting Common Scenarios
### Scenario: Claude Doesn't Follow Project Conventions
**Solution**: Update `.claude/CLAUDE.md` with explicit conventions
```markdown
## Coding Standards
- ALWAYS use arrow functions for React components
- NEVER use var, only const/let
- File naming: camelCase for files, PascalCase for classes
Solution: Use more explicit trigger phrases
Instead of: "Look at this code" Use: "Review this code for quality issues" (triggers code-review skill)
You: "Refactor the entire /services directory to use dependency injection"
Claude: [
- Analyzes all files
- Creates systematic refactoring plan
- Updates files incrementally
- Updates tests
- Verifies no breaking changes
]
You: "Generate architecture documentation for this project"
Claude: [
- Analyzes code structure
- Creates architecture diagrams (mermaid)
- Documents patterns used
- Explains data flow
- Creates component documentation
]
You: "Help migrate from JavaScript to TypeScript"
Claude: [
- Creates migration plan
- Converts files incrementally
- Adds type definitions
- Updates tests
- Ensures no runtime changes
]
- Try the examples above with your own code
- Create custom skills for your specific workflows
- Share successful patterns with your team
- Refine
.claude/CLAUDE.mdbased on what works
Have a great workflow example? Consider contributing it back to this template!