agent-quality-police 0.2.9 → 0.2.11
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.
- package/.agents/skills/anti-bypass-audit/SKILL.md +1 -0
- package/.agents/skills/typescript-zero-bypass/SKILL.md +10 -2
- package/.claude/agents/bypass-auditor.md +1 -0
- package/.claude/rules/typescript-zero-bypass.md +1 -0
- package/.claude/skills/anti-bypass-audit/SKILL.md +1 -0
- package/.claude/skills/typescript-zero-bypass/SKILL.md +10 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.codex/agents/bypass-auditor.toml +1 -0
- package/.codex-plugin/plugin.json +1 -1
- package/.opencode/agents/bypass-auditor.md +1 -0
- package/.opencode/skills/anti-bypass-audit/SKILL.md +1 -0
- package/.opencode/skills/typescript-zero-bypass/SKILL.md +10 -2
- package/docs/policy/quality-definition.md +3 -0
- package/package.json +1 -1
|
@@ -43,6 +43,7 @@ Find and report bypasses with short, evidence-based language. This skill is not
|
|
|
43
43
|
- constructor bypass
|
|
44
44
|
- prototype fabrication
|
|
45
45
|
- internal field hydration that fakes a valid class instance
|
|
46
|
+
- single-letter callback parameters or other meaningless abbreviations that hide domain meaning
|
|
46
47
|
- helper or factory noise hiding test intent
|
|
47
48
|
- mocks that replace the behavior under test
|
|
48
49
|
|
|
@@ -23,16 +23,20 @@ Define what acceptable TypeScript looks like in this framework. The compiler is
|
|
|
23
23
|
2. Model the allowed states explicitly with interfaces and named unions.
|
|
24
24
|
3. Keep absence explicit with `null` when the domain has “no value.”
|
|
25
25
|
4. If external input is involved, validate it at the boundary instead of coercing it internally.
|
|
26
|
-
5. If the compiler resists, redesign the model or the control flow. Do not cast.
|
|
26
|
+
5. If the compiler resists, redesign the model or the control flow. Do not cast, fabricate instances, or hide meaning behind abbreviations.
|
|
27
27
|
|
|
28
28
|
## Quality Criteria
|
|
29
29
|
|
|
30
30
|
- No `any`
|
|
31
31
|
- No `as`, `as const`, chained assertions, angle-bracket assertions, or non-null assertions
|
|
32
32
|
- No ts-comment bypasses
|
|
33
|
-
- No inline structural types
|
|
33
|
+
- No inline structural types, including private methods, local helpers, and return types
|
|
34
|
+
- No inline structural object return types such as `(): { completed: number; total: number }`
|
|
34
35
|
- No `Record` or index signatures as generic escape hatches
|
|
35
36
|
- No `Map` used to avoid modeling a named input contract
|
|
37
|
+
- No `Object.create(SomeClass.prototype)` or equivalent prototype fabrication to fake typed instances
|
|
38
|
+
- No `Object.assign(...)` or direct internal field hydration to bypass constructors, factories, or invariants
|
|
39
|
+
- No meaningless abbreviations in identifiers, including single-letter callback parameters such as `c`, `x`, or `i` when they do not carry real meaning
|
|
36
40
|
- Named types instead of anonymous structural sprawl
|
|
37
41
|
|
|
38
42
|
## Anti-Patterns
|
|
@@ -40,6 +44,9 @@ Define what acceptable TypeScript looks like in this framework. The compiler is
|
|
|
40
44
|
- Adding `if (!value) return fallback` only to narrow a type you modeled poorly
|
|
41
45
|
- Smuggling domain uncertainty through `Record<string, string>`
|
|
42
46
|
- Smuggling domain uncertainty through `Map<string, string>` in a public or domain-facing signature
|
|
47
|
+
- Fabricating a typed instance with `Object.create(SomeClass.prototype)` and then hydrating internal fields
|
|
48
|
+
- Returning inline structural objects from private methods or helpers instead of naming the concept
|
|
49
|
+
- Writing `this.allChecklists.find((c) => c.id === checklistId)` instead of using a meaningful callback name
|
|
43
50
|
- Using a test helper to hide an imprecise type instead of fixing the model
|
|
44
51
|
|
|
45
52
|
## Hard Cases
|
|
@@ -47,6 +54,7 @@ Define what acceptable TypeScript looks like in this framework. The compiler is
|
|
|
47
54
|
- For external input, validate at the edge and convert into explicit internal types.
|
|
48
55
|
- For collection lookups, model the input structure explicitly and translate `undefined` to a named result shape before it reaches the domain.
|
|
49
56
|
- For literals, prefer explicit unions declared once instead of assertion-based narrowing.
|
|
57
|
+
- For framework or class instances, use the real constructor or a real public factory. If the current API makes honest construction impossible, refactor the API instead of fabricating instances.
|
|
50
58
|
|
|
51
59
|
## Examples
|
|
52
60
|
|
|
@@ -36,6 +36,7 @@ You must actively hunt for:
|
|
|
36
36
|
- constructor bypass
|
|
37
37
|
- prototype fabrication such as `Object.create(SomeClass.prototype)`
|
|
38
38
|
- internal field hydration such as `Object.assign(...)` into fabricated instances
|
|
39
|
+
- meaningless abbreviations such as single-letter callback parameters with no real domain meaning
|
|
39
40
|
- helper noise
|
|
40
41
|
- mocks with no probative value
|
|
41
42
|
|
|
@@ -11,6 +11,7 @@ paths:
|
|
|
11
11
|
- Require named interfaces and named unions instead of inline structural types.
|
|
12
12
|
- Prohibit `Object.create(SomeClass.prototype)` and equivalent prototype fabrication to fake typed instances.
|
|
13
13
|
- Prohibit `Object.assign(...)` or direct internal field hydration when used to bypass constructors, factories, or invariants.
|
|
14
|
+
- Prohibit meaningless abbreviations in identifiers, including single-letter callback parameters such as `c`, `x`, or `i` when they do not carry real meaning.
|
|
14
15
|
- Reject `Record` and index signatures when they are used as generic escape hatches.
|
|
15
16
|
- Do not add branches or fallback values solely to satisfy the compiler.
|
|
16
17
|
- If the type system is resisting, remodel the data instead of coercing it.
|
|
@@ -43,6 +43,7 @@ Find and report bypasses with short, evidence-based language. This skill is not
|
|
|
43
43
|
- constructor bypass
|
|
44
44
|
- prototype fabrication
|
|
45
45
|
- internal field hydration that fakes a valid class instance
|
|
46
|
+
- single-letter callback parameters or other meaningless abbreviations that hide domain meaning
|
|
46
47
|
- helper or factory noise hiding test intent
|
|
47
48
|
- mocks that replace the behavior under test
|
|
48
49
|
|
|
@@ -23,16 +23,20 @@ Define what acceptable TypeScript looks like in this framework. The compiler is
|
|
|
23
23
|
2. Model the allowed states explicitly with interfaces and named unions.
|
|
24
24
|
3. Keep absence explicit with `null` when the domain has “no value.”
|
|
25
25
|
4. If external input is involved, validate it at the boundary instead of coercing it internally.
|
|
26
|
-
5. If the compiler resists, redesign the model or the control flow. Do not cast.
|
|
26
|
+
5. If the compiler resists, redesign the model or the control flow. Do not cast, fabricate instances, or hide meaning behind abbreviations.
|
|
27
27
|
|
|
28
28
|
## Quality Criteria
|
|
29
29
|
|
|
30
30
|
- No `any`
|
|
31
31
|
- No `as`, `as const`, chained assertions, angle-bracket assertions, or non-null assertions
|
|
32
32
|
- No ts-comment bypasses
|
|
33
|
-
- No inline structural types
|
|
33
|
+
- No inline structural types, including private methods, local helpers, and return types
|
|
34
|
+
- No inline structural object return types such as `(): { completed: number; total: number }`
|
|
34
35
|
- No `Record` or index signatures as generic escape hatches
|
|
35
36
|
- No `Map` used to avoid modeling a named input contract
|
|
37
|
+
- No `Object.create(SomeClass.prototype)` or equivalent prototype fabrication to fake typed instances
|
|
38
|
+
- No `Object.assign(...)` or direct internal field hydration to bypass constructors, factories, or invariants
|
|
39
|
+
- No meaningless abbreviations in identifiers, including single-letter callback parameters such as `c`, `x`, or `i` when they do not carry real meaning
|
|
36
40
|
- Named types instead of anonymous structural sprawl
|
|
37
41
|
|
|
38
42
|
## Anti-Patterns
|
|
@@ -40,6 +44,9 @@ Define what acceptable TypeScript looks like in this framework. The compiler is
|
|
|
40
44
|
- Adding `if (!value) return fallback` only to narrow a type you modeled poorly
|
|
41
45
|
- Smuggling domain uncertainty through `Record<string, string>`
|
|
42
46
|
- Smuggling domain uncertainty through `Map<string, string>` in a public or domain-facing signature
|
|
47
|
+
- Fabricating a typed instance with `Object.create(SomeClass.prototype)` and then hydrating internal fields
|
|
48
|
+
- Returning inline structural objects from private methods or helpers instead of naming the concept
|
|
49
|
+
- Writing `this.allChecklists.find((c) => c.id === checklistId)` instead of using a meaningful callback name
|
|
43
50
|
- Using a test helper to hide an imprecise type instead of fixing the model
|
|
44
51
|
|
|
45
52
|
## Hard Cases
|
|
@@ -47,6 +54,7 @@ Define what acceptable TypeScript looks like in this framework. The compiler is
|
|
|
47
54
|
- For external input, validate at the edge and convert into explicit internal types.
|
|
48
55
|
- For collection lookups, model the input structure explicitly and translate `undefined` to a named result shape before it reaches the domain.
|
|
49
56
|
- For literals, prefer explicit unions declared once instead of assertion-based narrowing.
|
|
57
|
+
- For framework or class instances, use the real constructor or a real public factory. If the current API makes honest construction impossible, refactor the API instead of fabricating instances.
|
|
50
58
|
|
|
51
59
|
## Examples
|
|
52
60
|
|
|
@@ -30,6 +30,7 @@ You must actively hunt for:
|
|
|
30
30
|
- constructor bypass
|
|
31
31
|
- prototype fabrication such as `Object.create(SomeClass.prototype)`
|
|
32
32
|
- internal field hydration such as `Object.assign(...)` into fabricated instances
|
|
33
|
+
- meaningless abbreviations such as single-letter callback parameters with no real domain meaning
|
|
33
34
|
- helper noise
|
|
34
35
|
- mocks with no probative value
|
|
35
36
|
|
|
@@ -34,6 +34,7 @@ You must actively hunt for:
|
|
|
34
34
|
- constructor bypass
|
|
35
35
|
- prototype fabrication such as `Object.create(SomeClass.prototype)`
|
|
36
36
|
- internal field hydration such as `Object.assign(...)` into fabricated instances
|
|
37
|
+
- meaningless abbreviations such as single-letter callback parameters with no real domain meaning
|
|
37
38
|
- helper noise
|
|
38
39
|
- mocks with no probative value
|
|
39
40
|
|
|
@@ -43,6 +43,7 @@ Find and report bypasses with short, evidence-based language. This skill is not
|
|
|
43
43
|
- constructor bypass
|
|
44
44
|
- prototype fabrication
|
|
45
45
|
- internal field hydration that fakes a valid class instance
|
|
46
|
+
- single-letter callback parameters or other meaningless abbreviations that hide domain meaning
|
|
46
47
|
- helper or factory noise hiding test intent
|
|
47
48
|
- mocks that replace the behavior under test
|
|
48
49
|
|
|
@@ -23,16 +23,20 @@ Define what acceptable TypeScript looks like in this framework. The compiler is
|
|
|
23
23
|
2. Model the allowed states explicitly with interfaces and named unions.
|
|
24
24
|
3. Keep absence explicit with `null` when the domain has “no value.”
|
|
25
25
|
4. If external input is involved, validate it at the boundary instead of coercing it internally.
|
|
26
|
-
5. If the compiler resists, redesign the model or the control flow. Do not cast.
|
|
26
|
+
5. If the compiler resists, redesign the model or the control flow. Do not cast, fabricate instances, or hide meaning behind abbreviations.
|
|
27
27
|
|
|
28
28
|
## Quality Criteria
|
|
29
29
|
|
|
30
30
|
- No `any`
|
|
31
31
|
- No `as`, `as const`, chained assertions, angle-bracket assertions, or non-null assertions
|
|
32
32
|
- No ts-comment bypasses
|
|
33
|
-
- No inline structural types
|
|
33
|
+
- No inline structural types, including private methods, local helpers, and return types
|
|
34
|
+
- No inline structural object return types such as `(): { completed: number; total: number }`
|
|
34
35
|
- No `Record` or index signatures as generic escape hatches
|
|
35
36
|
- No `Map` used to avoid modeling a named input contract
|
|
37
|
+
- No `Object.create(SomeClass.prototype)` or equivalent prototype fabrication to fake typed instances
|
|
38
|
+
- No `Object.assign(...)` or direct internal field hydration to bypass constructors, factories, or invariants
|
|
39
|
+
- No meaningless abbreviations in identifiers, including single-letter callback parameters such as `c`, `x`, or `i` when they do not carry real meaning
|
|
36
40
|
- Named types instead of anonymous structural sprawl
|
|
37
41
|
|
|
38
42
|
## Anti-Patterns
|
|
@@ -40,6 +44,9 @@ Define what acceptable TypeScript looks like in this framework. The compiler is
|
|
|
40
44
|
- Adding `if (!value) return fallback` only to narrow a type you modeled poorly
|
|
41
45
|
- Smuggling domain uncertainty through `Record<string, string>`
|
|
42
46
|
- Smuggling domain uncertainty through `Map<string, string>` in a public or domain-facing signature
|
|
47
|
+
- Fabricating a typed instance with `Object.create(SomeClass.prototype)` and then hydrating internal fields
|
|
48
|
+
- Returning inline structural objects from private methods or helpers instead of naming the concept
|
|
49
|
+
- Writing `this.allChecklists.find((c) => c.id === checklistId)` instead of using a meaningful callback name
|
|
43
50
|
- Using a test helper to hide an imprecise type instead of fixing the model
|
|
44
51
|
|
|
45
52
|
## Hard Cases
|
|
@@ -47,6 +54,7 @@ Define what acceptable TypeScript looks like in this framework. The compiler is
|
|
|
47
54
|
- For external input, validate at the edge and convert into explicit internal types.
|
|
48
55
|
- For collection lookups, model the input structure explicitly and translate `undefined` to a named result shape before it reaches the domain.
|
|
49
56
|
- For literals, prefer explicit unions declared once instead of assertion-based narrowing.
|
|
57
|
+
- For framework or class instances, use the real constructor or a real public factory. If the current API makes honest construction impossible, refactor the API instead of fabricating instances.
|
|
50
58
|
|
|
51
59
|
## Examples
|
|
52
60
|
|
|
@@ -53,6 +53,7 @@ Fraud includes:
|
|
|
53
53
|
- adding impossible fallback branches, fake narrowing, or defensive code only to satisfy TypeScript
|
|
54
54
|
- constructor bypass through `Object.create(SomeClass.prototype)` or equivalent prototype fabrication
|
|
55
55
|
- internal field hydration through `Object.assign(...)` or direct assignment to simulate a valid instance without using the real constructor or public factory
|
|
56
|
+
- meaningless abbreviations in identifiers that hide domain meaning
|
|
56
57
|
- using `Map` in public or domain-facing contracts to avoid explicit named input modeling
|
|
57
58
|
- helper layers that hide what the test is proving
|
|
58
59
|
- mocks that replace the exact behavior under test
|
|
@@ -67,6 +68,7 @@ Reject immediately when a diff introduces any of the following without an explic
|
|
|
67
68
|
- config weakening
|
|
68
69
|
- unproven tests
|
|
69
70
|
- suspicious helper noise
|
|
71
|
+
- meaningless abbreviations in newly introduced identifiers, including single-letter callback parameters such as `c`, `x`, or `i` when they do not carry real meaning
|
|
70
72
|
- narrowing that exists only to appease the compiler
|
|
71
73
|
- constructor bypasses, prototype fabrication, or internal field hydration that fabricate class instances without their real invariants
|
|
72
74
|
- branching that changes runtime semantics without product or domain justification
|
|
@@ -116,6 +118,7 @@ Acceptable typing:
|
|
|
116
118
|
- keeps narrowing honest and evidence-based
|
|
117
119
|
- keeps imported types and values coherent
|
|
118
120
|
- lets the compiler confirm the model instead of being tricked into silence
|
|
121
|
+
- uses names that preserve domain meaning instead of meaningless abbreviations
|
|
119
122
|
|
|
120
123
|
Unacceptable typing:
|
|
121
124
|
|