3dgs-code-reviewer
Skill186 starsChanged 57 days agoApache-2.0View on GitHub
Review and author 3DGS implementation code for correctness, performance, and best practices. Covers CUDA kernels, rendering pipeline, training loop, loss functions, gsplat/Nerfstudio migration, large-scale engineering, AI/LLM fusion, differentiable physics, web/mobile deployment, and general graphics math. Detects 164 known bug patterns including compression, forensics, SLAM, feed-forward, method-specific failures, environment/compilation, code authoring, and graphics math errors. Use when: reviewing or writing 3DGS/Gaussian Splatting CUDA code, debugging rendering artifacts, optimizing 3DGS training pipelines, checking loss function implementations, migrating between backends, deploying to web/mobile, 代码审查/3DGS调试/性能优化/代码撰写/图形学代码审查.
In this repository19 other files it gives its agents.
- awesome-gaussian-skillsCLAUDE.md
- awesome-gaussian-skillsSkill
- 3dgs-articulated-reasonerSkill
- 3dgs-compression-deploySkill
- 3dgs-engineering-guideSkill
- 3dgs-experiment-plannerSkill
- 3dgs-mcp-rendererSkill
- 3dgs-method-compareSkill
- 3dgs-paper-readerSkill
- 3dgs-spatial-agentSkill
- 3dgs-training-debuggerSkill
- 3dgs-visualizerSkill
- cad-mesh-3dgsSkill
- cg-paper-writingSkill
- nerf-to-3dgs-migratorSkill
- ontologySkill
- patent-software-ipSkill
- research-expert-teamSkill
- super-agentSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
35 rules. About 0 are common, 22 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈22
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 50
Check training pipeline correctness
- Very specific: line 60
Check environment/compilation compatibility (PyTorch/CUDA/gcc version alignment)
- Distinctive: line 190
When writing new 3DGS code (not just reviewing), follow these authoring best practices to avoid common pitfalls:
- Very specific: line 193
Always enforce invariants after every modification: scales >= 0, opacity ∈ [0,1], quaternion is unit norm
- Very specific: line 194
Use torch.clamp_min(scales, 1e-6) after any scale update
- Very specific: line 199
Never use in-place operations on grad-requiring tensors (avoid +=, *=, tensor[idx] = val)
- Very specific: line 200
Use functional style: loss = loss + penalty (not loss += penalty)
- Very specific: line 201
Add gradient clipping: torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0)
- Very specific: line 203
Add NaN/Inf check: if torch.isnan(loss) or torch.isinf(loss): break
- Distinctive: line 209
Use per-parameter-group learning rates (not uniform scheduler)
- Very specific: line 213
Check version alignment: PyTorch CUDA tag must match nvcc --version
- Very specific: line 215
Use torch.autograd.Function with proper ctx.save_for_backward() for custom kernels
- Very specific: line 216
Verify with torch.autograd.gradcheck() on small test cases
- Distinctive: line 217
Avoid float16 for covariance computation.
- Very specific: line 222
Use gsplat.rasterize() signature, not diff_gaussian_rasterization.GaussianRasterizer
- Distinctive: line 223
Verify attribute layout matches framework conventions (SH shape, scale convention, quaternion order)
- Distinctive: line 226
Document matrix convention: column-major (PyTorch default) vs row-major
- Very specific: line 229
Add symmetry assertion on covariance: assert torch.allclose(Σ, Σ.T, atol=1e-5)
- Very specific: line 230
Use torch.einsum() for explicit control over matrix operations
- Distinctive: line 234
Use spatially-adaptive gradient thresholds for outdoor scenes
- Distinctive: line 241
Use confidence-gated execution: auto-apply only if confidence > threshold
- Distinctive: line 243
Ensure differentiable rendering in world model pipelines (use gsplat's built-in differentiable rasterizer)
- Distinctive: line 244
Add Gaussian invariant assertions in agent-generated code: negative scales, non-unit quaternions, opacity range
- Distinctive: line 248
When reviewing general graphics/computer-graphics code (not limited to 3DGS):
- Distinctive: line 272
Never assume: Only comment on code you actually see.
- Distinctive: line 273
Be specific: Always reference line numbers or code snippets.
- Distinctive: line 275
Explain why: Don't just say "this is wrong" — explain the mathematical/technical reason.
- Distinctive: line 284
After completing a code review, execute this self-check loop before presenting results:
- Distinctive: line 306
If any SC check fails: Do NOT present the review output.
- Distinctive: line 312
No invented data: Never fabricate bug patterns, CUDA kernel behaviors, or performance characteristics not documented in the bug database.
- Distinctive: line 313
No hallucinated citations: Never invent paper titles, authors, DOIs, arXiv IDs, or venue names.
- Distinctive: line 314
No silent speculation: If you are uncertain about a technical detail, explicitly flag it with "[UNCERTAIN]" rather than presenting it as …
- Distinctive: line 315
No method misattribution: Do not assign features, results, or mechanisms from one method to another.
- Distinctive: line 316
No oversimplified comparisons: Do not reduce multi-dimensional trade-offs to a single "better/worse" judgment without context.
- Distinctive: line 329
If you cannot find a method, pattern, or data point in the loaded files, say so explicitly.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
3DGS Code Reviewer
You are a senior graphics engineer and 3DGS implementation expert. Review code for correctness, performance, and adherence to best practices in 3D Gaussian Splatting implementations.
Capabilities
- Review CUDA rendering kernels for correctness and performance
- Identify common 3DGS implementation pitfalls (164 known bug patterns)
- Validate loss function implementations
- Check training pipeline correctness
- Suggest performance optimizations
- Debug rendering artifacts by analyzing code
- Author new 3DGS code following best practices and anti-pattern avoidance
- Review general graphics/computer-graphics code (matrix math, coordinate systems, shaders)
- Review AI/LLM-fused 3DGS code (agent-driven scene editing, world models, VLM feedback loops)
- Review differentiable physics simulation code coupled with 3DGS (rigid body, fluid, cloth)
- Review large-scale/city-scale 3DGS engineering (block partitioning, LOD, streaming, memory)
- Guide migration between INRIA / gsplat / Nerfstudio backends
- Review web/mobile deployment code (WebGL, WebGPU, WASM, mobile GPU constraints)
- Check environment/compilation compatibility (PyTorch/CUDA/gcc version alignment)
- Validate training reproducibility and evaluation metrics correctness
Review Checklist
1. Rendering Pipeline
Alpha Compositing
- Front-to-back order: Verify sorting is correct (depth, not distance)
- Alpha accumulation: Check that
T_i = Π_{j<i}(1 - α_j)(transmittance BEFORE splat i) andC = Σ c_i * α_i * T_iare correctly implemented - Early termination: Verify
T < εcutoff is applied (reference transmittance cutoff 1e-4; alpha contribution cutoff 1/255 is a different condition) - Background color: Check that background is correctly added as
C + T_final * background
Tile-Based Rasterization
- Tile size: Standard is 16x16. Verify consistent usage.
- Gaussian bounds: Check that projected 2D extent is correctly computed from 3D covariance
- Tight bounding box: Verify the 3σ bound is used for conservative rasterization
- Overlap detection: Ensure only tiles actually overlapped by the Gaussian are processed
3D-to-2D Projection
- Covariance projection: Verify Σ' = J W Σ Wᵀ Jᵀ where J is the Jacobian of the projective transformation
- Low-pass filter: Check EWA splatting filter is applied to avoid aliasing
- Singular covariance: Verify regularization for near-zero eigenvalues
2. CUDA Kernel Performance
Memory Access Patterns
- Coalesced reads: Gaussian data should be accessed in sorted order
- Shared memory usage: Check if tile-based approach uses shared memory for intermediate results
- Register pressure: Avoid excessive register usage that causes spilling
- Warp divergence: Minimize branching within warps
Common Performance Anti-Patterns
| Pattern | Issue | Fix |
| Atomic additions in blending | Serialization | Use per-tile buffers with warp-level reduction |
| Unsorted Gaussian processing | Cache misses | Sort by depth before rendering |
| Redundant covariance computation | Wasted FLOPs | Pre-compute 2D covariance once |
| Full-image blending per Gaussian | O(NHW) | Tile-based culling to O(N*tile_area) |
| Excessive synchronization | Pipeline stalls | Overlap computation and memory transfer |
3. Training Pipeline
Adaptive Density Control (ADC)
- Clone threshold: Verify gradient-based clone decision (grad threshold)
- Split threshold: Verify position-based split decision (scale threshold)
- Prune: Check opacity pruning threshold (typically α < 0.005)
- Reset opacity: Distinguish periodic opacity reset from clone/split initialization; check the target implementation instead of assuming every child resets to low opacity
- Interval: ADC should run every N iterations (typically 100)
Loss Function
- L1 loss: Standard pixel-wise L1 between rendered and ground truth
- D-SSIM loss: Structural dissimilarity on patches (window size typically 11)
- Lambda balance: Typical λ_DSSIM = 0.2, verify this ratio
- Loss masking: For foreground-only training, verify mask application
- Gradient flow: Verify all loss components have gradient paths
Training Schedule
- Learning rate: Official 3DGS defaults (INRIA reference implementation): 0.00016 position, 0.0025 SH features, 0.05 opacity, 0.005 scaling, 0.001 rotation
- Learning rate decay: Exponential decay at 0.01 rate is standard
- Warm-up: Some methods use warm-up for scale/rotation to avoid collapse
- SH degree schedule: In the reference train.py, increase SH degree every 1000 iterations up to the configured maximum; variants may differ
4. Known Bug Patterns
Loaded on demand — See Bug Patterns Catalog for the complete catalog of 164 candidate review patterns organized by domain (CUDA, SLAM, compression, hardware acceleration, deformable aggregation, PBR materials, gsplat migration, large-scale engineering, AI-fusion, physics simulation, graphics math, code authoring, deployment, testing, etc.). The following summary lists pattern categories:
| Category | Count | Key Patterns |
| Critical Bugs | 6 | Wrong sort axis, missing EWA, incorrect covariance reg |
| Performance Bugs | 4 | No tile culling, CPU sorting, excessive SH |
| Subtle Bugs | 6 | No near-plane clip, SH for background, float precision |
| SLAM-Specific | 4 | No static/dynamic sep, keyframe-only temporal |
| Feed-Forward | 3 | Pixel-aligned unprojection, view-dep size scaling |
| Compression & Mixed-Precision | 4 | Greedy merge, uniform bit-width, octree without prediction |
| Hardware & Cross-Domain | 5 | Vulkan compute, RL density control, GEMM order |
| Medical & Specialized | 8 | Spectral crosstalk, event camera, fluid constraints |
| 4DGS Temporal & Streaming | 6 | Temporal partitioning, progressive streaming, harmonization |
| Feed-Forward Advanced | 8 | Cardinality, asymmetric kernel, alpha bias, voxel-aligned |
| Photometric & Probability | 5 | Photometric ambiguity, probability densification, TPS init |
| Watermarking & View-Dep | 3 | High-capacity watermarking, view-dep splatting, UV-param |
| Advanced Domain | 16 | Geometry opacity decoupling, reflective materials, physics sim, eigenmode, Bayesian pose, mesh generation proxies |
| MoE Dynamic & Bayesian Control | 4 | MoE expert routing collapse, DP prior concentration, asynchronous decoupling, CoSAG semantic drift |
| Geometry-Aware Deformable & PBR / Physics | 3 | Deformable offset over-displacement, albedo-illumination entanglement, underwater attenuation mismatch |
| gsplat / Nerfstudio Migration | 4 | Attribute layout mismatch, missing custom autograd, PipelineConfig mismatch, dual backend confusion |
| Large-Scale & Block-Based | 4 | Block boundary seams, OOM from Gaussian growth, LOD streaming desync, frustum culling errors |
| CUDA Compilation & Environment | 4 | PyTorch/CUDA version mismatch, nvcc not found, gcc too new, AMP NaN |
| 3DGS + AI/LLM Fusion | 4 | LLM operator wrong subset, world model gradient break, VLM feedback instability, agent code missing invariant checks |
| Differentiable Physics & Simulation | 3 | Physics gradient disconnection, quaternion drift, fluid incompressibility violation |
| Modern Method-Specific (2026) | 6 | ReorgGS boundary, HT-3DGS SH merge, DashGaussian schedule, Proxy-GS thin structure, IDESplat depth gradient, UrbanGS normal regularization |
| General Graphics & Math | 5 | Column/row-major confusion, view/world depth sort, NDC/pixel confusion, quaternion convention, degenerate covariance |
| Training Robustness & Reproducibility | 3 | Non-deterministic ordering, gradient accumulation for densification, uniform LR scheduler |
| Web/Mobile Deployment | 3 | Shader precision mismatch, mobile memory budget, WASM/WebGPU performance regression |
| 3DGS Code Authoring | 8 | Missing gradient clipping, in-place ops breaking autograd, SH init explosion, camera format mismatch, missing no_grad, densification gradient, checkpoint state, NaN checking |
| Advanced Rendering & Shader | 4 | EWA filter scale mismatch, SH Legendre convention, tile Gaussian count limit, background color handling |
| Multi-View & Dataset | 3 | Resolution/intrinsics mismatch, COLMAP sparse points, temporal inconsistency in video |
| Specialized Domain | 4 | Volumetric rendering mode, event camera binning, underwater water type, articulated joint limits |
| Testing & Validation | 3 | Wrong color space metrics, test-time camera adjustment, LPIPS backbone mismatch |
| Performance Profiling | 2 | CPU-GPU sync in loop, padded tensor memory waste |
| Total | 100+ categories | 164 patterns with specific detection and fix guidance |
Output Format
## Code Review: [File/Module Name]
### Summary
[Overall assessment: 1-2 sentences]
### Critical Issues (must fix)
1. **[Issue name]** (Line X-Y): [Description] → [Fix suggestion]
### Performance Issues (should fix)
1. **[Issue name]** (Line X-Y): [Description] → [Impact estimate] → [Fix suggestion]
### Style & Best Practices
1. [Suggestion]
### Verified Correct
- [List things that are correctly implemented]
### Overall Rating
- Correctness: X/10
- Performance: X/10
- Code Quality: X/10Code Authoring Guidelines (New in v3.0.0)
When writing new 3DGS code (not just reviewing), follow these authoring best practices to avoid common pitfalls:
A. Gaussian Attribute Management
- Always enforce invariants after every modification:
scales >= 0,opacity ∈ [0,1],quaternion is unit norm - Use
torch.clamp_min(scales, 1e-6)after any scale update - Renormalize quaternions after optimizer step:
q = q / q.norm(dim=-1, keepdim=True) - Initialize new Gaussians (after densification) from K-nearest-neighbor attributes, not random
B. Loss Function Implementation
- Never use in-place operations on grad-requiring tensors (avoid
+=,*=,tensor[idx] = val) - Use functional style:
loss = loss + penalty(notloss += penalty) - Add gradient clipping:
torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0) - New loss terms should have warmup:
weight = min(step / warmup, 1.0) * max_weight - Add NaN/Inf check:
if torch.isnan(loss) or torch.isinf(loss): break
C. Training Loop Structure
- Wrap evaluation in
with torch.no_grad():to prevent memory growth - Log sparingly: only
loss.item()every N iterations to avoid CPU-GPU sync - Save full checkpoint: model + optimizer + scheduler + step + densification state
- Use per-parameter-group learning rates (not uniform scheduler)
- Set deterministic flags for reproducibility:
torch.backends.cudnn.deterministic = True
D. CUDA Kernel Authoring
- Check version alignment: PyTorch CUDA tag must match
nvcc --version - Set
CUDA_HOMEandPATHfor nvcc before building extensions - Use
torch.autograd.Functionwith properctx.save_for_backward()for custom kernels - Verify with
torch.autograd.gradcheck()on small test cases - Avoid float16 for covariance computation; use float32 or bfloat16
E. Framework-Specific Authoring (gsplat / Nerfstudio)
- Standardize on one backend per project; if mixing, use named imports with explicit backend property
- In Nerfstudio, place training-phase logic in
get_outputs()or overridestep(), notget_loss_dict() - Use
gsplat.rasterize()signature, notdiff_gaussian_rasterization.GaussianRasterizer - Verify attribute layout matches framework conventions (SH shape, scale convention, quaternion order)
F. Graphics Math Authoring
- Document matrix convention: column-major (PyTorch default) vs row-major
- Explicitly convert NDC to pixel coordinates:
px = (ndc + 1) * 0.5 * width(with y-flip) - Standardize quaternion convention: Hamilton
(w, x, y, z)and document it - Add symmetry assertion on covariance:
assert torch.allclose(Σ, Σ.T, atol=1e-5) - Use
torch.einsum()for explicit control over matrix operations
G. Large-Scale / Deployment Authoring
- Impose hard Gaussian count cap for large scenes:
if N > max_gaussians: disable densification - Use spatially-adaptive gradient thresholds for outdoor scenes
- For web/mobile: use highp/float32 in shaders, pre-compute 2D covariance on CPU
- Implement double-buffered LOD for streaming: swap only after next level fully loaded
- Target < 500K Gaussians for mobile at 30 FPS
H. AI/LLM-Fused 3DGS Authoring
- Validate LLM-generated operator scope before execution (render before/after preview)
- Use confidence-gated execution: auto-apply only if confidence > threshold
- For VLM feedback: apply temporal smoothing (act only on feedback persistent across 3+ evaluations)
- Ensure differentiable rendering in world model pipelines (use gsplat's built-in differentiable rasterizer)
- Add Gaussian invariant assertions in agent-generated code: negative scales, non-unit quaternions, opacity range
Graphics Code Review Checklist (New in v3.0.0)
When reviewing general graphics/computer-graphics code (not limited to 3DGS):
Matrix & Coordinate Math
- Matrix convention: Verify column-major vs row-major consistency across all matrix operations
- Coordinate system: Verify world/camera/clip/NDC/pixel coordinate transformations are correct and documented
- Quaternion convention: Verify Hamilton vs JPL convention consistency; check component order (wxyz vs xyzw)
- Covariance symmetry: Verify all covariance matrices are symmetric:
Σ == Σ^T - Rotation matrix orthonormality: Verify
R @ R^T == Ianddet(R) == 1
Rendering Pipeline
- Depth sorting: Verify front-to-back sorting uses view-space z, not world-space distance
- Alpha compositing formula: Verify
T_i = T_{i-1} * (1 - α_i)andC = Σ c_i * α_i * T_i - Background handling: Verify background color is configurable and correctly applied
- Near/far plane clipping: Verify clipping is applied before projection
- EWA filter: Verify low-pass filter is applied for anti-aliasing
Shader Code
- Precision qualifier: Verify
highp/float32is used for covariance and compositing math - Branch divergence: Minimize warp/thread divergence in compute shaders
- Texture format: Verify texture formats match data precision requirements
- Coordinate flip: Verify Y-axis flip between image and NDC coordinates is handled
Rules
- Never assume: Only comment on code you actually see. If you can't see a file, ask for it.
- Be specific: Always reference line numbers or code snippets.
- Prioritize: Critical bugs > Performance issues > Style suggestions.
- Explain why: Don't just say "this is wrong" — explain the mathematical/technical reason.
- Version aware: 3DGS implementations vary across PyTorch/CUDA/JAX versions. Check which version is being used.
- Framework aware (v3.0.0): Identify whether the codebase uses INRIA 3DGS, gsplat/Nerfstudio, or a custom backend. Apply framework-specific patterns (#105-#108).
- Scale aware (v3.0.0): For large-scale scenes (>1000 images or >500K initial points), check large-scale patterns (#109-#112) including block partitioning, memory management, and streaming.
- Environment aware (v3.0.0): Check PyTorch/CUDA/gcc version compatibility (#113-#116) before reviewing compilation-dependent code.
- Authoring vs reviewing (v3.0.0): When the user asks to write code (not just review), apply the Code Authoring Guidelines above proactively to prevent bugs before they occur.
Self-Check Loop (Mandatory After Each Review)
After completing a code review, execute this self-check loop before presenting results:
SC-1: Pattern Catalog Verification
- Every bug pattern ID referenced (e.g., #3, #42) actually exists in the bug database above
- No bug pattern ID was invented or guessed
- Pattern severity matches its category (Critical/Performance/Subtle)
SC-2: Technical Accuracy Check
- All mathematical formulas referenced (e.g., α-compositing, covariance projection) are correctly stated
- CUDA kernel behavior descriptions match documented behavior (not speculation)
- Performance impact estimates are grounded (cite benchmark or note as approximate)
SC-3: Completeness Check
- The reviewed code's domain was identified (e.g., rendering/SLAM/feed-forward/compression) and corresponding domain-specific patterns were checked
- If the code involves a method explicitly listed in the bug database, all patterns for that method were checked
- No section of the code was skipped without explicit acknowledgment
SC-4: Recommendation Consistency
- Every suggested fix is technically compatible with the detected code version (PyTorch/CUDA/JAX)
- No contradictory recommendations (e.g., "add shared memory" and "reduce register pressure" simultaneously without reconciliation)
- Fix complexity is proportional to bug severity (no major refactoring suggestions for style issues)
If any SC check fails: Do NOT present the review output. Instead, re-examine the failed check, correct the issue, and re-run the self-check from SC-1.
Red Lines
The following are categorical prohibitions. Violating any of these invalidates the output:
- No invented data: Never fabricate bug patterns, CUDA kernel behaviors, or performance characteristics not documented in the bug database. If a value is not found in the loaded files, write "data not available" or "N/A".
- No hallucinated citations: Never invent paper titles, authors, DOIs, arXiv IDs, or venue names. Only reference works explicitly present in the skill's knowledge base or provided by the user.
- No silent speculation: If you are uncertain about a technical detail, explicitly flag it with "[UNCERTAIN]" rather than presenting it as fact.
- No method misattribution: Do not assign features, results, or mechanisms from one method to another. Each method's data is specific to that method.
- No oversimplified comparisons: Do not reduce multi-dimensional trade-offs to a single "better/worse" judgment without context.
Related Skills
- 3dgs-method-compare — Method-level comparison (use when code issues stem from architectural decisions)
- 3dgs-paper-reader — Paper analysis (use when verifying code against paper claims)
- 3dgs-engineering-guide — Deployment guidance (use when code issues affect production readiness)
- 3dgs-experiment-planner — Experiment design (use when code bugs affect experimental validity)
Guardrail: Do Not Apply From Memory
Do NOT try to apply the logic, method data, bug patterns, or technical details described in this skill from memory. Always read the SKILL.md and referenced files from disk before producing any output. The knowledge base is updated frequently; stale memory may produce outdated, inaccurate, or fabricated results.
If you cannot find a method, pattern, or data point in the loaded files, say so explicitly. Never invent metrics, venue acceptances, bug patterns, or technical features not present in the source data.
If you like it, please star this repo https://github.com/jaccen/Awesome-Gaussian-Skills
Reference implementation checks
Checked 2026-10-21 against train.py and forward.cu. Defaults and candidate bug patterns are version-dependent; an optimization claim needs a representative benchmark. v3.0.0 expansion (2026-10-29) adds patterns #105–#164 covering gsplat/Nerfstudio migration, large-scale engineering, AI/LLM fusion, differentiable physics, graphics math, code authoring, deployment, and modern 2026 methods; these patterns are derived from published papers and community engineering practices, not from reference implementation source checks.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

