claude-dev-env 1.38.0 → 1.39.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/CLAUDE.md +10 -36
- package/_shared/pr-loop/audit-reply-template.md +147 -0
- package/_shared/pr-loop/fix-protocol.md +25 -4
- package/_shared/pr-loop/gh-payloads.md +37 -50
- package/_shared/pr-loop/scripts/code_rules_gate.py +0 -60
- package/_shared/pr-loop/scripts/config/post_audit_thread_constants.py +189 -0
- package/_shared/pr-loop/scripts/post_audit_thread.py +947 -0
- package/_shared/pr-loop/scripts/tests/test_code_rules_gate.py +0 -19
- package/_shared/pr-loop/scripts/tests/test_post_audit_thread.py +923 -0
- package/_shared/pr-loop/scripts/tests/test_post_audit_thread_constants.py +127 -0
- package/_shared/pr-loop/state-schema.md +1 -1
- package/agents/clean-coder.md +2 -2
- package/bin/install.mjs +6 -7
- package/bin/install.test.mjs +8 -0
- package/commands/doc-gist.md +16 -0
- package/commands/plan.md +0 -2
- package/commands/review-plan.md +1 -1
- package/docs/CODE_RULES.md +122 -2
- package/hooks/blocking/bot_mention_comment_blocker.py +75 -0
- package/hooks/blocking/code_rules_enforcer.py +1236 -161
- package/hooks/blocking/convergence_gate_blocker.py +130 -0
- package/hooks/blocking/destructive_command_blocker.py +74 -0
- package/hooks/blocking/gh_body_arg_blocker.py +30 -0
- package/hooks/blocking/md_to_html_blocker.py +119 -0
- package/hooks/blocking/test_bot_mention_comment_blocker.py +131 -0
- package/hooks/blocking/test_code_rules_enforcer.py +21 -0
- package/hooks/blocking/test_code_rules_enforcer_any_exempt_files.py +70 -0
- package/hooks/blocking/test_code_rules_enforcer_any_imports_and_cast.py +92 -0
- package/hooks/blocking/test_code_rules_enforcer_banned_import_alias.py +143 -0
- package/hooks/blocking/test_code_rules_enforcer_banned_prefixes.py +152 -0
- package/hooks/blocking/test_code_rules_enforcer_bare_except.py +120 -0
- package/hooks/blocking/test_code_rules_enforcer_boundary_types.py +175 -0
- package/hooks/blocking/test_code_rules_enforcer_cap_meta.py +0 -1
- package/hooks/blocking/test_code_rules_enforcer_collection_prefix.py +50 -0
- package/hooks/blocking/test_code_rules_enforcer_docstring_format.py +255 -0
- package/hooks/blocking/test_code_rules_enforcer_inline_tuple_string_magic.py +130 -0
- package/hooks/blocking/test_code_rules_enforcer_stub_implementations.py +141 -0
- package/hooks/blocking/test_code_rules_enforcer_test_branching.py +143 -0
- package/hooks/blocking/test_code_rules_enforcer_thin_wrapper_files.py +169 -0
- package/hooks/blocking/test_code_rules_enforcer_todo_markers.py +99 -0
- package/hooks/blocking/test_code_rules_enforcer_typed_dict_pairs.py +141 -0
- package/hooks/blocking/test_code_rules_enforcer_unused_imports.py +158 -0
- package/hooks/blocking/test_convergence_gate_blocker.py +63 -0
- package/hooks/blocking/test_destructive_command_blocker.py +146 -0
- package/hooks/blocking/test_destructive_command_blocker_no_verify.py +102 -0
- package/hooks/blocking/test_gh_body_arg_blocker.py +45 -0
- package/hooks/blocking/test_md_to_html_blocker.py +317 -0
- package/hooks/config/any_type_config.py +7 -0
- package/hooks/config/banned_identifiers_constants.py +11 -0
- package/hooks/config/blocking_check_limits.py +38 -0
- package/hooks/config/bot_mention_comment_blocker_constants.py +20 -0
- package/hooks/config/code_rules_enforcer_constants.py +53 -0
- package/hooks/config/convergence_branch_constants.py +9 -0
- package/hooks/config/doc_gist_auto_publish_constants.py +18 -0
- package/hooks/config/html_companion_constants.py +20 -0
- package/hooks/config/inline_tuple_string_magic_constants.py +22 -0
- package/hooks/config/test_banned_identifiers_constants.py +17 -0
- package/hooks/hooks.json +28 -20
- package/hooks/pyproject.toml +69 -0
- package/hooks/validators/mypy_integration.py +47 -1
- package/hooks/validators/run_all_validators.py +3 -3
- package/hooks/validators/test_mypy_integration.py +50 -1
- package/hooks/workflow/doc_gist_auto_publish.py +144 -0
- package/hooks/workflow/md_to_html_companion.py +365 -0
- package/hooks/workflow/test_doc_gist_auto_publish.py +117 -0
- package/hooks/workflow/test_md_to_html_companion.py +452 -0
- package/package.json +1 -1
- package/rules/gh-body-file.md +2 -0
- package/scripts/Install-SweepEmptyDirs.ps1 +111 -0
- package/scripts/check.ps1 +106 -0
- package/scripts/config/timing.py +11 -0
- package/scripts/sweep_empty_dirs.py +138 -0
- package/scripts/sync_to_cursor/rules.py +1 -1
- package/scripts/test_sweep_empty_dirs.py +183 -0
- package/skills/_shared/pr-loop/prompts/pr-consistency-audit.xml +323 -0
- package/skills/_shared/pr-loop/scripts/_cli_utils.py +22 -0
- package/skills/_shared/pr-loop/scripts/_path_resolver.py +165 -0
- package/skills/_shared/pr-loop/scripts/_xml_utils.py +20 -0
- package/skills/_shared/pr-loop/scripts/build_audit_prompt.py +182 -0
- package/skills/_shared/pr-loop/scripts/build_fix_prompt.py +185 -0
- package/skills/_shared/pr-loop/scripts/config/__init__.py +0 -0
- package/skills/_shared/pr-loop/scripts/config/path_resolver_constants.py +78 -0
- package/skills/_shared/pr-loop/scripts/init_loop_state.py +135 -0
- package/skills/_shared/pr-loop/scripts/teardown_worktrees.py +175 -0
- package/skills/_shared/pr-loop/scripts/write_audit_outcomes.py +182 -0
- package/skills/_shared/pr-loop/scripts/write_fix_outcomes.py +206 -0
- package/skills/bugteam/CONSTRAINTS.md +21 -22
- package/skills/bugteam/EXAMPLES.md +3 -3
- package/skills/bugteam/PROMPTS.md +227 -67
- package/skills/bugteam/SKILL.md +114 -455
- package/skills/bugteam/reference/README.md +1 -1
- package/skills/bugteam/reference/audit-and-teammates.md +112 -39
- package/skills/bugteam/reference/audit-contract.md +4 -22
- package/skills/bugteam/reference/copilot-gap-analysis.md +8 -5
- package/skills/bugteam/reference/design-rationale.md +2 -2
- package/skills/bugteam/reference/github-pr-reviews.md +50 -57
- package/skills/bugteam/reference/obstacles/audit-assign-ids.md +13 -0
- package/skills/bugteam/reference/obstacles/audit-capture-excerpts.md +13 -0
- package/skills/bugteam/reference/obstacles/audit-walk-categories.md +13 -0
- package/skills/bugteam/reference/obstacles/audit-write-xml.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-append-summary.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-apply-fixes.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-git-add-commit.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-git-push.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-post-reply.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-publish-summary.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-py-compile.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-read-files.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-resolve-thread.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-test-suite.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-violation-count.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-write-xml.md +13 -0
- package/skills/bugteam/reference/team-setup.md +106 -9
- package/skills/bugteam/reference/teardown-publish-permissions.md +39 -8
- package/skills/bugteam/scripts/README.md +60 -0
- package/skills/bugteam/scripts/_claude_permissions_common.py +358 -0
- package/skills/bugteam/scripts/bugteam_code_rules_gate.py +976 -0
- package/skills/bugteam/scripts/bugteam_fix_hookspath.py +375 -0
- package/skills/bugteam/scripts/bugteam_preflight.py +294 -0
- package/skills/bugteam/scripts/config/bugteam_code_rules_gate_constants.py +25 -0
- package/skills/bugteam/scripts/config/bugteam_fix_hookspath_constants.py +26 -0
- package/skills/bugteam/scripts/config/bugteam_preflight_constants.py +35 -0
- package/skills/bugteam/scripts/config/claude_permissions_common_constants.py +20 -0
- package/skills/bugteam/scripts/config/probe_code_rules_enforcer_check_constants.py +12 -0
- package/skills/bugteam/scripts/config/windows_safe_rmtree_constants.py +7 -0
- package/skills/bugteam/scripts/grant_project_claude_permissions.py +175 -0
- package/skills/bugteam/scripts/probe_code_rules_enforcer_check.py +107 -0
- package/skills/bugteam/scripts/revoke_project_claude_permissions.py +220 -0
- package/skills/bugteam/scripts/test__claude_permissions_common.py +112 -0
- package/skills/bugteam/scripts/test_bugteam_code_rules_gate.py +400 -0
- package/skills/bugteam/scripts/test_bugteam_fix_hookspath.py +384 -0
- package/skills/bugteam/scripts/test_bugteam_preflight.py +268 -0
- package/skills/bugteam/scripts/test_claude_permissions_common.py +195 -0
- package/skills/bugteam/scripts/test_grant_project_claude_permissions.py +55 -0
- package/skills/bugteam/scripts/test_probe_code_rules_enforcer_check.py +76 -0
- package/skills/bugteam/scripts/test_revoke_project_claude_permissions.py +55 -0
- package/skills/bugteam/scripts/test_windows_safe_rmtree.py +108 -0
- package/skills/bugteam/scripts/windows_safe_rmtree.py +100 -0
- package/skills/bugteam/test_skill_additions.py +1 -11
- package/skills/code/SKILL.md +176 -0
- package/skills/doc-gist/SKILL.md +99 -0
- package/skills/doc-gist/references/examples/01-exploration-code-approaches.html +453 -0
- package/skills/doc-gist/references/examples/02-exploration-visual-designs.html +515 -0
- package/skills/doc-gist/references/examples/03-code-review-pr.html +638 -0
- package/skills/doc-gist/references/examples/04-code-understanding.html +491 -0
- package/skills/doc-gist/references/examples/05-design-system.html +629 -0
- package/skills/doc-gist/references/examples/06-component-variants.html +605 -0
- package/skills/doc-gist/references/examples/07-prototype-animation.html +455 -0
- package/skills/doc-gist/references/examples/08-prototype-interaction.html +396 -0
- package/skills/doc-gist/references/examples/09-slide-deck.html +592 -0
- package/skills/doc-gist/references/examples/10-svg-illustrations.html +492 -0
- package/skills/doc-gist/references/examples/11-status-report.html +528 -0
- package/skills/doc-gist/references/examples/12-incident-report.html +596 -0
- package/skills/doc-gist/references/examples/13-flowchart-diagram.html +395 -0
- package/skills/doc-gist/references/examples/14-research-feature-explainer.html +381 -0
- package/skills/doc-gist/references/examples/15-research-concept-explainer.html +368 -0
- package/skills/doc-gist/references/examples/16-implementation-plan.html +702 -0
- package/skills/doc-gist/references/examples/17-pr-writeup.html +595 -0
- package/skills/doc-gist/references/examples/18-editor-triage-board.html +573 -0
- package/skills/doc-gist/references/examples/19-editor-feature-flags.html +663 -0
- package/skills/doc-gist/references/examples/20-editor-prompt-tuner.html +722 -0
- package/skills/doc-gist/references/examples/README.md +5 -0
- package/skills/doc-gist/scripts/config/__init__.py +0 -0
- package/skills/doc-gist/scripts/config/gist_upload_constants.py +16 -0
- package/skills/doc-gist/scripts/gist_upload.py +177 -0
- package/skills/doc-gist/scripts/test_gist_upload.py +51 -0
- package/skills/findbugs/SKILL.md +68 -2
- package/skills/monitor-open-prs/SKILL.md +13 -32
- package/skills/monitor-open-prs/test_skill_contract.py +0 -11
- package/skills/pr-consistency-audit/SKILL.md +112 -0
- package/skills/pr-consistency-audit/reference/detection-rules.md +96 -0
- package/skills/pr-consistency-audit/reference/illustrations.md +78 -0
- package/skills/pr-converge/SKILL.md +227 -23
- package/skills/pr-converge/config/__init__.py +0 -0
- package/skills/pr-converge/config/constants.py +62 -0
- package/skills/pr-converge/reference/convergence-gates.md +138 -44
- package/skills/pr-converge/reference/examples.md +43 -11
- package/skills/pr-converge/reference/fix-protocol.md +6 -5
- package/skills/pr-converge/reference/ground-rules.md +5 -3
- package/skills/pr-converge/reference/multi-pr-orchestration.md +44 -19
- package/skills/pr-converge/reference/obstacles/fix-post-replies.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-publish-summary.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-push.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-read-filelines.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-reset-state.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-resolve-threads.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-spawn-clean-coder.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-stage-commit.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-trigger-bugbot.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-write-test.md +13 -0
- package/skills/pr-converge/reference/per-tick.md +90 -31
- package/skills/pr-converge/reference/state-schema.md +22 -1
- package/skills/pr-converge/reference/stop-conditions.md +9 -7
- package/skills/pr-converge/scripts/README.md +34 -46
- package/skills/pr-converge/scripts/check_bugbot_ci.py +174 -0
- package/skills/pr-converge/scripts/check_convergence.py +497 -0
- package/skills/pr-converge/scripts/check_pending_reviews.py +154 -0
- package/skills/pr-converge/scripts/config/pr_converge_constants.py +118 -0
- package/skills/pr-converge/scripts/fetch_copilot_reviews.py +134 -0
- package/skills/pr-converge/scripts/post_fix_reply.py +168 -0
- package/skills/pr-converge/workflows/schedule-wakeup-loop.md +5 -12
- package/skills/qbug/SKILL.md +132 -27
- package/skills/session-log/SKILL.md +216 -114
- package/skills/session-tidy/SKILL.md +1 -1
- package/skills/skill-builder/SKILL.md +138 -56
- package/skills/skill-builder/references/delegation-map.md +72 -113
- package/skills/skill-builder/references/progressive-disclosure.md +122 -0
- package/skills/skill-builder/references/self-audit-checklist.md +92 -0
- package/skills/skill-builder/references/skill-types.md +228 -0
- package/skills/skill-builder/references/thariq-x-post-skills.json +33 -0
- package/skills/skill-builder/templates/gap-analysis.md +15 -8
- package/skills/skill-builder/workflows/improve-skill.md +86 -57
- package/skills/skill-builder/workflows/new-skill.md +80 -168
- package/skills/skill-builder/workflows/polish-skill.md +78 -54
- package/skills/structure-prompt/SKILL.md +50 -0
- package/skills/structure-prompt/reference/adversarial-tuning.md +62 -0
- package/skills/structure-prompt/reference/block-classification.md +27 -0
- package/skills/structure-prompt/reference/canonical-case.md +48 -0
- package/skills/structure-prompt/reference/citation-depth.md +70 -0
- package/skills/structure-prompt/reference/cleanup.md +33 -0
- package/skills/structure-prompt/reference/constraints.md +33 -0
- package/skills/structure-prompt/reference/directives.md +37 -0
- package/skills/structure-prompt/reference/examples.md +72 -0
- package/skills/structure-prompt/reference/instantiation.md +51 -0
- package/skills/structure-prompt/reference/output-contract.md +72 -0
- package/skills/structure-prompt/reference/per-category.md +23 -0
- package/skills/structure-prompt/reference/persona.md +38 -0
- package/skills/structure-prompt/reference/research.md +33 -0
- package/skills/structure-prompt/reference/structure.md +28 -0
- package/agents/code-standards-agent.md +0 -93
- package/agents/groq-coder.md +0 -113
- package/agents/plan-executor.md +0 -226
- package/agents/project-docs-analyzer.md +0 -53
- package/agents/project-structure-organizer-agent.md +0 -72
- package/agents/skill-to-agent-converter.md +0 -370
- package/agents/skill-writer-agent.md +0 -470
- package/agents/user-docs-writer.md +0 -67
- package/agents/workflow-visual-documenter.md +0 -82
- package/commands/readability-review.md +0 -20
- package/hooks/mypy.ini +0 -2
- package/hooks/notification/attention_needed_notify.py +0 -71
- package/hooks/notification/claude_notification_handler.py +0 -67
- package/hooks/notification/notification_utils.py +0 -267
- package/hooks/notification/subagent_complete_notify.py +0 -381
- package/hooks/notification/test_attention_needed_notify.py +0 -47
- package/hooks/notification/test_claude_notification_handler.py +0 -54
- package/hooks/notification/test_notification_utils.py +0 -91
- package/hooks/notification/test_subagent_complete_notify.py +0 -79
- package/scripts/config/groq_bugteam_config.py +0 -230
- package/scripts/config/test_groq_bugteam_config.py +0 -83
- package/scripts/config/test_spec_implementer_prompt.py +0 -32
- package/scripts/groq_bugteam.README.md +0 -131
- package/scripts/groq_bugteam.py +0 -647
- package/scripts/groq_bugteam_dotenv.py +0 -40
- package/scripts/groq_bugteam_spec.py +0 -226
- package/scripts/test_groq_bugteam.py +0 -529
- package/scripts/test_groq_bugteam_apply_fix_from_spec.py +0 -426
- package/scripts/test_groq_bugteam_dotenv.py +0 -66
- package/scripts/test_groq_bugteam_spec.py +0 -338
- package/skills/bugteam/SKILL_EVALS.md +0 -309
- package/skills/dream/SKILL.md +0 -118
- package/skills/ingest/SKILL.md +0 -40
- package/skills/npm-creator/SKILL.md +0 -187
- package/skills/readability-review/SKILL.md +0 -127
- package/skills/resume-review/SKILL.md +0 -261
- package/skills/rule-audit/SKILL.md +0 -307
- package/skills/rule-creator/SKILL.md +0 -150
- package/skills/searching-obsidian-vault/SKILL.md +0 -131
- package/skills/skill-writer/REFERENCE.md +0 -284
- package/skills/skill-writer/SKILL.md +0 -222
- package/skills/tdd-team/SKILL.md +0 -128
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code
|
|
3
|
+
description: >-
|
|
4
|
+
Prepends strict code standards to every implementation session. Enforces
|
|
5
|
+
strong typing, no Any, no casts, no type: ignore, treated-as-immutable
|
|
6
|
+
TypedDicts, 100% test coverage, DRY, no mocks, no stubs, no fallbacks, and
|
|
7
|
+
proper module structure. Triggers: /code, code standards, strict code, enforce
|
|
8
|
+
standards, implement with standards.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Code Standards Enforcer
|
|
12
|
+
|
|
13
|
+
Prepends these standards to every implementation session. Every criterion is binary — pass or fail. No partial credit.
|
|
14
|
+
|
|
15
|
+
## When this applies
|
|
16
|
+
|
|
17
|
+
Invoke at the start of any implementation task. The standards persist for the entire session.
|
|
18
|
+
|
|
19
|
+
**Refusal cases — first match wins:**
|
|
20
|
+
|
|
21
|
+
- **Not an implementation task.** "This skill applies to code implementation. Ask me to implement something specific."
|
|
22
|
+
- **Exploratory research or planning.** "Code standards are for implementation. Use /anthropic-plan for planning, then invoke /code when implementing."
|
|
23
|
+
|
|
24
|
+
## Gotchas
|
|
25
|
+
|
|
26
|
+
- **`make check` must run from pwsh, not bash.** The Bash tool routes through Git Bash on Windows, where `make` may not be on PATH. Always use `pwsh -NoProfile -Command 'make check 2>&1 | Select-Object -Last 100; exit $LASTEXITCODE'` so the pipeline does not mask a non-zero exit code from make.
|
|
27
|
+
- **`New-Item`, `Get-ChildItem`, `Remove-Item` are pwsh cmdlets.** Don't use them inside Bash tool calls. Use the PowerShell tool or prefix with `pwsh -NoProfile -Command`.
|
|
28
|
+
- **`TypedDict` encode/decode must be manual.** Pydantic and similar frameworks bypass the strict validation pattern. Write `_encode_*` and `_decode_*` functions by hand.
|
|
29
|
+
- **`_test_hooks.py` is per-module, not per-package.** Every module that has dependencies needs its own hooks file. A single `conftest.py` with mocks does not satisfy this rule.
|
|
30
|
+
- **Protocol must match the real API exactly.** If the real class has `async def fetch(self, key: str) -> bytes`, the Protocol must declare the same signature. A mismatch is caught at type-check time by mypy strict mode.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Completion criteria
|
|
35
|
+
|
|
36
|
+
Every criterion below must be met before the change is complete.
|
|
37
|
+
|
|
38
|
+
### 1. Typing strictness
|
|
39
|
+
|
|
40
|
+
Zero violations across the project's source, test, and script directories (adapt `src/`, `tests/`, `scripts/` to the project's actual layout):
|
|
41
|
+
|
|
42
|
+
- No `Any`, `cast()`, `# type: ignore`, `# noqa`.
|
|
43
|
+
- No `.pyi` files, stubs, or shims.
|
|
44
|
+
- Mypy strict mode exits 0 with no errors.
|
|
45
|
+
- All TypedDicts are treated as immutable after construction and carry explicit `_encode_*` / `_decode_*` functions.
|
|
46
|
+
- All decode functions call `require_*` validation on every field.
|
|
47
|
+
- Internal encoder is typed — no untyped dict intermediaries.
|
|
48
|
+
|
|
49
|
+
### 2. Error handling
|
|
50
|
+
|
|
51
|
+
- No `try`/`except` in core logic that recovers, softens, or best-efforts a failure.
|
|
52
|
+
- Failures propagate. Callers decide whether to handle.
|
|
53
|
+
- APIs signal failure points through naming, docstrings, and test expectations — not by catching.
|
|
54
|
+
|
|
55
|
+
### 3. Test coverage
|
|
56
|
+
|
|
57
|
+
- Test runner exits 0 with full statement and branch coverage (e.g. `pytest -n auto --cov --cov-branch --cov-report=term-missing` with paths adapted to the project layout) (requires pytest-xdist and pytest-cov).
|
|
58
|
+
- Statement coverage: 100%. Branch coverage: 100%.
|
|
59
|
+
- Zero mocks. Every test exercises actual code paths through fakes injected via DI hooks (see criterion 4).
|
|
60
|
+
- Zero weak assertions. Every assert checks a specific, falsifiable property.
|
|
61
|
+
- Zero fake tests (tests that pass without validating behavior).
|
|
62
|
+
|
|
63
|
+
### 4. Dependency injection
|
|
64
|
+
|
|
65
|
+
- Every module that has external dependencies provides a `_test_hooks.py` with internal DI hooks (underscore = private). The hook file lives alongside the module it services.
|
|
66
|
+
- A shared testing utility module exports public test helpers for consumers (adapt the path to the project's conventions, e.g. `Libs/testing.py`).
|
|
67
|
+
- Production code sets hooks to real implementations at startup. Tests set them to fakes.
|
|
68
|
+
- No `if`/`else` branching on test vs. production — call the hook directly.
|
|
69
|
+
|
|
70
|
+
### 5. Codebase standards
|
|
71
|
+
|
|
72
|
+
- DRY: zero duplicate function bodies longer than 3 lines. Zero duplicate constant definitions.
|
|
73
|
+
- No placeholder code, no dead code, no commented-out blocks.
|
|
74
|
+
- No fallback paths, no back-compat shims, no legacy code.
|
|
75
|
+
- No `TypeAlias`, no `TYPE_CHECKING` import guards.
|
|
76
|
+
|
|
77
|
+
### 6. TypedDict protocol
|
|
78
|
+
|
|
79
|
+
- Every TypedDict has a paired `_encode_*` and `_decode_*` function.
|
|
80
|
+
- Every decode calls `require_*` (non-null, type-check, range-check) on every field before returning.
|
|
81
|
+
- Decode functions are the single point where untyped data becomes typed.
|
|
82
|
+
|
|
83
|
+
### 7. Redis boundary
|
|
84
|
+
|
|
85
|
+
- Use module-level helper functions or a Protocol.
|
|
86
|
+
- Never reference `Redis[Any]` in type annotations.
|
|
87
|
+
|
|
88
|
+
### 8. TOML boundary
|
|
89
|
+
|
|
90
|
+
- No `TYPE_CHECKING` guard for TOML types.
|
|
91
|
+
- Parse untyped dicts from TOML, then convert into TypedDict (no dataclasses) before use.
|
|
92
|
+
|
|
93
|
+
### 9. JSON recursive types
|
|
94
|
+
|
|
95
|
+
- Bypass framework validation (e.g., Pydantic).
|
|
96
|
+
- Parse with `json.loads()`, validate immediately with internal `_decode_*` / `_load_json_*` functions before any other use.
|
|
97
|
+
|
|
98
|
+
### 10. ASGI / framework boundaries
|
|
99
|
+
|
|
100
|
+
- Define a Protocol for the minimal interface (e.g., `async def body() -> bytes`).
|
|
101
|
+
- Never use `dict[str, Any]` in ASGI scopes.
|
|
102
|
+
- Parse at the edge, validate immediately, propagate as strict types.
|
|
103
|
+
|
|
104
|
+
### 11. Dynamic import pattern
|
|
105
|
+
|
|
106
|
+
When using `importlib.import_module()` + `getattr()`, the intermediate variables are untyped. Bind the final instance through a typed wrapper so the result carries a concrete type rather than `Any`:
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
import importlib
|
|
110
|
+
from collections.abc import Callable
|
|
111
|
+
|
|
112
|
+
mod = importlib.import_module("module_name")
|
|
113
|
+
cls = getattr(mod, "ClassName")
|
|
114
|
+
|
|
115
|
+
def _construct(klass: Callable[..., TheProtocol]) -> TheProtocol:
|
|
116
|
+
return klass()
|
|
117
|
+
|
|
118
|
+
instance = _construct(cls)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 12. Documentation
|
|
122
|
+
|
|
123
|
+
Google-style docstrings on every public function, method, and class:
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
def load_config(config_path: str) -> AppConfig:
|
|
127
|
+
"""Load and validate the application configuration from disk.
|
|
128
|
+
|
|
129
|
+
Args:
|
|
130
|
+
config_path: Absolute path to the TOML configuration file.
|
|
131
|
+
|
|
132
|
+
Returns:
|
|
133
|
+
A fully validated AppConfig TypedDict.
|
|
134
|
+
|
|
135
|
+
Raises:
|
|
136
|
+
FileNotFoundError: If config_path does not exist.
|
|
137
|
+
ValidationError: If the parsed config fails require_* checks.
|
|
138
|
+
"""
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 13. Build infrastructure
|
|
142
|
+
|
|
143
|
+
The project under development must contain:
|
|
144
|
+
|
|
145
|
+
- `Makefile` with targets: `check`, `lint`, `test`, `coverage`.
|
|
146
|
+
- `pyproject.toml` with `[tool.mypy]` strict mode, `[tool.pytest.ini_options]` with `addopts = -n auto` (requires pytest-xdist).
|
|
147
|
+
- A lint guard script that covers the project's source, test, and script directories.
|
|
148
|
+
|
|
149
|
+
### 14. Lint gates
|
|
150
|
+
|
|
151
|
+
- `make lint` runs mypy (strict), ruff, and the project's guard script.
|
|
152
|
+
- All linters cover the project's source, test, and script directories.
|
|
153
|
+
- `make lint` exits 0 before `make test` is valid.
|
|
154
|
+
|
|
155
|
+
### 15. Protocol signature match
|
|
156
|
+
|
|
157
|
+
- Every Protocol's method signatures match the real API they abstract.
|
|
158
|
+
- If the real API changes, the Protocol fails type-checking — no silent drift.
|
|
159
|
+
|
|
160
|
+
### 16. Auth, credentials, multi-tenancy
|
|
161
|
+
|
|
162
|
+
- Auth and credential handling is explicit, typed, and testable.
|
|
163
|
+
- Multi-tenant DB access uses typed connection factories, not string-formatted queries.
|
|
164
|
+
- MCP-shared resources follow the same strictness as application code.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Verification
|
|
169
|
+
|
|
170
|
+
Each criterion returns either **at least one finding** OR **exactly one proof-of-absence** with at least 3 adversarial probes specific to that criterion. A criterion returning neither is a protocol gap.
|
|
171
|
+
|
|
172
|
+
## File index
|
|
173
|
+
|
|
174
|
+
| File | Purpose |
|
|
175
|
+
|------|---------|
|
|
176
|
+
| `SKILL.md` | Hub — binary criteria, gotchas, when-to-apply, verification protocol |
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: doc-gist
|
|
3
|
+
description: >-
|
|
4
|
+
Use when the user asks to share, publish, preview, or open as a webpage any
|
|
5
|
+
HTML doc, writeup, report, plan, decision record, runbook, explainer, status
|
|
6
|
+
update, or interactive artifact. Triggers on `/doc-gist`, "publish this",
|
|
7
|
+
"share as a gist", "open this as a webpage", "make me a writeup", "publish my
|
|
8
|
+
report", or any request that ends in a shareable HTML preview URL. Provides
|
|
9
|
+
the `gist_upload` transport script, an auto-publish hook keyed off the
|
|
10
|
+
`<!-- @publish-as-gist -->` HTML comment, and a 20-file gallery of HTML
|
|
11
|
+
artifact patterns to draw from when designing fresh.
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# doc-gist
|
|
15
|
+
|
|
16
|
+
Design fresh HTML for the artifact at hand, mark it for publishing, write it. The rest is automatic — a hook spots the marker, uploads to a secret gist, and prints the htmlpreview URL into your output for the user to click.
|
|
17
|
+
|
|
18
|
+
## Principle (and what this skill deliberately does not ship)
|
|
19
|
+
|
|
20
|
+
This skill ships **transport, not shape**. There are no document templates here. There is no markdown-to-HTML converter. There is no rebase-report mode. The shape of every artifact is your fresh design per request, drawing on the gallery in [`references/examples/`](references/examples/) for inspiration.
|
|
21
|
+
|
|
22
|
+
Per Thariq's html-effectiveness thesis: *"twenty self-contained .html files an agent produced — each one trades a document you'd skim for one you'd actually read."* Every doc-gist invocation produces a fresh design appropriate to the work, not a template fill.
|
|
23
|
+
|
|
24
|
+
## How auto-publish works
|
|
25
|
+
|
|
26
|
+
1. You write HTML to any path (no directory rule, no naming rule).
|
|
27
|
+
2. The HTML contains the marker comment `<!-- @publish-as-gist -->` — typically as the first child of `<head>` or just inside `<body>`.
|
|
28
|
+
3. The PostToolUse hook ([`workflow/doc_gist_auto_publish.py`](../../hooks/workflow/doc_gist_auto_publish.py)) fires after the Write/Edit completes, sees the marker, and runs [`skills/doc-gist/scripts/gist_upload.py`](scripts/gist_upload.py) against the file.
|
|
29
|
+
4. The upload script's gist + preview URLs print into your tool output. Quote them back to the user.
|
|
30
|
+
|
|
31
|
+
The hook is a no-op for any HTML that lacks the marker — React components, test fixtures, scraped pages, partial fragments. The marker is the *intent signal*; absent marker means "this HTML isn't for sharing."
|
|
32
|
+
|
|
33
|
+
## Gotchas
|
|
34
|
+
|
|
35
|
+
- **`gh` must be authenticated.** The upload runs `gh gist create`. If `gh auth status` is failing, the hook surfaces the error to stderr and exits 0 (does not block the write). Run `gh auth login` and re-trigger by editing the HTML once more.
|
|
36
|
+
- **The marker is a literal HTML comment, not a meta tag.** `<!-- @publish-as-gist -->` exactly. `<meta name="publish-as-gist">` does not match. Whitespace inside the marker breaks it.
|
|
37
|
+
- **htmlpreview render delay.** First load of the preview URL takes 5–10 seconds while htmlpreview.github.io fetches the raw gist content. A blank page on first visit means refresh once.
|
|
38
|
+
- **Filenames carry into the gist.** The gist filename is the same as the source file's name. Name your files for the artifact, not for filesystem convenience — `auth-migration-plan.html` reads better in the gist UI than `tmp_plan_v3_final.html`.
|
|
39
|
+
- **Markers in code samples need escaping.** If you embed an example HTML snippet inside `<pre><code>` and that snippet contains the literal marker text, the hook will publish on first save. Either escape the comment angle brackets in the embedded sample, or write the marker as `<!- - @publish-as-gist - ->` in the embedded version.
|
|
40
|
+
- **Self-contained HTML only.** The upload sends a single file. External CSS/JS via `<link href="./style.css">` or `<script src="./app.js">` will fail to load in the htmlpreview view. Inline everything — `<style>`, `<script>`, base64 images, SVG.
|
|
41
|
+
- **Secret gist, not private.** `gh gist create` defaults to "secret" (anyone with the URL can view; not indexed; not on your public profile). Treat the preview URL like a shareable Google Doc — share with intent.
|
|
42
|
+
|
|
43
|
+
## When to include the marker
|
|
44
|
+
|
|
45
|
+
Include `<!-- @publish-as-gist -->` when **the artifact is for sharing or reading**: writeups, plans, reports, explainers, decision records, runbooks, status updates, prototypes the user will look at. Skip the marker for: HTML that's part of a code change (React components, test fixtures), HTML you're authoring as a one-off scratch file you'll delete, embedded HTML samples inside other artifacts.
|
|
46
|
+
|
|
47
|
+
The user's prompt is the strongest signal. *"Make me a writeup of this PR"* → publish. *"Add this React component"* → don't publish.
|
|
48
|
+
|
|
49
|
+
## The transport script — `skills/doc-gist/scripts/gist_upload.py`
|
|
50
|
+
|
|
51
|
+
For manual invocation when the marker route doesn't apply (an existing file you want to publish, HTML piped from another tool, a one-off):
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
python3 skills/doc-gist/scripts/gist_upload.py --input <path-or-stdin>
|
|
55
|
+
[--filename gist-file.html]
|
|
56
|
+
[--description "short label"]
|
|
57
|
+
[--no-open]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Reads HTML from `--input <path>` or stdin (`--input -`), runs `gh gist create`, prints `Gist:` and `Preview:` URLs to stderr, prints the preview URL to stdout (so callers can pipe), opens the preview in the default browser unless `--no-open`.
|
|
61
|
+
|
|
62
|
+
## Designing fresh — the example gallery
|
|
63
|
+
|
|
64
|
+
The skill ships [`references/examples/`](references/examples/) with all 20 of Thariq's html-effectiveness prototypes verbatim from [thariqs.github.io/html-effectiveness](https://thariqs.github.io/html-effectiveness/). They are *examples to learn from, not templates to fill.*
|
|
65
|
+
|
|
66
|
+
When the user requests an artifact, decide the shape that fits. Use the gallery for grounding:
|
|
67
|
+
|
|
68
|
+
| User wants | Gallery entries to study |
|
|
69
|
+
|---|---|
|
|
70
|
+
| PR writeup with file-by-file tour | `17-pr-writeup.html` |
|
|
71
|
+
| Annotated diff or code review | `03-code-review-pr.html` |
|
|
72
|
+
| Code-explainer with module map | `04-code-understanding.html` |
|
|
73
|
+
| Implementation plan with timeline + risks | `16-implementation-plan.html` |
|
|
74
|
+
| Side-by-side approach exploration | `01-exploration-code-approaches.html` |
|
|
75
|
+
| Visual design comparison | `02-exploration-visual-designs.html` |
|
|
76
|
+
| Design system swatches | `05-design-system.html` |
|
|
77
|
+
| Component variants matrix | `06-component-variants.html` |
|
|
78
|
+
| Animation tuning sandbox with sliders | `07-prototype-animation.html` |
|
|
79
|
+
| Multi-screen interaction mockup | `08-prototype-interaction.html` |
|
|
80
|
+
| Slide deck (keyboard-navigable) | `09-slide-deck.html` |
|
|
81
|
+
| SVG illustration | `10-svg-illustrations.html` |
|
|
82
|
+
| Status report (visual) | `11-status-report.html` |
|
|
83
|
+
| Incident timeline / post-mortem | `12-incident-report.html` |
|
|
84
|
+
| Flowchart / pipeline diagram | `13-flowchart-diagram.html` |
|
|
85
|
+
| Feature explainer with collapsibles | `14-research-feature-explainer.html` |
|
|
86
|
+
| Concept explainer (interactive learning) | `15-research-concept-explainer.html` |
|
|
87
|
+
| Triage / kanban board (drag-drop) | `18-editor-triage-board.html` |
|
|
88
|
+
| Feature flag toggles with deps | `19-editor-feature-flags.html` |
|
|
89
|
+
| Live-updating template editor | `20-editor-prompt-tuner.html` |
|
|
90
|
+
|
|
91
|
+
Read the matching example for the artifact you're designing. Crib palette, typography, spatial idioms, component patterns. **Adapt — do not copy.** A PR writeup for a hooks PR shouldn't look identical to one for a notification-queue PR. The gallery teaches what shapes work; the request decides which shape fits.
|
|
92
|
+
|
|
93
|
+
## Folder map
|
|
94
|
+
|
|
95
|
+
- `SKILL.md` — this file.
|
|
96
|
+
- `skills/doc-gist/scripts/gist_upload.py` — transport: HTML in, gist + preview URLs out.
|
|
97
|
+
- `skills/doc-gist/scripts/config/gist_upload_constants.py` — the URL prefixes and template strings.
|
|
98
|
+
- `references/examples/` — Thariq's 20 html-effectiveness prototypes.
|
|
99
|
+
- (PostToolUse hook lives in `packages/claude-dev-env/hooks/workflow/doc_gist_auto_publish.py` — wired into the plugin's `hooks.json`.)
|