check-cross-layer
Cross-Layer Check
Check if your changes considered all dimensions. Most bugs come from "didn't think of it", not lack of technical skill.
Note: This is a post-implementation safety net. Ideally, read the Pre-Implementation Checklist before writing code.
Related Documents
| Document | Purpose | Timing |
|---|---|---|
| Pre-Implementation Checklist | Questions before coding | Before writing code |
| Code Reuse Thinking Guide | Pattern recognition | During implementation |
/trellis:check-cross-layer (this) |
Verification check | After implementation |
Execution Steps
1. Identify Change Scope
git status
git diff --name-only
2. Select Applicable Check Dimensions
Based on your change type, execute relevant checks below:
Dimension A: Cross-Layer Data Flow (Required when 3+ layers)
Trigger: Changes involve 3 or more layers
| Layer | Common Locations |
|---|---|
| API/Routes | routes/, api/, handlers/, controllers/ |
| Service/Business Logic | services/, lib/, core/, domain/ |
| Database/Storage | db/, models/, repositories/, schema/ |
| UI/Presentation | components/, views/, templates/, pages/ |
| Utility | utils/, helpers/, common/ |
Checklist:
- Read flow: Database -> Service -> API -> UI
- Write flow: UI -> API -> Service -> Database
- Types/schemas correctly passed between layers?
- Errors properly propagated to caller?
- Loading/pending states handled at each layer?
Detailed Guide: .trellis/spec/guides/cross-layer-thinking-guide.md
Dimension B: Code Reuse (Required when modifying constants/config)
Trigger:
- Modifying UI constants (label, icon, color)
- Modifying any hardcoded value
- Seeing similar code in multiple places
- Creating a new utility/helper function
- Just finished batch modifications across files
Checklist:
- Search first: How many places define this value?
# Search in source files (adjust extensions for your project) grep -r "value-to-change" src/ - If 2+ places define same value -> Should extract to shared constant
- After modification, all usage sites updated?
- If creating utility: Does similar utility already exist?
Detailed Guide: .trellis/spec/guides/code-reuse-thinking-guide.md
Dimension B2: New Utility Functions
Trigger: About to create a new utility/helper function
Checklist:
- Search for existing similar utilities first
grep -r "functionNamePattern" src/ - If similar exists, can you extend it instead?
- If creating new, is it in the right location (shared vs domain-specific)?
Dimension B3: After Batch Modifications
Trigger: Just modified similar patterns in multiple files
Checklist:
- Did you check ALL files with similar patterns?
grep -r "patternYouChanged" src/ - Any files missed that should also be updated?
- Should this pattern be abstracted to prevent future duplication?
Dimension C: Import/Dependency Paths (Required when creating new files)
Trigger: Creating new source files
Checklist:
- Using correct import paths (relative vs absolute)?
- No circular dependencies?
- Consistent with project's module organization?
Dimension D: Same-Layer Consistency
Trigger:
- Modifying display logic or formatting
- Same domain concept used in multiple places
Checklist:
- Search for other places using same concept
grep -r "ConceptName" src/ - Are these usages consistent?
- Should they share configuration/constants?
Common Issues Quick Reference
| Issue | Root Cause | Prevention |
|---|---|---|
| Changed one place, missed others | Didn't search impact scope | grep before changing |
| Data lost at some layer | Didn't check data flow | Trace data source to destination |
| Type/schema mismatch | Cross-layer types inconsistent | Use shared type definitions |
| UI/output inconsistent | Same concept in multiple places | Extract shared constants |
| Similar utility exists | Didn't search first | Search before creating |
| Batch fix incomplete | Didn't verify all occurrences | grep after fixing |
Output
Report:
- Which dimensions your changes involve
- Check results for each dimension
- Issues found and fix suggestions
More from mindfold-ai/trellis
trellis-meta
Understand and customize the local Trellis architecture inside a user project. Use when modifying .trellis plus platform hooks, settings, agents, skills, commands, prompts, or workflows generated by trellis init.
166cc-codex-spec-bootstrap
Claude Code + Codex parallel pipeline for bootstrapping Trellis coding specs. CC analyzes the repo with GitNexus (knowledge graph) + ABCoder (AST), creates Trellis task PRDs with full architectural context and MCP tool instructions, then Codex agents run those tasks in parallel to fill spec files. Use when: bootstrapping coding guidelines, setting up Trellis specs, 'bootstrap specs for codex', 'create spec tasks', 'CC + Codex spec pipeline', 'initialize coding guidelines with code intelligence'. Also triggers when user wants to set up GitNexus or ABCoder MCP for multi-agent spec generation.
89brainstorm
Collaborative requirements discovery session optimized for AI coding workflows. Creates task directories, seeds PRDs, runs codebase research, proposes concrete implementation approaches with trade-offs, and converges on MVP scope through structured Q&A. Use when requirements are unclear, multiple implementation paths exist, trade-offs need evaluation, or a complex feature needs scoping before development.
38break-loop
Deep post-fix bug analysis across five dimensions: root cause categorization, fix failure analysis, prevention mechanisms, systematic expansion, and knowledge capture. Updates .trellis/spec/ guides with lessons learned to prevent recurring bugs. Use when a debugging session completes, after fixing a tricky bug, when the same class of bug keeps recurring, or when you want to capture debugging insights into project documentation.
34record-session
Records completed work progress to .trellis/workspace/ journal files after human testing and commit. Captures session summaries, commit hashes, and updates developer index files for future session context. Use when a coding session is complete, after the human has committed code, or to persist session knowledge for future AI sessions.
32start
Initializes an AI development session by reading workflow guides, developer identity, git status, active tasks, and project guidelines from .trellis/. Classifies incoming tasks and routes to brainstorm, direct edit, or task workflow. Use when beginning a new coding session, resuming work, starting a new task, or re-establishing project context.
30