xiaohongshu
xiaohongshu
ln-623-code-principles-auditor
Code principles audit worker (L3). Checks DRY (7 types), KISS/YAGNI, TODOs, error handling, DI patterns. Returns findings with severity, location, effort, recommendations.
Full skill instructions
Specialized worker auditing code principles (DRY, KISS, YAGNI) and design patterns.
Receives contextStore with:
tech_stack - detected tech stack (languages, frameworks)best_practices - researched best practices from MCPprinciples - project-specific principles from docs/principles.mdcodebase_root - root path of codebaseDomain-aware fields (NEW):
domain_mode: "domain-aware" | "global" (optional, defaults to "global")current_domain: {name, path} when domain_mode="domain-aware"Example contextStore (domain-aware):
{
"tech_stack": {...},
"best_practices": {...},
"principles": {...},
"codebase_root": "/project",
"domain_mode": "domain-aware",
"current_domain": {
"name": "users",
"path": "src/users"
}
}
Parse context from contextStore
IF domain_mode == "domain-aware":
scan_path = codebase_root + "/" + current_domain.path
domain_name = current_domain.name
ELSE:
scan_path = codebase_root
domain_name = null
Scan codebase for violations
scan_path (not codebase_root)Grep(pattern="TODO", path=scan_path)Collect findings with severity, location, effort, recommendation
domain: domain_name (if domain-aware)Calculate score using penalty algorithm
Return JSON result to coordinator
domain and scan_path fields (if domain-aware)What: Duplicated logic, constants, or code blocks across files
Detection Categories:
Severity:
What: Same validation patterns repeated across validators/controllers
Detection:
/@.*\./ regex patterns in multiple files/.{8,}/, strength checks repeatedisValid*, validate*, check* functions with similar logicSeverity:
Recommendation: Extract to shared validators module (validators/common.ts)
Effort: M (extract validators, update imports)
What: Hardcoded error messages instead of centralized error catalog
Detection:
throw new Error("..."), res.status(400).json({ error: "..." })errors.ts, error-messages.ts, constants/errors.tsSeverity:
Recommendation:
constants/error-messages.ts)const ERRORS = { USER_NOT_FOUND: "User not found", ... }throw new Error(ERRORS.USER_NOT_FOUND)Effort: M (create error catalog, replace hardcoded strings)
What: Code with similar logic but different variable names/structure
Detection:
Example:
// File 1
function processUser(user) { return user.name.toUpperCase(); }
// File 2
function formatUserName(u) { return u.name.toUpperCase(); }
// ✅ Same logic, different names - DETECTED
Severity:
Recommendation: Extract common logic, create shared helper function
Effort: M (refactor to shared module)
What: Same SQL queries/ORM calls in different controllers/services
Detection:
SELECT * FROM users WHERE id = ?User.findOne({ where: { email } }) in multiple filesSELECT, INSERT, UPDATE, DELETE with similar structureSeverity:
Recommendation: Extract to Repository layer, create query methods
Effort: M (create repository methods, update callers)
What: Test files with identical structure (arrange-act-assert duplicated)
Detection:
beforeEach, afterEach with identical codeSeverity:
Recommendation: Extract to test helpers (tests/helpers/*), use shared fixtures
Effort: M (create test utilities, refactor tests)
What: Duplicated response objects instead of shared DTOs
Detection:
return { id: user.id, name: user.name, email: user.email }
dtos/, responses/, models/return { ... } in controllersSeverity:
Recommendation: Create DTOs/Response classes, use serializers
Effort: M (create DTOs, update endpoints)
Overall Recommendation for DRY: Extract to shared module, create utility function, centralize constants/messages/validators/DTOs
Overall Effort: M (refactor + update imports, typically 1-4 hours per duplication type)
What: Over-engineered abstractions, unnecessary complexity
Detection:
Severity:
Recommendation: Remove abstraction, inline implementation, flatten hierarchy
Effort: L (requires careful refactoring)
What: Unused extensibility, dead feature flags, premature optimization
Detection:
Severity:
Recommendation: Remove unused code, simplify interfaces
Effort: M (verify no future use, then delete)
What: Unfinished work, temporary solutions
Detection:
TODO, FIXME, HACK, XXX, OPTIMIZESeverity:
Recommendation: Complete TODO, remove HACK, refactor workaround
Effort: Varies (S for simple TODO, L for architectural HACK)
What: Critical paths without try-catch, error propagation
Detection:
Severity:
Recommendation: Add try-catch, implement error middleware, propagate errors properly
Effort: M (add error handling logic)
What: Errors handled inconsistently across different contexts (web requests, cron jobs, background tasks)
Detection:
ErrorHandler, errorHandler, error-handler.ts/js/pyerrorHandler.handleError(err) or similarprocess.on("uncaughtException") usage (BAD PRACTICE per Express docs)Severity:
uncaughtException listener instead of proper error propagation (Express anti-pattern)Recommendation:
Effort: M-L (create error handler, refactor existing middleware)
What: Direct imports/instantiation instead of dependency injection, scattered initialization
Detection:
inversify, awilix, tsyringe, typedi packagesdependency_injector, injector packages@Autowired, @Inject annotationsIServiceCollectionnew SomeService(), new SomeRepository()bootstrap.ts, init.py, Startup.cs, app.module.tsSeverity:
new Service() in controllers/services)Recommendation:
Effort: L (refactor to DI pattern, add container, update all instantiations)
What: No architecture/design best practices documentation for developers
Detection:
docs/architecture.md, docs/best-practices.md, docs/design-patterns.mdARCHITECTURE.md, CONTRIBUTING.md (architecture section)Severity:
Recommendation:
docs/architecture.md with project-specific patterns:
Effort: S (create markdown file, ~1-2 hours documentation)
penalty = (critical * 2.0) + (high * 1.0) + (medium * 0.5) + (low * 0.2)
score = max(0, 10 - penalty)
Return JSON to coordinator:
Global mode output:
{
"category": "Architecture & Design",
"score": 6,
"total_issues": 12,
"critical": 2,
"high": 4,
"medium": 4,
"low": 2,
"findings": [...]
}
Domain-aware mode output (NEW):
{
"category": "Architecture & Design",
"score": 6,
"domain": "users",
"scan_path": "src/users",
"total_issues": 12,
"critical": 2,
"high": 4,
"medium": 4,
"low": 2,
"findings": [
{
"severity": "CRITICAL",
"location": "src/users/controllers/UserController.ts:45",
"issue": "Controller directly uses Repository (layer boundary break)",
"principle": "Layer Separation (Clean Architecture)",
"recommendation": "Create UserService, inject into controller",
"effort": "L",
"domain": "users"
},
{
"severity": "HIGH",
"location": "src/users/services/UserService.ts:45",
"issue": "DRY violation - duplicate validation logic",
"principle": "DRY Principle",
"recommendation": "Extract to shared validators module",
"effort": "M",
"domain": "users"
}
]
}
domain_mode="domain-aware", scan ONLY scan_path (not entire codebase)domain field in each finding when domain-awareprinciples.md to define what's acceptableVersion: 4.1.0 Last Updated: 2026-01-29
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience