6.4 KiB
6.4 KiB
description, allowed-tools, argument-hint
| description | allowed-tools | argument-hint | |
|---|---|---|---|
| Implement features or changes following best practices and project conventions | Read(*), Write(*), Edit(*), Grep(*), Glob(*), Bash(*) |
|
Implement Command
Implement requested features following project conventions and best practices.
Technology Adaptation
Configuration Source: CLAUDE.md
Before implementing, consult CLAUDE.md for:
- Technology Stack: Languages, frameworks, libraries to use
- Project Structure: Where to place new code
- Code Style: Naming conventions, formatting rules
- Testing Requirements: Test coverage and patterns
- Build Process: How to build and test changes
Instructions
-
Understand Requirements
- Parse feature description from $ARGUMENTS or ask user
- Clarify scope and acceptance criteria
- Identify impacted areas of codebase
- Check for existing similar implementations
-
Review Project Context
- Read CLAUDE.md for:
- Technology stack and patterns
- Code style and conventions
- Project structure
- Use serena MCP to analyze existing patterns
- Use context7 MCP for framework best practices
- Read CLAUDE.md for:
-
Plan Implementation
- Identify files to create/modify
- Determine appropriate design patterns
- Consider edge cases and error handling
- Plan for testing
- Check if architect agent needed for complex features
-
Implement Feature
- Follow CLAUDE.md code style and conventions
- Write clean, maintainable code
- Add appropriate error handling
- Include inline documentation
- Follow project's architectural patterns
- Use MCP servers for:
serena: Finding related code, refactoringcontext7: Framework/library documentationmemory: Storing implementation decisions
-
Add Tests
- Generate tests using project's test framework from CLAUDE.md
- Cover happy paths and edge cases
- Ensure tests are maintainable
- Consider using test-engineer agent for complex scenarios
-
Verify Implementation
- Run tests using command from CLAUDE.md
- Check code style compliance
- Verify no regressions
- Consider using code-reviewer agent for quality check
-
Document Changes
- Add/update inline comments where needed
- Update relevant documentation
- Note any architectural decisions
Implementation Best Practices
Code Quality
- Keep functions small and focused (< 50 lines typically)
- Follow Single Responsibility Principle
- Use meaningful names from CLAUDE.md conventions
- Add comments for "why", not "what"
- Handle errors gracefully
Testing
- Write tests alongside implementation
- Aim for coverage targets from CLAUDE.md
- Test edge cases and error conditions
- Make tests readable and maintainable
Security
- Validate all inputs
- Never hardcode secrets
- Use parameterized queries
- Follow least privilege principle
- Consider security-analyst agent for sensitive features
Performance
- Avoid premature optimization
- Consider scalability for data operations
- Use appropriate data structures
- Consider optimize command if performance-critical
MCP Server Usage
Serena MCP
Code Navigation:
find_symbol- Locate existing patterns to followfind_referencing_symbols- Understand dependencies and impactget_symbols_overview- Understand file structure before modifyingsearch_for_pattern- Find similar implementationsrename_symbol- Safely refactor across codebase
Persistent Memory (stored in .serena/memories/):
- Use
write_memoryto store implementation lessons:- "lesson-error-handling-[feature-name]"
- "pattern-api-integration-[service]"
- "lesson-performance-optimization-[component]"
- "decision-architecture-[feature-name]"
- Use
read_memoryto recall past implementation patterns - Use
list_memoriesto browse lessons learned
Memory MCP (Knowledge Graph)
Temporary Context (in-memory, cleared after session):
- Use
create_entitiesfor features/components being implemented - Use
create_relationsto track dependencies during implementation - Use
add_observationsto document implementation decisions
Note: After implementation completes, store key lessons in Serena memory.
Context7 MCP
- Use
get-library-docsfor current framework/library documentation and best practices
Other MCP Servers
- sequential-thinking: For complex algorithmic problems
Agent Collaboration
For complex features, consider delegating to specialized agents:
- architect: For system design and architecture decisions
- test-engineer: For comprehensive test generation
- security-analyst: For security-sensitive features
- code-reviewer: For quality assurance before completion
Output Format
## Implementation Complete: [Feature Name]
### Summary
[Brief description of what was implemented]
### Files Changed
- **Created**: [list new files]
- **Modified**: [list modified files]
### Key Changes
1. **[Change 1]**: [Description and location]
2. **[Change 2]**: [Description and location]
3. **[Change 3]**: [Description and location]
### Design Decisions
- **[Decision 1]**: [Why this approach was chosen]
- **[Decision 2]**: [Trade-offs considered]
### Testing
- **Tests Added**: [Count and location]
- **Coverage**: [Percentage if known]
- **Test Command**: `[from CLAUDE.md]`
### How to Use
```[language]
[Code example showing how to use the new feature]
Verification Steps
- [Step to verify feature works]
- [Step to run tests]
- [Step to check integration]
Next Steps
- Code review (use /review or code-reviewer agent)
- Update documentation
- Performance testing if needed
- Security review for sensitive features
## Usage Examples
```bash
# Implement a specific feature
/implement Add user authentication with JWT
# Implement with more context
/implement Create a payment processing service that integrates with Stripe API, handles webhooks, and stores transactions
# Quick implementation
/implement Add logging to the error handler
Guidelines
- Always read CLAUDE.md before starting
- Follow existing project patterns
- Test your implementation
- Document non-obvious decisions
- Ask for clarification when requirements are unclear
- Use appropriate agents for specialized tasks
- Verify changes don't break existing functionality
- Consider security implications