Skip to content

Commit a721509

Browse files
committed
docs: neutralize library name-shaming in stackguard's own copy
stackguard's voice should not editorialize about specific libraries being bad — that's the policy author's call, not the tool's. The example policy under examples/ is the place to be opinionated; it's a fictional org's own document. Strip named libraries (lodash, MongoDB, JWT, axios, etc.) from: - README problem statement, ASCII diagram, quickstart, 'what it checks' bullets, and rollout guide - CONTRIBUTING manual-test commands - The bug report issue template's example command - ADR-002 example list - The system prompt sent to the checker model — replaced the named few-shot examples with the underlying rule (match the prompt's explicit words against the policy's explicit words) The example policy under examples/policy.example.md is left intact — it's *meant* to be specific.
1 parent 66d3637 commit a721509

5 files changed

Lines changed: 37 additions & 31 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ assignees: ''
99
## What command did you run?
1010

1111
```bash
12-
# e.g. stackguard check "implement JWT auth from scratch"
12+
# e.g. stackguard check "implement token signing from scratch"
1313
```
1414

1515
## What did you expect to happen?

CONTRIBUTING.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ In another terminal:
1717
```bash
1818
node dist/index.js --help
1919
node dist/index.js init
20-
node dist/index.js check "implement JWT auth from scratch"
20+
node dist/index.js check "implement token signing from scratch"
2121
```
2222

2323
## Manual testing
@@ -32,8 +32,9 @@ The most important paths to exercise before opening a PR:
3232
— should never block on input, must exit non-zero in block mode.
3333
4. **`stackguard wrap -- echo hello`** — should pass through and
3434
echo "hello".
35-
5. **`stackguard wrap -- claude "add MongoDB"`** — full flow including
36-
revising the prompt and re-running the wrapped command.
35+
5. **`stackguard wrap -- claude "add a database connection"`** — full
36+
flow including revising the prompt and re-running the wrapped
37+
command (use a prompt your example policy will actually flag).
3738
6. **`stackguard policy hash`** then setting `policyHash` in
3839
`stackguard.json` — verify hash mismatch detection.
3940

README.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
## The problem
1313

1414
Your team agreed last quarter that all new auth flows go through
15-
`@acme/auth`. Then a developer opens Cursor and types
16-
*"implement JWT auth from scratch with refresh tokens"*. The AI
17-
happily produces 200 lines of custom token signing code. By the time
18-
code review catches it three days later, the developer has shipped
19-
two more features on top and is deep in a different branch.
15+
your shared auth wrapper. Then a developer opens their AI assistant
16+
and asks it to *"implement token signing and refresh from scratch."*
17+
The AI happily produces 200 lines of custom security code. By the
18+
time code review catches it three days later, the developer has
19+
shipped two more features on top and is deep in a different branch.
2020

21-
Same story for *"add a MongoDB connection"* when the policy is
22-
PostgreSQL-only, or *"use lodash to dedupe this array"* when lodash
23-
was banned eighteen months ago. The rules exist. The AI doesn't know
24-
them. The developer forgot — or never read the doc in the first place.
21+
Same story when a prompt asks for a database driver that isn't on
22+
the approved list, or pulls in a utility library the team migrated
23+
off of last year. The rules exist. The AI doesn't know them. The
24+
developer forgot — or never read the doc in the first place.
2525

2626
stackguard catches the violation **before** the prompt reaches the AI.
2727
It compares each prompt to your engineering policy doc, flags
@@ -34,7 +34,7 @@ seconds, with no infrastructure to set up.
3434

3535
```
3636
┌────────────────────────┐
37-
Developer ──▶│ "add MongoDB conn"
37+
Developer ──▶│ "add a DB connection"
3838
└──────────┬─────────────┘
3939
4040
┌────────────────────────┐
@@ -68,10 +68,10 @@ stackguard init
6868
export ANTHROPIC_API_KEY=sk-ant-...
6969

7070
# Direct check
71-
stackguard check "implement JWT auth from scratch"
71+
stackguard check "implement token signing from scratch"
7272

7373
# Wrap your AI assistant
74-
stackguard wrap -- claude "add MongoDB connection"
74+
stackguard wrap -- claude "add a database connection"
7575

7676
# Set it as your default
7777
alias claude='stackguard wrap -- claude'
@@ -82,9 +82,11 @@ alias claude='stackguard wrap -- claude'
8282
## What it checks vs. what it doesn't
8383

8484
**It checks:**
85-
- Explicit prohibited libraries ("use lodash", "add axios")
86-
- Explicit prohibited tech ("add MongoDB", "use Auth0")
87-
- Explicit prohibited patterns ("implement JWT from scratch")
85+
- Prompts that name a library your policy excludes
86+
- Prompts that name a database, framework, or service outside
87+
your approved stack
88+
- Prompts that ask for security primitives your team has agreed
89+
to delegate to a shared wrapper
8890

8991
**It does not check:**
9092
- Vague prompts ("build a login page") — there's nothing to flag yet
@@ -99,8 +101,8 @@ complements, not replaces, linters, CI checks, and code review.
99101
## Team rollout guide
100102

101103
1. **Write your policy.** Start from `examples/policy.example.md`.
102-
The more explicit ("NEVER use MongoDB"), the better stackguard
103-
performs. Vague guidelines produce vague checks.
104+
The more explicit your rules are, the better stackguard performs.
105+
Vague guidelines produce vague checks.
104106

105107
2. **Lock the policy hash.** Run `stackguard policy hash` and paste
106108
the output into `stackguard.json` as `policyHash`. This prevents
@@ -114,9 +116,9 @@ complements, not replaces, linters, CI checks, and code review.
114116
checked by default. Opting out is explicit, not accidental.
115117

116118
5. **Review the audit log weekly.** `stackguard audit --days 7`
117-
shows what was overridden and why. Patterns ("everyone is
118-
overriding the lodash rule") tell you whether the policy needs
119-
updating or whether the rule needs to be more strongly enforced.
119+
shows what was overridden and why. Patterns — the same rule
120+
getting overridden by everyone — tell you whether the policy
121+
needs updating or whether the rule needs to be enforced harder.
120122

121123
---
122124

docs/adr/ADR-002-low-confidence-passthrough.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ note instead of an interactive blocking UI.
2323
- **Low confidence = ambiguous = not worth blocking for.** The model
2424
itself is signaling uncertainty. Acting decisively on uncertain
2525
signals erodes trust in the tool.
26-
- **High and medium confidence violations are explicit** ("use
27-
MongoDB", "implement JWT from scratch") and worth interrupting for.
26+
- **High and medium confidence violations are explicit** — the
27+
prompt names a specific prohibited library, framework, or
28+
pattern by name — and worth interrupting for.
2829

2930
## Consequences
3031

src/lib/checker.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ RULES FOR FLAGGING:
1717
1818
Only flag prompts that explicitly name a prohibited technology,
1919
library, pattern, or approach.
20-
Do NOT flag vague prompts ("build a login page") — the developer
21-
has not specified a prohibited approach.
22-
DO flag "implement JWT auth from scratch" if custom JWT is banned.
23-
DO flag "add MongoDB" if policy requires PostgreSQL.
24-
DO flag "use lodash to filter" if lodash is prohibited.
20+
Do NOT flag vague prompts ("build a login page", "add a user
21+
profile screen") — the developer has not specified a prohibited
22+
approach yet, so there is nothing to compare to the policy.
23+
DO flag prompts that name a specific library, framework, database,
24+
service, or pattern that the policy excludes. The match is between
25+
the prompt's explicit words and the policy's explicit words — not
26+
between your own opinion about the named thing and the policy.
2527
2628
Confidence HIGH: prohibited thing is explicitly and unambiguously named.
2729
Confidence MEDIUM: likely prohibited but slightly indirect.

0 commit comments

Comments
 (0)