toga-ai 1.0.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.
Files changed (62) hide show
  1. package/.claude/settings.json +119 -0
  2. package/.claude-plugin/marketplace.json +87 -0
  3. package/.claude-plugin/plugin.json +22 -0
  4. package/CLAUDE.md +161 -0
  5. package/README.md +72 -0
  6. package/agents/framework-pattern-checker.md +67 -0
  7. package/agents/harness-optimizer.md +102 -0
  8. package/agents/knowledge-writer.md +62 -0
  9. package/agents/php-build-resolver.md +51 -0
  10. package/agents/php-reviewer.md +51 -0
  11. package/agents/planner.md +88 -0
  12. package/agents/session-capture.md +101 -0
  13. package/agents/sql-reviewer.md +67 -0
  14. package/contexts/dev.md +43 -0
  15. package/contexts/research.md +49 -0
  16. package/contexts/review.md +37 -0
  17. package/knowledge/1.0/apps/library/INDEX.md +5 -0
  18. package/knowledge/1.0/apps/library/architecture.md +105 -0
  19. package/knowledge/1.0/apps/worker/INDEX.md +5 -0
  20. package/knowledge/1.0/apps/worker/architecture.md +223 -0
  21. package/knowledge/1.0/standards/backend-php.md +450 -0
  22. package/knowledge/2.0/apps/_underscore/INDEX.md +6 -0
  23. package/knowledge/2.0/apps/_underscore/architecture.md +183 -0
  24. package/knowledge/2.0/apps/_underscore/features/recursive-item-fulfillments.md +111 -0
  25. package/knowledge/2.0/apps/api2/INDEX.md +5 -0
  26. package/knowledge/2.0/apps/api2/architecture.md +162 -0
  27. package/knowledge/2.0/apps/worker2/INDEX.md +6 -0
  28. package/knowledge/2.0/apps/worker2/architecture.md +127 -0
  29. package/knowledge/2.0/apps/worker2/features/creating-worker-actions.md +135 -0
  30. package/knowledge/2.0/standards/backend-php.md +710 -0
  31. package/knowledge/CONVENTIONS.md +117 -0
  32. package/knowledge/INDEX.md +19 -0
  33. package/knowledge/clients/.gitkeep +0 -0
  34. package/knowledge/registry.json +7 -0
  35. package/knowledge.js +384 -0
  36. package/mcp-configs/README.md +72 -0
  37. package/mcp-configs/mcp-servers.json +23 -0
  38. package/package.json +50 -0
  39. package/rules/README.md +53 -0
  40. package/rules/common/coding-style.md +123 -0
  41. package/rules/common/git-workflow.md +72 -0
  42. package/rules/common/security.md +118 -0
  43. package/rules/common/testing.md +74 -0
  44. package/rules/php/app-framework.md +104 -0
  45. package/rules/php/underscore-framework.md +111 -0
  46. package/scripts/harness.js +605 -0
  47. package/scripts/hooks/evaluate-session.js +55 -0
  48. package/scripts/hooks/post-edit-validate.js +102 -0
  49. package/scripts/hooks/session-end.js +13 -0
  50. package/scripts/hooks/session-start.js +57 -0
  51. package/scripts/install.js +611 -0
  52. package/scripts/pre-commit +46 -0
  53. package/skills/capture/SKILL.md +294 -0
  54. package/skills/code-review/SKILL.md +140 -0
  55. package/skills/create-elastic-beanstalk/SKILL.md +217 -0
  56. package/skills/harness-audit/SKILL.md +152 -0
  57. package/skills/kickoff/SKILL.md +151 -0
  58. package/skills/php-patterns/SKILL.md +296 -0
  59. package/skills/session-resume/SKILL.md +156 -0
  60. package/skills/session-save/SKILL.md +158 -0
  61. package/skills/sync-team-skills/SKILL.md +87 -0
  62. package/sync-skills.js +71 -0
@@ -0,0 +1,119 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "node \"${CLAUDE_PLUGIN_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/scripts/hooks/session-start.js\"",
9
+ "timeout": 5000
10
+ }
11
+ ]
12
+ }
13
+ ],
14
+ "PreToolUse": [
15
+ {
16
+ "matcher": "Bash",
17
+ "hooks": [
18
+ {
19
+ "type": "command",
20
+ "command": "if echo \"${CLAUDE_TOOL_INPUT}\" | grep -qE 'rm -rf|DROP TABLE|DROP DATABASE'; then echo 'BLOCKED: Destructive command detected. If intentional, run the command manually outside Claude Code.'; exit 2; fi",
21
+ "timeout": 3000
22
+ }
23
+ ]
24
+ },
25
+ {
26
+ "matcher": "Write|Edit|MultiEdit",
27
+ "hooks": [
28
+ {
29
+ "type": "command",
30
+ "command": "if echo \"${CLAUDE_TOOL_INPUT}\" | grep -q '\"file_path\":.*INDEX\\.md'; then echo 'BLOCKED: INDEX.md is auto-generated. Run `node knowledge.js index` to regenerate it instead of editing directly.'; exit 2; fi",
31
+ "timeout": 3000
32
+ }
33
+ ]
34
+ }
35
+ ],
36
+ "PostToolUse": [
37
+ {
38
+ "matcher": "Write|Edit|MultiEdit",
39
+ "hooks": [
40
+ {
41
+ "type": "command",
42
+ "command": "node \"${CLAUDE_PLUGIN_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/scripts/hooks/post-edit-validate.js\"",
43
+ "timeout": 15000
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "matcher": "Write|Edit|MultiEdit",
49
+ "hooks": [
50
+ {
51
+ "type": "command",
52
+ "command": "if echo \"${CLAUDE_TOOL_INPUT}\" | grep -qE '\"file_path\".*\\.php'; then echo 'PHP file edited. Consider running /code-review on this file, or use the php-reviewer agent to check for security and framework pattern issues.'; fi",
53
+ "timeout": 3000
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ "matcher": "Write|Edit|MultiEdit",
59
+ "hooks": [
60
+ {
61
+ "type": "command",
62
+ "command": "SCOPE_FILE=\"/tmp/toga-scope-${PPID:-$$}.count\"; COUNT=$(cat \"$SCOPE_FILE\" 2>/dev/null || echo 0); COUNT=$((COUNT+1)); echo $COUNT > \"$SCOPE_FILE\"; if [ $COUNT -ge 20 ]; then echo \"SCOPE WARNING: ${COUNT} files modified this session. Consider whether changes are too scattered.\"; fi",
63
+ "timeout": 3000
64
+ }
65
+ ]
66
+ }
67
+ ],
68
+ "Stop": [
69
+ {
70
+ "hooks": [
71
+ {
72
+ "type": "command",
73
+ "command": "node \"${CLAUDE_PLUGIN_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/scripts/hooks/session-end.js\"",
74
+ "timeout": 5000
75
+ }
76
+ ]
77
+ },
78
+ {
79
+ "hooks": [
80
+ {
81
+ "type": "command",
82
+ "command": "node \"${CLAUDE_PLUGIN_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/scripts/hooks/evaluate-session.js\"",
83
+ "timeout": 5000
84
+ }
85
+ ]
86
+ },
87
+ {
88
+ "hooks": [
89
+ {
90
+ "type": "command",
91
+ "command": "SCOPE_FILE=\"/tmp/toga-scope-${PPID:-$$}.count\"; if [ -f \"$SCOPE_FILE\" ] && [ \"$(cat $SCOPE_FILE 2>/dev/null)\" -gt 0 ] 2>/dev/null; then echo 'Reminder: run `php -l <file>` on any edited PHP files to check for syntax errors.'; fi",
92
+ "timeout": 3000
93
+ }
94
+ ]
95
+ }
96
+ ]
97
+ },
98
+ "permissions": {
99
+ "allow": [
100
+ "Bash(node knowledge.js *)",
101
+ "Bash(node sync-skills.js *)",
102
+ "Bash(node scripts/harness.js *)",
103
+ "Bash(node scripts/install.js *)",
104
+ "Bash(node scripts/hooks/*.js)",
105
+ "Bash(php -l *)",
106
+ "Bash(git status)",
107
+ "Bash(git diff *)",
108
+ "Bash(git log *)",
109
+ "Bash(git add *)",
110
+ "Bash(git commit *)",
111
+ "Bash(git checkout *)",
112
+ "Bash(git branch *)",
113
+ "Bash(git push *)",
114
+ "Bash(git pull *)",
115
+ "Bash(npm *)",
116
+ "Bash(npx *)"
117
+ ]
118
+ }
119
+ }
@@ -0,0 +1,87 @@
1
+ {
2
+ "marketplace": {
3
+ "id": "toga-team-knowledge",
4
+ "name": "TOGA Team Knowledge System",
5
+ "version": "1.0.0",
6
+ "author": "TOGA Technology",
7
+ "description": "Complete Claude Code harness for TOGA Technology's PHP development teams. Includes kickoff/capture session workflow, session persistence, PHP framework patterns for both App_ (1.0) and _underscore (2.0) frameworks, SQL and security review agents, and a living knowledge base system.",
8
+ "tags": ["php", "team-knowledge", "session-workflow", "code-review", "security"],
9
+ "install": "node scripts/install.js",
10
+ "source": "self-hosted",
11
+ "skills": [
12
+ {
13
+ "name": "kickoff",
14
+ "command": "/kickoff",
15
+ "description": "Prime Claude with repo architecture, framework standards, and client context at session start."
16
+ },
17
+ {
18
+ "name": "capture",
19
+ "command": "/capture",
20
+ "description": "Save session learnings (features, bugs, patterns, decisions) to the shared knowledge base."
21
+ },
22
+ {
23
+ "name": "session-save",
24
+ "command": "/session-save [name]",
25
+ "description": "Persist current session state for resuming in a future session."
26
+ },
27
+ {
28
+ "name": "session-resume",
29
+ "command": "/session-resume [name|latest]",
30
+ "description": "Reload a previously saved session state."
31
+ },
32
+ {
33
+ "name": "php-patterns",
34
+ "command": "/php-patterns [1.0|2.0|pdo|queue|api]",
35
+ "description": "Reference for TOGA PHP patterns across both frameworks."
36
+ },
37
+ {
38
+ "name": "code-review",
39
+ "command": "/code-review [file]",
40
+ "description": "PHP-focused security and framework pattern code review."
41
+ },
42
+ {
43
+ "name": "harness-audit",
44
+ "command": "/harness-audit",
45
+ "description": "Audit knowledge base and harness health, score 0-100."
46
+ }
47
+ ],
48
+ "agents": [
49
+ {
50
+ "name": "php-reviewer",
51
+ "description": "Expert PHP code reviewer for both TOGA frameworks."
52
+ },
53
+ {
54
+ "name": "planner",
55
+ "description": "Feature planning agent — produces phased implementation plans."
56
+ },
57
+ {
58
+ "name": "sql-reviewer",
59
+ "description": "SQL injection and query quality reviewer."
60
+ },
61
+ {
62
+ "name": "knowledge-writer",
63
+ "description": "Writes correctly-formatted docs into the knowledge base."
64
+ },
65
+ {
66
+ "name": "framework-pattern-checker",
67
+ "description": "Validates App_ and _underscore framework conventions."
68
+ },
69
+ {
70
+ "name": "php-build-resolver",
71
+ "description": "Resolves PHP fatal and parse errors with surgical fixes."
72
+ },
73
+ {
74
+ "name": "session-capture",
75
+ "description": "Extracts and categorizes session learnings for capture."
76
+ },
77
+ {
78
+ "name": "harness-optimizer",
79
+ "description": "Audits harness configuration and reports top improvements."
80
+ }
81
+ ],
82
+ "requirements": {
83
+ "node": ">=16.0.0",
84
+ "claudeCode": ">=1.0.0"
85
+ }
86
+ }
87
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "toga",
3
+ "version": "1.0.0",
4
+ "description": "TOGA Technology team Claude harness — kickoff/capture workflow, PHP framework patterns, session persistence, and team knowledge base",
5
+ "author": {
6
+ "name": "TOGA Technology"
7
+ },
8
+ "repository": "https://github.com/TOGATechnology/claude",
9
+ "license": "UNLICENSED",
10
+ "keywords": [
11
+ "claude-code",
12
+ "skills",
13
+ "php",
14
+ "knowledge-base",
15
+ "team-workflow"
16
+ ],
17
+ "mcpServers": {},
18
+ "skills": [
19
+ "./skills/"
20
+ ],
21
+ "commands": []
22
+ }
package/CLAUDE.md ADDED
@@ -0,0 +1,161 @@
1
+ # CLAUDE.md — TOGA Technology Team Knowledge Repo
2
+
3
+ This **is** the shared team knowledge repo for TOGA Technology. It is the canonical
4
+ source of truth for framework architecture, coding standards, feature documentation,
5
+ client knowledge, and project registry.
6
+
7
+ Every developer on the team uses this repo. The skills in `skills/` power a Claude Code
8
+ workflow: prime context at session start, capture learnings at session end, and sync
9
+ skills into any project repository.
10
+
11
+ ---
12
+
13
+ ## Skills (Claude Code slash commands)
14
+
15
+ Install them into any project with `node sync-skills.js <project-path>`, then call them
16
+ as `/skill-name` inside Claude Code.
17
+
18
+ | Skill | Command | When to use |
19
+ |-------|---------|-------------|
20
+ | **kickoff** | `/kickoff` | **Start of every session.** Primes Claude with the right framework architecture, coding standards, repo knowledge, and client context before writing any code. Always run this first — do not code without it. |
21
+ | **capture** | `/capture` | **End of every session.** Records what was built or changed into the knowledge base. Proposes creates/updates/deletes for one-tap approval, then writes docs and re-indexes. |
22
+ | **sync-team-skills** | `/sync-team-skills` | Copies all skills from this repo into a project's `.claude/skills/`. Run after adding or updating a skill, or when onboarding a new project. |
23
+ | **create-elastic-beanstalk** | `/create-elastic-beanstalk` | AWS Elastic Beanstalk environment setup wizard for TOGA projects. Run when provisioning a new cloud environment. |
24
+ | **session-save** | `/session-save [name]` | Persists current session state to `~/.claude/session-data/`. Run before closing a long session you intend to resume later. |
25
+ | **session-resume** | `/session-resume [name\|latest]` | Loads a previously saved session. Run at the start of a session that continues prior work — run this **before** `/kickoff`. |
26
+ | **harness-audit** | `/harness-audit` | Audits the health of this knowledge repo: validates docs, checks registry completeness, scores 0-100. Run periodically or before a PR. |
27
+
28
+ ---
29
+
30
+ ## Knowledge Directory Structure
31
+
32
+ ```
33
+ knowledge/
34
+ ├── CONVENTIONS.md ← canonical doc-format spec (READ THIS FIRST)
35
+ ├── registry.json ← all repos: name ↔ project ↔ framework ↔ role ↔ dependsOn
36
+ ├── INDEX.md ← AUTO-GENERATED — do NOT hand-edit
37
+ ├── 1.0/
38
+ │ ├── apps/<repo>/
39
+ │ │ ├── INDEX.md ← AUTO-GENERATED
40
+ │ │ ├── architecture.md
41
+ │ │ └── features/*.md
42
+ │ └── standards/*.md ← 1.0 (App_ framework) coding standards
43
+ ├── 2.0/
44
+ │ ├── apps/<repo>/
45
+ │ │ ├── INDEX.md ← AUTO-GENERATED
46
+ │ │ ├── architecture.md
47
+ │ │ └── features/*.md
48
+ │ └── standards/*.md ← 2.0 (_underscore framework) coding standards
49
+ └── clients/<client>/
50
+ ├── INDEX.md ← AUTO-GENERATED
51
+ ├── profile.md
52
+ ├── features/*.md ← client-specific overrides (link back to apps/)
53
+ └── workflows/*.md ← client business processes
54
+ ```
55
+
56
+ ### Key files
57
+
58
+ - **`knowledge/CONVENTIONS.md`** — the complete doc-format spec: frontmatter schema,
59
+ document types, INDEX rules, integrity requirements, and local-path policy. Read this
60
+ before writing or modifying any knowledge file.
61
+ - **`knowledge/registry.json`** — maps every repo to its project name, framework,
62
+ role (core or app), and dependsOn list. The skills maintain this; do not hand-edit it.
63
+ - **`knowledge/INDEX.md`** — auto-generated master index. Never hand-edit it.
64
+
65
+ ---
66
+
67
+ ## The Two PHP Frameworks
68
+
69
+ TOGA Technology runs two parallel PHP frameworks. The framework determines which
70
+ `knowledge/` subtree a repo lives in and which coding standards apply.
71
+
72
+ ### Framework 1.0 — `App_` framework
73
+ - **Core repo:** `library`
74
+ - **On-disk root (Windows):** `C:\WWW\1.0`
75
+ - **Pattern:** classes prefixed with `App_` (e.g. `App_Controller`, `App_Model`)
76
+ - **Knowledge path:** `knowledge/1.0/`
77
+ - **Standards:** `knowledge/1.0/standards/`
78
+
79
+ ### Framework 2.0 — `_underscore` framework
80
+ - **Core repo:** `_underscore`
81
+ - **On-disk root (Windows):** `C:\WWW\2.0`
82
+ - **Pattern:** leading underscore naming (e.g. `_Controller`, `_Model`, `_Worker`)
83
+ - **Knowledge path:** `knowledge/2.0/`
84
+ - **Standards:** `knowledge/2.0/standards/`
85
+
86
+ If you are unsure which framework a repo belongs to, look it up in `registry.json` or
87
+ run `node knowledge.js search --repo=<name>`.
88
+
89
+ ---
90
+
91
+ ## Rules for Claude
92
+
93
+ ### After ANY write to `knowledge/` files
94
+ Always run:
95
+ ```sh
96
+ node knowledge.js validate
97
+ ```
98
+ The `PostToolUse` hook in `.claude/settings.json` does this automatically for writes
99
+ in this repo. If validation fails (any `ERROR` line in output), **stop and fix the
100
+ error before continuing** — do not report success on an inconsistent knowledge base.
101
+
102
+ ### INDEX.md files — NEVER hand-edit
103
+ `INDEX.md` files (master, per-repo, per-client) are **auto-generated** by:
104
+ ```sh
105
+ node knowledge.js index
106
+ ```
107
+ The `capture` skill runs this automatically. If you hand-edit an INDEX.md, the next
108
+ `index` run will overwrite your changes. Treat INDEX.md as read-only output.
109
+
110
+ ### Local repo paths — NEVER commit
111
+ Absolute local paths (e.g. `C:\WWW\2.0\worker2`) are **machine-specific**. They are
112
+ stored only in each developer's Claude memory as `reference` entries named
113
+ `repo-path-<repo>` (e.g. `repo-path-worker2`) and `team-repo-path`. They are never
114
+ stored in `registry.json`, any knowledge doc, or any committed file. If you ever see
115
+ a local path in a committed file, remove it.
116
+
117
+ ### Document format
118
+ All knowledge docs follow the frontmatter schema defined in `knowledge/CONVENTIONS.md`.
119
+ Required fields: `title`, `framework`, `type`, `status`, `project`. See CONVENTIONS.md
120
+ for the full template for each doc type (feature, architecture, standard, etc.).
121
+
122
+ ---
123
+
124
+ ## CLI Reference
125
+
126
+ ```sh
127
+ # Validate knowledge base integrity
128
+ node knowledge.js validate
129
+
130
+ # Rebuild all INDEX.md files
131
+ node knowledge.js index
132
+
133
+ # Search docs
134
+ node knowledge.js search --framework=2.0 --repo=worker2 --q=<keywords>
135
+
136
+ # Resolve dependency load order for a repo
137
+ node knowledge.js deps --repo=worker2
138
+
139
+ # Sync skills into a project
140
+ node sync-skills.js [project-path]
141
+
142
+ # Harness utilities (audit, status, new-repo wizard)
143
+ node scripts/harness.js audit
144
+ node scripts/harness.js status
145
+ node scripts/harness.js new-repo
146
+ node scripts/harness.js sync [project-path]
147
+ ```
148
+
149
+ ---
150
+
151
+ ## npm Package
152
+
153
+ This repo is published as `toga-harness`. To install skills into a new project:
154
+
155
+ ```sh
156
+ npx toga-harness
157
+ # or after npm install -g toga-harness:
158
+ toga-harness
159
+ ```
160
+
161
+ See `package.json` for full details.
package/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # claude
2
+
3
+ Shared Claude Code skills, configuration, and the team **knowledge base** for TOGA Technology projects.
4
+
5
+ ## Skills
6
+
7
+ | Skill | Description |
8
+ |-------|-------------|
9
+ | [kickoff](skills/kickoff/SKILL.md) | **Start of session.** Asks what you're working on (framework 1.0/2.0/both, front/back/hybrid, repo/project, client) and loads the matching coding standards, framework-core architecture, repo knowledge, and client knowledge from `knowledge/`. |
10
+ | [capture](skills/capture/SKILL.md) | **End of session.** Figures out what you worked on, matches it against existing knowledge, and proposes create/update/retire changes for one-tap approval — then writes them and keeps `registry.json`, frontmatter, and INDEX files consistent. |
11
+ | [create-elastic-beanstalk](skills/create-elastic-beanstalk/SKILL.md) | Interview for a new Elastic Beanstalk environment, then emit a ready-to-paste CloudShell `create-environment` command. |
12
+
13
+ ## The knowledge base (`knowledge/`)
14
+
15
+ The team's feature, workflow, client, and architecture knowledge lives under `knowledge/`,
16
+ managed **entirely by the `kickoff` and `capture` skills**. **Developers never hand-edit
17
+ these files** — run `kickoff` to start a session and `capture` to finish one.
18
+
19
+ - **Framework partitions everything:** `1.0/` (the `App_` framework, core repo `library`)
20
+ and `2.0/` (the `_underscore` framework, core repo `_underscore`). Each owns its `apps/`
21
+ and `standards/`.
22
+ - App folders are keyed by **repo name** (`2.0/apps/worker2/`, …); the project name lives in
23
+ `registry.json` and doc frontmatter.
24
+ - **Clients are shared** at the top level (`clients/<client>/`), each doc tagging its framework.
25
+ - [`registry.json`](knowledge/registry.json) maps **repo ↔ project ↔ framework ↔ role ↔
26
+ dependsOn**. Every repo implicitly depends on its framework core; `dependsOn` adds more.
27
+ - See [`knowledge/CONVENTIONS.md`](knowledge/CONVENTIONS.md) for the full structure spec
28
+ (the same spec is embedded in both skills).
29
+
30
+ ### `knowledge.js`
31
+
32
+ A dependency-free Node helper that keeps the mechanical parts deterministic (the skills call it):
33
+
34
+ ```
35
+ node knowledge.js search --framework= --repo= --project= --client= --file= --q= # find docs
36
+ node knowledge.js index # rebuild all INDEX.md
37
+ node knowledge.js deps --repo=<repo> # resolve load set (core + deps)
38
+ node knowledge.js validate # integrity check
39
+ ```
40
+
41
+ `validate` enforces that `registry.json`, the folder layout, and every doc's frontmatter
42
+ agree, and runs after every `capture` write.
43
+
44
+ ### Where local paths live
45
+
46
+ Absolute repo paths are machine-specific and are **not** stored in this repo. The skills keep
47
+ them in **Claude memory** (`reference` entries `team-repo-path` and `repo-path-<repo>`),
48
+ resolved lazily and asked for by repo name only when a session needs them. The first time a
49
+ developer references a repo on a new machine, the skill asks "What is the path to the
50
+ `<repo>` repository?" and remembers the answer.
51
+
52
+ ## How skills are deployed
53
+
54
+ Claude Code loads skills from `.claude/skills/` at the project root. The skills in this repo
55
+ are the source of truth — run the sync script to copy them into that directory.
56
+
57
+ ## Syncing skills
58
+
59
+ After pulling new skills from this repo, run:
60
+
61
+ ```
62
+ node claude/sync-skills.js
63
+ ```
64
+
65
+ Works on Mac and PC. Run it from anywhere inside the project.
66
+
67
+ ## Adding a skill
68
+
69
+ 1. Create a directory under `skills/` with your skill name.
70
+ 2. Add a `SKILL.md` with YAML frontmatter (`name`, `description`) and the instructions.
71
+ 3. Run `node claude/sync-skills.js` to deploy it.
72
+ 4. Update the table above.
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: framework-pattern-checker
3
+ description: Checks that new PHP code follows the correct TOGA framework conventions for either the 1.0 (App_) or 2.0 (_underscore) framework.
4
+ model: haiku
5
+ tools: Read, Grep, Glob, Bash
6
+ ---
7
+
8
+ # Framework Pattern Checker
9
+
10
+ Lightweight, fast checker that validates new code follows TOGA's exact framework conventions. Designed for pre-commit or pre-review use. Detects framework automatically and checks naming, inheritance, method signatures, and structural rules. Reports violations only — does not suggest style improvements.
11
+
12
+ ## Trigger phrases
13
+ - "check framework patterns"
14
+ - "does this follow conventions?"
15
+ - "validate my new class"
16
+ - "is this the right way to do X in 1.0/2.0?"
17
+
18
+ ## Behavior
19
+
20
+ 1. **Detect framework** from file path or class name:
21
+ - File under `C:\WWW\1.0` or class starts with `App_` → **Framework 1.0**
22
+ - File under `C:\WWW\2.0` or class starts with `_` → **Framework 2.0**
23
+ - If still ambiguous: check `knowledge/registry.json` by repo name.
24
+
25
+ 2. **Framework 1.0 checks** (`App_` rules):
26
+ - Every class name begins with `App_` — e.g. `App_Controller_Orders`, `App_Model_User`.
27
+ - Controllers extend `App_Controller` (directly or via intermediate base class that itself extends `App_Controller`).
28
+ - Models extend `App_Model`.
29
+ - No direct model instantiation in controllers — must use the registry or factory: `App_Registry::get('ModelName')` or equivalent.
30
+ - Method names follow `camelCase`. No `snake_case` public methods.
31
+ - Class file is named to match the class: `App_Controller_Orders` → `Orders.php` under `controllers/`.
32
+ - Check `knowledge/1.0/apps/<repo>/architecture.md` for repo-specific patterns before flagging.
33
+
34
+ 3. **Framework 2.0 checks** (`_underscore` rules):
35
+ - All framework classes use leading underscore: `_Controller`, `_Model`, `_Worker`, `_Api`.
36
+ - Workers must extend `_Worker` and implement a `run()` method.
37
+ - Workers must NOT be called directly from controllers or other workers — dispatch via queue.
38
+ - Controllers extend `_Controller`.
39
+ - For `api2` repo: every action method must return an array with keys `success`, `data`, `errors` — never a raw string or bare array.
40
+ - `dependsOn` in `registry.json` means shared base classes exist — check `knowledge/2.0/apps/<shared-repo>/architecture.md` before adding new methods to inherited classes.
41
+
42
+ 4. **Cross-framework checks** (both):
43
+ - No `eval()` usage.
44
+ - No direct `$_GET`/`$_POST` access without validation wrapper.
45
+ - No raw string SQL (`"SELECT * FROM users WHERE id = " . $id`).
46
+
47
+ 5. **Report only violations** — not style preferences. Each violation must cite the rule source.
48
+
49
+ ## Output format
50
+
51
+ ```
52
+ ## Framework Pattern Check — <filename>
53
+ Framework: 1.0 (App_) | 2.0 (_underscore)
54
+
55
+ VIOLATIONS (must fix):
56
+ [line 14] Class 'OrderProcessor' missing App_ prefix — should be 'App_Model_OrderProcessor'
57
+ [line 47] Direct model instantiation: `new App_Model_User()` — use App_Registry::get('User')
58
+
59
+ PASSES:
60
+ ✓ Controller extends App_Controller
61
+ ✓ No direct SQL string concatenation found
62
+ ✓ No eval() usage
63
+
64
+ Result: 2 violation(s) found.
65
+ ```
66
+
67
+ If no violations: "All framework pattern checks passed."
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: harness-optimizer
3
+ description: Audits the Claude harness configuration in this repo and reports a 0-100 health score with the top 3 highest-leverage improvements.
4
+ model: sonnet
5
+ tools: Read, Grep, Glob, Bash
6
+ ---
7
+
8
+ # Harness Optimizer
9
+
10
+ Audits the TOGA Team Knowledge System harness and scores its completeness and health from 0 to 100. Runs actual validation commands when available. Reports concisely: score, what's working, what's missing, and the three changes that would have the highest impact.
11
+
12
+ ## Trigger phrases
13
+ - "audit the harness"
14
+ - "how healthy is the harness?"
15
+ - "harness score"
16
+ - "/harness-audit"
17
+ - "what should I improve in the harness?"
18
+
19
+ ## Behavior
20
+
21
+ 1. **Run existing audit tooling** (if available):
22
+ - `node knowledge.js validate` — knowledge base integrity
23
+ - `node scripts/harness.js audit` — harness-level checks
24
+ - Note the output and exit codes.
25
+
26
+ 2. **Check hooks coverage** (25 points):
27
+ - Read `.claude/settings.json`.
28
+ - Check for `SessionStart` hook → context priming (5 pts)
29
+ - Check for `PreToolUse` hooks → dangerous command protection (5 pts)
30
+ - Check for `PostToolUse` hooks → validation after writes (5 pts)
31
+ - Check for `Stop` hooks → session-end reminders (5 pts)
32
+ - Each hook that has a real implementation (not just an echo) = full points. (5 pts total for quality)
33
+
34
+ 3. **Check rules completeness** (20 points):
35
+ - `rules/common/coding-style.md` exists (4 pts)
36
+ - `rules/common/security.md` exists (4 pts)
37
+ - `rules/common/git-workflow.md` exists (4 pts)
38
+ - `rules/php/app-framework.md` exists (4 pts)
39
+ - `rules/php/underscore-framework.md` exists (4 pts)
40
+
41
+ 4. **Check agent coverage** (20 points):
42
+ - `agents/php-reviewer.md` exists (4 pts)
43
+ - `agents/planner.md` exists (4 pts)
44
+ - `agents/sql-reviewer.md` exists (4 pts)
45
+ - `agents/knowledge-writer.md` exists (4 pts)
46
+ - `agents/harness-optimizer.md` (self) exists (4 pts)
47
+
48
+ 5. **Check skills completeness** (20 points):
49
+ - `skills/kickoff/SKILL.md` (4 pts)
50
+ - `skills/capture/SKILL.md` (4 pts)
51
+ - `skills/session-save/SKILL.md` (4 pts)
52
+ - `skills/session-resume/SKILL.md` (4 pts)
53
+ - `skills/php-patterns/SKILL.md` OR `skills/code-review/SKILL.md` (4 pts)
54
+
55
+ 6. **Check knowledge base** (15 points):
56
+ - `knowledge/CONVENTIONS.md` exists (3 pts)
57
+ - `knowledge/registry.json` exists and is valid JSON (3 pts)
58
+ - At least one architecture.md per registered repo (3 pts)
59
+ - No validation errors from `node knowledge.js validate` (3 pts)
60
+ - INDEX.md files are present for all app directories (3 pts)
61
+
62
+ 7. **Identify top 3 improvements**: Rank missing items by impact × ease. Prioritize:
63
+ - Security rules (highest impact if missing)
64
+ - Hooks that validate/protect (high impact)
65
+ - Agent coverage for the team's core workflow (php-reviewer, planner)
66
+
67
+ ## Output format
68
+
69
+ ```
70
+ ## Harness Audit — TOGA Team Knowledge System
71
+
72
+ ### Score: 73 / 100
73
+
74
+ ### What's Working
75
+ - ✓ SessionStart hook primes context
76
+ - ✓ PostToolUse validates knowledge/ writes
77
+ - ✓ kickoff, capture, session-save, session-resume skills present
78
+ - ✓ knowledge/CONVENTIONS.md and registry.json present
79
+ - ✓ Architecture docs for all 5 registered repos
80
+
81
+ ### What's Missing
82
+ - ✗ rules/common/security.md — (-4 pts)
83
+ - ✗ rules/php/ directory — (-8 pts)
84
+ - ✗ agents/sql-reviewer.md — (-4 pts)
85
+ - ✗ PreToolUse hook for dangerous commands — (-5 pts)
86
+ - ✗ skills/php-patterns/SKILL.md — (-4 pts)
87
+ - ⚠ PostToolUse hook exists but does not call a real script — (-3 pts quality)
88
+
89
+ ### Top 3 Improvements (highest leverage)
90
+
91
+ 1. **Add rules/common/security.md and rules/php/** (+12 pts)
92
+ Security rules are always-loaded context — they prevent the most expensive bugs.
93
+ Add 5 rule files: common/security.md, common/coding-style.md, common/git-workflow.md,
94
+ php/app-framework.md, php/underscore-framework.md.
95
+
96
+ 2. **Add PreToolUse hook for rm -rf / DROP TABLE** (+5 pts, prevents data loss)
97
+ Single hook entry in settings.json blocks the two most destructive accidental commands.
98
+ Run: add matcher `Bash` with command grep for `rm -rf` or `DROP TABLE`.
99
+
100
+ 3. **Add skills/php-patterns/SKILL.md** (+4 pts)
101
+ The team's most frequent task is PHP feature work. A patterns skill accelerates every session.
102
+ ```