@ai-kits/wp-ag-kit 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 (104) hide show
  1. package/ANTIGRAVITY-README.md +47 -0
  2. package/CONTRIBUTING.md +122 -0
  3. package/README.md +135 -0
  4. package/STRUCTURE.md +200 -0
  5. package/agents/wordpress-expert.md +36 -0
  6. package/agents/wp-frontend-expert.md +21 -0
  7. package/bin/antigravity-agent.js +159 -0
  8. package/docs/authoring-guide.md +56 -0
  9. package/docs/compatibility-policy.md +18 -0
  10. package/docs/packaging.md +26 -0
  11. package/docs/principles.md +7 -0
  12. package/docs/skill-set-v1.md +21 -0
  13. package/docs/upstream-sync.md +52 -0
  14. package/package.json +47 -0
  15. package/rules/GEMINI.md +273 -0
  16. package/shared/references/.gitkeep +1 -0
  17. package/shared/references/gutenberg-releases.json +155 -0
  18. package/shared/references/wordpress-core-versions.json +208 -0
  19. package/shared/references/wp-gutenberg-version-map.json +886 -0
  20. package/shared/scripts/ai-generate-updates.mjs +458 -0
  21. package/shared/scripts/scaffold-skill.mjs +62 -0
  22. package/shared/scripts/skillpack-build.mjs +165 -0
  23. package/shared/scripts/skillpack-install.mjs +275 -0
  24. package/shared/scripts/update-upstream-indices.mjs +173 -0
  25. package/skills/wordpress-router/SKILL.md +51 -0
  26. package/skills/wordpress-router/references/decision-tree.md +55 -0
  27. package/skills/wp-abilities-api/SKILL.md +95 -0
  28. package/skills/wp-abilities-api/references/php-registration.md +67 -0
  29. package/skills/wp-abilities-api/references/rest-api.md +13 -0
  30. package/skills/wp-block-development/SKILL.md +174 -0
  31. package/skills/wp-block-development/references/attributes-and-serialization.md +22 -0
  32. package/skills/wp-block-development/references/block-json.md +49 -0
  33. package/skills/wp-block-development/references/creating-new-blocks.md +46 -0
  34. package/skills/wp-block-development/references/debugging.md +36 -0
  35. package/skills/wp-block-development/references/deprecations.md +24 -0
  36. package/skills/wp-block-development/references/dynamic-rendering.md +23 -0
  37. package/skills/wp-block-development/references/inner-blocks.md +25 -0
  38. package/skills/wp-block-development/references/registration.md +30 -0
  39. package/skills/wp-block-development/references/supports-and-wrappers.md +18 -0
  40. package/skills/wp-block-development/references/tooling-and-testing.md +21 -0
  41. package/skills/wp-block-development/scripts/list_blocks.mjs +121 -0
  42. package/skills/wp-block-themes/SKILL.md +116 -0
  43. package/skills/wp-block-themes/references/creating-new-block-theme.md +37 -0
  44. package/skills/wp-block-themes/references/debugging.md +24 -0
  45. package/skills/wp-block-themes/references/patterns.md +18 -0
  46. package/skills/wp-block-themes/references/style-variations.md +14 -0
  47. package/skills/wp-block-themes/references/templates-and-parts.md +16 -0
  48. package/skills/wp-block-themes/references/theme-json.md +59 -0
  49. package/skills/wp-block-themes/scripts/detect_block_themes.mjs +117 -0
  50. package/skills/wp-interactivity-api/SKILL.md +179 -0
  51. package/skills/wp-interactivity-api/references/debugging.md +29 -0
  52. package/skills/wp-interactivity-api/references/directives-quickref.md +30 -0
  53. package/skills/wp-interactivity-api/references/server-side-rendering.md +310 -0
  54. package/skills/wp-performance/SKILL.md +146 -0
  55. package/skills/wp-performance/references/autoload-options.md +24 -0
  56. package/skills/wp-performance/references/cron.md +20 -0
  57. package/skills/wp-performance/references/database.md +20 -0
  58. package/skills/wp-performance/references/http-api.md +15 -0
  59. package/skills/wp-performance/references/measurement.md +21 -0
  60. package/skills/wp-performance/references/object-cache.md +24 -0
  61. package/skills/wp-performance/references/query-monitor-headless.md +38 -0
  62. package/skills/wp-performance/references/server-timing.md +22 -0
  63. package/skills/wp-performance/references/wp-cli-doctor.md +24 -0
  64. package/skills/wp-performance/references/wp-cli-profile.md +32 -0
  65. package/skills/wp-performance/scripts/perf_inspect.mjs +128 -0
  66. package/skills/wp-phpstan/SKILL.md +97 -0
  67. package/skills/wp-phpstan/references/configuration.md +52 -0
  68. package/skills/wp-phpstan/references/third-party-classes.md +76 -0
  69. package/skills/wp-phpstan/references/wordpress-annotations.md +124 -0
  70. package/skills/wp-phpstan/scripts/phpstan_inspect.mjs +263 -0
  71. package/skills/wp-playground/SKILL.md +101 -0
  72. package/skills/wp-playground/references/blueprints.md +36 -0
  73. package/skills/wp-playground/references/cli-commands.md +39 -0
  74. package/skills/wp-playground/references/debugging.md +16 -0
  75. package/skills/wp-plugin-development/SKILL.md +112 -0
  76. package/skills/wp-plugin-development/references/data-and-cron.md +19 -0
  77. package/skills/wp-plugin-development/references/debugging.md +19 -0
  78. package/skills/wp-plugin-development/references/lifecycle.md +33 -0
  79. package/skills/wp-plugin-development/references/security.md +29 -0
  80. package/skills/wp-plugin-development/references/settings-api.md +22 -0
  81. package/skills/wp-plugin-development/references/structure.md +16 -0
  82. package/skills/wp-plugin-development/scripts/detect_plugins.mjs +122 -0
  83. package/skills/wp-project-triage/SKILL.md +38 -0
  84. package/skills/wp-project-triage/references/triage.schema.json +143 -0
  85. package/skills/wp-project-triage/scripts/detect_wp_project.mjs +592 -0
  86. package/skills/wp-rest-api/SKILL.md +114 -0
  87. package/skills/wp-rest-api/references/authentication.md +18 -0
  88. package/skills/wp-rest-api/references/custom-content-types.md +20 -0
  89. package/skills/wp-rest-api/references/discovery-and-params.md +20 -0
  90. package/skills/wp-rest-api/references/responses-and-fields.md +30 -0
  91. package/skills/wp-rest-api/references/routes-and-endpoints.md +36 -0
  92. package/skills/wp-rest-api/references/schema.md +22 -0
  93. package/skills/wp-wpcli-and-ops/SKILL.md +123 -0
  94. package/skills/wp-wpcli-and-ops/references/automation.md +30 -0
  95. package/skills/wp-wpcli-and-ops/references/cron-and-cache.md +23 -0
  96. package/skills/wp-wpcli-and-ops/references/debugging.md +17 -0
  97. package/skills/wp-wpcli-and-ops/references/multisite.md +22 -0
  98. package/skills/wp-wpcli-and-ops/references/packages-and-updates.md +22 -0
  99. package/skills/wp-wpcli-and-ops/references/safety.md +30 -0
  100. package/skills/wp-wpcli-and-ops/references/search-replace.md +40 -0
  101. package/skills/wp-wpcli-and-ops/scripts/wpcli_inspect.mjs +90 -0
  102. package/skills/wpds/SKILL.md +58 -0
  103. package/workflows/create-block.md +27 -0
  104. package/workflows/wp-lint.md +27 -0
@@ -0,0 +1,159 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require('child_process');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ const AGENT_SKILLS_ROOT = path.resolve(__dirname, '..');
8
+ const AGENT_SKILLS_SKILLS = path.join(AGENT_SKILLS_ROOT, 'skills');
9
+
10
+ function printHelp() {
11
+ console.log(`WordPress Antigravity Kit CLI\n\nUsage:\n wpag <command> [args]\n\nCommands:\n init Initialize .agent folder in current project\n list-skills List available skills from the kit\n list-agents List available agents from the kit\n list-installed List items currently installed in .agent/\n use-skill <name> Copy a specific skill into .agent/skills\n help Show this help message\n`);
12
+ }
13
+
14
+ function initAgentFolder() {
15
+ const target = path.resolve(process.cwd(), '.agent');
16
+ const AGENT_SKILLS_SHARED = path.join(AGENT_SKILLS_ROOT, 'shared');
17
+ const AGENT_SKILLS_AGENTS = path.join(AGENT_SKILLS_ROOT, 'agents');
18
+ const AGENT_SKILLS_WORKFLOWS = path.join(AGENT_SKILLS_ROOT, 'workflows');
19
+ const AGENT_SKILLS_RULES = path.join(AGENT_SKILLS_ROOT, 'rules');
20
+
21
+ if (!fs.existsSync(target)) {
22
+ fs.mkdirSync(target);
23
+ console.log('Created .agent folder');
24
+ } else {
25
+ console.log('.agent folder already exists');
26
+ }
27
+
28
+ const foldersToCopy = [
29
+ { name: 'skills', src: AGENT_SKILLS_SKILLS },
30
+ { name: 'shared', src: AGENT_SKILLS_SHARED },
31
+ { name: 'agents', src: AGENT_SKILLS_AGENTS },
32
+ { name: 'workflows', src: AGENT_SKILLS_WORKFLOWS },
33
+ { name: 'rules', src: AGENT_SKILLS_RULES }
34
+ ];
35
+
36
+ foldersToCopy.forEach(folder => {
37
+ const dest = path.join(target, folder.name);
38
+ if (fs.existsSync(folder.src)) {
39
+ if (!fs.existsSync(dest)) {
40
+ copyDirRecursive(folder.src, dest);
41
+ console.log(`Copied "${folder.name}" to .agent/${folder.name}`);
42
+ } else {
43
+ console.log(`.agent/${folder.name} already exists.`);
44
+ }
45
+ }
46
+ });
47
+ }
48
+
49
+ function copyDirRecursive(src, dest) {
50
+ if (!fs.existsSync(dest)) {
51
+ fs.mkdirSync(dest, { recursive: true });
52
+ }
53
+ fs.readdirSync(src).forEach(item => {
54
+ const srcPath = path.join(src, item);
55
+ const destPath = path.join(dest, item);
56
+ if (fs.statSync(srcPath).isDirectory()) {
57
+ copyDirRecursive(srcPath, destPath);
58
+ } else {
59
+ fs.copyFileSync(srcPath, destPath);
60
+ }
61
+ });
62
+ }
63
+
64
+ function listSkills() {
65
+ if (!fs.existsSync(AGENT_SKILLS_SKILLS)) {
66
+ console.error('Skills directory not found in kit.');
67
+ process.exit(1);
68
+ }
69
+ const skills = fs.readdirSync(AGENT_SKILLS_SKILLS).filter(f => fs.statSync(path.join(AGENT_SKILLS_SKILLS, f)).isDirectory());
70
+ console.log('Available skills in kit:');
71
+ skills.forEach(skill => console.log(' -', skill));
72
+ }
73
+
74
+ function listAgents() {
75
+ const AGENT_SKILLS_AGENTS = path.join(AGENT_SKILLS_ROOT, 'agents');
76
+ if (!fs.existsSync(AGENT_SKILLS_AGENTS)) {
77
+ console.log('No agents directory found in kit.');
78
+ return;
79
+ }
80
+ const agents = fs.readdirSync(AGENT_SKILLS_AGENTS).filter(f => f.endsWith('.md'));
81
+ console.log('Available agents in kit:');
82
+ agents.forEach(agent => console.log(' -', agent));
83
+ }
84
+
85
+ function listInstalled() {
86
+ const target = path.resolve(process.cwd(), '.agent');
87
+ if (!fs.existsSync(target)) {
88
+ console.log('No .agent folder found. Run "ag-agent init".');
89
+ return;
90
+ }
91
+
92
+ const subs = ['skills', 'agents', 'workflows', 'rules'];
93
+ subs.forEach(sub => {
94
+ const subPath = path.join(target, sub);
95
+ if (fs.existsSync(subPath)) {
96
+ const items = fs.readdirSync(subPath);
97
+ console.log(`Installed in .agent/${sub}:`);
98
+ if (items.length === 0) {
99
+ console.log(' (none)');
100
+ } else {
101
+ items.forEach(item => console.log(' -', item));
102
+ }
103
+ }
104
+ });
105
+ }
106
+
107
+
108
+ function useSkill(skillName) {
109
+ const target = path.resolve(process.cwd(), '.agent/skills');
110
+ if (!fs.existsSync(target)) {
111
+ console.error('No .agent/skills folder found. Run ag-agent init first.');
112
+ process.exit(1);
113
+ }
114
+ const src = path.join(AGENT_SKILLS_SKILLS, skillName);
115
+ const dest = path.join(target, skillName);
116
+ if (!fs.existsSync(src)) {
117
+ console.error('Skill not found:', skillName);
118
+ process.exit(1);
119
+ }
120
+ if (fs.existsSync(dest)) {
121
+ console.log('Skill already exists in .agent/skills:', skillName);
122
+ return;
123
+ }
124
+ copyDirRecursive(src, dest);
125
+ console.log('Copied skill', skillName, 'to .agent/skills');
126
+ }
127
+
128
+ const cmd = process.argv[2];
129
+ const arg = process.argv[3];
130
+
131
+ switch (cmd) {
132
+ case 'init':
133
+ initAgentFolder();
134
+ break;
135
+ case 'list-skills':
136
+ listSkills();
137
+ break;
138
+ case 'list-agents':
139
+ listAgents();
140
+ break;
141
+ case 'list-installed':
142
+ listInstalled();
143
+ break;
144
+ case 'use-skill':
145
+ if (!arg) {
146
+ console.error('Please specify a skill name.');
147
+ process.exit(1);
148
+ }
149
+ useSkill(arg);
150
+ break;
151
+ case 'help':
152
+ case undefined:
153
+ printHelp();
154
+ break;
155
+ default:
156
+ console.error('Unknown command:', cmd);
157
+ printHelp();
158
+ process.exit(1);
159
+ }
@@ -0,0 +1,56 @@
1
+ # Authoring guide (AI-assisted)
2
+
3
+ This repo is built for **AI-assisted authoring** with **deterministic guardrails**.
4
+
5
+ ## Golden rules
6
+
7
+ - Keep `SKILL.md` short and procedural; push depth into `references/` and scripts.
8
+ - Prefer deterministic scripts for anything the agent would otherwise β€œguess” (repo detection, version checks, lint/test command discovery).
9
+ - Don’t add a new skill without at least one scenario in `eval/scenarios/`.
10
+ - Keep file references 1 hop from `SKILL.md` (avoid deep chains).
11
+ - Include a `compatibility:` frontmatter line matching `docs/compatibility-policy.md`.
12
+
13
+ ## Workflow: draft β†’ harden β†’ ship
14
+
15
+ 1. **Route first**
16
+ - Start from `skills/wordpress-router/SKILL.md` to classify the repo and pick the domain.
17
+ 2. **Collect inputs**
18
+ - What repo type(s) does triage detect?
19
+ - What WP/PHP/Node versions are targeted (if known)?
20
+ - What tooling exists (Composer, @wordpress/scripts, PHPUnit, Playwright, wp-env)?
21
+ 3. **Draft the skill (AI-assisted)**
22
+ - Write `SKILL.md` as a checklist/procedure with explicit β€œVerification” and β€œFailure modes”.
23
+ - Keep examples short; link to topic references when needed.
24
+ 4. **Add deterministic helpers**
25
+ - If the skill depends on detection (versions, project layout, build system), add a script under `scripts/`.
26
+ 5. **Add evaluation scenario(s)**
27
+ - Add at least 1 prompt-style scenario under `eval/scenarios/` describing expected behavior.
28
+ 6. **Validate**
29
+ - Run `node eval/harness/run.mjs`.
30
+ - Optionally validate frontmatter using `skills-ref validate` (see `docs/upstream-sync.md` for CI guidance).
31
+
32
+ ## Scaffolding a new skill
33
+
34
+ Use the scaffold script to create a minimal, spec-compliant starting point:
35
+
36
+ - `node shared/scripts/scaffold-skill.mjs <skill-name> "<description>"`
37
+
38
+ ## β€œSkill generation” prompt template (recommended)
39
+
40
+ When using an LLM to draft a skill, provide:
41
+
42
+ - The repo triage JSON output
43
+ - The user’s task statement(s)
44
+ - Any version constraints and non-goals
45
+ - The required sections: When to use, Inputs required, Procedure, Verification, Failure modes, Escalation
46
+
47
+ Then ask the model to output:
48
+
49
+ 1. `skills/<skill-name>/SKILL.md`
50
+ 2. Any `references/*.md` files it mentions
51
+ 3. Any `scripts/*` stubs needed for deterministic checks
52
+ 4. One scenario markdown file under `eval/scenarios/`
53
+
54
+ ## Suggested initial domain skills (v1)
55
+
56
+ See `docs/skill-set-v1.md`.
@@ -0,0 +1,18 @@
1
+ # Compatibility policy
2
+
3
+ This repo is an authoring workspace for WordPress-focused Agent Skills.
4
+
5
+ ## Compatibility contract (v1)
6
+
7
+ Skills in this repo target:
8
+
9
+ - WordPress core **6.9+**
10
+ - PHP **7.2.24+** (minimum supported by WordPress 6.9)
11
+
12
+ ## Authoring rules
13
+
14
+ Skills should:
15
+
16
+ - Prefer stable WordPress APIs and best practices.
17
+ - Prefer detection + guardrails (triage) over hard-coded assumptions.
18
+ - If a task requires behavior that differs across core versions, ask for a target version (but default guidance should assume WP 6.9+).
@@ -0,0 +1,26 @@
1
+ # Packaging and installation
2
+
3
+ This repo is the **source of truth** under `skills/`.
4
+
5
+ To distribute skills to other repos/tools (without symlinks), use the skillpack scripts.
6
+
7
+ ## Build dist
8
+
9
+ Build a packaged copy under `dist/`:
10
+
11
+ - `node shared/scripts/skillpack-build.mjs --clean`
12
+
13
+ Outputs:
14
+
15
+ - `dist/codex/.codex/skills/*` (OpenAI Codex repo layout)
16
+ - `dist/vscode/.github/skills/*` (VS Code / Copilot repo layout)
17
+
18
+ ## Install into another repo
19
+
20
+ 1. Build dist (above).
21
+ 2. Install into a destination repo:
22
+
23
+ - `node shared/scripts/skillpack-install.mjs --dest=../some-repo --targets=codex,vscode`
24
+
25
+ By default, install mode is `replace` (it replaces only the skill directories it installs).
26
+
@@ -0,0 +1,7 @@
1
+ # Principles
2
+
3
+ - Prefer small, composable skills over a single "mega-skill".
4
+ - Keep `SKILL.md` bodies short; move depth into `references/`.
5
+ - Bundle deterministic checks as scripts when reliability matters.
6
+ - Treat upstream docs as canonical; store agent-first checklists and decision trees.
7
+ - Every new skill must include at least one eval scenario under `eval/scenarios/`.
@@ -0,0 +1,21 @@
1
+ # WordPress skill set (v1)
2
+
3
+ This repo currently includes:
4
+
5
+ - `wordpress-router`
6
+ - `wp-project-triage`
7
+ - `wp-block-development`
8
+ - `wp-block-themes`
9
+ - `wp-plugin-development`
10
+ - `wp-rest-api`
11
+ - `wp-interactivity-api`
12
+ - `wp-abilities-api`
13
+ - `wp-wpcli-and-ops`
14
+ - `wp-performance`
15
+ - `wp-phpstan`
16
+
17
+ Planned next skills (not yet implemented):
18
+
19
+ - `wp-build-tooling`
20
+ - `wp-testing`
21
+ - `wp-security`
@@ -0,0 +1,52 @@
1
+ # Upstream sync (automation plan)
2
+
3
+ Goal: when upstream changes (WordPress core releases, Gutenberg releases, docs updates), the repo should **regenerate indexes** and (eventually) **open PRs** that update affected skills/references.
4
+
5
+ ## What to automate first (low risk)
6
+
7
+ 1. **Indexes and matrices**
8
+ - WordPress core version list (latest stable + recent).
9
+ - Gutenberg releases list (latest stable + recent).
10
+ - WordPress ↔ Gutenberg mapping table (derived from canonical docs where available).
11
+ 2. **Routing metadata refresh**
12
+ - Update `shared/references/*.json` files only.
13
+
14
+ This keeps automation deterministic and reviewable before it starts rewriting skill prose.
15
+
16
+ ## Later automation (higher risk)
17
+
18
+ - β€œReference chunk regeneration” from upstream docs into `skills/*/references/*.md`.
19
+ - Task-shaped deltas (e.g. a new Gutenberg package, new block APIs, changes in theme.json schema).
20
+ - Semi-automated PRs that include:
21
+ - regenerated references
22
+ - updated checklists
23
+ - updated eval scenarios
24
+
25
+ ## Scripts
26
+
27
+ - `shared/scripts/update-upstream-indices.mjs`
28
+ - Fetches upstream sources and rewrites JSON indexes in `shared/references/`.
29
+
30
+ ## CI / PR bot design (recommended)
31
+
32
+ - Schedule a workflow (daily/weekly).
33
+ - Run `shared/scripts/update-upstream-indices.mjs`.
34
+ - If `git diff` is non-empty, open a PR with:
35
+ - a summary of changes
36
+ - links to upstream release notes
37
+ - a checklist for human review (β€œdoes this impact blocks/themes/plugin workflows?”)
38
+
39
+ ## Validation
40
+
41
+ - Always run `node eval/harness/run.mjs`.
42
+ - Optional: use Agent Skills reference validator:
43
+ - `skills-ref validate skills/<skill-name>`
44
+
45
+ ## Canonical sources
46
+
47
+ The automation should prefer canonical sources and avoid scraping where possible.
48
+
49
+ - WordPress core releases and API endpoints (official WordPress APIs)
50
+ - Gutenberg releases (GitHub releases)
51
+ - WordPress developer docs (used for the WP↔Gutenberg mapping when no API exists)
52
+
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@ai-kits/wp-ag-kit",
3
+ "version": "1.0.0",
4
+ "description": "WordPress Antigravity Kit - Complete WordPress development environment for Antigravity IDE with skills, agents, workflows, and rules.",
5
+ "main": "bin/antigravity-agent.js",
6
+ "bin": {
7
+ "wpag": "bin/antigravity-agent.js"
8
+ },
9
+ "scripts": {
10
+ "test": "node eval/harness/run.mjs",
11
+ "build": "node shared/scripts/skillpack-build.mjs --clean",
12
+ "prepublishOnly": "npm test"
13
+ },
14
+ "author": "Anikesh Kumar",
15
+ "license": "MIT",
16
+ "keywords": [
17
+ "wordpress",
18
+ "antigravity",
19
+ "gutenberg",
20
+ "blocks",
21
+ "agent",
22
+ "ai",
23
+ "cli",
24
+ "skills",
25
+ "block-themes",
26
+ "interactivity-api",
27
+ "wp-cli",
28
+ "phpstan",
29
+ "ai-kits"
30
+ ],
31
+ "files": [
32
+ "bin/",
33
+ "skills/",
34
+ "agents/",
35
+ "workflows/",
36
+ "rules/",
37
+ "shared/",
38
+ "docs/",
39
+ "README.md",
40
+ "ANTIGRAVITY-README.md",
41
+ "STRUCTURE.md",
42
+ "CONTRIBUTING.md"
43
+ ],
44
+ "engines": {
45
+ "node": ">=16"
46
+ }
47
+ }
@@ -0,0 +1,273 @@
1
+ ---
2
+ trigger: always_on
3
+ ---
4
+
5
+ # GEMINI.md - Antigravity Kit
6
+
7
+ > This file defines how the AI behaves in this workspace.
8
+
9
+ ---
10
+
11
+ ## CRITICAL: AGENT & SKILL PROTOCOL (START HERE)
12
+
13
+ > **MANDATORY:** You MUST read the appropriate agent file and its skills BEFORE performing any implementation. This is the highest priority rule.
14
+
15
+ ### 1. Modular Skill Loading Protocol
16
+
17
+ Agent activated β†’ Check frontmatter "skills:" β†’ Read SKILL.md (INDEX) β†’ Read specific sections.
18
+
19
+ - **Selective Reading:** DO NOT read ALL files in a skill folder. Read `SKILL.md` first, then only read sections matching the user's request.
20
+ - **Rule Priority:** P0 (GEMINI.md) > P1 (Agent .md) > P2 (SKILL.md). All rules are binding.
21
+
22
+ ### 2. Enforcement Protocol
23
+
24
+ 1. **When agent is activated:**
25
+ - βœ… Activate: Read Rules β†’ Check Frontmatter β†’ Load SKILL.md β†’ Apply All.
26
+ 2. **Forbidden:** Never skip reading agent rules or skill instructions. "Read β†’ Understand β†’ Apply" is mandatory.
27
+
28
+ ---
29
+
30
+ ## πŸ“₯ REQUEST CLASSIFIER (STEP 1)
31
+
32
+ **Before ANY action, classify the request:**
33
+
34
+ | Request Type | Trigger Keywords | Active Tiers | Result |
35
+ | ---------------- | ------------------------------------------ | ------------------------------ | --------------------------- |
36
+ | **QUESTION** | "what is", "how does", "explain" | TIER 0 only | Text Response |
37
+ | **SURVEY/INTEL** | "analyze", "list files", "overview" | TIER 0 + Explorer | Session Intel (No File) |
38
+ | **SIMPLE CODE** | "fix", "add", "change" (single file) | TIER 0 + TIER 1 (lite) | Inline Edit |
39
+ | **COMPLEX CODE** | "build", "create", "implement", "refactor" | TIER 0 + TIER 1 (full) + Agent | **{task-slug}.md Required** |
40
+ | **DESIGN/UI** | "design", "UI", "page", "dashboard" | TIER 0 + TIER 1 + Agent | **{task-slug}.md Required** |
41
+ | **SLASH CMD** | /create, /orchestrate, /debug | Command-specific flow | Variable |
42
+
43
+ ---
44
+
45
+ ## πŸ€– INTELLIGENT AGENT ROUTING (STEP 2 - AUTO)
46
+
47
+ **ALWAYS ACTIVE: Before responding to ANY request, automatically analyze and select the best agent(s).**
48
+
49
+ > πŸ”΄ **MANDATORY:** You MUST follow the protocol defined in `@[skills/intelligent-routing]`.
50
+
51
+ ### Auto-Selection Protocol
52
+
53
+ 1. **Analyze (Silent)**: Detect domains (Frontend, Backend, Security, etc.) from user request.
54
+ 2. **Select Agent(s)**: Choose the most appropriate specialist(s).
55
+ 3. **Inform User**: Concisely state which expertise is being applied.
56
+ 4. **Apply**: Generate response using the selected agent's persona and rules.
57
+
58
+ ### Response Format (MANDATORY)
59
+
60
+ When auto-applying an agent, inform the user:
61
+
62
+ ```markdown
63
+ πŸ€– **Applying knowledge of `@[agent-name]`...**
64
+
65
+ [Continue with specialized response]
66
+ ```
67
+
68
+ **Rules:**
69
+
70
+ 1. **Silent Analysis**: No verbose meta-commentary ("I am analyzing...").
71
+ 2. **Respect Overrides**: If user mentions `@agent`, use it.
72
+ 3. **Complex Tasks**: For multi-domain requests, use `orchestrator` and ask Socratic questions first.
73
+
74
+ ### ⚠️ AGENT ROUTING CHECKLIST (MANDATORY BEFORE EVERY CODE/DESIGN RESPONSE)
75
+
76
+ **Before ANY code or design work, you MUST complete this mental checklist:**
77
+
78
+ | Step | Check | If Unchecked |
79
+ |------|-------|--------------|
80
+ | 1 | Did I identify the correct agent for this domain? | β†’ STOP. Analyze request domain first. |
81
+ | 2 | Did I READ the agent's `.md` file (or recall its rules)? | β†’ STOP. Open `.agent/agents/{agent}.md` |
82
+ | 3 | Did I announce `πŸ€– Applying knowledge of @[agent]...`? | β†’ STOP. Add announcement before response. |
83
+ | 4 | Did I load required skills from agent's frontmatter? | β†’ STOP. Check `skills:` field and read them. |
84
+
85
+ **Failure Conditions:**
86
+
87
+ - ❌ Writing code without identifying an agent = **PROTOCOL VIOLATION**
88
+ - ❌ Skipping the announcement = **USER CANNOT VERIFY AGENT WAS USED**
89
+ - ❌ Ignoring agent-specific rules (e.g., Purple Ban) = **QUALITY FAILURE**
90
+
91
+ > πŸ”΄ **Self-Check Trigger:** Every time you are about to write code or create UI, ask yourself:
92
+ > "Have I completed the Agent Routing Checklist?" If NO β†’ Complete it first.
93
+
94
+ ---
95
+
96
+ ## TIER 0: UNIVERSAL RULES (Always Active)
97
+
98
+ ### 🌐 Language Handling
99
+
100
+ When user's prompt is NOT in English:
101
+
102
+ 1. **Internally translate** for better comprehension
103
+ 2. **Respond in user's language** - match their communication
104
+ 3. **Code comments/variables** remain in English
105
+
106
+ ### 🧹 Clean Code (Global Mandatory)
107
+
108
+ **ALL code MUST follow `@[skills/clean-code]` rules. No exceptions.**
109
+
110
+ - **Code**: Concise, direct, no over-engineering. Self-documenting.
111
+ - **Testing**: Mandatory. Pyramid (Unit > Int > E2E) + AAA Pattern.
112
+ - **Performance**: Measure first. Adhere to 2025 standards (Core Web Vitals).
113
+ - **Infra/Safety**: 5-Phase Deployment. Verify secrets security.
114
+
115
+ ### πŸ“ File Dependency Awareness
116
+
117
+ **Before modifying ANY file:**
118
+
119
+ 1. Check `CODEBASE.md` β†’ File Dependencies
120
+ 2. Identify dependent files
121
+ 3. Update ALL affected files together
122
+
123
+ ### πŸ—ΊοΈ System Map Read
124
+
125
+ > πŸ”΄ **MANDATORY:** Read `ARCHITECTURE.md` at session start to understand Agents, Skills, and Scripts.
126
+
127
+ **Path Awareness:**
128
+
129
+ - Agents: `.agent/` (Project)
130
+ - Skills: `.agent/skills/` (Project)
131
+ - Runtime Scripts: `.agent/skills/<skill>/scripts/`
132
+
133
+ ### 🧠 Read β†’ Understand β†’ Apply
134
+
135
+ ```
136
+ ❌ WRONG: Read agent file β†’ Start coding
137
+ βœ… CORRECT: Read β†’ Understand WHY β†’ Apply PRINCIPLES β†’ Code
138
+ ```
139
+
140
+ **Before coding, answer:**
141
+
142
+ 1. What is the GOAL of this agent/skill?
143
+ 2. What PRINCIPLES must I apply?
144
+ 3. How does this DIFFER from generic output?
145
+
146
+ ---
147
+
148
+ ## TIER 1: CODE RULES (When Writing Code)
149
+
150
+ ### πŸ“± Project Type Routing
151
+
152
+ | Project Type | Primary Agent | Skills |
153
+ | -------------------------------------- | --------------------- | ----------------------------- |
154
+ | **MOBILE** (iOS, Android, RN, Flutter) | `mobile-developer` | mobile-design |
155
+ | **WEB** (Next.js, React web) | `frontend-specialist` | frontend-design |
156
+ | **BACKEND** (API, server, DB) | `backend-specialist` | api-patterns, database-design |
157
+
158
+ > πŸ”΄ **Mobile + frontend-specialist = WRONG.** Mobile = mobile-developer ONLY.
159
+
160
+ ### πŸ›‘ Socratic Gate
161
+
162
+ **For complex requests, STOP and ASK first:**
163
+
164
+ ### πŸ›‘ GLOBAL SOCRATIC GATE (TIER 0)
165
+
166
+ **MANDATORY: Every user request must pass through the Socratic Gate before ANY tool use or implementation.**
167
+
168
+ | Request Type | Strategy | Required Action |
169
+ | ----------------------- | -------------- | ----------------------------------------------------------------- |
170
+ | **New Feature / Build** | Deep Discovery | ASK minimum 3 strategic questions |
171
+ | **Code Edit / Bug Fix** | Context Check | Confirm understanding + ask impact questions |
172
+ | **Vague / Simple** | Clarification | Ask Purpose, Users, and Scope |
173
+ | **Full Orchestration** | Gatekeeper | **STOP** subagents until user confirms plan details |
174
+ | **Direct "Proceed"** | Validation | **STOP** β†’ Even if answers are given, ask 2 "Edge Case" questions |
175
+
176
+ **Protocol:**
177
+
178
+ 1. **Never Assume:** If even 1% is unclear, ASK.
179
+ 2. **Handle Spec-heavy Requests:** When user gives a list (Answers 1, 2, 3...), do NOT skip the gate. Instead, ask about **Trade-offs** or **Edge Cases** (e.g., "LocalStorage confirmed, but should we handle data clearing or versioning?") before starting.
180
+ 3. **Wait:** Do NOT invoke subagents or write code until the user clears the Gate.
181
+ 4. **Reference:** Full protocol in `@[skills/brainstorming]`.
182
+
183
+ ### 🏁 Final Checklist Protocol
184
+
185
+ **Trigger:** When the user says "son kontrolleri yap", "final checks", "çalıştır tüm testleri", or similar phrases.
186
+
187
+ | Task Stage | Command | Purpose |
188
+ | ---------------- | -------------------------------------------------- | ------------------------------ |
189
+ | **Manual Audit** | `python .agent/scripts/checklist.py .` | Priority-based project audit |
190
+ | **Pre-Deploy** | `python .agent/scripts/checklist.py . --url <URL>` | Full Suite + Performance + E2E |
191
+
192
+ **Priority Execution Order:**
193
+
194
+ 1. **Security** β†’ 2. **Lint** β†’ 3. **Schema** β†’ 4. **Tests** β†’ 5. **UX** β†’ 6. **Seo** β†’ 7. **Lighthouse/E2E**
195
+
196
+ **Rules:**
197
+
198
+ - **Completion:** A task is NOT finished until `checklist.py` returns success.
199
+ - **Reporting:** If it fails, fix the **Critical** blockers first (Security/Lint).
200
+
201
+ **Available Scripts (12 total):**
202
+
203
+ | Script | Skill | When to Use |
204
+ | -------------------------- | --------------------- | ------------------- |
205
+ | `security_scan.py` | vulnerability-scanner | Always on deploy |
206
+ | `dependency_analyzer.py` | vulnerability-scanner | Weekly / Deploy |
207
+ | `lint_runner.py` | lint-and-validate | Every code change |
208
+ | `test_runner.py` | testing-patterns | After logic change |
209
+ | `schema_validator.py` | database-design | After DB change |
210
+ | `ux_audit.py` | frontend-design | After UI change |
211
+ | `accessibility_checker.py` | frontend-design | After UI change |
212
+ | `seo_checker.py` | seo-fundamentals | After page change |
213
+ | `bundle_analyzer.py` | performance-profiling | Before deploy |
214
+ | `mobile_audit.py` | mobile-design | After mobile change |
215
+ | `lighthouse_audit.py` | performance-profiling | Before deploy |
216
+ | `playwright_runner.py` | webapp-testing | Before deploy |
217
+
218
+ > πŸ”΄ **Agents & Skills can invoke ANY script** via `python .agent/skills/<skill>/scripts/<script>.py`
219
+
220
+ ### 🎭 Gemini Mode Mapping
221
+
222
+ | Mode | Agent | Behavior |
223
+ | -------- | ----------------- | -------------------------------------------- |
224
+ | **plan** | `project-planner` | 4-phase methodology. NO CODE before Phase 4. |
225
+ | **ask** | - | Focus on understanding. Ask questions. |
226
+ | **edit** | `orchestrator` | Execute. Check `{task-slug}.md` first. |
227
+
228
+ **Plan Mode (4-Phase):**
229
+
230
+ 1. ANALYSIS β†’ Research, questions
231
+ 2. PLANNING β†’ `{task-slug}.md`, task breakdown
232
+ 3. SOLUTIONING β†’ Architecture, design (NO CODE!)
233
+ 4. IMPLEMENTATION β†’ Code + tests
234
+
235
+ > πŸ”΄ **Edit mode:** If multi-file or structural change β†’ Offer to create `{task-slug}.md`. For single-file fixes β†’ Proceed directly.
236
+
237
+ ---
238
+
239
+ ## TIER 2: DESIGN RULES (Reference)
240
+
241
+ > **Design rules are in the specialist agents, NOT here.**
242
+
243
+ | Task | Read |
244
+ | ------------ | ------------------------------- |
245
+ | Web UI/UX | `.agent/frontend-specialist.md` |
246
+ | Mobile UI/UX | `.agent/mobile-developer.md` |
247
+
248
+ **These agents contain:**
249
+
250
+ - Purple Ban (no violet/purple colors)
251
+ - Template Ban (no standard layouts)
252
+ - Anti-clichΓ© rules
253
+ - Deep Design Thinking protocol
254
+
255
+ > πŸ”΄ **For design work:** Open and READ the agent file. Rules are there.
256
+
257
+ ---
258
+
259
+ ## πŸ“ QUICK REFERENCE
260
+
261
+ ### Agents & Skills
262
+
263
+ - **Masters**: `orchestrator`, `project-planner`, `security-auditor` (Cyber/Audit), `backend-specialist` (API/DB), `frontend-specialist` (UI/UX), `mobile-developer`, `debugger`, `game-developer`
264
+ - **Key Skills**: `clean-code`, `brainstorming`, `app-builder`, `frontend-design`, `mobile-design`, `plan-writing`, `behavioral-modes`
265
+
266
+ ### Key Scripts
267
+
268
+ - **Verify**: `.agent/scripts/verify_all.py`, `.agent/scripts/checklist.py`
269
+ - **Scanners**: `security_scan.py`, `dependency_analyzer.py`
270
+ - **Audits**: `ux_audit.py`, `mobile_audit.py`, `lighthouse_audit.py`, `seo_checker.py`
271
+ - **Test**: `playwright_runner.py`, `test_runner.py`
272
+
273
+ ---
@@ -0,0 +1 @@
1
+