@antoneeo/mkt-agentic-sdlc-skill 0.2.0 → 0.3.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.
@@ -1,82 +1,116 @@
1
- # Mechanical Enforcement (optional)
2
-
3
- The prompt is not enforcement. Where the project needs repeatable guarantees,
4
- wire the validator into the workflow. Everything here is optional: the skill
5
- must stay usable without Python or hooks, declaring what it cannot verify.
6
-
7
- ## 1. Pre-delivery gate (the one that matters)
8
-
9
- Before presenting any E2/E3 deliverable as finished:
10
-
11
- ```bash
12
- python <skill_dir>/scripts/mkt_check.py check --root <project_root>
13
- ```
14
-
15
- `check` runs `validate + ledger + budget + funnel + trace`. Errors block the
16
- delivery; warnings ship only with explicit user acknowledgment. This is the
17
- marketing twin of "tests must pass before DONE".
18
-
19
- ## 2. CI
20
-
21
- For a marketing repo kept under version control:
22
-
23
- ```yaml
24
- # e.g. GitHub Actions step
25
- - run: python skills/mkt-agentic-sdlc/scripts/mkt_check.py validate --strict --root .
26
- - run: python skills/mkt-agentic-sdlc/scripts/mkt_check.py ledger --root .
27
- ```
28
-
29
- Use `--strict` only in CI: locally, warnings are guidance; in CI they are
30
- drift.
31
-
32
- ## 3. Git hook (pre-commit)
33
-
34
- ```bash
35
- #!/bin/sh
36
- python skills/mkt-agentic-sdlc/scripts/mkt_check.py check --root . || {
37
- echo "mkt_check failed — fix the plan before committing."; exit 1; }
38
- ```
39
-
40
- ## 4. What the validator cannot check (honesty list)
41
-
42
- - Whether a BENCHMARK's URL actually supports the claimed number (it checks
43
- presence, not truth) — that is the review's R2/R3 territory.
44
- - Whether the positioning passes the swap test (R1) — adversarial review only.
45
- - Whether kill/scale thresholds are sensible — review, with ledger evidence.
46
- - Whether the deliverable language matches the target market — Discovery
47
- record + review.
48
-
49
- Declare these residuals when reporting a CLEAN check: mechanical CLEAN plus
50
- review PASS is the full gate, neither alone.
51
-
52
- ## 5. Skill self-test (skill development only)
53
-
54
- Two deterministic batteries — the release gate. Run both:
55
-
56
- ```bash
57
- python -m unittest discover -s skills/mkt-agentic-sdlc/scripts -p "test_*.py"
58
- ```
59
-
60
- - `test_mkt_check.py` — the validator itself; gate for changes to
61
- `mkt_check.py` or to the parseable template formats in `templates.md` (the
62
- two must move together: a template format change without a validator change
63
- is drift).
64
- - `test_skill_invariants.py` — the doctrine invariants: asserts the
65
- load-bearing rules are still present in `SKILL.md` and the support files
66
- (the three guarantees, the review red-flags R1/R11b/R15, the elicitation
67
- rules, the research URL rule, the parseable template tokens, every support
68
- file wired). Fails when a rule is deleted or weakened — a real regression,
69
- never flakiness.
70
-
71
- ## 6. Behavioral eval layer (opt-in, non-gating)
72
-
73
- ```bash
74
- python skills/mkt-agentic-sdlc/evals/run_behavioral.py skills/mkt-agentic-sdlc/evals/scenarios/<scenario>.md
75
- ```
76
-
77
- Declarative scenarios exercise real agent *adherence* (elicitation asks only
78
- owned facts, no number without a ledger entry, swap-test enforced, low-cost
79
- trap flagged, E2-without-strategy escalates, no guaranteed-success promise).
80
- The driver seeds a throwaway fixture, prints the prompt + pass criteria, makes
81
- NO model call, and never gates — LLM nondeterminism is why the deterministic
82
- gate stays §5. See `evals/scenarios/README.md`.
1
+ # Mechanical enforcement (optional, recommended for teams)
2
+
3
+ Prompt-level rules depend on the model's discipline and degrade with long contexts, compaction and competing instructions. Three levels of increasing guarantee:
4
+
5
+ ## 1. Interactive validation (default, no setup)
6
+
7
+ The agent runs a single gate at closure (Phase 5):
8
+
9
+ ```
10
+ python "<skill_dir>/scripts/mkt_check.py" check
11
+ ```
12
+
13
+ (`check` = validate + ledger + budget + funnel + trace in one command.) Exit code ≠ 0 ⇒ the feature is not declared closed. This is the minimum level the skill expects.
14
+
15
+ ## 2. Check in CI (recommended for teams)
16
+
17
+ Copy **both** validator files into the repository — `scripts/mkt_check.py` (the entry point) **and** `scripts/sdlc_core.py` (the shared core it imports) — keeping them side by side, e.g. `tools/mkt_check.py` + `tools/sdlc_core.py`. Then add to the pipeline:
18
+
19
+ ```
20
+ python tools/mkt_check.py validate --strict
21
+ ```
22
+
23
+ The validator ships as two files: the core carries the behaviour and is identical in every distribution of the family, the entry point names the domain. Copying only `mkt_check.py` fails immediately with a message saying so — loudly, never as a silently green pipeline. (Copying `sdlc_core.py` alone also works: `python tools/sdlc_core.py validate --strict` behaves identically, defaulting to the code domain.)
24
+
25
+ Effect: an unregenerated index, invalid frontmatter, a missing security section or incoherent states **block the pipeline** instead of relying on the agent's memory. `--strict` also fails on warnings and on a missing `ai_docs/`, so a wrong working directory cannot produce a green pipeline. This works because documents travel in the same PR as the code (Phase 5 rule).
26
+
27
+ Note: the copy in the repo is the authoritative one for CI; update it when you update the skill — both files, together.
28
+
29
+ **Projects whose docs root is not `ai_docs/`.** Pass `--docs-dir <name>` (e.g. `--docs-dir mkt_docs`) on any subcommand, or set `AGENTIC_SDLC_DOCS_DIR`. Without either, the validator walks up from the working directory and takes the nearest root it recognizes. If it finds two side by side — the shape of a half-finished migration — it refuses and names both rather than validating half a project and printing a verdict. `ai_docs/` remains the default and the recommended root: the parameter exists so a legacy tree can be read and migrated, not so a second one can be kept.
30
+
31
+ ## 3. PreToolUse hook (gate on writes)
32
+
33
+ Blocks Edit/Write on protected paths when no `ANALYSIS_*.md` is `IN_PROGRESS`. In the project's `.claude/settings.json`:
34
+
35
+ ```json
36
+ {
37
+ "hooks": {
38
+ "PreToolUse": [
39
+ {
40
+ "matcher": "Write|Edit",
41
+ "hooks": [
42
+ {
43
+ "type": "command",
44
+ "command": "python \"C:\\Users\\<user>\\.claude\\skills\\agentic-sdlc\\scripts\\mkt_check.py\" gate --hook --protected \"src/auth;src/crypto\""
45
+ }
46
+ ]
47
+ }
48
+ ]
49
+ }
50
+ }
51
+ ```
52
+
53
+ Semantics: exit code 2 + message on stderr ⇒ the write is blocked and the message is shown to the agent, which must create the ANALYSIS (Phase 3) before retrying.
54
+
55
+ **Usage warnings:**
56
+ - The gate is deliberately coarse: applied to all of `src/` it would also block the legitimate L1/L2 tasks foreseen by the Triage. Use it **only on security-critical directories** (`--protected "src/auth;src/crypto"`), where "never without analysis" is the desired policy.
57
+ - The paths in `--protected` are prefixes relative to the project root, separated by `;`.
58
+ - `ai_docs/`, `tests/` and `test/` are always excluded from blocking.
59
+ - The hook assumes the working directory is the project root (standard behavior of Claude Code hooks).
60
+ - **Hybrid/devPNT projects**: add `--hybrid` to the gate command. Governed designs live in the devPNT DB, so the gate also unlocks when an approved E-TDD shadow (`ai_docs/solutions/SHADOW_*tdd*.md`, exported before implementation — see the SKILL.md shadow discipline) is present. Without the flag the gate would block legitimate governed work. The flag is deliberately explicit: never auto-detected.
61
+
62
+ ## 4. SessionStart hook (orientation, recommended default)
63
+
64
+ Emits the `ai_docs/` orientation — reading guide (`README.md`), manifest (`INDEX.md`), guide router (`reference/INDEX.md`) and last `handoff.md` — plus the Rule-Zero triage reminder to stdout at session start, so the agent begins already oriented instead of reading them only if it remembers to. It is **fail-open**: a missing, unreadable or oversized doc is skipped, the output is size-capped, and it always exits 0 — a broken or empty `ai_docs/` never blocks the session. It is **zero-execution** (it reads and prints, never runs anything).
65
+
66
+ **Wire it on every project that has `ai_docs/` and a Python interpreter.** It was opt-in until v1.16.0 and the field result was the defect this level exists to prevent: the guide router stayed unread unless the user asked for it by hand, so guides were written and never consulted. Prompt-level placement (Rule Zero declares the router verdict; Phase 1 reads the router) carries the process on its own — this hook is the backstop that survives long contexts, compaction and a session that never enters Phase 1 explicitly. Skip it only where Python is unavailable, and know what you are trading.
67
+
68
+ Wire it via each client's SessionStart mechanism — the same command everywhere (add `--hybrid` on devPNT/Hybrid projects):
69
+
70
+ Claude Code — in the project's `.claude/settings.json`:
71
+
72
+ ```json
73
+ {
74
+ "hooks": {
75
+ "SessionStart": [
76
+ {
77
+ "hooks": [
78
+ {
79
+ "type": "command",
80
+ "command": "python \"C:\\Users\\<user>\\.claude\\skills\\agentic-sdlc\\scripts\\mkt_check.py\" orient"
81
+ }
82
+ ]
83
+ }
84
+ ]
85
+ }
86
+ }
87
+ ```
88
+
89
+ Codex — in `.codex/hooks.json`, the same `SessionStart` → `{"type":"command","command":"… orient"}` shape (this replaces the legacy static-echo protocol some fixtures still carry).
90
+
91
+ Gemini CLI — wire the same command into its startup-hook mechanism if present; otherwise the step simply degrades to the manual Phase-1 reads (no capability lost).
92
+
93
+ **Usage notes:**
94
+ - The hook assumes the working directory is the project root (standard Claude Code hook behavior); it also accepts `--root <path>`.
95
+ - **Hybrid/devPNT projects**: add `--hybrid` — the hook then appends a one-line pointer to run `devpnt_mcp_get_bootstrap` for the Master Plan / Knowledge Layer and does not replicate them; the filesystem orientation (router + handoff + README) still emits.
96
+ - Like the CI gate (§2), if you copied the validator into the repo, the hook references that copy — keep both files current when you update the skill.
97
+
98
+ ## 5. Skill eval battery (release gate)
99
+
100
+ **Skill development only.** `test_*.py` and `evals/` are deliberately absent from the npm `files` allowlist — they never reach an installed consumer, so this section applies to whoever builds the skill, not to a project that uses it. (Consumers get `mkt_check.py` + `sdlc_core.py`; §1–§4 are theirs.)
101
+
102
+ The skill self-tests its own doctrine invariants. Two layers over one scenario corpus:
103
+
104
+ **Static battery — the deterministic release gate.** Run before any publish:
105
+
106
+ ```
107
+ python -m unittest discover -s skills/mkt-agentic-sdlc/scripts -p "test_*.py"
108
+ ```
109
+
110
+ It aggregates the test files (`test_plan.py` + `test_session_start.py` + `test_skill_invariants.py` + `test_domain_rules.py` + `test_golden_regression.py` + `test_mkt_check.py`) and asserts the skill's invariants: the M4 triggers/hook/worktree doctrine is present and wired, support-file pointers resolve, and the generated indexes are idempotent. A non-zero exit **blocks the release** — a failing eval is always a real regression, never flakiness: the battery is stdlib-only and makes no model or network call. One test does spawn a subprocess — `test_golden_regression.py` runs the shipped validator over a frozen corpus, which is the only way to compare what a user actually sees; it is local, offline and deterministic. If `test_indexes_idempotent` fails, run `mkt_check.py index` and re-run. If `test_golden_regression` fails, the validator's behaviour on an unchanged project changed: treat that as a regression until someone declares it intended.
111
+
112
+ **Behavioral corpus — opt-in, non-CI.** `evals/scenarios/*.md` (declarative, model-neutral) + `evals/run_behavioral.py` seed a fixture and print a prompt + pass criteria for a human/agent to run and self-assess. Because live adherence is nondeterministic, this layer **never gates** — it is the reproducible way to check that, e.g., the consult trigger actually fires on a seeded repo (the "demonstrably" artifact).
113
+
114
+ **Optional CI** (same shape as §2, not mandatory): add a `run:` step invoking the `unittest discover` command above.
115
+
116
+ **T10 note:** if you copied the validator (both files) and the `test_*.py` battery into the repo for CI, that copy is authoritative — keep it current when you update the skill.