Last active
May 21, 2025 15:12
-
-
Save architjn/a9c7264aff57a9fcece262213bd1b26f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
description: On-demand debug logging | |
globs: ["**/*.js","**/*.ts","**/*.jsx","**/*.tsx"] | |
alwaysApply: true | |
--- | |
# Debug Logging Rules | |
## When to add logs | |
- Only if user asks for debug logs | |
- Insert inside specified functions/blocks | |
- Target key variables or steps | |
## Log Format | |
- Use existing logger (console.log or winston) | |
- Prefix with context: function name or file | |
- Example: | |
```js | |
console.log('[addUser] id=', user.id, 'role=', user.role); | |
``` | |
## Edit Scope | |
- Touch only lines needed for log insertion | |
- Don’t remove/alter existing logs | |
- Skip unrelated code | |
## Confidence | |
- Act only if ≥ 90% confident about placement | |
- If unsure, skip and ask the user | |
## Off-limits | |
- No mass instrumentation | |
- No new deps unless asked | |
- Don’t leave dev logs in prod without prompt | |
## Integration | |
- If a logger setup exists, use that | |
- If none, ask before adding one | |
## Diff Hygiene | |
- Show only added log lines | |
- Strip trailing spaces on edited lines | |
## Transparency | |
- Begin with: | |
`Added <N> debug logs in <file>.` | |
- No extra chatter unless asked |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment