external/tgd-skills/tgd-code-review-and-quality/SKILL.md
Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch.
npx skillsauth add seikaikyo/dash-skills tgd-code-review-and-qualityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Multi-dimensional code review with quality gates. Every change gets reviewed before merge — no exceptions. Review covers five axes: correctness, readability, architecture, security, and performance.
The approval standard: Approve a change when it definitely improves overall code health, even if it isn't perfect. Perfect code doesn't exist — the goal is continuous improvement. Don't block a change because it isn't exactly how you would have written it. If it improves the codebase and follows the project's conventions, approve it.
Every review evaluates code across these dimensions:
Does the code do what it claims to do?
Can another engineer (or agent) understand this code without the author explaining it?
temp, data, result without context)_unused), backwards-compat shims, or // removed comments?Does the change fit the system's design?
For detailed security guidance, see tgd-security-and-hardening. Does the change introduce vulnerabilities?
For detailed profiling and optimization, see tgd-performance-optimization. Does the change introduce performance problems?
Small, focused changes are easier to review, faster to merge, and safer to deploy. Target these sizes:
~100 lines changed → Good. Reviewable in one sitting.
~300 lines changed → Acceptable if it's a single logical change.
~1000 lines changed → Too large. Split it.
What counts as "one change": A single self-contained modification that addresses one thing, includes related tests, and keeps the system functional after submission. One part of a feature — not the whole feature.
Splitting strategies when a change is too large:
| Strategy | How | When | |----------|-----|------| | Stack | Submit a small change, start the next one based on it | Sequential dependencies | | By file group | Separate changes for groups needing different reviewers | Cross-cutting concerns | | Horizontal | Create shared code/stubs first, then consumers | Layered architecture | | Vertical | Break into smaller full-stack slices of the feature | Feature work |
When large changes are acceptable: Complete file deletions and automated refactoring where the reviewer only needs to verify intent, not every line.
Separate refactoring from feature work. A change that refactors existing code and adds new behavior is two changes — submit them separately. Small cleanups (variable renaming) can be included at reviewer discretion.
Every change needs a description that stands alone in version control history.
First line: Short, imperative, standalone. "Delete the FizzBuzz RPC" not "Deleting the FizzBuzz RPC." Must be informative enough that someone searching history can understand the change without reading the diff.
Body: What is changing and why. Include context, decisions, and reasoning not visible in the code itself. Link to bug numbers, benchmark results, or design docs where relevant. Acknowledge approach shortcomings when they exist.
Anti-patterns: "Fix bug," "Fix build," "Add patch," "Moving code from A to B," "Phase 1," "Add convenience functions."
Before looking at code, understand the intent:
- What is this change trying to accomplish?
- What spec or task does it implement?
- What is the expected behavior change?
If .codegraph/ exists, run codegraph callers "<modified-function>" to verify the change doesn't miss any dependent code. Run codegraph affected <changed-files> to confirm all impacted tests are included. For large or unfamiliar changes, run the understand-diff skill to visualize the full blast radius before approving.
Tests reveal intent and coverage:
- Do tests exist for the change?
- Do they test behavior (not implementation details)?
- Are edge cases covered?
- Do tests have descriptive names?
- Would the tests catch a regression if the code changed?
Walk through the code with the five axes in mind:
For each file changed:
1. Correctness: Does this code do what the test says it should?
2. Readability: Can I understand this without help?
3. Architecture: Does this fit the system?
4. Security: Any vulnerabilities?
5. Performance: Any bottlenecks?
Label every comment with its severity so the author knows what's required vs optional:
This is the ONE severity taxonomy for the review phase — REVIEW.md, the code-reviewer persona (agents/code-reviewer.md), and this skill all use it:
| Prefix | Meaning | Author Action | |--------|---------|---------------| | Critical: | Blocks merge | Security vulnerability, data loss, broken functionality — must fix before merge | | Important: | Should fix before merge | Missing test, wrong abstraction, poor error handling — deferring requires explicit justification | | Nit: | Minor, optional | Author may ignore — formatting, style preferences, optional improvements | | FYI: | Informational only | No action needed — context for future reference |
This prevents authors from treating all feedback as mandatory and wasting time on optional suggestions.
Check the author's verification story:
- What tests were run?
- Did the build pass?
- Was the change tested manually?
- Are there screenshots for UI changes?
- Is there a before/after comparison?
Use different models for different review perspectives:
Model A writes the code
│
▼
Model B reviews for correctness and architecture
│
▼
Model A addresses the feedback
│
▼
Human makes the final call
This catches issues that a single model might miss — different models have different blind spots.
Example prompt for a review agent:
Review this code change for correctness, security, and adherence to
our project conventions. The spec says [X]. The change should [Y].
Flag any issues as Critical, Important, Nit, or FYI.
After any refactoring or implementation change, check for orphaned code:
Don't leave dead code lying around — it confuses future readers and agents. But don't silently delete things you're not sure about. When in doubt, ask.
DEAD CODE IDENTIFIED:
- formatLegacyDate() in src/utils/date.ts — replaced by formatDate()
- OldTaskCard component in src/components/ — replaced by TaskCard
- LEGACY_API_URL constant in src/config.ts — no remaining references
→ Safe to remove these?
Slow reviews block entire teams. The cost of context-switching to review is less than the waiting cost imposed on others.
When resolving review disputes, apply this hierarchy:
Don't accept "I'll clean it up later." Experience shows deferred cleanup rarely happens. Require cleanup before submission unless it's a genuine emergency. If surrounding issues can't be addressed in this change, require filing a bug with self-assignment.
When reviewing code — whether written by you, another agent, or a human:
Part of code review is dependency review:
Before adding any dependency:
npm audit)Rule: Prefer standard library and existing utilities over new dependencies. Every dependency is a liability.
## Review: [PR/Change title]
### Context
- [ ] I understand what this change does and why
### Correctness
- [ ] Change matches spec/task requirements
- [ ] Edge cases handled
- [ ] Error paths handled
- [ ] Tests cover the change adequately
### Readability
- [ ] Names are clear and consistent
- [ ] Logic is straightforward
- [ ] No unnecessary complexity
### Architecture
- [ ] Follows existing patterns
- [ ] No unnecessary coupling or dependencies
- [ ] Appropriate abstraction level
### Security
- [ ] No secrets in code
- [ ] Input validated at boundaries
- [ ] No injection vulnerabilities
- [ ] Auth checks in place
- [ ] External data sources treated as untrusted
### Performance
- [ ] No N+1 patterns
- [ ] No unbounded operations
- [ ] Pagination on list endpoints
### Verification
- [ ] Tests pass
- [ ] Build succeeds
- [ ] Manual verification done (if applicable)
### Verdict
- [ ] **Approve** — Ready to merge
- [ ] **Request changes** — Issues must be addressed
references/security-checklist.mdreferences/performance-checklist.mdWhen code review identifies issues that are known but intentionally not fixed in the current cycle, track them:
$TGD_DIR/<feature-name>/DEBT.md (table below) — this is the primary record and works with zero configuration.JIRA_URL/JIRA_PROJECT/JIRA_TOKEN set): additionally create a Jira issue and put its key in the DEBT.md row. Do NOT stall the review asking for credentials when Jira isn't configured.| Category | Action | Jira Issue Type | Label |
|----------|--------|-----------------|-------|
| Architecture | Design debt, needs refactor | Improvement | tech-debt |
| Performance | Known bottleneck, not critical now | Improvement | tech-debt |
| Security | Low-risk vulnerability, hardening needed | Improvement | security-hardening |
| Code Quality | Readability/maintainability issues | Improvement | tech-debt |
| Test Coverage | Missing tests for edge cases | Improvement | test-coverage |
Issue discovered during Review
│
▼
Is this a blocker for merge?
├── YES → Request changes, do NOT merge
└── NO
├── Should it be fixed in this sprint?
│ ├── YES → Fix now (no Jira needed)
│ └── NO → File Jira Improvement
│
├── Is it a known limitation?
│ └── YES → File Jira Improvement + document in code
│
└── Is it a future risk?
└── YES → File Jira Improvement + set priority
When filing a Jira tech debt issue, include:
## Tech Debt Summary
[One-line description]
## Category
[Architecture / Performance / Security / Code Quality / Test Coverage]
## Priority
[High / Medium / Low]
## Context
- Feature: <feature-name>
- File(s): [path/to/file]
- Review Stage: /tgd-review
## Current State
[What the code looks like now]
## Desired State
[What the code should look like]
## Impact if Not Addressed
[Consequences of leaving this debt]
## Suggested Approach
[How to fix it - if known]
## Acceptance Criteria
- [ ] [Criterion 1]
- [ ] [Criterion 2]
When tech debt is identified:
Add a comment in TASKS.md next to the relevant task:
- [x] Implement login API <!-- TECH-DEBT: JIRA-456 - Password hashing should use bcrypt -->
Create a $TGD_DIR/<feature-name>/DEBT.md file to track all tech debt:
# Tech Debt: <feature-name>
| Issue | Category | Priority | Jira Key |
|-------|----------|----------|----------|
| Password hashing | Security | High | JIRA-456 |
| Missing pagination | Performance | Medium | JIRA-457 |
| Rationalization | Reality | |---|---| | "It works, that's good enough" | Working code that's unreadable, insecure, or architecturally wrong creates debt that compounds. | | "I wrote it, so I know it's correct" | Authors are blind to their own assumptions. Every change benefits from another set of eyes. | | "We'll clean it up later" | Later never comes. The review is the quality gate — use it. Require cleanup before merge, not after. | | "AI-generated code is probably fine" | AI code needs more scrutiny, not less. It's confident and plausible, even when wrong. | | "The tests pass, so it's good" | Tests are necessary but not sufficient. They don't catch architecture problems, security issues, or readability concerns. |
After review is complete:
development
拋棄式 HTML mockup 比稿:產出 2 到 3 個設計立場不同的變體(密度 / 版式 / 強調軸,不是換色),各附取捨說明,最後給有立場的對比結論。適用:「畫個草圖」「比較 A 版 B 版」「先看方向再做」「給我看幾種做法」。要 production 元件或設計已定案時不適用。
tools
需求不明時的意圖萃取訪談:一次一題、每題附上自己的猜測、聽出「真正想要 vs 覺得應該要」,直到能預測使用者反應(約 95% 信心)才動工。適用:需求缺少對象 / 動機 / 成功標準 / 約束,或使用者點名「訪談我」「先確認一下」「我們確定嗎」。明確自足的指示、純資訊查詢、機械性操作不適用。
development
對非平凡決策啟動新鮮 context 對抗審查(找碴不背書),在修正還便宜的時候抓出錯誤方向。適用:高風險改動(production、資安敏感邏輯、不可逆操作)、不熟的程式碼、要宣稱「這樣是安全的 / 可行的」之前。機械性操作與一行修改不適用。
testing
Reference for writing and editing agent skills well — the vocabulary and principles that make a skill predictable. Consult when authoring, reviewing, or pruning a SKILL.md.