commit
Create git commits with user approval and no Claude attribution
Check for backend architecture pattern violations
$ npx -y skills add dcouple/Pane --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
/architecture-backendContext preview
What this command does when you run it.
Check for backend architecture pattern violations
allowed-tools: Bash(git diff:*), Bash(git log:*), Bash(git show:*), Bash(git rev-parse:*), Bash(git branch:*), Read, Grep, Glob, TodoWrite description: Check for backend architecture pattern violations
You are reviewing code changes for violations of **backend architecture patterns**.
Controllers must use `authenticatedHandler` wrapper for authenticated routes. This wrapper:
**Controllers should NEVER have try/catch blocks.**
Services accessing the database must extend `BaseService` to get `this.db`.
Backend code must throw `ApiError` with proper status codes, not generic `Error`.
**No business logic in controllers. No database queries in controllers.**
# Get current branch git rev-parse --abbrev-ref HEAD # Get changed files (backend only) git diff main...HEAD --name-only | grep "apps/api" # Get full diff for backend git diff main...HEAD -- "apps/api/"
Read the backend patterns:
For each controller file changed:
**Check for authenticatedHandler:**
// CORRECT
router.get('/', authenticatedHandler(async (req, res) => {
const userId = req.user.id;
// ...
}));
// WRONG - Missing wrapper
router.get('/', async (req, res) => {
try {
// ...
} catch (e) {
// ...
}
});**Check for try/catch blocks:**
**Check for business logic:**
**Study exemplar:** `apps/api/src/modules/feed/controllers/feed.controller.ts`
For each service file changed:
**Check for BaseService extension:**
// CORRECT
export class FeedService extends BaseService {
async getItems() {
const items = await this.db.query...
}
}
// WRONG - Direct db import
import { db } from '@/shared/db';
export class FeedService {
async getItems() {
const items = await db.query...
}
}**Check for ApiError usage:**
// CORRECT
throw new ApiError(404, 'Item not found');
// WRONG
throw new Error('Item not found');**Check for single responsibility:**
**Study exemplar:** `apps/api/src/modules/feed/services/feed.service.ts`
For validator files:
**Check for Zod usage:**
// CORRECT
import { z } from 'zod';
export const createItemSchema = z.object({
name: z.string().min(1),
type: z.enum(['A', 'B']),
});
export type CreateItemInput = z.infer<typeof createItemSchema>;
// WRONG - Manual validation in controller/service
if (!name || name.length < 1) {
throw new Error('Invalid name');
}**Study exemplar:** `apps/api/src/modules/feed/validators/feed-tag.validator.ts`
For large services:
**Check folder structure:**
services/
recording/
index.ts # Main service, re-exports
recording.service.ts
helpers/
audio-processor.ts# Backend Architecture Report
**Branch:** {branch}
**Status:** {PASS | WARN | FAIL}
## Summary
{One sentence assessment of backend architecture compliance}
## Patterns Checked
- [x] authenticatedHandler usage
- [x] No try/catch in controllers
- [x] Controller-service separation
- [x] BaseService extension
- [x] ApiError usage
- [x] Zod validators
- [x] Single responsibility
## Violations Found
### Critical (Must Fix)
| Location | Pattern Violated | Fix |
|----------|------------------|-----|
| {file:line} | {pattern} | {how to fix} |
### Warnings
| Location | Issue | Recommendation |
|----------|-------|----------------|
| {file:line} | {description} | {suggestion} |
## Controller Issues
| Controller | Issue | Fix |
|------------|-------|-----|
| {file} | {try/catch found / business logic / missing wrapper} | {fix} |
## Service Issues
| Service | Issue | Fix |
|---------|-------|-----|
| {file} | {not extending BaseService / throwing Error / multiple responsibilities} | {fix} |
## Exemplars to Study
- Controller pattern: `apps/api/src/modules/feed/controllers/feed.controller.ts`
- Service pattern: `apps/api/src/modules/feed/services/feed.service.ts`
- Validator pattern: `apps/api/src/modules/feed/validators/feed-tag.validator.ts`
- Complex service: `apps/api/src/modules/audio/services/recording/`
## Recommendations
1. {specific action with file reference}
2. {specific action with file reference}1. Save report to `tmp/review-architecture-backend-{branch}.md` 2. Present summary:
| Pattern | Correct | Wrong | |---------|---------|-------| | Controller auth | `authenticatedHandler(async (req, res) => ...)` | `async (req, res) => { try {...} catch {...} }` | | Controller logic | Delegates to service | Contains business logic | | Service DB | `extends BaseService`, uses `this.db` | Direct `db` import | | Service errors | `thro
Repo: dcouple/Pane
Create git commits with user approval and no Claude attribution
You are tasked with creating detailed implementation plans through an interactive, iterative process. You should be skeptical, thorough, and work…
Generate comprehensive PR descriptions following repository templates
You are tasked with implementing an approved technical plan from `thoughts/shared/plans/`. These plans contain phases with specific changes and success…
Iterate on existing implementation plans with thorough research and updates
You are tasked with conducting comprehensive research across the codebase to answer user questions. You will spawn one or more parallel sub-agents to perform…