@esoteric-logic/praxis-harness 2.10.0 → 2.11.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.
- package/base/CLAUDE.md +24 -9
- package/base/rules/api-quality.md +25 -0
- package/base/{skills → rules}/code-excellence.md +9 -2
- package/base/rules/css-quality.md +25 -0
- package/base/rules/go-quality.md +25 -0
- package/base/rules/java-quality.md +25 -0
- package/base/rules/python-quality.md +25 -0
- package/base/rules/rust-quality.md +25 -0
- package/base/rules/shell-quality.md +26 -0
- package/base/rules/sql-quality.md +25 -0
- package/base/rules/typescript-quality.md +26 -0
- package/package.json +1 -1
- /package/base/{skills → rules}/engineering-judgment.md +0 -0
- /package/base/{skills → rules}/self-verify.md +0 -0
package/base/CLAUDE.md
CHANGED
|
@@ -142,27 +142,42 @@ Kit manifests live in `~/.claude/kits/<name>/KIT.md`.
|
|
|
142
142
|
|
|
143
143
|
## Rules Registry — Load on Demand Only
|
|
144
144
|
|
|
145
|
-
### Universal — always active (
|
|
145
|
+
### Universal — always active (12 rules)
|
|
146
|
+
|
|
147
|
+
Quality is a generation-time constraint, not a post-hoc review. The rules below
|
|
148
|
+
are the lens you write through — they shape every line of code produced.
|
|
149
|
+
|
|
146
150
|
| File | Purpose |
|
|
147
151
|
|------|---------|
|
|
148
152
|
| `~/.claude/rules/profile.md` | Who the user is, identities, working style |
|
|
149
153
|
| `~/.claude/rules/execution-loop.md` | SPEC/PLAN/VALIDATE loop enforcement |
|
|
150
154
|
| `~/.claude/rules/coding.md` | Context7 mandate, tool preferences, quality architecture reference |
|
|
151
|
-
| `~/.claude/rules/code-quality.md` |
|
|
155
|
+
| `~/.claude/rules/code-quality.md` | Active constraints — hard limits during generation (30 lines, 3 nesting, 4 params) |
|
|
156
|
+
| `~/.claude/rules/code-excellence.md` | Core principles — simplicity, correctness, naming, error design, dependency hygiene |
|
|
157
|
+
| `~/.claude/rules/engineering-judgment.md` | Meta-reasoning — Five Questions, YAGNI, Rule of Three, reversibility test |
|
|
158
|
+
| `~/.claude/rules/self-verify.md` | Self-verification — 24-check protocol before every commit |
|
|
152
159
|
| `~/.claude/rules/git-workflow.md` | Commits, branches, identity verification, pre-commit checks |
|
|
153
160
|
| `~/.claude/rules/vault.md` | Second brain integration — vault backend, file purposes |
|
|
154
161
|
| `~/.claude/rules/context-management.md` | Context anti-rot, phase scoping, context reset protocol |
|
|
155
162
|
| `~/.claude/rules/memory-boundary.md` | Auto-memory boundary, MEMORY.md cap, dream integration |
|
|
156
163
|
| `~/.claude/rules/security-posture.md` | Sandbox model, credential protection, protected paths |
|
|
157
164
|
|
|
158
|
-
### Skills — loaded at session start
|
|
159
|
-
| File | Purpose |
|
|
160
|
-
|------|---------|
|
|
161
|
-
| `~/.claude/skills/code-excellence.md` | Layer 1: Principles — shapes reasoning about code |
|
|
162
|
-
| `~/.claude/skills/engineering-judgment.md` | Layer 1: Meta-reasoning — principal engineer decision framework |
|
|
163
|
-
| `~/.claude/skills/self-verify.md` | Layer 3: Self-verification protocol — proves correctness before commit |
|
|
164
|
-
|
|
165
165
|
### Scoped — load only when paths match
|
|
166
|
+
|
|
167
|
+
#### Language quality (generation-time constraints per language)
|
|
168
|
+
| File | Loads when |
|
|
169
|
+
|------|------------|
|
|
170
|
+
| `~/.claude/rules/python-quality.md` | `**/*.py` |
|
|
171
|
+
| `~/.claude/rules/typescript-quality.md` | `**/*.ts`, `**/*.tsx` |
|
|
172
|
+
| `~/.claude/rules/shell-quality.md` | `**/*.sh` |
|
|
173
|
+
| `~/.claude/rules/go-quality.md` | `**/*.go` |
|
|
174
|
+
| `~/.claude/rules/rust-quality.md` | `**/*.rs` |
|
|
175
|
+
| `~/.claude/rules/java-quality.md` | `**/*.java` |
|
|
176
|
+
| `~/.claude/rules/css-quality.md` | `**/*.css`, `**/*.scss`, `**/*.less` |
|
|
177
|
+
| `~/.claude/rules/sql-quality.md` | `**/*.sql` |
|
|
178
|
+
| `~/.claude/rules/api-quality.md` | `**/routes/**`, `**/api/**`, `**/controllers/**`, `**/handlers/**` |
|
|
179
|
+
|
|
180
|
+
#### Infrastructure and tooling
|
|
166
181
|
| File | Loads when |
|
|
167
182
|
|------|------------|
|
|
168
183
|
| `~/.claude/rules/azure.md` | `**/*.tf`, `**/*.bicep`, `**/*.azcli` |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# API Quality — Generation Constraints
|
|
2
|
+
# Scope: **/routes/**, **/api/**, **/controllers/**, **/handlers/**
|
|
3
|
+
# Active during code generation, not post-hoc review
|
|
4
|
+
|
|
5
|
+
## Invariants — BLOCK on violation
|
|
6
|
+
|
|
7
|
+
- Validate all input before touching business logic — type, range, format, length.
|
|
8
|
+
- Auth and permission checks execute before any data access — never after.
|
|
9
|
+
- Every endpoint has an explicit error response shape — no raw stack traces to callers.
|
|
10
|
+
- No raw database objects in responses — always project to a response type or DTO.
|
|
11
|
+
- Parameterized queries only — never concatenate user input into SQL or query strings.
|
|
12
|
+
- Rate limiting or pagination on any endpoint that returns unbounded collections.
|
|
13
|
+
|
|
14
|
+
## Conventions — WARN on violation
|
|
15
|
+
|
|
16
|
+
- Consistent error response format across all endpoints (status, code, message, details).
|
|
17
|
+
- Idempotency keys on state-changing operations that clients may retry.
|
|
18
|
+
- Request correlation IDs for tracing — propagate through the call chain.
|
|
19
|
+
- CORS, CSRF, and security headers configured explicitly — not inherited from defaults.
|
|
20
|
+
- Separate validation errors (400) from auth errors (401/403) from not-found (404) from server errors (500).
|
|
21
|
+
- Log request context (method, path, status, duration) — never log request bodies containing PII.
|
|
22
|
+
- API versioning strategy declared before first endpoint is written.
|
|
23
|
+
|
|
24
|
+
## Removal Condition
|
|
25
|
+
Remove when an API-specific linter rule engine replaces generation-time constraints.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Code Excellence — Core Principles
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
These principles shape how you reason about code before writing a single character.
|
|
4
|
+
They are not a checklist — they are a worldview. They are always active.
|
|
5
5
|
|
|
6
6
|
## The Prime Directive
|
|
7
7
|
Write code that the next engineer will thank you for.
|
|
@@ -21,6 +21,13 @@ Before adding any abstraction, answer all three:
|
|
|
21
21
|
- Would a new engineer understand the code FASTER with this abstraction than without it?
|
|
22
22
|
If any answer is no — do not add it. Inline the logic.
|
|
23
23
|
|
|
24
|
+
Over-engineering red flags — stop and simplify if you see yourself writing:
|
|
25
|
+
- An interface/factory/strategy with exactly one implementation
|
|
26
|
+
- A wrapper function whose entire body is a single delegating call
|
|
27
|
+
- Unused type parameters, config options no caller sets, plugin systems with one plugin
|
|
28
|
+
- Observer/EventEmitter with 2 listeners, Singleton for a module variable, Builder for 3 fields
|
|
29
|
+
- A function with boolean flags that switch behavior — write two functions instead
|
|
30
|
+
|
|
24
31
|
## On Correctness
|
|
25
32
|
Correctness means the code does exactly what its name promises. Not more. Not less.
|
|
26
33
|
A function named `getUserById` returns a user by ID.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# CSS Quality — Generation Constraints
|
|
2
|
+
# Scope: **/*.css, **/*.scss, **/*.less
|
|
3
|
+
# Active during code generation, not post-hoc review
|
|
4
|
+
|
|
5
|
+
## Invariants — BLOCK on violation
|
|
6
|
+
|
|
7
|
+
- No `!important` — fix the specificity problem instead.
|
|
8
|
+
- No hardcoded color values — use design tokens or CSS custom properties.
|
|
9
|
+
- No `px` for font sizes — use `rem` for scalability and accessibility.
|
|
10
|
+
- No `z-index` without a comment and reference to the project's z-index scale.
|
|
11
|
+
- No layout via `float` — use flexbox or grid.
|
|
12
|
+
|
|
13
|
+
## Conventions — WARN on violation
|
|
14
|
+
|
|
15
|
+
- CSS custom properties (`--var`) for all recurring values: spacing, colors, radii, shadows.
|
|
16
|
+
- Mobile-first media queries (`min-width`) — never desktop-first (`max-width`).
|
|
17
|
+
- Logical properties (`margin-inline`, `padding-block`) over physical (`margin-left`, `padding-top`).
|
|
18
|
+
- `gap` for spacing between flex/grid items — not margin hacks on children.
|
|
19
|
+
- Prefer `clamp()` for fluid typography and spacing over media query breakpoints.
|
|
20
|
+
- `:focus-visible` over `:focus` for keyboard-only focus indicators.
|
|
21
|
+
- `prefers-reduced-motion` media query wrapping any animation or transition.
|
|
22
|
+
- BEM or utility-class convention — never bare tag selectors outside resets.
|
|
23
|
+
|
|
24
|
+
## Removal Condition
|
|
25
|
+
Remove when a CSS-specific linter rule engine replaces generation-time constraints.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Go Quality — Generation Constraints
|
|
2
|
+
# Scope: **/*.go
|
|
3
|
+
# Active during code generation, not post-hoc review
|
|
4
|
+
|
|
5
|
+
## Invariants — BLOCK on violation
|
|
6
|
+
|
|
7
|
+
- Every error return checked immediately — no `_` for error values.
|
|
8
|
+
- No `panic` in library code — return errors. Reserve `panic` for truly unrecoverable states in `main`.
|
|
9
|
+
- No `interface{}` or `any` without a comment explaining why a concrete type won't work.
|
|
10
|
+
- Context (`context.Context`) as the first parameter of any function that does I/O or may be cancelled.
|
|
11
|
+
- No goroutine without a clear ownership and shutdown path — leaked goroutines are memory leaks.
|
|
12
|
+
|
|
13
|
+
## Conventions — WARN on violation
|
|
14
|
+
|
|
15
|
+
- Table-driven tests for any function with more than 2 test cases.
|
|
16
|
+
- `errors.Is` / `errors.As` for error comparison — never string matching on `err.Error()`.
|
|
17
|
+
- `fmt.Errorf("context: %w", err)` to wrap errors with context — never lose the original.
|
|
18
|
+
- Named return values only when they clarify the function signature — not as a substitute for declarations.
|
|
19
|
+
- `sync.Mutex` fields placed immediately above the fields they protect, with a comment.
|
|
20
|
+
- `defer` for cleanup — but never defer in a loop body.
|
|
21
|
+
- Prefer `io.Reader` / `io.Writer` interfaces over concrete types in function signatures.
|
|
22
|
+
- Struct field tags (`json`, `db`) on every field of a struct used for serialization.
|
|
23
|
+
|
|
24
|
+
## Removal Condition
|
|
25
|
+
Remove when golangci-lint rules replace generation-time constraints entirely.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Java Quality — Generation Constraints
|
|
2
|
+
# Scope: **/*.java
|
|
3
|
+
# Active during code generation, not post-hoc review
|
|
4
|
+
|
|
5
|
+
## Invariants — BLOCK on violation
|
|
6
|
+
|
|
7
|
+
- No raw types — always use parameterized generics (`List<String>`, not `List`).
|
|
8
|
+
- No empty catch blocks — handle, re-throw with context, or log with severity.
|
|
9
|
+
- No `null` returns from public methods without `@Nullable` annotation and documented behavior.
|
|
10
|
+
- All public API methods have Javadoc with `@param`, `@return`, and `@throws`.
|
|
11
|
+
- Resources (streams, connections) use try-with-resources — never manual `finally` close.
|
|
12
|
+
|
|
13
|
+
## Conventions — WARN on violation
|
|
14
|
+
|
|
15
|
+
- Records over classes for immutable data carriers (Java 16+).
|
|
16
|
+
- `Optional` return type over nullable for methods that may not produce a result.
|
|
17
|
+
- `var` for local variables only when the type is obvious from the right-hand side.
|
|
18
|
+
- `sealed` interfaces/classes for closed hierarchies with pattern matching.
|
|
19
|
+
- Builder pattern only for objects with 5+ fields — constructors or factories for fewer.
|
|
20
|
+
- Prefer `List.of()`, `Map.of()` for immutable collections — not `Collections.unmodifiable*`.
|
|
21
|
+
- `@Override` on every overriding method — let the compiler catch signature drift.
|
|
22
|
+
- Stream operations only when they improve readability — explicit loops for complex logic.
|
|
23
|
+
|
|
24
|
+
## Removal Condition
|
|
25
|
+
Remove when a Java-specific linter rule engine replaces generation-time constraints.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Python Quality — Generation Constraints
|
|
2
|
+
# Scope: **/*.py
|
|
3
|
+
# Active during code generation, not post-hoc review
|
|
4
|
+
|
|
5
|
+
## Invariants — BLOCK on violation
|
|
6
|
+
|
|
7
|
+
- Type hints on every function signature — parameters and return type. No exceptions.
|
|
8
|
+
- No bare `except:` — always catch a specific exception type.
|
|
9
|
+
- No mutable default arguments (`def f(x=[])`) — use `None` and assign inside.
|
|
10
|
+
- No `import *` — explicit imports only.
|
|
11
|
+
- No `type: ignore` without an inline comment explaining why it's safe.
|
|
12
|
+
- f-strings only for string formatting — never `%` or `.format()`.
|
|
13
|
+
|
|
14
|
+
## Conventions — WARN on violation
|
|
15
|
+
|
|
16
|
+
- `dataclass` or `TypedDict` over raw dicts for structured data with 3+ fields.
|
|
17
|
+
- `pathlib.Path` over `os.path` for path manipulation.
|
|
18
|
+
- Context managers (`with`) for all resource handling (files, connections, locks).
|
|
19
|
+
- Comprehensions only when they fit one line — explicit loops otherwise.
|
|
20
|
+
- `enum.Enum` or `Literal` for fixed sets of values — never raw strings.
|
|
21
|
+
- `logging` module over `print()` in anything that isn't a CLI script.
|
|
22
|
+
- Async functions: every `await` in a try/except or the caller handles the exception.
|
|
23
|
+
|
|
24
|
+
## Removal Condition
|
|
25
|
+
Remove when a Python-specific linter rule engine replaces generation-time constraints.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Rust Quality — Generation Constraints
|
|
2
|
+
# Scope: **/*.rs
|
|
3
|
+
# Active during code generation, not post-hoc review
|
|
4
|
+
|
|
5
|
+
## Invariants — BLOCK on violation
|
|
6
|
+
|
|
7
|
+
- No `.unwrap()` or `.expect()` in library code — propagate errors with `?`.
|
|
8
|
+
- No `unsafe` blocks without an inline `// SAFETY:` comment explaining the invariant.
|
|
9
|
+
- No `.clone()` to silence the borrow checker — restructure ownership instead.
|
|
10
|
+
- All public items have doc comments (`///`) — the API is the documentation.
|
|
11
|
+
- Error types implement `std::error::Error` and provide context via `Display`.
|
|
12
|
+
|
|
13
|
+
## Conventions — WARN on violation
|
|
14
|
+
|
|
15
|
+
- `thiserror` for library error types, `anyhow` for application error types.
|
|
16
|
+
- Prefer `&str` over `String` in function parameters — take ownership only when needed.
|
|
17
|
+
- Prefer iterators and combinators over manual loops where they improve readability.
|
|
18
|
+
- `#[must_use]` on functions whose return value should not be silently ignored.
|
|
19
|
+
- Derive `Debug` on all public structs and enums.
|
|
20
|
+
- `#[non_exhaustive]` on public enums that may gain variants.
|
|
21
|
+
- Prefer `impl Trait` in argument position over generic type parameters when the type is used once.
|
|
22
|
+
- Integration tests in `tests/` directory — unit tests in the same file with `#[cfg(test)]`.
|
|
23
|
+
|
|
24
|
+
## Removal Condition
|
|
25
|
+
Remove when clippy rules replace generation-time constraints entirely.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Shell Quality — Generation Constraints
|
|
2
|
+
# Scope: **/*.sh
|
|
3
|
+
# Active during code generation, not post-hoc review
|
|
4
|
+
|
|
5
|
+
## Invariants — BLOCK on violation
|
|
6
|
+
|
|
7
|
+
- Every script starts with `#!/usr/bin/env bash` and `set -euo pipefail`.
|
|
8
|
+
- All variable expansions quoted: `"$VAR"`, never bare `$VAR`.
|
|
9
|
+
- No `eval` — ever. Use arrays for dynamic command construction.
|
|
10
|
+
- `[[ ]]` for conditionals — never `[ ]` (no word splitting, no glob expansion).
|
|
11
|
+
- No inline credentials or tokens — use environment variables.
|
|
12
|
+
- Exit codes: 0 for success, 1 for general failure, 2 for hard block (Praxis convention).
|
|
13
|
+
|
|
14
|
+
## Conventions — WARN on violation
|
|
15
|
+
|
|
16
|
+
- Heredocs or `printf` for multi-line output — never multi-line `echo`.
|
|
17
|
+
- `local` keyword for all variables inside functions.
|
|
18
|
+
- `command -v` for tool detection — never `which`.
|
|
19
|
+
- `mktemp` for temporary files — never hardcoded `/tmp/myfile`.
|
|
20
|
+
- Trap `ERR` or use explicit error handling — don't rely solely on `set -e`.
|
|
21
|
+
- Use `jq` with `--arg` / `--argjson` for JSON — never interpolate variables into JSON strings.
|
|
22
|
+
- Prefer `$(...)` over backticks for command substitution.
|
|
23
|
+
- Group related options into functions — no scripts longer than 100 lines without functions.
|
|
24
|
+
|
|
25
|
+
## Removal Condition
|
|
26
|
+
Remove when a shell-specific linter rule engine replaces generation-time constraints.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# SQL Quality — Generation Constraints
|
|
2
|
+
# Scope: **/*.sql
|
|
3
|
+
# Active during code generation, not post-hoc review
|
|
4
|
+
|
|
5
|
+
## Invariants — BLOCK on violation
|
|
6
|
+
|
|
7
|
+
- Parameterized queries only — never concatenate user input into SQL strings.
|
|
8
|
+
- Every `SELECT` on user-generated data has a `LIMIT` — no unbounded result sets.
|
|
9
|
+
- Every migration is reversible — include both `UP` and `DOWN` in every migration file.
|
|
10
|
+
- No `SELECT *` — explicitly list columns. Schema changes should not silently alter query results.
|
|
11
|
+
- No `DROP TABLE` or `DROP COLUMN` without a preceding data migration or explicit confirmation.
|
|
12
|
+
|
|
13
|
+
## Conventions — WARN on violation
|
|
14
|
+
|
|
15
|
+
- Uppercase SQL keywords (`SELECT`, `FROM`, `WHERE`) — lowercase for identifiers.
|
|
16
|
+
- `snake_case` for all table and column names.
|
|
17
|
+
- Foreign keys have explicit `ON DELETE` and `ON UPDATE` behavior — never rely on defaults.
|
|
18
|
+
- Indexes on all columns used in `WHERE`, `JOIN`, and `ORDER BY` on tables >1000 rows.
|
|
19
|
+
- `NOT NULL` by default — nullable columns require a comment explaining why null is valid.
|
|
20
|
+
- `TIMESTAMP WITH TIME ZONE` for all temporal columns — never naive timestamps.
|
|
21
|
+
- `CHECK` constraints for domain validation at the database level — don't rely solely on application code.
|
|
22
|
+
- CTEs (`WITH`) for readability over nested subqueries beyond 2 levels.
|
|
23
|
+
|
|
24
|
+
## Removal Condition
|
|
25
|
+
Remove when a SQL-specific linter rule engine replaces generation-time constraints.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# TypeScript Quality — Generation Constraints
|
|
2
|
+
# Scope: **/*.ts, **/*.tsx
|
|
3
|
+
# Active during code generation, not post-hoc review
|
|
4
|
+
|
|
5
|
+
## Invariants — BLOCK on violation
|
|
6
|
+
|
|
7
|
+
- No `any` type — ever. Use `unknown` and narrow, or define the actual type.
|
|
8
|
+
- Explicit return types on all exported functions.
|
|
9
|
+
- No non-null assertion (`!`) without an inline comment explaining why it's safe.
|
|
10
|
+
- No `@ts-ignore` or `@ts-expect-error` without an inline comment explaining why.
|
|
11
|
+
- No `as` type assertions unless narrowing from `unknown` — prefer type guards.
|
|
12
|
+
- Strict null checks: handle `null` and `undefined` explicitly, never assume presence.
|
|
13
|
+
|
|
14
|
+
## Conventions — WARN on violation
|
|
15
|
+
|
|
16
|
+
- `const` by default — `let` only when reassignment is necessary. Never `var`.
|
|
17
|
+
- Discriminated unions over optional fields for modeling distinct states.
|
|
18
|
+
- `readonly` on properties that should not be mutated after construction.
|
|
19
|
+
- `interface` for object shapes, `type` for unions, intersections, and computed types.
|
|
20
|
+
- Named exports over default exports — better refactoring support and tree-shaking.
|
|
21
|
+
- `Promise.all` for independent async operations — never sequential awaits for parallel work.
|
|
22
|
+
- Error boundaries in React components that render user-generated or external data.
|
|
23
|
+
- `satisfies` operator over `as` for type validation without widening.
|
|
24
|
+
|
|
25
|
+
## Removal Condition
|
|
26
|
+
Remove when a TypeScript-specific linter rule engine replaces generation-time constraints.
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|