- Home
- Skills
- Code Quality & Review
- Clean Code And Architecture Skill
Works with the AI Agents you already use
Clean Code And Architecture Skill
Practical code review and architectural refactoring based on Clean Code principles and dependency health analysis.
$4.99
Clean Code And Architecture Skill
Example session with this skill installed
Review this Express controller for clean code issues and suggest a refactoring plan:
app.post('/user', (req, res) => {
const user = req.body;
if(!user.email) return res.status(400).send('No email');
db.query('INSERT INTO users...', [user.email], (err, result) => {
if(err) throw err;
emailService.sendWelcome(user.email);
res.send('Saved');
});
});
- Read your context and instructions
- Compiled the clean code
I have reviewed the app.post('/user') handler. The current implementation couples HTTP concerns directly with database infrastructure and side effects.
Code Quality and Architecture Audit
| Severity | Reference | Finding | Recommendation |
|---|---|---|---|
| High | Controller Logic | Infrastructure Leakage: The HTTP handler directly executes SQL queries via db.query. | Extract database logic into a repository or service layer. |
| Medium | Error Handling | Fragile Error Path: throw err inside a callback will crash the process in many Node.js versions. | Use a try/catch block or pass the error to the Express next middleware. |
| Medium | Responsibility | Side-effect Coupling: The welcome email is triggered inside the DB callback. | Move side effects to an application service or event emitter. |
| Low | Validation | Basic Validation: Manual check for user.email is primitive. | Use a validation schema (e.g., Joi or Zod). |
Architecture Assessment
The current structure is
Transaction Script style. The Presentation layer (Express) is heavily coupled to the Infrastructure layer (Database). There is no visible Domain or Application layer to house business rules.
Refactoring Roadmap
Add Characterization Test: Create a test case that hits the /user endpoint to verify the 400 and 200 responses.
2. Extract Data Access: Move the INSERT query into a UserRepository.js file.
3. Handle Errors Gracefully: Replace the throw with a proper Express error handler response.
4.
Introduce Application Service: Create a RegisterUser use case that coordinates the Repository and the emailService.
Next steps
- Would you like me to generate the
UserRepositoryandUserServicefiles? - Should I provide the updated Express route using these new abstractions?
- Do you want a Joi schema for the input validation?
Connects securely to your tools. The creator never sees your data.
About this skill
Deeply nested logic, circular dependencies, and leaked infrastructure details make codebases hard to maintain. This skill acts as a pragmatic software quality engineer to review your project and provide a structured roadmap for incremental improvement.
What it does
- Code quality review identifies readability issues, improper naming, and bloated functions using file-specific references.
- Architectural mapping evaluates boundaries between domain logic, presentation, and infrastructure to detect layer leakage.
- Dependency health analysis audits manifests and lockfiles for version consistency and upgrade risks.
- Safe refactoring plans generates step-by-step sequences for improving code without breaking existing behavior.
- Severity classification prioritizes findings from critical risks to low-impact readability improvements.
How it works
- Provide your repository files, language details, and any specific maintenance goals.
- The agent inspects your project structure to summarize current conventions and architectural boundaries.
- You receive a prioritized report including code smells, architectural risks, and dependency health.
- Request implementation for specific findings to receive incremental, behavior-preserving code changes.
Frameworks & tools
Works with any language or framework including JavaScript/TypeScript, Python, Java, Go, and C#. It integrates with package managers via manifest analysis and uses standard unit testing patterns for validation.
Why this beats prompting it yourself
Generic prompts often lead to "hallucinated" refactors that break production code or force enterprise patterns on small scripts. This skill follows a strict workflow to preserve observable behavior and ensures every recommendation is grounded in your specific file context.
Use cases
- Reviewing a legacy module before adding new features to ensure testability.
- Auditing dependency lockfiles for version drift and framework compatibility.
- Decoupling business logic from framework-specific code in growing applications.
- Onboarding to a new codebase by generating an architectural assessment.
Known limitations
Cannot verify security vulnerabilities without external advisory data. Refactoring implementation requires the user to provide the relevant file context and execution environment for testing.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.
Cannot verify security vulnerabilities without external advisory data. Refactoring requires full file context. Testing only occurs if an execution environment is provided.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 14 days ago