Generate implementation code from technical specifications, following project patterns, coding standards, and best practices.
/plugin marketplace add marcel-Ngan/ai-dev-team/plugin install marcel-ngan-ai-dev-team@marcel-Ngan/ai-dev-teamThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Generate implementation code from technical specifications, following project patterns, coding standards, and best practices.
| Principle | Implementation |
|---|---|
| Readable | Clear names, consistent formatting |
| Maintainable | Small functions, single responsibility |
| Testable | Pure functions where possible, injectable deps |
| Secure | Input validation, no hardcoded secrets |
| Performant | Efficient algorithms, appropriate data structures |
## Function: {{functionName}}
### Specification
- **Purpose:** {{whatItDoes}}
- **Inputs:** {{parameters}}
- **Outputs:** {{returnValue}}
- **Side Effects:** {{sideEffects}}
### Implementation Approach
1. {{step1}}
2. {{step2}}
3. {{step3}}
### Edge Cases to Handle
- {{edgeCase1}}
- {{edgeCase2}}
### Generated Code
```{{language}}
{{generatedCode}}
{{testCode}}
### API Endpoint Template
```markdown
## Endpoint: {{method}} {{path}}
### Specification
- **Auth:** {{authRequirement}}
- **Request Body:** {{requestSchema}}
- **Response:** {{responseSchema}}
- **Errors:** {{errorCodes}}
### Implementation
```{{language}}
// Route handler
{{routeCode}}
// Validation
{{validationCode}}
// Business logic
{{businessLogicCode}}
// Error handling
{{errorHandlingCode}}
{{endpointTests}}
### React Component Template
```markdown
## Component: {{componentName}}
### Specification
- **Props:** {{propTypes}}
- **State:** {{stateShape}}
- **Events:** {{eventHandlers}}
- **Children:** {{childComponents}}
### Generated Code
```tsx
{{componentCode}}
{{storybookStories}}
{{componentTests}}
### Database Model Template
```markdown
## Model: {{modelName}}
### Schema
| Field | Type | Constraints |
|-------|------|-------------|
| {{field}} | {{type}} | {{constraints}} |
### Generated Code
```{{language}}
{{modelCode}}
{{migrationCode}}
{{repositoryCode}}
---
## Code Patterns
### Error Handling Pattern
```typescript
// Standard error handling structure
async function {{functionName}}({{params}}): Promise<{{ReturnType}}> {
try {
// Validate input
if (!{{validationCondition}}) {
throw new ValidationError('{{errorMessage}}');
}
// Business logic
const result = await {{operation}};
// Return success
return result;
} catch (error) {
// Log error
logger.error('{{functionName}} failed', { error, {{contextParams}} });
// Rethrow or transform
if (error instanceof ValidationError) {
throw error;
}
throw new ServiceError('{{userFriendlyMessage}}', error);
}
}
// Data access layer
class {{Entity}}Repository {
async findById(id: string): Promise<{{Entity}} | null> {
// Implementation
}
async findAll(filter: {{Filter}}): Promise<{{Entity}}[]> {
// Implementation with pagination
}
async create(data: Create{{Entity}}Dto): Promise<{{Entity}}> {
// Validation and creation
}
async update(id: string, data: Update{{Entity}}Dto): Promise<{{Entity}}> {
// Find, validate, update
}
async delete(id: string): Promise<void> {
// Soft delete or hard delete
}
}
// Business logic layer
class {{Entity}}Service {
constructor(
private repository: {{Entity}}Repository,
private eventEmitter: EventEmitter,
) {}
async {{operation}}({{params}}): Promise<{{Result}}> {
// Business rules
// Repository call
// Event emission
// Return result
}
}
// Input validation schema
const {{entity}}Schema = z.object({
{{field1}}: z.string().min(1).max(100),
{{field2}}: z.number().positive(),
{{field3}}: z.enum(['option1', 'option2']),
});
// Validation function
function validate{{Entity}}(input: unknown): {{Entity}} {
const result = {{entity}}Schema.safeParse(input);
if (!result.success) {
throw new ValidationError(result.error.format());
}
return result.data;
}
describe('{{functionName}}', () => {
// Setup
beforeEach(() => {
// Reset mocks, create instances
});
describe('happy path', () => {
it('should {{expectedBehavior}} when {{condition}}', async () => {
// Arrange
const input = {{testInput}};
// Act
const result = await {{functionName}}(input);
// Assert
expect(result).toEqual({{expected}});
});
});
describe('error cases', () => {
it('should throw {{ErrorType}} when {{errorCondition}}', async () => {
// Arrange
const invalidInput = {{invalidInput}};
// Act & Assert
await expect({{functionName}}(invalidInput))
.rejects.toThrow({{ErrorType}});
});
});
describe('edge cases', () => {
it('should handle {{edgeCase}}', async () => {
// Test edge case
});
});
});
describe('{{Endpoint}} Integration', () => {
let app: Express;
let db: Database;
beforeAll(async () => {
// Setup test database
// Initialize app
});
afterAll(async () => {
// Cleanup
});
beforeEach(async () => {
// Reset database state
});
describe('POST {{path}}', () => {
it('should create {{entity}} with valid data', async () => {
const response = await request(app)
.post('{{path}}')
.send({{validPayload}})
.expect(201);
expect(response.body).toMatchObject({{expected}});
// Verify database state
const dbRecord = await db.findOne(response.body.id);
expect(dbRecord).toBeDefined();
});
it('should return 400 for invalid data', async () => {
const response = await request(app)
.post('{{path}}')
.send({{invalidPayload}})
.expect(400);
expect(response.body.error).toBeDefined();
});
});
});
Before submitting generated code:
### Self-Review Checklist
#### Correctness
- [ ] Meets all acceptance criteria
- [ ] Handles edge cases
- [ ] Error handling is comprehensive
#### Code Quality
- [ ] Follows project coding standards
- [ ] Names are clear and consistent
- [ ] No code duplication
- [ ] Functions are focused (SRP)
#### Security
- [ ] Input is validated
- [ ] No hardcoded secrets
- [ ] SQL/injection safe
- [ ] Auth/authz properly checked
#### Performance
- [ ] No obvious inefficiencies
- [ ] Appropriate data structures
- [ ] Database queries optimized
#### Testing
- [ ] Unit tests written
- [ ] Edge cases tested
- [ ] Mocks used appropriately
#### Documentation
- [ ] Complex logic commented
- [ ] Public APIs documented
- [ ] Types are clear
| Anti-Pattern | Problem | Better Approach |
|---|---|---|
| God functions | Too much responsibility | Split into focused functions |
| Magic numbers | Unclear meaning | Use named constants |
| Deep nesting | Hard to follow | Early returns, extract functions |
| Hardcoded values | Inflexible | Config or environment |
| Silent failures | Hidden bugs | Explicit error handling |
| Copy-paste code | Maintenance burden | Extract shared logic |
| Premature optimization | Over-complexity | Optimize when needed |
// Prefer
- Strict mode enabled
- Explicit return types on public functions
- Interface over type for objects
- Readonly where appropriate
- Enums for finite sets
// Avoid
- any type (use unknown if needed)
- Non-null assertions (!)
- Implicit any
- Type assertions without validation
# Prefer
- Type hints (Python 3.9+)
- Dataclasses for data structures
- Context managers for resources
- f-strings for formatting
- List comprehensions (readable)
# Avoid
- Mutable default arguments
- Bare except clauses
- Global state
- Complex one-liners
| Agent | Code Generation Use |
|---|---|
| Senior Developer | Complex features, architecture code |
| Junior Developer | Standard features, tests |
| DevOps Engineer | Infrastructure code, scripts |
| QA Engineer | Test code, automation scripts |
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.