@sentry/warden 0.0.0

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 (199) hide show
  1. package/.agents/skills/find-bugs/SKILL.md +75 -0
  2. package/.agents/skills/vercel-react-best-practices/AGENTS.md +2934 -0
  3. package/.agents/skills/vercel-react-best-practices/SKILL.md +136 -0
  4. package/.agents/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  5. package/.agents/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
  6. package/.agents/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
  7. package/.agents/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
  8. package/.agents/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
  9. package/.agents/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
  10. package/.agents/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
  11. package/.agents/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
  12. package/.agents/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
  13. package/.agents/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
  14. package/.agents/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
  15. package/.agents/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  16. package/.agents/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
  17. package/.agents/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
  18. package/.agents/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
  19. package/.agents/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
  20. package/.agents/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
  21. package/.agents/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
  22. package/.agents/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
  23. package/.agents/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
  24. package/.agents/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
  25. package/.agents/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
  26. package/.agents/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
  27. package/.agents/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
  28. package/.agents/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
  29. package/.agents/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
  30. package/.agents/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
  31. package/.agents/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
  32. package/.agents/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
  33. package/.agents/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
  34. package/.agents/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  35. package/.agents/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
  36. package/.agents/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
  37. package/.agents/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  38. package/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  39. package/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
  40. package/.agents/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
  41. package/.agents/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
  42. package/.agents/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
  43. package/.agents/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
  44. package/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
  45. package/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
  46. package/.agents/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
  47. package/.agents/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  48. package/.agents/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
  49. package/.agents/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
  50. package/.agents/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
  51. package/.agents/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
  52. package/.agents/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
  53. package/.agents/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
  54. package/.agents/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
  55. package/.agents/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
  56. package/.agents/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
  57. package/.agents/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
  58. package/.agents/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
  59. package/.agents/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
  60. package/.agents/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
  61. package/.claude/settings.json +57 -0
  62. package/.claude/settings.local.json +88 -0
  63. package/.claude/skills/agent-prompt/SKILL.md +54 -0
  64. package/.claude/skills/agent-prompt/references/agentic-patterns.md +94 -0
  65. package/.claude/skills/agent-prompt/references/anti-patterns.md +140 -0
  66. package/.claude/skills/agent-prompt/references/context-design.md +124 -0
  67. package/.claude/skills/agent-prompt/references/core-principles.md +75 -0
  68. package/.claude/skills/agent-prompt/references/model-guidance.md +118 -0
  69. package/.claude/skills/agent-prompt/references/output-formats.md +98 -0
  70. package/.claude/skills/agent-prompt/references/skill-structure.md +115 -0
  71. package/.claude/skills/agent-prompt/references/system-prompts.md +115 -0
  72. package/.claude/skills/notseer/SKILL.md +131 -0
  73. package/.claude/skills/skill-writer/SKILL.md +140 -0
  74. package/.claude/skills/testing-guidelines/SKILL.md +132 -0
  75. package/.claude/skills/warden-skill/SKILL.md +250 -0
  76. package/.claude/skills/warden-skill/references/config-schema.md +133 -0
  77. package/.dex/config.toml +2 -0
  78. package/.github/workflows/ci.yml +33 -0
  79. package/.github/workflows/release.yml +54 -0
  80. package/.github/workflows/warden.yml +40 -0
  81. package/AGENTS.md +89 -0
  82. package/CONTRIBUTING.md +60 -0
  83. package/LICENSE +105 -0
  84. package/README.md +43 -0
  85. package/SPEC.md +263 -0
  86. package/action.yml +87 -0
  87. package/assets/favicon.png +0 -0
  88. package/assets/warden-icon-bw.svg +5 -0
  89. package/assets/warden-icon-purple.png +0 -0
  90. package/assets/warden-icon-purple.svg +5 -0
  91. package/docs/.claude/settings.local.json +11 -0
  92. package/docs/astro.config.mjs +43 -0
  93. package/docs/package.json +19 -0
  94. package/docs/pnpm-lock.yaml +4000 -0
  95. package/docs/public/favicon.svg +5 -0
  96. package/docs/src/components/Code.astro +141 -0
  97. package/docs/src/components/PackageManagerTabs.astro +183 -0
  98. package/docs/src/components/Terminal.astro +212 -0
  99. package/docs/src/layouts/Base.astro +380 -0
  100. package/docs/src/pages/cli.astro +167 -0
  101. package/docs/src/pages/config.astro +394 -0
  102. package/docs/src/pages/guide.astro +449 -0
  103. package/docs/src/pages/index.astro +490 -0
  104. package/docs/src/styles/global.css +551 -0
  105. package/docs/tsconfig.json +3 -0
  106. package/docs/vercel.json +5 -0
  107. package/eslint.config.js +33 -0
  108. package/package.json +73 -0
  109. package/src/action/index.ts +1 -0
  110. package/src/action/main.ts +868 -0
  111. package/src/cli/args.test.ts +477 -0
  112. package/src/cli/args.ts +415 -0
  113. package/src/cli/commands/add.ts +447 -0
  114. package/src/cli/commands/init.test.ts +136 -0
  115. package/src/cli/commands/init.ts +132 -0
  116. package/src/cli/commands/setup-app/browser.ts +38 -0
  117. package/src/cli/commands/setup-app/credentials.ts +45 -0
  118. package/src/cli/commands/setup-app/manifest.ts +48 -0
  119. package/src/cli/commands/setup-app/server.ts +172 -0
  120. package/src/cli/commands/setup-app.ts +156 -0
  121. package/src/cli/commands/sync.ts +114 -0
  122. package/src/cli/context.ts +131 -0
  123. package/src/cli/files.test.ts +155 -0
  124. package/src/cli/files.ts +89 -0
  125. package/src/cli/fix.test.ts +310 -0
  126. package/src/cli/fix.ts +387 -0
  127. package/src/cli/git.test.ts +119 -0
  128. package/src/cli/git.ts +318 -0
  129. package/src/cli/index.ts +14 -0
  130. package/src/cli/main.ts +672 -0
  131. package/src/cli/output/box.ts +235 -0
  132. package/src/cli/output/formatters.test.ts +187 -0
  133. package/src/cli/output/formatters.ts +269 -0
  134. package/src/cli/output/icons.ts +13 -0
  135. package/src/cli/output/index.ts +44 -0
  136. package/src/cli/output/ink-runner.tsx +337 -0
  137. package/src/cli/output/jsonl.test.ts +347 -0
  138. package/src/cli/output/jsonl.ts +126 -0
  139. package/src/cli/output/reporter.ts +435 -0
  140. package/src/cli/output/tasks.ts +374 -0
  141. package/src/cli/output/tty.test.ts +117 -0
  142. package/src/cli/output/tty.ts +60 -0
  143. package/src/cli/output/verbosity.test.ts +40 -0
  144. package/src/cli/output/verbosity.ts +31 -0
  145. package/src/cli/terminal.test.ts +148 -0
  146. package/src/cli/terminal.ts +301 -0
  147. package/src/config/index.ts +3 -0
  148. package/src/config/loader.test.ts +313 -0
  149. package/src/config/loader.ts +103 -0
  150. package/src/config/schema.ts +168 -0
  151. package/src/config/writer.test.ts +119 -0
  152. package/src/config/writer.ts +84 -0
  153. package/src/diff/classify.test.ts +162 -0
  154. package/src/diff/classify.ts +92 -0
  155. package/src/diff/coalesce.test.ts +208 -0
  156. package/src/diff/coalesce.ts +133 -0
  157. package/src/diff/context.test.ts +226 -0
  158. package/src/diff/context.ts +201 -0
  159. package/src/diff/index.ts +4 -0
  160. package/src/diff/parser.test.ts +212 -0
  161. package/src/diff/parser.ts +149 -0
  162. package/src/event/context.ts +132 -0
  163. package/src/event/index.ts +2 -0
  164. package/src/event/schedule-context.ts +101 -0
  165. package/src/examples/examples.integration.test.ts +66 -0
  166. package/src/examples/index.test.ts +101 -0
  167. package/src/examples/index.ts +122 -0
  168. package/src/examples/setup.ts +25 -0
  169. package/src/index.ts +115 -0
  170. package/src/output/dedup.test.ts +419 -0
  171. package/src/output/dedup.ts +607 -0
  172. package/src/output/github-checks.test.ts +300 -0
  173. package/src/output/github-checks.ts +476 -0
  174. package/src/output/github-issues.ts +329 -0
  175. package/src/output/index.ts +5 -0
  176. package/src/output/issue-renderer.ts +197 -0
  177. package/src/output/renderer.test.ts +727 -0
  178. package/src/output/renderer.ts +217 -0
  179. package/src/output/stale.test.ts +375 -0
  180. package/src/output/stale.ts +155 -0
  181. package/src/output/types.ts +34 -0
  182. package/src/sdk/index.ts +1 -0
  183. package/src/sdk/runner.test.ts +806 -0
  184. package/src/sdk/runner.ts +1232 -0
  185. package/src/skills/index.ts +36 -0
  186. package/src/skills/loader.test.ts +300 -0
  187. package/src/skills/loader.ts +423 -0
  188. package/src/skills/remote.test.ts +704 -0
  189. package/src/skills/remote.ts +604 -0
  190. package/src/triggers/matcher.test.ts +277 -0
  191. package/src/triggers/matcher.ts +152 -0
  192. package/src/types/index.ts +194 -0
  193. package/src/utils/async.ts +18 -0
  194. package/src/utils/index.test.ts +84 -0
  195. package/src/utils/index.ts +50 -0
  196. package/tsconfig.json +25 -0
  197. package/vitest.config.ts +8 -0
  198. package/vitest.integration.config.ts +11 -0
  199. package/warden.toml +19 -0
@@ -0,0 +1,115 @@
1
+ # Skill Structure
2
+
3
+ How to write effective Warden skill files.
4
+
5
+ ## File Format
6
+
7
+ Skills use YAML frontmatter + markdown body:
8
+
9
+ ```markdown
10
+ ---
11
+ name: skill-name
12
+ description: Brief description for discovery and trigger matching.
13
+ allowed-tools: Read Grep Glob
14
+ ---
15
+
16
+ [Prompt body - the actual instructions]
17
+ ```
18
+
19
+ ## Required Frontmatter
20
+
21
+ | Field | Purpose |
22
+ |-------|---------|
23
+ | `name` | Unique identifier, lowercase with hyphens |
24
+ | `description` | One line explaining when to use this skill |
25
+ | `allowed-tools` | Space-separated list (typically `Read Grep Glob`) |
26
+
27
+ ## Recommended Body Structure
28
+
29
+ ```markdown
30
+ [Role statement - who the agent is]
31
+
32
+ ## Your Task
33
+
34
+ [Clear statement of what to analyze]
35
+
36
+ ### [Category 1]
37
+
38
+ - Specific pattern to look for
39
+ - Guiding questions: "Is X happening? Does Y exist?"
40
+
41
+ ### [Category 2]
42
+
43
+ ...
44
+
45
+ ## What NOT to Report
46
+
47
+ [Explicit exclusions prevent scope creep]
48
+
49
+ ## Severity Levels
50
+
51
+ [Definitions tied to impact]
52
+
53
+ ## Output Requirements
54
+
55
+ [Formatting expectations]
56
+ ```
57
+
58
+ ## Effective Patterns
59
+
60
+ ### Guiding Questions
61
+
62
+ Help the agent know what to look for:
63
+
64
+ ```markdown
65
+ ### Injection Vulnerabilities
66
+ - **SQL injection**: User input concatenated into queries instead of parameterized?
67
+ - **Command injection**: User input passed to shell/exec functions?
68
+ ```
69
+
70
+ ### Explicit Exclusions
71
+
72
+ Prevent false positives and scope creep:
73
+
74
+ ```markdown
75
+ ## What NOT to Report
76
+
77
+ - Security vulnerabilities (use security-review skill)
78
+ - Style or formatting issues
79
+ - Code that "could be better" but works correctly
80
+ ```
81
+
82
+ ### Confidence Calibration
83
+
84
+ Set expectations for certainty:
85
+
86
+ ```markdown
87
+ Do NOT use low or info severity - if you're not confident it's a real
88
+ bug, don't report it.
89
+ ```
90
+
91
+ ### Severity Tied to Impact
92
+
93
+ Avoid vague definitions:
94
+
95
+ ```markdown
96
+ - **critical**: Crash, data loss, or silent data corruption
97
+ - **high**: Incorrect behavior in common scenarios
98
+ - **medium**: Incorrect behavior in edge cases
99
+ ```
100
+
101
+ ## File Locations
102
+
103
+ Skills are discovered in order (first match wins):
104
+
105
+ 1. `.warden/skills/{name}/SKILL.md` - Project-specific
106
+ 2. `.agents/skills/{name}/SKILL.md` - Shared agent skills
107
+ 3. `.claude/skills/{name}/SKILL.md` - Claude Code skills
108
+ 4. `skills/{name}/SKILL.md` - Built-in skills
109
+
110
+ ## Examples
111
+
112
+ See existing skills for reference:
113
+ - `skills/security-review/SKILL.md` - Comprehensive checklist approach
114
+ - `skills/find-bugs/SKILL.md` - Confidence-focused with exclusions
115
+ - `skills/code-simplifier/SKILL.md` - Balanced "do/don't" guidance
@@ -0,0 +1,115 @@
1
+ # System Prompts
2
+
3
+ How Warden constructs system prompts and how to customize them.
4
+
5
+ ## Warden's Prompt Architecture
6
+
7
+ Warden builds a two-layer prompt for each analysis:
8
+
9
+ ### System Prompt (Built by Runner)
10
+
11
+ Constructed in `src/sdk/runner.ts`:
12
+
13
+ ```xml
14
+ <role>
15
+ You are a code analysis agent for Warden...
16
+ </role>
17
+
18
+ <tools>
19
+ Available tools: Read, Grep
20
+ </tools>
21
+
22
+ <skill_instructions>
23
+ {skill.prompt injected here}
24
+ </skill_instructions>
25
+
26
+ <output_format>
27
+ JSON schema and requirements
28
+ </output_format>
29
+
30
+ <skill_resources>
31
+ Path to skill assets (if applicable)
32
+ </skill_resources>
33
+ ```
34
+
35
+ ### User Prompt (Per-Hunk)
36
+
37
+ Each code change is analyzed with:
38
+ - Skill name being applied
39
+ - Formatted code context (before/after lines)
40
+ - The diff hunk
41
+ - Instruction to only report matching findings
42
+
43
+ ## XML Tags for Structure
44
+
45
+ Use XML tags to create clear sections:
46
+
47
+ ```xml
48
+ <role>...</role>
49
+ <tools>...</tools>
50
+ <skill_instructions>...</skill_instructions>
51
+ ```
52
+
53
+ **Benefits:**
54
+ - Clear boundaries between sections
55
+ - Model can reference sections by name
56
+ - Consistent parsing and validation
57
+
58
+ ## Role Definition
59
+
60
+ The role section establishes:
61
+
62
+ | Element | Purpose |
63
+ |---------|---------|
64
+ | Identity | What kind of expert is this agent? |
65
+ | Scope | What does it evaluate? What's out of scope? |
66
+ | Stance | Conservative (avoid false positives) or thorough? |
67
+
68
+ **Example:**
69
+ ```xml
70
+ <role>
71
+ You are a code analysis agent for Warden. You evaluate code changes
72
+ against specific skill criteria and report findings ONLY when the code
73
+ violates or conflicts with those criteria.
74
+ </role>
75
+ ```
76
+
77
+ ## Tool Documentation
78
+
79
+ Document available tools clearly:
80
+
81
+ ```xml
82
+ <tools>
83
+ You have access to these tools to gather context:
84
+ - **Read**: Check related files to understand context
85
+ - **Grep**: Search for patterns to trace data flow
86
+ </tools>
87
+ ```
88
+
89
+ ## Claude Agent SDK Options
90
+
91
+ From [Anthropic's SDK documentation](https://platform.claude.com/docs/en/agent-sdk/modifying-system-prompts):
92
+
93
+ | Option | Effect |
94
+ |--------|--------|
95
+ | `systemPrompt: string` | Replace default entirely |
96
+ | `systemPrompt: { preset: "claude_code" }` | Use full Claude Code prompt |
97
+ | `systemPrompt: { preset: "claude_code", append: "..." }` | Add to Claude Code prompt |
98
+
99
+ **Note:** The SDK's minimal default omits coding guidelines. Use `preset: "claude_code"` for full capabilities.
100
+
101
+ ## CLAUDE.md Integration
102
+
103
+ Project-level context via CLAUDE.md requires explicit configuration:
104
+
105
+ ```typescript
106
+ options: {
107
+ systemPrompt: { preset: "claude_code" },
108
+ settingSources: ["project"], // Required to load CLAUDE.md
109
+ }
110
+ ```
111
+
112
+ ## Sources
113
+
114
+ - [Anthropic: Modifying System Prompts](https://platform.claude.com/docs/en/agent-sdk/modifying-system-prompts)
115
+ - `src/sdk/runner.ts` - Warden's implementation
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: notseer
3
+ description: High-precision bug detection. Every report is a proof, not a suspicion. Finds logic errors, null handling bugs, async issues, and edge cases with certainty.
4
+ allowed-tools: Read Grep Glob
5
+ ---
6
+
7
+ You are an expert bug hunter analyzing code changes. Your reports are proofs, not suspicions.
8
+
9
+ ## Core Principle
10
+
11
+ **Certainty-based reporting**: Every bug report must be provable from the code. If you cannot construct a concrete proof that code will fail, do not report it.
12
+
13
+ ## The 5-Point Proof
14
+
15
+ Before reporting ANY bug, you MUST be able to answer ALL five:
16
+
17
+ 1. **Location**: What exact file and line is wrong?
18
+ 2. **Behavior**: What incorrect output, state, or crash will occur?
19
+ 3. **Trigger**: What specific input or condition causes it?
20
+ 4. **Root Cause**: Why doesn't the code handle this case?
21
+ 5. **Confidence**: Would another engineer agree this is a bug without debate?
22
+
23
+ If you cannot complete all 5, it is speculation—do NOT report.
24
+
25
+ ## Bug Categories
26
+
27
+ ### Null & Undefined Access
28
+ - Property access without null check
29
+ - Missing guard after nullable operation
30
+ - Optional chaining hiding real errors
31
+ - Array access without bounds checking
32
+
33
+ ### Off-by-One and Boundary Errors
34
+ - Loop misses first or last element
35
+ - Array index calculation off by one
36
+ - Inclusive/exclusive range confusion
37
+ - Boundary value handling (min/max)
38
+
39
+ ### Logic Errors
40
+ - Condition negated incorrectly
41
+ - `&&` / `||` swapped
42
+ - Wrong comparison operator (`<` vs `<=`, `==` vs `===`)
43
+ - Missing else branches or switch cases
44
+ - Short-circuit evaluation hiding bugs
45
+ - Assignment in conditional (`=` vs `==`)
46
+
47
+ ### Async & Promise Bugs
48
+ - Missing `await` on async operations
49
+ - Unhandled promise rejections
50
+ - Race conditions in parallel mutation
51
+ - Stale closures capturing outdated values
52
+
53
+ ### Type Coercion
54
+ - String concat instead of number add (`"1" + 1 = "11"`)
55
+ - Truthiness check where `0` or `""` is valid
56
+ - Implicit coercion causing unexpected behavior
57
+
58
+ ### State & Data Bugs
59
+ - Unintended mutation of shared objects/arrays
60
+ - State updates based on stale values
61
+ - Incorrect shallow vs deep copy
62
+ - Missing React hook dependencies
63
+ - Return statement inside finally block
64
+
65
+ ### Copy-Paste Errors
66
+ - Wrong variable from copy-paste
67
+ - Incomplete find-replace
68
+ - Partial refactor leaving inconsistency
69
+
70
+ ### Edge Cases
71
+ - Empty array/string not handled
72
+ - Division by zero possible
73
+ - Integer overflow/underflow
74
+
75
+ ## What NOT to Report
76
+
77
+ Do NOT report:
78
+ - Style or formatting preferences
79
+ - "Could be cleaner" suggestions
80
+ - Speculative "might be a problem" issues
81
+ - Performance concerns (unless causing incorrect behavior)
82
+ - Security vulnerabilities (use security-review skill)
83
+ - Missing error handling that "might" matter
84
+ - Incomplete implementations (unless they'll crash)
85
+ - Unused variables or dead code
86
+ - Missing tests or documentation
87
+
88
+ If linters or type checkers would catch it, don't report it.
89
+
90
+ ## Analysis Method
91
+
92
+ 1. **Read enough context.** Understand what the code is trying to do before judging correctness. If unsure, read more files.
93
+
94
+ 2. **Trace data flow.** Follow values from source to use. Where could they be null, empty, wrong type?
95
+
96
+ 3. **Check boundaries.** Empty input? Null? Zero? Negative? First/last element? Max values?
97
+
98
+ 4. **Verify async.** Every promise awaited? Can operations race? Are closures stale?
99
+
100
+ 5. **Spot copy-paste.** Similar blocks with inconsistent variable names are a top source of bugs.
101
+
102
+ 6. **Never guess.** If uncertain whether something is a bug, read more code. Do not speculate.
103
+
104
+ ## Pre-Report Checklist
105
+
106
+ Before reporting each bug, verify:
107
+ - [ ] I am certain this code is wrong
108
+ - [ ] I can explain exactly what breaks and when
109
+ - [ ] I have read enough context to understand intent
110
+ - [ ] Another engineer would agree this is a bug, not a style preference
111
+ - [ ] I can construct a specific input or condition that triggers failure
112
+
113
+ If ANY answer is no, do not report.
114
+
115
+ ## Severity Levels
116
+
117
+ - **critical**: Crash, data loss, or silent data corruption in normal usage paths
118
+ - **high**: Incorrect behavior users will encounter in common scenarios
119
+ - **medium**: Incorrect behavior requiring specific edge conditions to trigger
120
+
121
+ Do NOT use low or info. If confidence is that low, don't report it.
122
+
123
+ ## Output Format
124
+
125
+ For each bug:
126
+ - File path and line number
127
+ - One sentence: what's wrong
128
+ - Trigger: the specific condition that causes failure
129
+ - Suggested fix (only if the fix is clear and obvious)
130
+
131
+ Be concise. Focus on the proof, not general advice.
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: Skill Writer
3
+ description: Generate valid Warden skill definitions from natural language descriptions
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ Describe what the skill should do, and this will generate a complete skill YAML file.
9
+
10
+ ## Instructions
11
+
12
+ When the user describes a skill they want to create:
13
+
14
+ 1. **Understand the Purpose**: Clarify what the skill should analyze or check
15
+ 2. **Design the Prompt**: Write a clear, specific system prompt for the Claude agent
16
+ 3. **Configure Tools**: Select appropriate tool restrictions based on the skill's needs
17
+ 4. **Define Output Expectations**: Ensure the skill will produce valid SkillReport output
18
+
19
+ ## Skill Definition Schema
20
+
21
+ ```yaml
22
+ name: skill-name # kebab-case, unique identifier
23
+ description: Short description of what the skill does
24
+
25
+ prompt: |
26
+ Detailed instructions for the Claude agent.
27
+ - What to analyze
28
+ - What to look for
29
+ - How to categorize findings
30
+ - Severity guidelines
31
+
32
+ tools:
33
+ allowed: # Tools the skill CAN use
34
+ - Read
35
+ - Grep
36
+ - Glob
37
+ - WebFetch
38
+ - WebSearch
39
+ denied: # Tools the skill CANNOT use
40
+ - Write
41
+ - Edit
42
+ - Bash
43
+ ```
44
+
45
+ ## Available Tools
46
+
47
+ | Tool | Purpose | When to Allow |
48
+ |------|---------|---------------|
49
+ | Read | Read file contents | Analysis skills (always) |
50
+ | Grep | Search file contents | Finding patterns/issues |
51
+ | Glob | Find files by pattern | Discovering relevant files |
52
+ | WebFetch | Fetch URL content | CVE lookups, doc references |
53
+ | WebSearch | Web search | External information |
54
+ | Write | Create files | NEVER for review skills |
55
+ | Edit | Modify files | Auto-fix skills only |
56
+ | Bash | Run commands | Test runners, builds |
57
+
58
+ ## Severity Guidelines
59
+
60
+ Instruct skills to use these severity levels:
61
+
62
+ - **critical**: Actively exploitable, high impact, immediate action required
63
+ - **high**: Exploitable with moderate effort, should fix before merge
64
+ - **medium**: Potential issue, needs review and consideration
65
+ - **low**: Minor concern, fix when convenient
66
+ - **info**: Observation, no action required
67
+
68
+ ## Output Schema
69
+
70
+ All skills must output a SkillReport:
71
+
72
+ ```typescript
73
+ {
74
+ skill: string; // Skill name
75
+ summary: string; // Brief overview of findings
76
+ findings: [{
77
+ id: string; // Unique finding ID
78
+ severity: 'critical' | 'high' | 'medium' | 'low' | 'info';
79
+ title: string; // Short title
80
+ description: string; // Detailed explanation
81
+ location?: { // Where the issue is
82
+ path: string;
83
+ startLine: number;
84
+ endLine?: number;
85
+ };
86
+ suggestedFix?: { // Optional fix
87
+ description: string;
88
+ diff: string; // Unified diff format
89
+ };
90
+ }];
91
+ metadata?: Record<string, unknown>;
92
+ }
93
+ ```
94
+
95
+ ## Example Output
96
+
97
+ When asked to create a skill, output the complete YAML:
98
+
99
+ ```yaml
100
+ name: test-coverage
101
+ description: Check if new code has adequate test coverage
102
+
103
+ prompt: |
104
+ You are a test coverage analyst. Review the PR changes and check:
105
+
106
+ 1. New functions/methods have corresponding tests
107
+ 2. Edge cases are covered
108
+ 3. Error paths are tested
109
+ 4. Test names are descriptive
110
+
111
+ Focus on:
112
+ - New code additions (not modifications to existing tests)
113
+ - Public APIs and exported functions
114
+ - Complex logic branches
115
+
116
+ Severity levels:
117
+ - high: Public API with no tests
118
+ - medium: Complex logic without edge case tests
119
+ - low: Missing negative/error case tests
120
+ - info: Suggestions for additional coverage
121
+
122
+ tools:
123
+ allowed:
124
+ - Read
125
+ - Grep
126
+ - Glob
127
+ denied:
128
+ - Write
129
+ - Edit
130
+ - Bash
131
+ - WebFetch
132
+ - WebSearch
133
+ ```
134
+
135
+ ## Process
136
+
137
+ 1. Ask clarifying questions if the skill purpose is unclear
138
+ 2. Generate the skill YAML
139
+ 3. Explain any design decisions
140
+ 4. Offer to refine based on feedback
@@ -0,0 +1,132 @@
1
+ ---
2
+ name: testing-guidelines
3
+ description: Guide for writing tests. Use when adding new functionality, fixing bugs, or when tests are needed. Emphasizes integration tests, real-world fixtures, and regression coverage.
4
+ ---
5
+
6
+ # Testing Guidelines
7
+
8
+ Follow these principles when writing tests for this codebase.
9
+
10
+ ## Core Principles
11
+
12
+ ### 1. Mock External Services, Use Real Fixtures
13
+
14
+ **ALWAYS** mock third-party network services. **ALWAYS** use fixtures based on real-world data.
15
+
16
+ - Fixtures must be scrubbed of PII (use dummy data like `foo@example.com`, `user-123`)
17
+ - Capture real API responses, then sanitize them
18
+ - Never make actual network calls in tests
19
+
20
+ ### 2. Prefer Integration Tests Over Unit Tests
21
+
22
+ Focus on **end-to-end style tests** that validate inputs and outputs, not implementation details.
23
+
24
+ - Test the public interface, not internal methods
25
+ - Unit tests are valuable for edge cases in pure functions, but integration tests are the priority
26
+ - If refactoring breaks tests but behavior is unchanged, the tests were too coupled to implementation
27
+
28
+ ### 3. Minimize Edge Case Testing
29
+
30
+ Don't test every variant of a problem.
31
+
32
+ - Cover the **common path** thoroughly
33
+ - Skip exhaustive input permutations
34
+ - Skip unlikely edge cases that add maintenance burden without value
35
+ - One representative test per category of input is usually sufficient
36
+
37
+ ### 4. Always Add Regression Tests for Bugs
38
+
39
+ When a **bug** is identified, **ALWAYS** add a test that would have caught it.
40
+
41
+ - The test should fail before the fix and pass after
42
+ - Name it descriptively to document the bug
43
+ - This prevents the same bug from recurring
44
+
45
+ **Note:** Regression tests are for unintentional broken behavior (bugs), not intentional changes. Intentional feature removals, deprecations, or breaking changes do NOT need regression tests—these are design decisions, not defects.
46
+
47
+ ### 5. Cover Every User Entry Point
48
+
49
+ **ALWAYS** have at least one basic test for each customer/user entry point.
50
+
51
+ - CLI commands, API endpoints, public/exported functions
52
+ - Test the common/happy path first
53
+ - This proves the entry point works at all
54
+
55
+ **Note:** "Entry point" means the public interface—exported functions, CLI commands, API routes. Internal/private functions are NOT entry points, even if they handle user-facing flags or options. Test entry points; internal functions get coverage through those tests.
56
+
57
+ ### 6. Tests Validate Before Manual QA
58
+
59
+ Tests are how we validate **ANY** functionality works before manual testing.
60
+
61
+ - Write tests first or alongside code, not as an afterthought
62
+ - If you can't test it, reconsider the design
63
+ - Passing tests should give confidence to ship
64
+
65
+ ## Technical Guidelines
66
+
67
+ ### File Organization
68
+
69
+ - Test files use `*.test.ts` extension
70
+ - Co-locate tests with source: `foo.ts` → `foo.test.ts`
71
+
72
+ ### Test Isolation
73
+
74
+ Every test must:
75
+ - Run independently without affecting other tests
76
+ - Use temporary directories for file operations
77
+ - Clean up resources in `afterEach` hooks
78
+
79
+ ```typescript
80
+ import { describe, it, expect, beforeEach, afterEach } from 'vitest';
81
+ import { mkdirSync, rmSync, writeFileSync } from 'node:fs';
82
+ import { join } from 'node:path';
83
+ import { tmpdir } from 'node:os';
84
+
85
+ describe('my feature', () => {
86
+ let tempDir: string;
87
+
88
+ beforeEach(() => {
89
+ tempDir = join(tmpdir(), `warden-test-${Date.now()}`);
90
+ mkdirSync(tempDir, { recursive: true });
91
+ });
92
+
93
+ afterEach(() => {
94
+ rmSync(tempDir, { recursive: true, force: true });
95
+ });
96
+
97
+ it('does something with files', () => {
98
+ writeFileSync(join(tempDir, 'test.ts'), 'content');
99
+ // ... test code
100
+ });
101
+ });
102
+ ```
103
+
104
+ ### Pure Function Tests
105
+
106
+ For pure functions without side effects, no special setup is needed:
107
+
108
+ ```typescript
109
+ import { describe, it, expect } from 'vitest';
110
+ import { matchGlob } from './matcher.js';
111
+
112
+ describe('matchGlob', () => {
113
+ it('matches exact paths', () => {
114
+ expect(matchGlob('src/index.ts', 'src/index.ts')).toBe(true);
115
+ });
116
+ });
117
+ ```
118
+
119
+ ## Running Tests
120
+
121
+ ```bash
122
+ pnpm test # Run all tests in watch mode
123
+ pnpm test:run # Run all tests once
124
+ ```
125
+
126
+ ## Checklist Before Submitting
127
+
128
+ - [ ] New entry points have at least one happy-path test
129
+ - [ ] Bug fixes (not intentional changes) include a regression test
130
+ - [ ] External services are mocked with sanitized fixtures
131
+ - [ ] Tests validate behavior, not implementation
132
+ - [ ] No shared state between tests