@lvlup-sw/axiom 0.2.4 → 0.2.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.
- package/.claude-plugin/plugin.json +2 -2
- package/package.json +1 -1
- package/skills/audit/SKILL.md +4 -3
- package/skills/audit/references/composition-guide.md +3 -2
- package/skills/backend-quality/SKILL.md +2 -1
- package/skills/backend-quality/references/deterministic-checks.md +86 -0
- package/skills/backend-quality/references/dimensions.md +30 -1
- package/skills/critique/SKILL.md +12 -1
- package/skills/critique/references/readability-patterns.md +277 -0
- package/skills/distill/references/simplification-guide.md +45 -1
- package/skills/humanize/SKILL.md +79 -0
- package/skills/humanize/references/ai-writing-patterns.md +243 -0
- package/skills/humanize/references/severity-guide.md +98 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "axiom",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Backend code quality skills for Claude Code.
|
|
3
|
+
"version": "0.2.6",
|
|
4
|
+
"description": "Backend code quality skills for Claude Code. Seven skills that audit, critique, harden, simplify, and humanize your architecture — the backend half of impeccable.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "LevelUp Software"
|
|
7
7
|
},
|
package/package.json
CHANGED
package/skills/audit/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: audit
|
|
3
|
-
description: "Run a comprehensive backend quality audit across all
|
|
3
|
+
description: "Run a comprehensive backend quality audit across all eight dimensions. Orchestrates scan, critique, harden, distill, verify, and humanize skills, deduplicates findings, and produces a unified report with verdict. Use when assessing overall codebase health. Triggers: 'audit backend', 'full quality check', 'run audit', or /axiom:audit. Do NOT use for targeted checks — use individual skills instead."
|
|
4
4
|
user-invokable: true
|
|
5
5
|
metadata:
|
|
6
6
|
author: lvlup-sw
|
|
@@ -14,7 +14,7 @@ metadata:
|
|
|
14
14
|
|
|
15
15
|
## Overview
|
|
16
16
|
|
|
17
|
-
The anchor skill that orchestrates all other axiom skills to produce a comprehensive backend quality report. Runs deterministic checks and qualitative assessments across all
|
|
17
|
+
The anchor skill that orchestrates all other axiom skills to produce a comprehensive backend quality report. Runs deterministic checks and qualitative assessments across all 8 dimensions, deduplicates findings, computes per-dimension metrics, and delivers a unified verdict.
|
|
18
18
|
|
|
19
19
|
## Triggers
|
|
20
20
|
|
|
@@ -52,6 +52,7 @@ Run each specialized skill in sequence, passing the scope:
|
|
|
52
52
|
2. **`axiom:harden`** — Observability (DIM-2) + Resilience (DIM-7)
|
|
53
53
|
3. **`axiom:distill`** — Hygiene (DIM-5) + Topology (DIM-1)
|
|
54
54
|
4. **`axiom:verify`** — Test Fidelity (DIM-4) + Contracts (DIM-3)
|
|
55
|
+
5. **`axiom:humanize`** — Prose Quality (DIM-8)
|
|
55
56
|
|
|
56
57
|
Each skill produces findings in the standard format: `@skills/backend-quality/references/findings-format.md`
|
|
57
58
|
|
|
@@ -65,7 +66,7 @@ Merge findings from all skills using these rules:
|
|
|
65
66
|
|
|
66
67
|
### Step 5: Coverage Check
|
|
67
68
|
|
|
68
|
-
Verify all
|
|
69
|
+
Verify all 8 dimensions were assessed. If any dimension has zero findings and zero checks:
|
|
69
70
|
- **Warning:** "DIM-N ({name}) was not assessed — no checks or findings produced"
|
|
70
71
|
- This may indicate the scope doesn't contain code relevant to that dimension
|
|
71
72
|
|
|
@@ -13,6 +13,7 @@ The audit skill invokes a fixed set of specialized skills:
|
|
|
13
13
|
| 3 | `axiom:harden` | Observability, Resilience |
|
|
14
14
|
| 4 | `axiom:distill` | Hygiene, Topology |
|
|
15
15
|
| 5 | `axiom:verify` | Test Fidelity, Contracts |
|
|
16
|
+
| 6 | `axiom:humanize` | Prose Quality |
|
|
16
17
|
|
|
17
18
|
**Execution order matters:** `scan` runs first so specialized skills can reference its deterministic findings when layering qualitative assessment.
|
|
18
19
|
|
|
@@ -41,7 +42,7 @@ When `scan` and a qualitative skill both flag the same issue, merge them. The de
|
|
|
41
42
|
After deduplication, compute the coverage matrix:
|
|
42
43
|
|
|
43
44
|
```text
|
|
44
|
-
For each dimension (DIM-1 through DIM-
|
|
45
|
+
For each dimension (DIM-1 through DIM-8):
|
|
45
46
|
- deterministic_checks: count of scan checks run for this dimension
|
|
46
47
|
- qualitative_assessed: was a specialized skill invoked for this dimension?
|
|
47
48
|
- finding_count: total findings (post-dedup)
|
|
@@ -83,7 +84,7 @@ const verdict = (HIGH_count > 0 || MEDIUM_count > 5)
|
|
|
83
84
|
### Finding Ordering
|
|
84
85
|
|
|
85
86
|
Within each severity tier, order findings by:
|
|
86
|
-
1. Dimension (DIM-1 first, DIM-
|
|
87
|
+
1. Dimension (DIM-1 first, DIM-8 last)
|
|
87
88
|
2. Evidence file path (alphabetical)
|
|
88
89
|
3. Evidence line number (ascending)
|
|
89
90
|
|
|
@@ -15,7 +15,7 @@ This skill defines the shared foundation for all axiom backend quality skills. I
|
|
|
15
15
|
|
|
16
16
|
## Dimension Taxonomy
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Eight canonical quality dimensions: `@skills/backend-quality/references/dimensions.md`
|
|
19
19
|
|
|
20
20
|
| ID | Name | What it assesses |
|
|
21
21
|
|----|------|-----------------|
|
|
@@ -26,6 +26,7 @@ Seven canonical quality dimensions: `@skills/backend-quality/references/dimensio
|
|
|
26
26
|
| DIM-5 | Hygiene | Dead code, vestigial patterns, evolutionary leftovers |
|
|
27
27
|
| DIM-6 | Architecture | SOLID, coupling, cohesion, dependency direction |
|
|
28
28
|
| DIM-7 | Resilience | Resource management, timeouts, failure handling |
|
|
29
|
+
| DIM-8 | Prose Quality | AI-writing patterns, documentation authenticity |
|
|
29
30
|
|
|
30
31
|
## Finding Format
|
|
31
32
|
|
|
@@ -108,6 +108,30 @@ Each check has: ID, pattern, what it detects, severity, and false-positive guida
|
|
|
108
108
|
|
|
109
109
|
## DIM-6: Architecture
|
|
110
110
|
|
|
111
|
+
### T-6.1a: Deep nesting
|
|
112
|
+
- **Pattern:** Count indentation levels per function; flag functions with >3 levels of nesting
|
|
113
|
+
- **Severity:** MEDIUM
|
|
114
|
+
- **Detects:** Functions where business logic is buried under layers of conditional checks
|
|
115
|
+
- **False positives:** Nesting from resource scoping (`try`/`with` blocks) or framework-required patterns
|
|
116
|
+
|
|
117
|
+
### T-6.1b: Long functions
|
|
118
|
+
- **Pattern:** Functions exceeding 50 lines (measured from signature to closing brace)
|
|
119
|
+
- **Severity:** MEDIUM
|
|
120
|
+
- **Detects:** Functions doing too much — multiple concerns in a single body
|
|
121
|
+
- **False positives:** Functions with long but simple data declarations (mapping tables, configuration objects)
|
|
122
|
+
|
|
123
|
+
### T-6.1c: Long parameter lists
|
|
124
|
+
- **Pattern:** Functions with more than 4 parameters in the signature
|
|
125
|
+
- **Severity:** MEDIUM
|
|
126
|
+
- **Detects:** Functions with too many inputs, suggesting they handle multiple concerns or need an options object
|
|
127
|
+
- **False positives:** Constructor functions in DI-heavy codebases where parameters are injected dependencies; callback-heavy APIs where signature is dictated by framework
|
|
128
|
+
|
|
129
|
+
### T-6.1d: Deep inheritance
|
|
130
|
+
- **Pattern:** `class\s+\w+\s+extends\s+` — flag when inheritance chain exceeds 2 levels
|
|
131
|
+
- **Severity:** MEDIUM
|
|
132
|
+
- **Detects:** Class hierarchies that would be simpler as composition
|
|
133
|
+
- **False positives:** Framework-required inheritance (e.g., extending base controller classes); sealed hierarchies with exhaustive matching
|
|
134
|
+
|
|
111
135
|
### T-6.1: Circular imports
|
|
112
136
|
- **Pattern:** Build import graph; detect cycles
|
|
113
137
|
- **Severity:** HIGH
|
|
@@ -146,6 +170,68 @@ Each check has: ID, pattern, what it detects, severity, and false-positive guida
|
|
|
146
170
|
- **Detects:** Retry logic that could loop forever
|
|
147
171
|
- **False positives:** Loops with break conditions that aren't pattern-matched
|
|
148
172
|
|
|
173
|
+
## DIM-8: Prose Quality
|
|
174
|
+
|
|
175
|
+
### PQ-8.1: AI vocabulary clustering
|
|
176
|
+
- **Pattern:** Count of `(additionally|crucial|delve|foster|garner|intricate|landscape|pivotal|tapestry|testament|underscore|vibrant)` per paragraph; flag if >=3
|
|
177
|
+
- **Severity:** MEDIUM
|
|
178
|
+
- **Detects:** Clustering of words disproportionately used by language models
|
|
179
|
+
- **False positives:** Technical contexts where "landscape" means literal landscape, or "crucial" is genuinely appropriate
|
|
180
|
+
|
|
181
|
+
### PQ-8.2: Chatbot collaborative artifacts
|
|
182
|
+
- **Pattern:** `(I hope this helps|Of course!|Certainly!|You're absolutely right|Would you like|let me know if|here is a)`
|
|
183
|
+
- **Severity:** HIGH
|
|
184
|
+
- **Detects:** Chatbot correspondence language left in shipped content
|
|
185
|
+
- **False positives:** Legitimate user-facing chat interfaces; FAQ sections
|
|
186
|
+
|
|
187
|
+
### PQ-8.3: Knowledge-cutoff disclaimers
|
|
188
|
+
- **Pattern:** `(as of (my|this|the) (last|latest)|up to my last training|based on available information|while specific details are (limited|scarce))`
|
|
189
|
+
- **Severity:** HIGH
|
|
190
|
+
- **Detects:** AI model disclaimers about incomplete knowledge left in documentation
|
|
191
|
+
- **False positives:** Legitimate date-scoped statements ("as of the latest release")
|
|
192
|
+
|
|
193
|
+
### PQ-8.4: Sycophantic openers
|
|
194
|
+
- **Pattern:** `^(Great question|That's a great|Excellent point|Absolutely[!,]|What a (great|wonderful|fantastic))`
|
|
195
|
+
- **Severity:** HIGH
|
|
196
|
+
- **Detects:** People-pleasing language inappropriate for technical documentation
|
|
197
|
+
- **False positives:** None in technical docs; rare in any professional writing
|
|
198
|
+
|
|
199
|
+
### PQ-8.5: Em dash density
|
|
200
|
+
- **Pattern:** Count of `\u2014` (em dash) per file; flag if density > 1 per 100 words
|
|
201
|
+
- **Severity:** LOW
|
|
202
|
+
- **Detects:** Overuse of em dashes mimicking punchy sales writing
|
|
203
|
+
- **False positives:** Quoted dialogue; style guides that favor em dashes
|
|
204
|
+
|
|
205
|
+
### PQ-8.6: Superficial -ing analyses
|
|
206
|
+
- **Pattern:** `(highlighting|underscoring|emphasizing|ensuring|reflecting|symbolizing|contributing to|cultivating|fostering|encompassing|showcasing)\s+(the|its|a|an)`
|
|
207
|
+
- **Severity:** MEDIUM
|
|
208
|
+
- **Detects:** Present participle phrases tacked on for fake depth
|
|
209
|
+
- **False positives:** Active voice descriptions of ongoing processes
|
|
210
|
+
|
|
211
|
+
### PQ-8.7: Inflated significance
|
|
212
|
+
- **Pattern:** `(serves as a testament|stands as a reminder|pivotal (role|moment)|indelible mark|key turning point|evolving landscape|setting the stage|focal point of)`
|
|
213
|
+
- **Severity:** MEDIUM
|
|
214
|
+
- **Detects:** Inflated language that elevates mundane topics to cosmic importance
|
|
215
|
+
- **False positives:** Historical or genuinely significant events
|
|
216
|
+
|
|
217
|
+
### PQ-8.8: Promotional language
|
|
218
|
+
- **Pattern:** `(boasts a|in the heart of|groundbreaking|renowned|breathtaking|must-visit|stunning|nestled)`
|
|
219
|
+
- **Severity:** MEDIUM
|
|
220
|
+
- **Detects:** Loss of neutral tone, especially on cultural/heritage topics
|
|
221
|
+
- **False positives:** Marketing copy where promotional tone is intentional
|
|
222
|
+
|
|
223
|
+
### PQ-8.9: Filler phrases
|
|
224
|
+
- **Pattern:** `(in order to|due to the fact that|at this point in time|in the event that|has the ability to|it is worth noting that|it is important to note)`
|
|
225
|
+
- **Severity:** LOW
|
|
226
|
+
- **Detects:** Wordy phrases that can be simplified
|
|
227
|
+
- **False positives:** Legal or formal contexts where precision requires verbosity
|
|
228
|
+
|
|
229
|
+
### PQ-8.10: Generic positive conclusions
|
|
230
|
+
- **Pattern:** `(the future looks bright|exciting times|looking forward to|great potential|paving the way|on the right track)`
|
|
231
|
+
- **Severity:** MEDIUM
|
|
232
|
+
- **Detects:** Vague upbeat endings without substance
|
|
233
|
+
- **False positives:** Genuine forward-looking statements with specific plans attached
|
|
234
|
+
|
|
149
235
|
## Extensibility
|
|
150
236
|
|
|
151
237
|
Projects can add custom checks via `.axiom/checks.md` at the repo root. Format matches this file — one section per dimension, each check with pattern, severity, description, and false-positive guidance. Custom checks are loaded alongside the built-in catalog by the `scan` skill.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Backend Quality Dimensions
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Eight canonical dimensions for assessing backend architectural health. Each dimension is independently assessable — no dimension requires another's output to produce findings.
|
|
4
4
|
|
|
5
5
|
## DIM-1: Topology
|
|
6
6
|
|
|
@@ -196,11 +196,40 @@ Seven canonical dimensions for assessing backend architectural health. Each dime
|
|
|
196
196
|
|
|
197
197
|
---
|
|
198
198
|
|
|
199
|
+
## DIM-8: Prose Quality
|
|
200
|
+
|
|
201
|
+
**Definition:** The absence of detectable AI-writing patterns in documentation, comments, user-facing strings, and prose content. Prose quality violations erode trust, signal unreviewed AI output, and make content feel generic rather than purposeful.
|
|
202
|
+
|
|
203
|
+
**Invariants:**
|
|
204
|
+
- Documentation reads as written by a domain expert, not generated by a language model
|
|
205
|
+
- No chatbot correspondence artifacts (sycophantic openers, "let me know" closers)
|
|
206
|
+
- Technical writing is direct and specific, not padded with filler phrases or hedging
|
|
207
|
+
|
|
208
|
+
**Detectable Signals:**
|
|
209
|
+
- AI vocabulary clustering (additionally, crucial, delve, landscape, tapestry, testament, underscore, vibrant)
|
|
210
|
+
- Collaborative communication artifacts ("I hope this helps", "Certainly!", "Would you like...")
|
|
211
|
+
- Knowledge-cutoff disclaimers ("as of [date]", "based on available information")
|
|
212
|
+
- Structural tells (em dash overuse, rule of three, inline-header vertical lists, title case headings)
|
|
213
|
+
- Content inflation (inflated significance, promotional language, superficial -ing analyses)
|
|
214
|
+
- Filler and hedging (generic positive conclusions, excessive hedging, wordy phrases)
|
|
215
|
+
|
|
216
|
+
**Severity Guide:**
|
|
217
|
+
- **HIGH:** Chatbot artifacts or knowledge-cutoff disclaimers left in shipped content
|
|
218
|
+
- **MEDIUM:** AI vocabulary clustering (3+ AI-typical words in a paragraph) or structural tells
|
|
219
|
+
- **LOW:** Isolated filler phrases or mild hedging
|
|
220
|
+
|
|
221
|
+
**Examples:**
|
|
222
|
+
- Violation: "This crucial module serves as a testament to the team's commitment to fostering robust architecture. It delves into the intricate tapestry of event-sourced workflows."
|
|
223
|
+
- Healthy: "This module handles event-sourced workflow state. It stores events in SQLite and rebuilds state on read."
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
199
227
|
## Dimension Independence
|
|
200
228
|
|
|
201
229
|
Each dimension can be assessed in isolation. However, some findings may span multiple dimensions:
|
|
202
230
|
|
|
203
231
|
- A lazy fallback constructor (DIM-1: Topology) may also be a silent error (DIM-2: Observability)
|
|
204
232
|
- Dead code (DIM-5: Hygiene) may also be a test fidelity issue if tests reference it (DIM-4)
|
|
233
|
+
- AI-generated prose (DIM-8: Prose Quality) may also be a hygiene issue if it contains dead documentation (DIM-5)
|
|
205
234
|
|
|
206
235
|
When a finding spans dimensions, it should be reported under the **primary** dimension (the one most directly violated) with a cross-reference note. The `audit` skill handles deduplication when the same evidence appears under multiple dimensions.
|
package/skills/critique/SKILL.md
CHANGED
|
@@ -100,7 +100,17 @@ Identify modules with too many responsibilities:
|
|
|
100
100
|
- Classes or modules that are modified in every feature branch (shotgun surgery indicator)
|
|
101
101
|
- Modules that import from many unrelated domains
|
|
102
102
|
|
|
103
|
-
#### 3e.
|
|
103
|
+
#### 3e. Readability Patterns
|
|
104
|
+
|
|
105
|
+
Evaluate code-level readability and structural clarity:
|
|
106
|
+
|
|
107
|
+
- **DRY violations:** Duplicated logic across multiple locations that should be extracted
|
|
108
|
+
- **Deep nesting:** Functions with excessive indentation that could use guard clauses / early returns
|
|
109
|
+
- **Composition over inheritance:** Class hierarchies that would be simpler as composed components
|
|
110
|
+
- **Parameter discipline:** Long parameter lists and boolean flags that obscure call-site meaning
|
|
111
|
+
- For definitions, violation signals, and refactoring approaches, see `@skills/critique/references/readability-patterns.md`
|
|
112
|
+
|
|
113
|
+
#### 3f. Circular Dependency Identification
|
|
104
114
|
|
|
105
115
|
Detect import cycles between modules:
|
|
106
116
|
|
|
@@ -130,3 +140,4 @@ Format all findings per `@skills/backend-quality/references/findings-format.md`:
|
|
|
130
140
|
- `@skills/backend-quality/references/findings-format.md` — Standard output format for findings
|
|
131
141
|
- `@skills/critique/references/solid-principles.md` — SOLID principle definitions, violation signals, severity guide, and detection heuristics
|
|
132
142
|
- `@skills/critique/references/dependency-patterns.md` — Dependency pattern catalog, coupling metrics, circular dependency detection, and layered architecture guidance
|
|
143
|
+
- `@skills/critique/references/readability-patterns.md` — DRY, early returns, composition over inheritance, and parameter discipline
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# Readability Patterns Reference
|
|
2
|
+
|
|
3
|
+
Detection heuristics and severity guidance for code readability concerns beyond SOLID. These patterns address structural clarity at the function and expression level.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## DRY — Don't Repeat Yourself
|
|
8
|
+
|
|
9
|
+
### Definition
|
|
10
|
+
|
|
11
|
+
Every piece of knowledge should have a single, authoritative representation in the system. When the same logic appears in multiple places, a change to that logic requires finding and updating every copy — and missing one creates a bug.
|
|
12
|
+
|
|
13
|
+
### Violation Signals
|
|
14
|
+
|
|
15
|
+
1. Two or more functions with near-identical bodies differing only in variable names or literals
|
|
16
|
+
2. Copy-pasted conditional chains (same `if/else` structure with different field names)
|
|
17
|
+
3. Parallel data transformations that follow the same pattern but aren't abstracted
|
|
18
|
+
4. Test setup code duplicated across multiple test files without extraction into a shared fixture
|
|
19
|
+
5. Configuration or mapping objects repeated in multiple modules instead of imported from one source
|
|
20
|
+
|
|
21
|
+
### When Duplication Is Acceptable
|
|
22
|
+
|
|
23
|
+
Not all duplication violates DRY. Apply the **three uses rule** (see `@skills/distill/references/simplification-guide.md`):
|
|
24
|
+
|
|
25
|
+
- **First occurrence:** Write it inline. Do not extract.
|
|
26
|
+
- **Second occurrence:** Note the duplication but tolerate it. The pattern may be coincidental.
|
|
27
|
+
- **Third occurrence:** Extract. You now have enough examples to see the true shape of the abstraction.
|
|
28
|
+
|
|
29
|
+
**Also acceptable:**
|
|
30
|
+
- Test assertions that happen to look similar but test different behaviors — readability in tests often outweighs DRY
|
|
31
|
+
- Protocol handlers or route definitions that share structure but represent distinct endpoints — premature abstraction here creates "magic" dispatchers that are harder to understand
|
|
32
|
+
- Two-line utility patterns (e.g., null-check-and-return) — the abstraction would be longer than the duplication
|
|
33
|
+
|
|
34
|
+
### Severity Guide
|
|
35
|
+
|
|
36
|
+
| Severity | When to assign |
|
|
37
|
+
|----------|---------------|
|
|
38
|
+
| **HIGH** | Duplicated business logic where a bug fix applied to one copy but not the other would cause incorrect behavior. |
|
|
39
|
+
| **MEDIUM** | Duplicated structural patterns (>10 lines) across 3+ locations. The abstraction is clear but hasn't been extracted. |
|
|
40
|
+
| **LOW** | Minor duplication (<10 lines) in 2 locations. Extraction would add more complexity than it removes. |
|
|
41
|
+
|
|
42
|
+
### Detection Heuristics
|
|
43
|
+
|
|
44
|
+
- Look for functions with the same control flow structure but different variable names
|
|
45
|
+
- Search for identical error handling blocks across different catch clauses
|
|
46
|
+
- Check for repeated object construction patterns (same keys, different values)
|
|
47
|
+
- Compare test files for duplicated setup/teardown logic
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Early Returns and Guard Clauses
|
|
52
|
+
|
|
53
|
+
### Definition
|
|
54
|
+
|
|
55
|
+
Guard clauses handle edge cases and preconditions at the top of a function, returning or throwing early. This eliminates nesting and keeps the main logic path at the lowest indentation level.
|
|
56
|
+
|
|
57
|
+
### The Problem with Deep Nesting
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
// Deep nesting — hard to follow
|
|
61
|
+
function processOrder(order: Order): Result {
|
|
62
|
+
if (order) {
|
|
63
|
+
if (order.items.length > 0) {
|
|
64
|
+
if (order.customer) {
|
|
65
|
+
if (order.customer.isActive) {
|
|
66
|
+
// ... actual business logic buried at 4 levels deep
|
|
67
|
+
const total = calculateTotal(order.items)
|
|
68
|
+
return { success: true, total }
|
|
69
|
+
} else {
|
|
70
|
+
return { success: false, error: 'Inactive customer' }
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
return { success: false, error: 'No customer' }
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
return { success: false, error: 'Empty order' }
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
return { success: false, error: 'No order' }
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
// Guard clauses — preconditions handled upfront, main path is flat
|
|
86
|
+
function processOrder(order: Order): Result {
|
|
87
|
+
if (!order) return { success: false, error: 'No order' }
|
|
88
|
+
if (order.items.length === 0) return { success: false, error: 'Empty order' }
|
|
89
|
+
if (!order.customer) return { success: false, error: 'No customer' }
|
|
90
|
+
if (!order.customer.isActive) return { success: false, error: 'Inactive customer' }
|
|
91
|
+
|
|
92
|
+
const total = calculateTotal(order.items)
|
|
93
|
+
return { success: true, total }
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Violation Signals
|
|
98
|
+
|
|
99
|
+
1. Functions with more than 3 levels of nesting
|
|
100
|
+
2. `else` branches that contain only a return or throw (invert the condition and return early)
|
|
101
|
+
3. Long `if` blocks followed by a short `else { return }` — the return should come first
|
|
102
|
+
4. Nested `if` chains where each level checks a single condition (collapse into sequential guards)
|
|
103
|
+
5. Functions where the main logic is indented 3+ levels deep
|
|
104
|
+
|
|
105
|
+
### When to Keep Nesting
|
|
106
|
+
|
|
107
|
+
- **Mutually exclusive branches with equal weight:** When both branches contain substantial logic (not just a return), `if/else` is clearer than early return
|
|
108
|
+
- **Loop bodies with `continue`:** Using `continue` as a guard clause inside loops is the same pattern and equally valid, but excessive `continue` statements can fragment loop logic
|
|
109
|
+
- **Transaction scoping:** When nesting represents a resource scope (e.g., `try` blocks wrapping database transactions), the nesting communicates the scope boundary
|
|
110
|
+
|
|
111
|
+
### Severity Guide
|
|
112
|
+
|
|
113
|
+
| Severity | When to assign |
|
|
114
|
+
|----------|---------------|
|
|
115
|
+
| **HIGH** | Function with 5+ levels of nesting. Main business logic is buried and hard to trace. |
|
|
116
|
+
| **MEDIUM** | Function with 3-4 levels of nesting that could be flattened with guard clauses. |
|
|
117
|
+
| **LOW** | Occasional unnecessary `else` after a return statement. Cosmetic but worth noting. |
|
|
118
|
+
|
|
119
|
+
### Detection Heuristics
|
|
120
|
+
|
|
121
|
+
- Measure maximum indentation depth per function — flag functions exceeding 3 levels
|
|
122
|
+
- Search for `else { return` or `else { throw` patterns — these can almost always be inverted
|
|
123
|
+
- Look for `if (condition) { ... long block ... } else { return }` — invert the condition
|
|
124
|
+
- Count the ratio of guard-eligible checks to actual guards in functions with preconditions
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Composition Over Inheritance
|
|
129
|
+
|
|
130
|
+
### Definition
|
|
131
|
+
|
|
132
|
+
Favor assembling behavior from small, focused components rather than building deep class hierarchies. Inheritance creates tight coupling between parent and child classes; composition allows flexible recombination.
|
|
133
|
+
|
|
134
|
+
### Why Inheritance Creates Problems
|
|
135
|
+
|
|
136
|
+
- **Fragile base class:** Changes to the parent class ripple into all children, even when irrelevant to their specific behavior
|
|
137
|
+
- **Forced inheritance of unwanted behavior:** Subclasses inherit all parent methods, even ones that don't apply (ISP violation in class form)
|
|
138
|
+
- **Diamond problem:** Multiple inheritance paths create ambiguity about which parent's behavior to use
|
|
139
|
+
- **Deep hierarchies obscure behavior:** Understanding what a class does requires reading the entire chain from root to leaf
|
|
140
|
+
|
|
141
|
+
### Violation Signals
|
|
142
|
+
|
|
143
|
+
1. Class hierarchies deeper than 2 levels (grandchild classes)
|
|
144
|
+
2. Subclasses that override >50% of parent methods (the "is-a" relationship is wrong)
|
|
145
|
+
3. Abstract base classes with only one concrete implementation (premature abstraction)
|
|
146
|
+
4. Classes that extend a base class only to access a utility method (use composition or a standalone function)
|
|
147
|
+
5. `super` calls that require understanding the parent's implementation details (leaky inheritance)
|
|
148
|
+
6. "Template method" patterns where the base class controls flow and subclasses fill in hooks — often better expressed as a function accepting strategy callbacks
|
|
149
|
+
|
|
150
|
+
### Composition Alternatives
|
|
151
|
+
|
|
152
|
+
**Instead of inheritance for shared behavior:**
|
|
153
|
+
```typescript
|
|
154
|
+
// Inheritance approach — tight coupling
|
|
155
|
+
class BaseRepository {
|
|
156
|
+
async findById(id: string) { /* shared query logic */ }
|
|
157
|
+
async save(entity: unknown) { /* shared persistence logic */ }
|
|
158
|
+
}
|
|
159
|
+
class UserRepository extends BaseRepository {
|
|
160
|
+
async findByEmail(email: string) { /* user-specific */ }
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
// Composition approach — flexible, testable
|
|
166
|
+
function createRepository(tableName: string) {
|
|
167
|
+
return {
|
|
168
|
+
findById: (id: string) => query(tableName, { id }),
|
|
169
|
+
save: (entity: unknown) => upsert(tableName, entity),
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function createUserRepository() {
|
|
174
|
+
const base = createRepository('users')
|
|
175
|
+
return {
|
|
176
|
+
...base,
|
|
177
|
+
findByEmail: (email: string) => query('users', { email }),
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Instead of inheritance for variation:**
|
|
183
|
+
```typescript
|
|
184
|
+
// Strategy pattern via composition
|
|
185
|
+
interface PricingStrategy {
|
|
186
|
+
calculate(items: Item[]): number
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const standardPricing: PricingStrategy = {
|
|
190
|
+
calculate: (items) => items.reduce((sum, i) => sum + i.price, 0)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const discountPricing: PricingStrategy = {
|
|
194
|
+
calculate: (items) => items.reduce((sum, i) => sum + i.price * 0.9, 0)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// No inheritance needed — strategies are interchangeable values
|
|
198
|
+
function checkout(items: Item[], pricing: PricingStrategy) {
|
|
199
|
+
return pricing.calculate(items)
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### When Inheritance Is Appropriate
|
|
204
|
+
|
|
205
|
+
- **Framework requirements:** When a framework requires extending a base class (e.g., React class components, some ORM patterns). Use inheritance because the framework demands it, not by choice.
|
|
206
|
+
- **True "is-a" relationships with shared state:** When the parent class manages state that all subclasses genuinely need, and subclasses extend rather than override behavior.
|
|
207
|
+
- **Sealed hierarchies:** When the set of subclasses is closed and known (e.g., AST node types, event types). Inheritance + exhaustive pattern matching is a valid design.
|
|
208
|
+
|
|
209
|
+
### Severity Guide
|
|
210
|
+
|
|
211
|
+
| Severity | When to assign |
|
|
212
|
+
|----------|---------------|
|
|
213
|
+
| **HIGH** | Class hierarchy 3+ levels deep where subclasses override most parent behavior. The hierarchy is fighting against itself. |
|
|
214
|
+
| **MEDIUM** | Abstract base class with one implementation, or base class used primarily as a bag of utility methods. Composition would be simpler. |
|
|
215
|
+
| **LOW** | Shallow inheritance (1 level) that works but could be expressed as composition. Not causing active problems. |
|
|
216
|
+
|
|
217
|
+
### Detection Heuristics
|
|
218
|
+
|
|
219
|
+
- Count `extends` depth — flag hierarchies deeper than 2 levels
|
|
220
|
+
- Look for abstract classes with exactly one concrete subclass
|
|
221
|
+
- Search for `super.` calls in methods that also override the parent method — sign of fragile coupling
|
|
222
|
+
- Check if subclasses use <50% of inherited methods — the inheritance may be for convenience, not design
|
|
223
|
+
- Look for classes that extend a base class and immediately override the constructor to do something unrelated
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Parameter Discipline
|
|
228
|
+
|
|
229
|
+
### Long Parameter Lists
|
|
230
|
+
|
|
231
|
+
Functions with many parameters are hard to call correctly. The caller must remember the order, and boolean flags in the middle of a parameter list are especially error-prone.
|
|
232
|
+
|
|
233
|
+
**Violation signals:**
|
|
234
|
+
- Functions with more than 4 parameters
|
|
235
|
+
- Boolean parameters that aren't self-documenting at the call site
|
|
236
|
+
- Parameters that are always passed together (should be grouped into an object)
|
|
237
|
+
|
|
238
|
+
**Refactoring approaches:**
|
|
239
|
+
```typescript
|
|
240
|
+
// Before: positional parameters, unclear at call site
|
|
241
|
+
function createUser(name: string, email: string, isAdmin: boolean,
|
|
242
|
+
sendWelcome: boolean, teamId: string | null) { ... }
|
|
243
|
+
|
|
244
|
+
createUser('Alice', 'a@b.com', true, false, 'team-1') // What do true, false mean?
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
// After: options object, self-documenting
|
|
249
|
+
interface CreateUserOptions {
|
|
250
|
+
name: string
|
|
251
|
+
email: string
|
|
252
|
+
isAdmin?: boolean
|
|
253
|
+
sendWelcome?: boolean
|
|
254
|
+
teamId?: string
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function createUser(options: CreateUserOptions) { ... }
|
|
258
|
+
|
|
259
|
+
createUser({ name: 'Alice', email: 'a@b.com', isAdmin: true, teamId: 'team-1' })
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Boolean Parameters
|
|
263
|
+
|
|
264
|
+
Boolean parameters are a special case of poor readability. At the call site, `true` and `false` carry no meaning without reading the function signature.
|
|
265
|
+
|
|
266
|
+
**Alternatives:**
|
|
267
|
+
- Use an options object (as above)
|
|
268
|
+
- Use separate functions: `enableFeature()` / `disableFeature()` instead of `setFeature(enabled: boolean)`
|
|
269
|
+
- Use string literals or enums: `format('compact')` instead of `format(true)`
|
|
270
|
+
|
|
271
|
+
### Severity Guide
|
|
272
|
+
|
|
273
|
+
| Severity | When to assign |
|
|
274
|
+
|----------|---------------|
|
|
275
|
+
| **HIGH** | Function with 6+ parameters, especially if multiple are booleans. Call sites are unreadable. |
|
|
276
|
+
| **MEDIUM** | Function with 4-5 parameters where grouping into an object would improve clarity. |
|
|
277
|
+
| **LOW** | Function with a boolean parameter that could be more expressive but is only called in 1-2 places. |
|
|
@@ -36,10 +36,54 @@ Reference guide for reducing code complexity, identifying vestigial patterns, an
|
|
|
36
36
|
### Reducing Conditional Complexity
|
|
37
37
|
|
|
38
38
|
- **Collapse nested conditionals:** Replace `if (a) { if (b) { ... } }` with `if (a && b) { ... }` when the nesting adds no clarity
|
|
39
|
-
- **Use early returns:** Convert deep nesting into guard clauses that return/throw early
|
|
40
39
|
- **Replace flag variables:** When a boolean flag is set and then checked once, inline the condition
|
|
41
40
|
- **Simplify boolean expressions:** `if (x === true)` becomes `if (x)`; `if (!x === false)` becomes `if (x)`
|
|
42
41
|
|
|
42
|
+
#### Early Returns and Guard Clauses
|
|
43
|
+
|
|
44
|
+
Convert deep nesting into guard clauses that return or throw early. This is one of the highest-impact readability improvements available.
|
|
45
|
+
|
|
46
|
+
**The principle:** Handle preconditions and edge cases at the top of the function, then let the main logic flow at the lowest indentation level.
|
|
47
|
+
|
|
48
|
+
**Before — nested conditionals:**
|
|
49
|
+
```typescript
|
|
50
|
+
function getDiscount(customer: Customer): number {
|
|
51
|
+
if (customer) {
|
|
52
|
+
if (customer.isActive) {
|
|
53
|
+
if (customer.orders > 10) {
|
|
54
|
+
return 0.15
|
|
55
|
+
} else {
|
|
56
|
+
return 0.05
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
return 0
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
throw new Error('Customer required')
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**After — guard clauses:**
|
|
68
|
+
```typescript
|
|
69
|
+
function getDiscount(customer: Customer): number {
|
|
70
|
+
if (!customer) throw new Error('Customer required')
|
|
71
|
+
if (!customer.isActive) return 0
|
|
72
|
+
|
|
73
|
+
return customer.orders > 10 ? 0.15 : 0.05
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Patterns to look for:**
|
|
78
|
+
- `if (x) { ... long block ... } else { return y }` — invert: `if (!x) return y; ... long block ...`
|
|
79
|
+
- `if (x) { if (y) { if (z) { ... } } }` — flatten: `if (!x) return; if (!y) return; if (!z) return; ...`
|
|
80
|
+
- `else` after a `return` or `throw` — the `else` is unnecessary; remove it and dedent
|
|
81
|
+
|
|
82
|
+
**When not to flatten:**
|
|
83
|
+
- Both branches have substantial logic (not just returns) — `if/else` is clearer
|
|
84
|
+
- The nesting represents resource scoping (e.g., transaction boundaries)
|
|
85
|
+
- The conditions are not preconditions but genuinely branching logic paths
|
|
86
|
+
|
|
43
87
|
## Vestigial Pattern Identification
|
|
44
88
|
|
|
45
89
|
### Code Archaeology Approach
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: humanize
|
|
3
|
+
description: "Scan for AI writing patterns in markdown, docs, comments, and user-facing strings. Detects 24 cataloged AI-writing tells across content, language, style, communication, and filler categories. Triggers: 'check prose', 'AI writing', 'humanize', or /axiom:humanize. Do NOT use for code quality — use other axiom skills."
|
|
4
|
+
user-invokable: true
|
|
5
|
+
metadata:
|
|
6
|
+
author: lvlup-sw
|
|
7
|
+
version: 0.1.0
|
|
8
|
+
category: assessment
|
|
9
|
+
dimensions:
|
|
10
|
+
- prose-quality
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Humanize — Prose Quality Assessment
|
|
14
|
+
|
|
15
|
+
## Overview
|
|
16
|
+
|
|
17
|
+
Detects signs of AI-generated writing in prose content. Based on Wikipedia's "Signs of AI writing" guide maintained by WikiProject AI Cleanup. Covers 24 patterns across 5 categories: content, language/grammar, style, communication, and filler/hedging.
|
|
18
|
+
|
|
19
|
+
## Triggers
|
|
20
|
+
|
|
21
|
+
**Use when:**
|
|
22
|
+
- Reviewing documentation, README files, or user-facing copy
|
|
23
|
+
- Checking comments and docstrings for AI tells
|
|
24
|
+
- User says "humanize", "check prose", "AI writing patterns", "de-slop"
|
|
25
|
+
|
|
26
|
+
**Do NOT use when:**
|
|
27
|
+
- Reviewing code logic or architecture (use `axiom:critique`)
|
|
28
|
+
- Checking error handling (use `axiom:harden`)
|
|
29
|
+
- Running full quality audit (use `axiom:audit`, which includes humanize)
|
|
30
|
+
|
|
31
|
+
## Process
|
|
32
|
+
|
|
33
|
+
### Step 1: Scope Resolution
|
|
34
|
+
|
|
35
|
+
Determine assessment scope:
|
|
36
|
+
- **File:** Assess a single file
|
|
37
|
+
- **Directory:** Assess all prose-containing files (recursive)
|
|
38
|
+
- **Codebase:** Assess the entire project
|
|
39
|
+
|
|
40
|
+
Default file scope: `*.md`, `*.txt`, `*.mdx`, plus comments and user-facing strings in source files (`*.ts`, `*.js`, `*.py`, etc.).
|
|
41
|
+
|
|
42
|
+
Exclude: `node_modules/`, `dist/`, `.git/`, `CHANGELOG.md`, lock files, binary files, generated files.
|
|
43
|
+
|
|
44
|
+
### Step 2: Deterministic Scan
|
|
45
|
+
|
|
46
|
+
Run `axiom:scan` with `dimensions: prose-quality` for the resolved scope. This executes the PQ-* check catalog against the content.
|
|
47
|
+
|
|
48
|
+
### Step 3: Qualitative Assessment
|
|
49
|
+
|
|
50
|
+
Layer qualitative assessment on top of scan results:
|
|
51
|
+
- Read flagged sections in context -- some patterns are acceptable in certain contexts
|
|
52
|
+
- Check for pattern clustering (multiple AI tells in the same paragraph/section is worse than isolated occurrences)
|
|
53
|
+
- Assess overall tone -- does the content read as expert-written or machine-generated?
|
|
54
|
+
- Apply false-positive filtering per guidance in `@skills/humanize/references/ai-writing-patterns.md`
|
|
55
|
+
|
|
56
|
+
### Step 4: Produce Findings
|
|
57
|
+
|
|
58
|
+
Output findings in standard format: `@skills/backend-quality/references/findings-format.md`
|
|
59
|
+
|
|
60
|
+
Each finding includes:
|
|
61
|
+
- `dimension: "prose-quality"`
|
|
62
|
+
- `severity: HIGH | MEDIUM | LOW` per `@skills/humanize/references/severity-guide.md`
|
|
63
|
+
- `title`: Pattern name and location
|
|
64
|
+
- `evidence`: File path and line numbers
|
|
65
|
+
- `explanation`: What pattern was detected and why it matters
|
|
66
|
+
- `suggestion`: Concrete rewrite suggestion
|
|
67
|
+
|
|
68
|
+
## Error Handling
|
|
69
|
+
|
|
70
|
+
- **No prose files in scope:** Return "No prose content found in scope" with no findings
|
|
71
|
+
- **Binary/generated files:** Skip silently
|
|
72
|
+
- **Large files (>10K lines):** Sample first 1000 and last 1000 lines
|
|
73
|
+
|
|
74
|
+
## References
|
|
75
|
+
|
|
76
|
+
- Pattern catalog: `@skills/humanize/references/ai-writing-patterns.md`
|
|
77
|
+
- Severity mapping: `@skills/humanize/references/severity-guide.md`
|
|
78
|
+
- Finding format: `@skills/backend-quality/references/findings-format.md`
|
|
79
|
+
- Dimension taxonomy: `@skills/backend-quality/references/dimensions.md`
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# AI Writing Patterns Catalog
|
|
2
|
+
|
|
3
|
+
24 cataloged patterns for detecting AI-generated prose, organized into 5 categories. Based on Wikipedia's "Signs of AI writing" guide maintained by WikiProject AI Cleanup.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Category 1: Content Patterns
|
|
8
|
+
|
|
9
|
+
### PQ-1.1: Inflated Significance
|
|
10
|
+
|
|
11
|
+
- **Detection keywords/regex:** `(serves as a testament|pivotal (role|moment)|indelible mark|setting the stage|key turning point|evolving landscape)`
|
|
12
|
+
- **Problem:** Elevates mundane topics to cosmic importance. AI models default to grandiose framing because training data over-represents formal and promotional writing.
|
|
13
|
+
- **Before:** "This module serves as a testament to the team's commitment to fostering robust architecture."
|
|
14
|
+
- **After:** "This module handles event routing."
|
|
15
|
+
- **False-positive guidance:** Historical or genuinely significant events may warrant strong language. If the subject is a literal turning point (e.g., a major version migration), the phrase may be appropriate.
|
|
16
|
+
|
|
17
|
+
### PQ-1.2: Notability Emphasis
|
|
18
|
+
|
|
19
|
+
- **Detection keywords/regex:** `(independent coverage|leading expert|active social media presence|widely recognized|notable for)`
|
|
20
|
+
- **Problem:** Asserts notability without evidence. AI models insert Wikipedia-style notability markers to make subjects sound important.
|
|
21
|
+
- **Before:** "The library has received independent coverage from leading experts in the field."
|
|
22
|
+
- **After:** "The library is used by 200+ projects on GitHub."
|
|
23
|
+
- **False-positive guidance:** Legitimate when backed by specific citations. Flag only when the claim is vague or unsourced.
|
|
24
|
+
|
|
25
|
+
### PQ-1.3: Superficial -ing Analyses
|
|
26
|
+
|
|
27
|
+
- **Detection keywords/regex:** `(highlighting|underscoring|emphasizing|ensuring|reflecting|symbolizing|contributing to|cultivating|fostering|encompassing|showcasing)\s+(the|its|a|an)`
|
|
28
|
+
- **Problem:** Present participle phrases tacked on to create an illusion of depth. The -ing verb adds no information -- it just restates the obvious in fancier terms.
|
|
29
|
+
- **Before:** "The error handler catches exceptions, ensuring the application remains stable while highlighting the importance of robust error handling."
|
|
30
|
+
- **After:** "The error handler catches exceptions and returns a 500 status code."
|
|
31
|
+
- **False-positive guidance:** Active voice descriptions of ongoing processes are fine ("the service is currently processing requests"). Flag when the -ing phrase adds no new information.
|
|
32
|
+
|
|
33
|
+
### PQ-1.4: Promotional Language
|
|
34
|
+
|
|
35
|
+
- **Detection keywords/regex:** `(boasts a|vibrant|rich\s+(history|tradition|culture|ecosystem)|profound|nestled|in the heart of|groundbreaking|renowned|breathtaking|must-visit|stunning)`
|
|
36
|
+
- **Problem:** Loss of neutral, technical tone. AI models default to promotional language especially for cultural, geographic, or heritage topics.
|
|
37
|
+
- **Before:** "The framework boasts a vibrant ecosystem of plugins and a rich tradition of community-driven development."
|
|
38
|
+
- **After:** "The framework has 340 plugins maintained by 50+ contributors."
|
|
39
|
+
- **False-positive guidance:** Marketing copy where promotional tone is intentional. Technical docs should almost never use these words.
|
|
40
|
+
|
|
41
|
+
### PQ-1.5: Vague Attributions
|
|
42
|
+
|
|
43
|
+
- **Detection keywords/regex:** `(Industry reports|Observers have cited|Experts argue|Some critics argue|Many believe|It is widely believed|According to sources)`
|
|
44
|
+
- **Problem:** Creates false authority by attributing claims to unnamed experts. AI models use vague attribution when they lack specific sources.
|
|
45
|
+
- **Before:** "Experts argue that this approach represents a paradigm shift."
|
|
46
|
+
- **After:** "Martin Fowler's 2019 article 'Microservices Trade-Offs' argues this approach reduces deployment coupling."
|
|
47
|
+
- **False-positive guidance:** Legitimate when the vagueness is intentional (e.g., summarizing a debate without taking sides). Flag when used to bolster a specific claim.
|
|
48
|
+
|
|
49
|
+
### PQ-1.6: Formulaic Sections
|
|
50
|
+
|
|
51
|
+
- **Detection keywords/regex:** `(Despite its.*faces several challenges|Despite these challenges|Future Outlook|Looking Ahead|In Conclusion)`
|
|
52
|
+
- **Problem:** Template-like section transitions that signal generated structure. Real writers don't mechanically alternate between positive and negative sections.
|
|
53
|
+
- **Before:** "Despite its many strengths, the framework faces several challenges. Despite these challenges, the future looks bright."
|
|
54
|
+
- **After:** "Two open issues affect production use: memory leaks under high concurrency (#234) and missing ARM64 support (#567)."
|
|
55
|
+
- **False-positive guidance:** "In Conclusion" is conventional in academic writing. Flag primarily in technical documentation and README files.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Category 2: Language/Grammar Patterns
|
|
60
|
+
|
|
61
|
+
### PQ-2.1: AI Vocabulary Words
|
|
62
|
+
|
|
63
|
+
- **Detection keywords/regex:** `(additionally|align with|crucial|delve|emphasizing|enduring|enhance|fostering|garner|highlight\b|interplay|intricate|intricacies|key\s+(aspect|component|feature|element)|landscape\b|pivotal|showcase|tapestry|testament|underscore\b|valuable|vibrant)`
|
|
64
|
+
- **Problem:** These words appear far more frequently in AI output than in human writing. Individually they are fine; clustered together they create an unmistakable AI fingerprint.
|
|
65
|
+
- **Before:** "This crucial module delves into the intricate tapestry of event-sourced workflows, highlighting the interplay between producers and consumers."
|
|
66
|
+
- **After:** "This module stores events in SQLite and rebuilds state on read."
|
|
67
|
+
- **False-positive guidance:** Any single occurrence is fine. Flag when 3+ appear in the same paragraph. In technical writing, "key" as an adjective and "landscape" as a metaphor are the most common false positives.
|
|
68
|
+
|
|
69
|
+
### PQ-2.2: Copula Avoidance
|
|
70
|
+
|
|
71
|
+
- **Detection keywords/regex:** `(serves as|stands as|marks a|represents a|constitutes a|functions as|acts as a)\s+(a |an |the )`
|
|
72
|
+
- **Problem:** AI models avoid simple "is/are" constructions in favor of fancier verbs. This makes prose feel stilted and over-formal.
|
|
73
|
+
- **Before:** "This module serves as a bridge between the event store and the query layer."
|
|
74
|
+
- **After:** "This module is the bridge between the event store and the query layer." (Or better: "This module connects the event store to the query layer.")
|
|
75
|
+
- **False-positive guidance:** "Acts as" and "functions as" are sometimes genuinely clearer than "is" when describing behavior rather than identity.
|
|
76
|
+
|
|
77
|
+
### PQ-2.3: Negative Parallelisms
|
|
78
|
+
|
|
79
|
+
- **Detection keywords/regex:** `(Not only.*but (also)?|It's not just about.*it's (also)?|more than just|goes beyond)`
|
|
80
|
+
- **Problem:** Formulaic rhetorical structure that AI uses to build artificial momentum. Rarely adds meaning.
|
|
81
|
+
- **Before:** "It's not just about handling errors, it's about building a culture of reliability."
|
|
82
|
+
- **After:** "The error handler retries transient failures and circuits open after 3 consecutive timeouts."
|
|
83
|
+
- **False-positive guidance:** Legitimate in persuasive writing (blog posts, conference talks). Flag in technical docs and code comments.
|
|
84
|
+
|
|
85
|
+
### PQ-2.4: Rule of Three Overuse
|
|
86
|
+
|
|
87
|
+
- **Detection keywords/regex:** Three comma-separated items in a row, especially adjectives or abstract nouns. Manual check -- no single regex.
|
|
88
|
+
- **Problem:** AI models force ideas into groups of three for rhetorical effect, even when only two points exist or four would be more accurate.
|
|
89
|
+
- **Before:** "The system is fast, reliable, and scalable." (when only speed was measured)
|
|
90
|
+
- **After:** "The system handles 10K requests/second with p99 latency under 50ms."
|
|
91
|
+
- **False-positive guidance:** Three items is often natural. Flag only when items feel padded to reach three, or when the third item is vague/generic.
|
|
92
|
+
|
|
93
|
+
### PQ-2.5: Elegant Variation
|
|
94
|
+
|
|
95
|
+
- **Detection keywords/regex:** Manual check -- look for excessive synonym cycling within a paragraph (e.g., "users"/"individuals"/"people"/"stakeholders" all referring to the same group).
|
|
96
|
+
- **Problem:** AI models cycle through synonyms to avoid repetition, creating confusion about whether different terms refer to different things.
|
|
97
|
+
- **Before:** "Users configure the system. Individuals can customize their preferences. People set up notifications. Stakeholders manage access."
|
|
98
|
+
- **After:** "Users configure the system, customize preferences, set up notifications, and manage access."
|
|
99
|
+
- **False-positive guidance:** Technical writing should use consistent terms. Some variation is natural in longer prose. Flag when variation creates ambiguity.
|
|
100
|
+
|
|
101
|
+
### PQ-2.6: False Ranges
|
|
102
|
+
|
|
103
|
+
- **Detection keywords/regex:** `(from\s+\w+\s+to\s+\w+|range from|spanning from)`
|
|
104
|
+
- **Problem:** AI creates artificial ranges where the endpoints are not on a meaningful scale. "From beginners to experts" or "from development to production" are usually filler.
|
|
105
|
+
- **Before:** "The tool serves everyone from beginners to seasoned professionals."
|
|
106
|
+
- **After:** "The tool requires no prior experience with event sourcing."
|
|
107
|
+
- **False-positive guidance:** Legitimate when describing an actual continuum with meaningful endpoints. Flag when the range is vague or the endpoints are not comparable.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Category 3: Style Patterns
|
|
112
|
+
|
|
113
|
+
### PQ-3.1: Em Dash Overuse
|
|
114
|
+
|
|
115
|
+
- **Detection keywords/regex:** Count of `\u2014` (em dash) per file; flag if density > 1 per 100 words.
|
|
116
|
+
- **Problem:** ChatGPT overuses em dashes to create punchy, sales-copy-like rhythm. Natural writing uses them sparingly.
|
|
117
|
+
- **Before:** "The system handles events -- all of them -- in real time -- no exceptions."
|
|
118
|
+
- **After:** "The system handles all events in real time."
|
|
119
|
+
- **False-positive guidance:** Quoted dialogue and some editorial styles favor em dashes. Check overall density rather than flagging individual occurrences.
|
|
120
|
+
|
|
121
|
+
### PQ-3.2: Boldface Overuse
|
|
122
|
+
|
|
123
|
+
- **Detection keywords/regex:** Count of `\*\*[^*]+\*\*` per section; flag if >3 bold phrases per paragraph.
|
|
124
|
+
- **Problem:** AI models mechanically emphasize phrases. Too much boldface reduces its impact and creates visual noise.
|
|
125
|
+
- **Before:** "The **event store** provides **reliable** persistence with **guaranteed** ordering and **automatic** compaction."
|
|
126
|
+
- **After:** "The event store provides reliable persistence with guaranteed ordering and automatic compaction."
|
|
127
|
+
- **False-positive guidance:** Reference docs and API documentation often use bold for parameter names. Flag only in prose paragraphs, not in structured reference material.
|
|
128
|
+
|
|
129
|
+
### PQ-3.3: Inline-Header Vertical Lists
|
|
130
|
+
|
|
131
|
+
- **Detection keywords/regex:** `^\s*[-*]\s+\*\*[^*]+\*\*:` (bulleted items with bolded headers followed by colons)
|
|
132
|
+
- **Problem:** AI defaults to this format for any list, even when a simple bulleted list or a paragraph would be clearer. The pattern creates unnecessary visual weight.
|
|
133
|
+
- **Before:**
|
|
134
|
+
```
|
|
135
|
+
- **Performance:** The system is fast
|
|
136
|
+
- **Reliability:** The system is reliable
|
|
137
|
+
- **Scalability:** The system scales
|
|
138
|
+
```
|
|
139
|
+
- **After:** "The system is fast, reliable, and scales horizontally."
|
|
140
|
+
- **False-positive guidance:** This format is appropriate for glossaries, API parameter docs, and reference material. Flag when used for simple lists that would read better as prose.
|
|
141
|
+
|
|
142
|
+
### PQ-3.4: Title Case Headings
|
|
143
|
+
|
|
144
|
+
- **Detection keywords/regex:** Headings where all major words are capitalized (e.g., `^#+\s+([A-Z][a-z]+\s+){2,}[A-Z]`)
|
|
145
|
+
- **Problem:** AI defaults to title case headings. Most modern style guides (Google, Microsoft, AP) recommend sentence case for headings in technical writing.
|
|
146
|
+
- **Before:** `## Getting Started With Event Sourcing`
|
|
147
|
+
- **After:** `## Getting started with event sourcing`
|
|
148
|
+
- **False-positive guidance:** Title case is correct for proper nouns, product names, and some style guides (APA). This is a style preference, not a hard rule. Flag only when the project's own style guide prefers sentence case.
|
|
149
|
+
|
|
150
|
+
### PQ-3.5: Emojis in Prose
|
|
151
|
+
|
|
152
|
+
- **Detection keywords/regex:** Unicode emoji characters in headings or bullet points (excluding code blocks and quoted strings).
|
|
153
|
+
- **Problem:** AI models decorate headings and lists with emojis. Professional technical writing almost never uses emojis in headings or body text.
|
|
154
|
+
- **Before:** "## Features", "- Fast performance", "- Easy setup"
|
|
155
|
+
- **After:** "## Features", "- Fast performance", "- Easy setup" (identical but without emojis)
|
|
156
|
+
- **False-positive guidance:** Some projects intentionally use emojis (changelogs, README badges). Check project conventions before flagging.
|
|
157
|
+
|
|
158
|
+
### PQ-3.6: Curly Quotation Marks
|
|
159
|
+
|
|
160
|
+
- **Detection keywords/regex:** `[\u2018\u2019\u201C\u201D]` (Unicode curly single and double quotes)
|
|
161
|
+
- **Problem:** ChatGPT uses curly (typographic) quotation marks instead of straight quotes. In code-adjacent documentation, straight quotes are standard.
|
|
162
|
+
- **Before:** \u201CThis is a string\u201D
|
|
163
|
+
- **After:** "This is a string"
|
|
164
|
+
- **False-positive guidance:** Curly quotes are correct in published prose (books, articles). Flag only in technical documentation and code-adjacent content.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Category 4: Communication Patterns
|
|
169
|
+
|
|
170
|
+
### PQ-4.1: Collaborative Artifacts
|
|
171
|
+
|
|
172
|
+
- **Detection keywords/regex:** `(I hope this helps|Of course!|Certainly!|You're absolutely right|Would you like|let me know if|here is a|feel free to|don't hesitate to|happy to help)`
|
|
173
|
+
- **Problem:** Chatbot correspondence language left in shipped content. These phrases only make sense in a conversation between a user and an AI assistant.
|
|
174
|
+
- **Before:** "I hope this helps! Let me know if you'd like me to explain anything else."
|
|
175
|
+
- **After:** (Delete entirely -- this is chatbot conversation, not documentation.)
|
|
176
|
+
- **False-positive guidance:** Legitimate in user-facing chat interfaces and FAQ sections where conversational tone is intentional. Flag in all other documentation.
|
|
177
|
+
|
|
178
|
+
### PQ-4.2: Knowledge-Cutoff Disclaimers
|
|
179
|
+
|
|
180
|
+
- **Detection keywords/regex:** `(as of (my|this|the) (last|latest)|up to my last training|based on available information|while specific details are (limited|scarce)|at the time of (writing|this response))`
|
|
181
|
+
- **Problem:** AI model disclaimers about incomplete knowledge left in documentation. These reveal unreviewed AI output.
|
|
182
|
+
- **Before:** "As of my last training update, the API supports three endpoints."
|
|
183
|
+
- **After:** "The API supports three endpoints (v2.3.0)."
|
|
184
|
+
- **False-positive guidance:** "As of the latest release" or "at the time of writing" with a specific date are legitimate. Flag only when the phrasing reveals an AI knowledge cutoff.
|
|
185
|
+
|
|
186
|
+
### PQ-4.3: Sycophantic Tone
|
|
187
|
+
|
|
188
|
+
- **Detection keywords/regex:** `(Great question|That's a great|Excellent point|Absolutely[!,]|What a (great|wonderful|fantastic)|You're right to|Good thinking)`
|
|
189
|
+
- **Problem:** People-pleasing language that is inappropriate in technical documentation. Signals unreviewed AI output pasted directly from a chat session.
|
|
190
|
+
- **Before:** "Great question! The event store uses SQLite for persistence."
|
|
191
|
+
- **After:** "The event store uses SQLite for persistence."
|
|
192
|
+
- **False-positive guidance:** None in technical docs. Rare in any professional writing. Almost always an AI tell.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Category 5: Filler/Hedging Patterns
|
|
197
|
+
|
|
198
|
+
### PQ-5.1: Filler Phrases
|
|
199
|
+
|
|
200
|
+
- **Detection keywords/regex:** `(in order to|due to the fact that|at this point in time|in the event that|has the ability to|it is worth noting that|it is important to note|it should be noted that|needless to say)`
|
|
201
|
+
- **Problem:** Wordy phrases that can be simplified without losing meaning. AI models use them to pad output length.
|
|
202
|
+
- **Before:** "In order to ensure that the system has the ability to handle errors, it is important to note that..."
|
|
203
|
+
- **After:** "To handle errors..."
|
|
204
|
+
- **Simplification table:**
|
|
205
|
+
| Filler | Replacement |
|
|
206
|
+
|--------|-------------|
|
|
207
|
+
| In order to | To |
|
|
208
|
+
| Due to the fact that | Because |
|
|
209
|
+
| At this point in time | Now |
|
|
210
|
+
| In the event that | If |
|
|
211
|
+
| Has the ability to | Can |
|
|
212
|
+
| It is worth noting that | (delete or rephrase) |
|
|
213
|
+
| It is important to note | (delete or rephrase) |
|
|
214
|
+
- **False-positive guidance:** Legal or formal contexts where precision requires verbosity. "In order to" is sometimes clearer than "to" when the infinitive could be misread.
|
|
215
|
+
|
|
216
|
+
### PQ-5.2: Excessive Hedging
|
|
217
|
+
|
|
218
|
+
- **Detection keywords/regex:** `(could potentially|might possibly|may potentially|it could be argued|one might suggest|there is a possibility|to some extent|in some cases|it is possible that)`
|
|
219
|
+
- **Problem:** Over-qualifying statements strips them of usefulness. Technical docs should be direct.
|
|
220
|
+
- **Before:** "It could potentially be argued that this approach might possibly offer some advantages in certain scenarios."
|
|
221
|
+
- **After:** "This approach reduces memory usage by 40%."
|
|
222
|
+
- **False-positive guidance:** Some hedging is appropriate when genuinely uncertain (e.g., "performance may vary depending on hardware"). Flag stacked hedges (2+ qualifying phrases in one sentence).
|
|
223
|
+
|
|
224
|
+
### PQ-5.3: Generic Positive Conclusions
|
|
225
|
+
|
|
226
|
+
- **Detection keywords/regex:** `(the future looks bright|exciting times|looking forward to|great potential|paving the way|on the right track|poised for|well-positioned)`
|
|
227
|
+
- **Problem:** Vague upbeat endings without substance. AI models default to optimistic conclusions that say nothing specific.
|
|
228
|
+
- **Before:** "The future looks bright for this framework, and we look forward to exciting times ahead."
|
|
229
|
+
- **After:** "The v3.0 roadmap includes WebSocket support (Q2) and horizontal scaling (Q3)."
|
|
230
|
+
- **False-positive guidance:** Genuine forward-looking statements with specific plans attached are fine. Flag only when the conclusion is vague and could apply to anything.
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Frequency-Based Escalation
|
|
235
|
+
|
|
236
|
+
Not all occurrences warrant the same severity. Use these escalation rules:
|
|
237
|
+
|
|
238
|
+
| Pattern Type | 1 occurrence | 3+ in paragraph | 5+ in paragraph | 3+ in file |
|
|
239
|
+
|-------------|-------------|-----------------|-----------------|------------|
|
|
240
|
+
| AI vocabulary (PQ-2.1) | Ignore | MEDIUM | HIGH | MEDIUM |
|
|
241
|
+
| Structural tells (PQ-3.x) | LOW | MEDIUM | MEDIUM | MEDIUM |
|
|
242
|
+
| Filler phrases (PQ-5.1) | Ignore | LOW | MEDIUM | LOW |
|
|
243
|
+
| Communication (PQ-4.x) | HIGH | HIGH | HIGH | HIGH |
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Prose Quality Severity Guide
|
|
2
|
+
|
|
3
|
+
Severity mappings for each AI-writing pattern, with rationale and frequency-based escalation rules.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## HIGH Severity
|
|
8
|
+
|
|
9
|
+
Dead giveaways of unreviewed AI output. These should never appear in shipped content.
|
|
10
|
+
|
|
11
|
+
| Pattern ID | Pattern Name | Rationale |
|
|
12
|
+
|-----------|-------------|-----------|
|
|
13
|
+
| PQ-4.1 | Collaborative artifacts | Chatbot language ("I hope this helps") in documentation is an obvious copy-paste from an AI session |
|
|
14
|
+
| PQ-4.2 | Knowledge-cutoff disclaimers | "As of my last training update" in docs reveals AI-generated content that was never reviewed |
|
|
15
|
+
| PQ-4.3 | Sycophantic tone | "Great question!" in technical docs is inappropriate in any context |
|
|
16
|
+
| PQ-2.1 | AI vocabulary (5+ cluster) | Five or more AI-typical words in one paragraph creates an unmistakable AI fingerprint |
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## MEDIUM Severity
|
|
21
|
+
|
|
22
|
+
Patterns that cluster to create an AI-generated feel. Individually tolerable, but multiple occurrences signal low editorial effort.
|
|
23
|
+
|
|
24
|
+
| Pattern ID | Pattern Name | Rationale |
|
|
25
|
+
|-----------|-------------|-----------|
|
|
26
|
+
| PQ-1.1 | Inflated significance | Grandiose framing makes mundane topics sound absurd |
|
|
27
|
+
| PQ-1.3 | Superficial -ing analyses | Participial phrases that restate the obvious in fancier terms |
|
|
28
|
+
| PQ-1.4 | Promotional language | Loss of neutral, technical tone |
|
|
29
|
+
| PQ-2.1 | AI vocabulary (3-4 cluster) | Noticeable AI fingerprint but not overwhelming |
|
|
30
|
+
| PQ-2.2 | Copula avoidance | Over-formal "serves as" / "stands as" instead of simple "is" |
|
|
31
|
+
| PQ-2.3 | Negative parallelisms | "Not only...but also" rhetorical formula |
|
|
32
|
+
| PQ-5.3 | Generic positive conclusions | Vague upbeat endings with no substance |
|
|
33
|
+
| PQ-1.5 | Vague attributions | False authority via unnamed experts |
|
|
34
|
+
| PQ-1.6 | Formulaic sections | Template-like section transitions |
|
|
35
|
+
| PQ-2.4 | Rule of three overuse | Forced triadic groupings |
|
|
36
|
+
| PQ-2.6 | False ranges | Artificial ranges with non-comparable endpoints |
|
|
37
|
+
| PQ-1.2 | Notability emphasis | Unsubstantiated notability claims |
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## LOW Severity
|
|
42
|
+
|
|
43
|
+
Minor style issues. Worth fixing in a polish pass but not urgent.
|
|
44
|
+
|
|
45
|
+
| Pattern ID | Pattern Name | Rationale |
|
|
46
|
+
|-----------|-------------|-----------|
|
|
47
|
+
| PQ-3.1 | Em dash overuse | Style preference; only a problem at high density |
|
|
48
|
+
| PQ-3.5 | Emojis in prose | May be intentional per project conventions |
|
|
49
|
+
| PQ-5.1 | Filler phrases (isolated) | Single occurrences of wordy phrases are minor |
|
|
50
|
+
| PQ-5.2 | Excessive hedging (isolated) | Some hedging is appropriate for uncertainty |
|
|
51
|
+
| PQ-3.2 | Boldface overuse | Visual noise but does not affect meaning |
|
|
52
|
+
| PQ-3.3 | Inline-header vertical lists | Format preference; appropriate in some contexts |
|
|
53
|
+
| PQ-3.4 | Title case headings | Style guide dependent |
|
|
54
|
+
| PQ-3.6 | Curly quotation marks | Typographic preference |
|
|
55
|
+
| PQ-2.5 | Elegant variation | Confusing synonym cycling |
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Frequency-Based Escalation Rules
|
|
60
|
+
|
|
61
|
+
Base severity can be escalated based on pattern density:
|
|
62
|
+
|
|
63
|
+
### AI Vocabulary (PQ-2.1)
|
|
64
|
+
- **1 occurrence in paragraph:** Ignore (no finding)
|
|
65
|
+
- **3-4 occurrences in paragraph:** MEDIUM
|
|
66
|
+
- **5+ occurrences in paragraph:** HIGH
|
|
67
|
+
- **3+ occurrences across file (non-clustered):** MEDIUM
|
|
68
|
+
|
|
69
|
+
### Structural Tells (PQ-3.x)
|
|
70
|
+
- **1-2 occurrences in file:** LOW
|
|
71
|
+
- **3+ occurrences in file:** MEDIUM
|
|
72
|
+
|
|
73
|
+
### Filler Phrases (PQ-5.1)
|
|
74
|
+
- **1 occurrence in paragraph:** Ignore
|
|
75
|
+
- **3+ in paragraph:** LOW
|
|
76
|
+
- **5+ in paragraph:** MEDIUM
|
|
77
|
+
- **3+ across file:** LOW
|
|
78
|
+
|
|
79
|
+
### Communication Patterns (PQ-4.x)
|
|
80
|
+
- **Any occurrence:** HIGH (no escalation needed; always critical)
|
|
81
|
+
|
|
82
|
+
### Content Patterns (PQ-1.x)
|
|
83
|
+
- **Isolated occurrence:** Base severity
|
|
84
|
+
- **3+ in same section:** Escalate one level (LOW -> MEDIUM, MEDIUM -> HIGH)
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Context Modifiers
|
|
89
|
+
|
|
90
|
+
Severity may be adjusted based on where the pattern appears:
|
|
91
|
+
|
|
92
|
+
| Context | Modifier |
|
|
93
|
+
|---------|----------|
|
|
94
|
+
| User-facing documentation (README, guides) | No change (base severity) |
|
|
95
|
+
| Internal comments and docstrings | Reduce one level |
|
|
96
|
+
| Marketing copy or landing pages | Promotional language (PQ-1.4) acceptable; reduce to LOW |
|
|
97
|
+
| Changelogs and release notes | Formulaic sections (PQ-1.6) acceptable; reduce to LOW |
|
|
98
|
+
| Chat interface copy | Collaborative artifacts (PQ-4.1) acceptable; reduce to LOW |
|