Production-ready code standards following CLAUDE Framework with TDD, security, and quality requirements
This skill encapsulates the CLAUDE Framework standards for production-ready code development. It ensures consistency, quality, security, and maintainability across all code deliverables.
Basis Missie - Breaking these = delivery rejected:
Impact Analysis - Before ANY code change:
Single Responsibility & DRY:
// ✅ GOOD - Single responsibility
class UserAuthenticator {
authenticate(credentials: Credentials): AuthResult {
return this.validateAndAuthenticate(credentials);
}
}
class UserNotifier {
sendWelcomeEmail(user: User): void {
this.emailService.send(user.email, 'Welcome!');
}
}
// ❌ BAD - Multiple responsibilities
class UserManager {
authenticate() { /* auth logic */ }
sendEmail() { /* email logic */ }
updateDatabase() { /* db logic */ }
}
Naming Conventions (MUST):
getUserData(), calculateTotal() (verbs)user, totalAmount (nouns)isValid, hasPermission (is/has prefix)MAX_RETRY_COUNT, API_BASE_URLUserService, OrderController (PascalCase)Function Size Limit:
// ✅ GOOD - Comprehensive error handling
async function fetchUserData(userId: string): Promise<User> {
try {
if (!userId || userId.trim() === '') {
throw new ValidationError('User ID is required');
}
const user = await db.users.findById(userId);
if (!user) {
throw new NotFoundError(`User ${userId} not found`);
}
logger.info('User fetched successfully', { userId });
return user;
} catch (error) {
if (error instanceof ValidationError || error instanceof NotFoundError) {
throw error;
}
logger.error('Failed to fetch user', { userId, error: error.message });
throw new DatabaseError('Failed to fetch user data');
}
}
// ❌ BAD - Silent failure
async function fetchUserData(userId: string) {
try {
return await db.users.findById(userId);
} catch (error) {
return null; // Silent failure - NEVER do this!
}
}
Error Handling Rules (MUST):
Red-Green-Refactor Cycle:
Test Coverage Requirements:
// ✅ GOOD - Descriptive test with AAA pattern
describe('UserAuthenticator', () => {
it('should return success when valid credentials provided', () => {
// Arrange
const authenticator = new UserAuthenticator();
const validCredentials = { email: 'test@example.com', password: 'Valid123!' };
// Act
const result = authenticator.authenticate(validCredentials);
// Assert
expect(result.success).toBe(true);
expect(result.user).toBeDefined();
});
it('should throw ValidationError when email is missing', () => {
// Arrange
const authenticator = new UserAuthenticator();
const invalidCredentials = { email: '', password: 'Valid123!' };
// Act & Assert
expect(() => authenticator.authenticate(invalidCredentials))
.toThrow(ValidationError);
});
});
Input Validation (MUST):
// ✅ GOOD - Validate at boundaries
function createUser(input: unknown): User {
const validated = userSchema.parse(input); // Zod/Joi validation
// Sanitize
const sanitized = {
email: validator.normalizeEmail(validated.email),
name: validator.escape(validated.name),
};
return userService.create(sanitized);
}
// ❌ BAD - No validation
function createUser(input: any) {
return userService.create(input); // Unsafe!
}
Security Requirements (MUST):
See companion files:
detailed-patterns.md - Advanced patterns and examplesrefactoring-guide.md - Step-by-step refactoring strategiessecurity-checklist.md - Comprehensive security validationSee scripts directory:
scripts/pre-commit-check.sh - Run before commitsscripts/quality-gate.sh - CI/CD quality validationscripts/security-scan.sh - Dependency and secret scanningBefore marking any task complete:
senior-fullstack-developer:
code-refactoring-specialist:
qa-testing-engineer:
Track these KPIs:
Version 1.0.0 | Compatible with CLAUDE Framework v5.0
npx skills add Primadetaautomation/production-code-standards下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer