codex-genesis-harness 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/.codebase/ARCHITECTURE_REVIEW_COMPLETE.md +216 -216
  2. package/.codebase/CURRENT_STATE.md +7 -2
  3. package/.codebase/FILE_NAMING_CLARIFICATION.md +161 -161
  4. package/.codebase/HARNESS_COMPLETENESS_AUDIT.md +613 -613
  5. package/.codebase/IMPLEMENTATION_COMPLETE.md +429 -429
  6. package/.codebase/IMPLEMENTATION_HANDOFF.md +351 -351
  7. package/.codebase/IMPROVEMENTS_SUMMARY.md +419 -419
  8. package/.codebase/PHASE3_SKILLS_NAMING_COMPLETE.md +292 -292
  9. package/.codebase/PHASE_DEPENDENCY_MAP.md +486 -486
  10. package/.codebase/QUICK_START_SPEC_IMPACT.md +456 -456
  11. package/.codebase/README.md +139 -139
  12. package/.codebase/RECOVERY_POINTS.md +438 -438
  13. package/.codex/skills/genesis-api-sync/SKILL.md +354 -354
  14. package/.codex/skills/genesis-api-sync/checklists/api-sync-checklist.md +101 -101
  15. package/.codex/skills/genesis-api-sync/templates/api-change-template.md +257 -257
  16. package/.codex/skills/genesis-debug-guide/SKILL.md +479 -479
  17. package/.codex/skills/genesis-debug-guide/checklists/flaky-test-investigation.md +339 -339
  18. package/.codex/skills/genesis-debug-guide/checklists/production-bug-debug.md +210 -210
  19. package/.codex/skills/genesis-debug-guide/checklists/test-failure-debug.md +158 -158
  20. package/.codex/skills/genesis-debug-guide/observability/debug-commands.md +365 -365
  21. package/.codex/skills/genesis-debug-guide/playbooks/unit-test-failures.md +289 -289
  22. package/.codex/skills/genesis-debug-guide/templates/debug-investigation-log.md +288 -288
  23. package/.codex/skills/genesis-docs-automation/SKILL.md +1003 -1003
  24. package/.codex/skills/genesis-docs-automation/checklists/docs-validation.md +359 -359
  25. package/.codex/skills/genesis-docs-automation/checklists/spec-alignment.md +312 -312
  26. package/.codex/skills/genesis-docs-automation/observability/docs-tracking.md +382 -382
  27. package/.codex/skills/genesis-docs-automation/playbooks/auto-update-flow.md +851 -851
  28. package/.codex/skills/genesis-docs-automation/playbooks/changelog-generation.md +491 -491
  29. package/.codex/skills/genesis-docs-automation/templates/changelog-entry-template.md +187 -187
  30. package/.codex/skills/genesis-docs-automation/templates/handoff-template.md +297 -297
  31. package/.codex/skills/genesis-harness/SKILL.md +1427 -1427
  32. package/.codex/skills/genesis-harness/agents/openai.yaml +7 -7
  33. package/.codex/skills/genesis-harness/checklists/bug-fix-qa.md +169 -169
  34. package/.codex/skills/genesis-harness/checklists/new-feature-qa.md +157 -157
  35. package/.codex/skills/genesis-harness/checklists/refactor-qa.md +216 -216
  36. package/.codex/skills/genesis-harness/checklists/requirements-validation.md +211 -211
  37. package/.codex/skills/genesis-harness/references/planning-schema.md +35 -35
  38. package/.codex/skills/genesis-harness/references/quality-rubric.md +21 -21
  39. package/.codex/skills/genesis-harness/references/research-rubric.md +41 -41
  40. package/.codex/skills/genesis-harness/references/workflows.md +33 -33
  41. package/.codex/skills/genesis-harness/resources/agents-template.md +27 -27
  42. package/.codex/skills/genesis-harness/resources/api-docs-template.md +32 -32
  43. package/.codex/skills/genesis-harness/resources/architecture-template.md +30 -30
  44. package/.codex/skills/genesis-harness/resources/audit-template.md +26 -26
  45. package/.codex/skills/genesis-harness/resources/bug-template.md +34 -34
  46. package/.codex/skills/genesis-harness/resources/change-impact-matrix-template.md +204 -204
  47. package/.codex/skills/genesis-harness/resources/check-template.md +21 -21
  48. package/.codex/skills/genesis-harness/resources/conventions-template.md +42 -42
  49. package/.codex/skills/genesis-harness/resources/decision-template.md +33 -33
  50. package/.codex/skills/genesis-harness/resources/design-template.md +26 -26
  51. package/.codex/skills/genesis-harness/resources/escalation-template.md +21 -21
  52. package/.codex/skills/genesis-harness/resources/feature-template.md +49 -49
  53. package/.codex/skills/genesis-harness/resources/foundation-phase-template.md +131 -131
  54. package/.codex/skills/genesis-harness/resources/integrations-template.md +32 -32
  55. package/.codex/skills/genesis-harness/resources/journeys-template.md +13 -13
  56. package/.codex/skills/genesis-harness/resources/lessons-learned-template.md +12 -12
  57. package/.codex/skills/genesis-harness/resources/observability-template.md +34 -34
  58. package/.codex/skills/genesis-harness/resources/phase-00-foundation-template.md +76 -76
  59. package/.codex/skills/genesis-harness/resources/phase-template.md +34 -34
  60. package/.codex/skills/genesis-harness/resources/pitfalls-template.md +22 -22
  61. package/.codex/skills/genesis-harness/resources/planning-tree-template.md +39 -39
  62. package/.codex/skills/genesis-harness/resources/post-implementation-guide.md +347 -347
  63. package/.codex/skills/genesis-harness/resources/project-template.md +38 -38
  64. package/.codex/skills/genesis-harness/resources/quality-score-template.md +11 -11
  65. package/.codex/skills/genesis-harness/resources/requirements-template.md +26 -26
  66. package/.codex/skills/genesis-harness/resources/research-template.md +26 -26
  67. package/.codex/skills/genesis-harness/resources/review-template.md +22 -22
  68. package/.codex/skills/genesis-harness/resources/spec-changelog-template.md +6 -6
  69. package/.codex/skills/genesis-harness/resources/stack-template.md +33 -33
  70. package/.codex/skills/genesis-harness/resources/verification-template.md +26 -26
  71. package/.codex/skills/genesis-harness/scripts/check-architecture-boundaries.sh +0 -0
  72. package/.codex/skills/genesis-harness/scripts/check-docs-sync.sh +0 -0
  73. package/.codex/skills/genesis-harness/scripts/check-no-debug-logs.sh +0 -0
  74. package/.codex/skills/genesis-harness/scripts/check-required-planning-files.sh +0 -0
  75. package/.codex/skills/genesis-harness/scripts/check-spec-changelog.sh +0 -0
  76. package/.codex/skills/genesis-harness/scripts/check-task-tracking.sh +0 -0
  77. package/.codex/skills/genesis-harness/scripts/compact-context.sh +0 -0
  78. package/.codex/skills/genesis-harness/scripts/create-adr.sh +0 -0
  79. package/.codex/skills/genesis-harness/scripts/create-bug.sh +0 -0
  80. package/.codex/skills/genesis-harness/scripts/create-feature.sh +0 -0
  81. package/.codex/skills/genesis-harness/scripts/detect-stack.sh +0 -0
  82. package/.codex/skills/genesis-harness/scripts/init-planning.sh +0 -0
  83. package/.codex/skills/genesis-harness/scripts/list-changed-files.sh +0 -0
  84. package/.codex/skills/genesis-harness/scripts/offload-log.sh +0 -0
  85. package/.codex/skills/genesis-harness/scripts/run-verification.sh +0 -0
  86. package/.codex/skills/genesis-harness/scripts/run-verify-loop.sh +0 -0
  87. package/.codex/skills/genesis-harness/scripts/update-state.sh +0 -0
  88. package/.codex/skills/genesis-mvp-planning/SKILL.md +114 -0
  89. package/.codex/skills/genesis-mvp-planning/agents/openai.yaml +6 -0
  90. package/.codex/skills/genesis-mvp-planning/checklists/mvp-readiness.md +18 -0
  91. package/.codex/skills/genesis-mvp-planning/examples/5-phase-roadmap-example.md +43 -0
  92. package/.codex/skills/genesis-mvp-planning/templates/phase-1-core.md +17 -0
  93. package/.codex/skills/genesis-mvp-planning/templates/phase-2-auth.md +17 -0
  94. package/.codex/skills/genesis-mvp-planning/templates/phase-3-features.md +17 -0
  95. package/.codex/skills/genesis-mvp-planning/templates/phase-4-integrations.md +17 -0
  96. package/.codex/skills/genesis-mvp-planning/templates/phase-5-readiness.md +17 -0
  97. package/.codex/skills/genesis-new-design/agents/openai.yaml +3 -3
  98. package/.codex/skills/genesis-observability-automation/checklists/.gitkeep +0 -0
  99. package/.codex/skills/genesis-observability-automation/observability/.gitkeep +0 -0
  100. package/.codex/skills/genesis-observability-automation/playbooks/.gitkeep +0 -0
  101. package/.codex/skills/genesis-observability-automation/templates/.gitkeep +0 -0
  102. package/.codex/skills/genesis-release-orchestration/SKILL.md +653 -653
  103. package/.codex/skills/genesis-release-orchestration/checklists/post-deployment-verification.md +274 -274
  104. package/.codex/skills/genesis-release-orchestration/checklists/pre-release-validation.md +220 -220
  105. package/.codex/skills/genesis-release-orchestration/observability/release-tracking.md +253 -253
  106. package/.codex/skills/genesis-release-orchestration/playbooks/canary-deployment-orchestration.md +472 -472
  107. package/.codex/skills/genesis-release-orchestration/playbooks/semantic-versioning-automation.md +494 -494
  108. package/.codex/skills/genesis-release-orchestration/templates/deployment-strategy-template.md +303 -303
  109. package/.codex/skills/genesis-release-orchestration/templates/release-runbook-template.md +420 -420
  110. package/.codex/skills/genesis-research-first/SKILL.md +237 -237
  111. package/.codex/skills/genesis-research-first/templates/.gitkeep +0 -0
  112. package/.codex/skills/genesis-spec-propagation/SKILL.md +534 -534
  113. package/.codex/skills/genesis-spec-propagation/checklists/phase-update-verification.md +384 -384
  114. package/.codex/skills/genesis-spec-propagation/checklists/spec-change-detection.md +257 -257
  115. package/.codex/skills/genesis-spec-propagation/observability/propagation-tracking.md +373 -373
  116. package/.codex/skills/genesis-spec-propagation/playbooks/breaking-change-propagation.md +692 -692
  117. package/.codex/skills/genesis-spec-propagation/playbooks/feature-change-propagation.md +434 -434
  118. package/.codex/skills/genesis-spec-propagation/templates/migration-guide-template.md +407 -407
  119. package/.codex/skills/genesis-upgrade-design/agents/openai.yaml +3 -3
  120. package/.codex/skills/spec-impact-engine/SKILL.md +504 -504
  121. package/.codex/skills/spec-impact-engine/detect-spec-changes.sh +0 -0
  122. package/.codex-plugin/plugin.json +19 -19
  123. package/CHANGELOG.md +42 -0
  124. package/LICENSE +22 -22
  125. package/README.EN.md +784 -730
  126. package/README.VI.md +776 -723
  127. package/README.md +102 -247
  128. package/VERSION +2 -2
  129. package/bin/genesis-harness.js +90 -87
  130. package/package.json +9 -3
  131. package/scripts/README.md +342 -342
  132. package/scripts/compact-context.sh +0 -0
  133. package/scripts/contract_integrity_gate.js +83 -0
  134. package/scripts/detect-changes.sh +0 -0
  135. package/scripts/healing_telemetry.js +118 -0
  136. package/scripts/install.sh +4 -1
  137. package/scripts/offload-log.sh +0 -0
  138. package/scripts/prompt_sentinel.js +84 -0
  139. package/scripts/run-evals.sh +1 -0
  140. package/scripts/run-verify-loop.sh +11 -0
  141. package/scripts/spec_visual_sync.js +157 -0
  142. package/scripts/test_generator.js +142 -0
  143. package/scripts/transition_state.sh +0 -0
  144. package/scripts/uninstall.sh +1 -0
  145. package/scripts/validation_gates.sh +40 -1
  146. package/scripts/verify.sh +5 -0
  147. package/tests/unit/contract_integrity_gate.test.js +74 -0
  148. package/tests/unit/healing_telemetry.test.js +58 -0
  149. package/tests/unit/prompt_sentinel.test.js +50 -0
  150. package/tests/unit/spec_visual_sync.test.js +77 -0
  151. package/tests/unit/test_generator.test.js +62 -0
@@ -1,365 +1,365 @@
1
- # Debug Commands by Language
2
-
3
- Quick reference for debugging commands in different languages used in Genesis projects.
4
-
5
- ---
6
-
7
- ## Node.js / JavaScript
8
-
9
- ### Console Methods
10
- ```javascript
11
- // Information
12
- console.log('Message:', value);
13
- console.info('Info message');
14
- console.warn('Warning message');
15
- console.error('Error message');
16
-
17
- // Structured
18
- console.table([{ id: 1, name: 'John' }, { id: 2, name: 'Jane' }]);
19
- console.dir(object);
20
-
21
- // Timing
22
- console.time('label');
23
- // ... code ...
24
- console.timeEnd('label'); // Outputs: label: 1234.56ms
25
-
26
- // Assertions
27
- console.assert(condition, 'Message if assertion fails');
28
-
29
- // Trace
30
- console.trace('Stack trace at this point');
31
-
32
- // Groups
33
- console.group('Group label');
34
- console.log('...logs in group...');
35
- console.groupEnd();
36
- ```
37
-
38
- ### Debugging CLI
39
- ```bash
40
- # Run with Node inspector
41
- node --inspect script.js
42
- node --inspect-brk script.js # Breaks on first line
43
-
44
- # Run Jest with debugging
45
- node --inspect-brk node_modules/.bin/jest --runInBand test.js
46
-
47
- # Open Chrome DevTools: chrome://inspect
48
- ```
49
-
50
- ### Jest/Test Debugging
51
- ```javascript
52
- test('example', () => {
53
- debugger; // Browser debugger breakpoint (if using inspect)
54
- expect(value).toBe(expected);
55
- });
56
-
57
- // Skip a test
58
- test.skip('should do something', () => {});
59
-
60
- // Only run this test
61
- test.only('should do something', () => {});
62
-
63
- // Print all mocks
64
- console.log(jest.fn.mock.calls);
65
- ```
66
-
67
- ---
68
-
69
- ## Python
70
-
71
- ### Print Debugging
72
- ```python
73
- print(f"Value: {value}")
74
- print(f"Type: {type(value)}")
75
- print(f"Dict keys: {obj.__dict__}")
76
-
77
- # Pretty print
78
- import pprint
79
- pprint.pprint(large_dict)
80
-
81
- # JSON
82
- import json
83
- print(json.dumps(obj, indent=2))
84
- ```
85
-
86
- ### Logging
87
- ```python
88
- import logging
89
- logging.basicConfig(level=logging.DEBUG)
90
- logger = logging.getLogger(__name__)
91
-
92
- logger.debug('Debug message')
93
- logger.info('Info message')
94
- logger.warning('Warning message')
95
- logger.error('Error message')
96
-
97
- # With context
98
- logger.info(f'Processing user {user_id}: {user.name}')
99
- ```
100
-
101
- ### Interactive Debugging
102
- ```python
103
- # PDB - Python Debugger
104
- import pdb
105
- pdb.set_trace() # Breakpoint - enters debugger here
106
-
107
- # Or:
108
- breakpoint() # Python 3.7+
109
-
110
- # IPython for interactive shell
111
- from IPython import embed
112
- embed() # Opens interactive IPython shell
113
- ```
114
-
115
- ### Testing
116
- ```python
117
- import unittest
118
-
119
- # Skip test
120
- @unittest.skip("Not implemented")
121
- def test_something(self):
122
- pass
123
-
124
- # Print test details
125
- python -m pytest -v -s test.py # -v verbose, -s show print statements
126
- ```
127
-
128
- ---
129
-
130
- ## PHP
131
-
132
- ### Echo/Print
133
- ```php
134
- echo "Simple output";
135
- print_r($array); // For arrays/objects
136
- var_dump($variable); // Detailed dump with types
137
- var_export($variable); // Machine-readable format
138
- ```
139
-
140
- ### Error Reporting
141
- ```php
142
- // Set error level
143
- ini_set('display_errors', 1);
144
- error_reporting(E_ALL);
145
-
146
- // Log to file
147
- error_log("Debug message", 3, "/tmp/debug.log");
148
- ```
149
-
150
- ### Debugging Tools
151
- ```php
152
- // Xdebug extension (if installed)
153
- var_dump($variable); // With Xdebug: shows enhanced output
154
-
155
- // Fire up debugger breakpoint
156
- xdebug_break();
157
-
158
- // Stack trace
159
- debug_backtrace();
160
- ```
161
-
162
- ### Laravel Specific
163
- ```php
164
- // Log helper
165
- \Log::debug('Message', ['key' => $value]);
166
- \Log::channel('single')->debug('Message');
167
-
168
- // Dump and die
169
- dd($variable);
170
-
171
- // Dump without dying
172
- dump($variable);
173
- ```
174
-
175
- ---
176
-
177
- ## Ruby
178
-
179
- ### Print Debugging
180
- ```ruby
181
- puts "Message: #{value}"
182
- p variable # Inspect format (like Ruby console)
183
- pp object # Pretty print (requires 'pp')
184
- ```
185
-
186
- ### Debugging
187
- ```ruby
188
- # Byebug debugger
189
- require 'byebug'
190
- byebug # Breakpoint - enters debugger
191
-
192
- # Pry (better interactive console)
193
- require 'pry'
194
- binding.pry # Open Pry console here
195
-
196
- # Interactive shell
197
- irb # Interactive Ruby shell
198
- ```
199
-
200
- ### Logging
201
- ```ruby
202
- require 'logger'
203
- logger = Logger.new(STDOUT)
204
- logger.debug("Debug message")
205
- logger.info("Info message")
206
-
207
- # Rails logging
208
- Rails.logger.debug("Message")
209
- ```
210
-
211
- ### Testing
212
- ```bash
213
- # Run single test
214
- ruby -I lib test/test_name.rb
215
-
216
- # Run with debugging
217
- ruby -r pry -I lib test/test_name.rb
218
-
219
- # Rspec with debugging
220
- rspec test_file.rb --format documentation
221
- rspec test_file.rb -e "test name" # Run specific test
222
- ```
223
-
224
- ---
225
-
226
- ## Go
227
-
228
- ### Logging
229
- ```go
230
- import "log"
231
-
232
- log.Println("Standard output")
233
- log.Printf("Formatted: %v, %s", value, text)
234
- log.Fatalf("Fatal error: %v", err) // Prints and exits
235
-
236
- // Structured logging (with external package)
237
- import "github.com/sirupsen/logrus"
238
- log.WithField("user_id", id).Debug("User action")
239
- ```
240
-
241
- ### Debugging
242
- ```go
243
- // Delve debugger
244
- import _ "net/http/pprof"
245
-
246
- // Profiling
247
- import "runtime/pprof"
248
- ```
249
-
250
- ### Testing
251
- ```bash
252
- # Run tests with verbose output
253
- go test -v ./...
254
-
255
- # Run single test
256
- go test -run TestName ./...
257
-
258
- # Show coverage
259
- go test -cover ./...
260
-
261
- # Debug test with dlv
262
- dlv test ./package -- -test.v -test.run TestName
263
- ```
264
-
265
- ---
266
-
267
- ## System / Performance Debugging
268
-
269
- ### Check System Load
270
- ```bash
271
- # Unix/Linux/macOS
272
- top # Real-time CPU/Memory usage
273
- htop # Better interface for top
274
- ps aux # List all processes
275
- uptime # System load average
276
-
277
- # Network
278
- netstat -tuln # Listen ports
279
- lsof -i :8000 # Processes using port 8000
280
-
281
- # File I/O
282
- iotop # I/O by process
283
- ```
284
-
285
- ### Check Application Ports
286
- ```bash
287
- # See if port is in use
288
- lsof -i :3000
289
- netstat -tulpn | grep 3000
290
-
291
- # Kill process on port
292
- kill -9 $(lsof -t -i :3000)
293
- ```
294
-
295
- ### Trace System Calls
296
- ```bash
297
- # Linux
298
- strace command # Show system calls
299
- strace -e trace=network command # Network calls only
300
-
301
- # macOS
302
- dtruss command # Similar to strace
303
- ```
304
-
305
- ---
306
-
307
- ## Browser DevTools
308
-
309
- ### Chrome/Edge DevTools
310
- ```javascript
311
- // Keyboard shortcuts
312
- F12 or Ctrl+Shift+I // Open DevTools
313
- Ctrl+Shift+J // Console
314
- Ctrl+Shift+C // Element picker
315
- Ctrl+Shift+M // Device mode
316
-
317
- // Console commands
318
- console.log(...)
319
- console.time('label')
320
- console.assert(condition, 'message')
321
- ```
322
-
323
- ### Break on Error
324
- ```javascript
325
- // Pause on all exceptions
326
- DevTools → Sources → Pause on exceptions (icon with triangle)
327
-
328
- // Break on specific line
329
- DevTools → Sources → Click line number to set breakpoint
330
-
331
- // Conditional breakpoint
332
- Right-click line → Add conditional breakpoint → Condition
333
- ```
334
-
335
- ---
336
-
337
- ## Environment Inspection
338
-
339
- ### Check Environment
340
- ```bash
341
- # Node.js
342
- node -e "console.log(process.versions)"
343
-
344
- # Python
345
- python -c "import sys; print(sys.version)"
346
-
347
- # Check installed packages
348
- npm list # Node
349
- pip list # Python
350
- gem list # Ruby
351
- ```
352
-
353
- ### Debug Environment Variables
354
- ```bash
355
- # Show all env vars
356
- env | sort
357
- echo $PATH
358
-
359
- # Node.js
360
- console.log(process.env.NODE_ENV)
361
-
362
- # Python
363
- import os
364
- print(os.environ.get('DATABASE_URL'))
365
- ```
1
+ # Debug Commands by Language
2
+
3
+ Quick reference for debugging commands in different languages used in Genesis projects.
4
+
5
+ ---
6
+
7
+ ## Node.js / JavaScript
8
+
9
+ ### Console Methods
10
+ ```javascript
11
+ // Information
12
+ console.log('Message:', value);
13
+ console.info('Info message');
14
+ console.warn('Warning message');
15
+ console.error('Error message');
16
+
17
+ // Structured
18
+ console.table([{ id: 1, name: 'John' }, { id: 2, name: 'Jane' }]);
19
+ console.dir(object);
20
+
21
+ // Timing
22
+ console.time('label');
23
+ // ... code ...
24
+ console.timeEnd('label'); // Outputs: label: 1234.56ms
25
+
26
+ // Assertions
27
+ console.assert(condition, 'Message if assertion fails');
28
+
29
+ // Trace
30
+ console.trace('Stack trace at this point');
31
+
32
+ // Groups
33
+ console.group('Group label');
34
+ console.log('...logs in group...');
35
+ console.groupEnd();
36
+ ```
37
+
38
+ ### Debugging CLI
39
+ ```bash
40
+ # Run with Node inspector
41
+ node --inspect script.js
42
+ node --inspect-brk script.js # Breaks on first line
43
+
44
+ # Run Jest with debugging
45
+ node --inspect-brk node_modules/.bin/jest --runInBand test.js
46
+
47
+ # Open Chrome DevTools: chrome://inspect
48
+ ```
49
+
50
+ ### Jest/Test Debugging
51
+ ```javascript
52
+ test('example', () => {
53
+ debugger; // Browser debugger breakpoint (if using inspect)
54
+ expect(value).toBe(expected);
55
+ });
56
+
57
+ // Skip a test
58
+ test.skip('should do something', () => {});
59
+
60
+ // Only run this test
61
+ test.only('should do something', () => {});
62
+
63
+ // Print all mocks
64
+ console.log(jest.fn.mock.calls);
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Python
70
+
71
+ ### Print Debugging
72
+ ```python
73
+ print(f"Value: {value}")
74
+ print(f"Type: {type(value)}")
75
+ print(f"Dict keys: {obj.__dict__}")
76
+
77
+ # Pretty print
78
+ import pprint
79
+ pprint.pprint(large_dict)
80
+
81
+ # JSON
82
+ import json
83
+ print(json.dumps(obj, indent=2))
84
+ ```
85
+
86
+ ### Logging
87
+ ```python
88
+ import logging
89
+ logging.basicConfig(level=logging.DEBUG)
90
+ logger = logging.getLogger(__name__)
91
+
92
+ logger.debug('Debug message')
93
+ logger.info('Info message')
94
+ logger.warning('Warning message')
95
+ logger.error('Error message')
96
+
97
+ # With context
98
+ logger.info(f'Processing user {user_id}: {user.name}')
99
+ ```
100
+
101
+ ### Interactive Debugging
102
+ ```python
103
+ # PDB - Python Debugger
104
+ import pdb
105
+ pdb.set_trace() # Breakpoint - enters debugger here
106
+
107
+ # Or:
108
+ breakpoint() # Python 3.7+
109
+
110
+ # IPython for interactive shell
111
+ from IPython import embed
112
+ embed() # Opens interactive IPython shell
113
+ ```
114
+
115
+ ### Testing
116
+ ```python
117
+ import unittest
118
+
119
+ # Skip test
120
+ @unittest.skip("Not implemented")
121
+ def test_something(self):
122
+ pass
123
+
124
+ # Print test details
125
+ python -m pytest -v -s test.py # -v verbose, -s show print statements
126
+ ```
127
+
128
+ ---
129
+
130
+ ## PHP
131
+
132
+ ### Echo/Print
133
+ ```php
134
+ echo "Simple output";
135
+ print_r($array); // For arrays/objects
136
+ var_dump($variable); // Detailed dump with types
137
+ var_export($variable); // Machine-readable format
138
+ ```
139
+
140
+ ### Error Reporting
141
+ ```php
142
+ // Set error level
143
+ ini_set('display_errors', 1);
144
+ error_reporting(E_ALL);
145
+
146
+ // Log to file
147
+ error_log("Debug message", 3, "/tmp/debug.log");
148
+ ```
149
+
150
+ ### Debugging Tools
151
+ ```php
152
+ // Xdebug extension (if installed)
153
+ var_dump($variable); // With Xdebug: shows enhanced output
154
+
155
+ // Fire up debugger breakpoint
156
+ xdebug_break();
157
+
158
+ // Stack trace
159
+ debug_backtrace();
160
+ ```
161
+
162
+ ### Laravel Specific
163
+ ```php
164
+ // Log helper
165
+ \Log::debug('Message', ['key' => $value]);
166
+ \Log::channel('single')->debug('Message');
167
+
168
+ // Dump and die
169
+ dd($variable);
170
+
171
+ // Dump without dying
172
+ dump($variable);
173
+ ```
174
+
175
+ ---
176
+
177
+ ## Ruby
178
+
179
+ ### Print Debugging
180
+ ```ruby
181
+ puts "Message: #{value}"
182
+ p variable # Inspect format (like Ruby console)
183
+ pp object # Pretty print (requires 'pp')
184
+ ```
185
+
186
+ ### Debugging
187
+ ```ruby
188
+ # Byebug debugger
189
+ require 'byebug'
190
+ byebug # Breakpoint - enters debugger
191
+
192
+ # Pry (better interactive console)
193
+ require 'pry'
194
+ binding.pry # Open Pry console here
195
+
196
+ # Interactive shell
197
+ irb # Interactive Ruby shell
198
+ ```
199
+
200
+ ### Logging
201
+ ```ruby
202
+ require 'logger'
203
+ logger = Logger.new(STDOUT)
204
+ logger.debug("Debug message")
205
+ logger.info("Info message")
206
+
207
+ # Rails logging
208
+ Rails.logger.debug("Message")
209
+ ```
210
+
211
+ ### Testing
212
+ ```bash
213
+ # Run single test
214
+ ruby -I lib test/test_name.rb
215
+
216
+ # Run with debugging
217
+ ruby -r pry -I lib test/test_name.rb
218
+
219
+ # Rspec with debugging
220
+ rspec test_file.rb --format documentation
221
+ rspec test_file.rb -e "test name" # Run specific test
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Go
227
+
228
+ ### Logging
229
+ ```go
230
+ import "log"
231
+
232
+ log.Println("Standard output")
233
+ log.Printf("Formatted: %v, %s", value, text)
234
+ log.Fatalf("Fatal error: %v", err) // Prints and exits
235
+
236
+ // Structured logging (with external package)
237
+ import "github.com/sirupsen/logrus"
238
+ log.WithField("user_id", id).Debug("User action")
239
+ ```
240
+
241
+ ### Debugging
242
+ ```go
243
+ // Delve debugger
244
+ import _ "net/http/pprof"
245
+
246
+ // Profiling
247
+ import "runtime/pprof"
248
+ ```
249
+
250
+ ### Testing
251
+ ```bash
252
+ # Run tests with verbose output
253
+ go test -v ./...
254
+
255
+ # Run single test
256
+ go test -run TestName ./...
257
+
258
+ # Show coverage
259
+ go test -cover ./...
260
+
261
+ # Debug test with dlv
262
+ dlv test ./package -- -test.v -test.run TestName
263
+ ```
264
+
265
+ ---
266
+
267
+ ## System / Performance Debugging
268
+
269
+ ### Check System Load
270
+ ```bash
271
+ # Unix/Linux/macOS
272
+ top # Real-time CPU/Memory usage
273
+ htop # Better interface for top
274
+ ps aux # List all processes
275
+ uptime # System load average
276
+
277
+ # Network
278
+ netstat -tuln # Listen ports
279
+ lsof -i :8000 # Processes using port 8000
280
+
281
+ # File I/O
282
+ iotop # I/O by process
283
+ ```
284
+
285
+ ### Check Application Ports
286
+ ```bash
287
+ # See if port is in use
288
+ lsof -i :3000
289
+ netstat -tulpn | grep 3000
290
+
291
+ # Kill process on port
292
+ kill -9 $(lsof -t -i :3000)
293
+ ```
294
+
295
+ ### Trace System Calls
296
+ ```bash
297
+ # Linux
298
+ strace command # Show system calls
299
+ strace -e trace=network command # Network calls only
300
+
301
+ # macOS
302
+ dtruss command # Similar to strace
303
+ ```
304
+
305
+ ---
306
+
307
+ ## Browser DevTools
308
+
309
+ ### Chrome/Edge DevTools
310
+ ```javascript
311
+ // Keyboard shortcuts
312
+ F12 or Ctrl+Shift+I // Open DevTools
313
+ Ctrl+Shift+J // Console
314
+ Ctrl+Shift+C // Element picker
315
+ Ctrl+Shift+M // Device mode
316
+
317
+ // Console commands
318
+ console.log(...)
319
+ console.time('label')
320
+ console.assert(condition, 'message')
321
+ ```
322
+
323
+ ### Break on Error
324
+ ```javascript
325
+ // Pause on all exceptions
326
+ DevTools → Sources → Pause on exceptions (icon with triangle)
327
+
328
+ // Break on specific line
329
+ DevTools → Sources → Click line number to set breakpoint
330
+
331
+ // Conditional breakpoint
332
+ Right-click line → Add conditional breakpoint → Condition
333
+ ```
334
+
335
+ ---
336
+
337
+ ## Environment Inspection
338
+
339
+ ### Check Environment
340
+ ```bash
341
+ # Node.js
342
+ node -e "console.log(process.versions)"
343
+
344
+ # Python
345
+ python -c "import sys; print(sys.version)"
346
+
347
+ # Check installed packages
348
+ npm list # Node
349
+ pip list # Python
350
+ gem list # Ruby
351
+ ```
352
+
353
+ ### Debug Environment Variables
354
+ ```bash
355
+ # Show all env vars
356
+ env | sort
357
+ echo $PATH
358
+
359
+ # Node.js
360
+ console.log(process.env.NODE_ENV)
361
+
362
+ # Python
363
+ import os
364
+ print(os.environ.get('DATABASE_URL'))
365
+ ```