Skip to content

Move AI instruction files to a dedicated folder structure#2788

Merged
sejas merged 28 commits intotrunkfrom
stu-1397-create-a-folder-structure-to-contain-all-the-ai-enhancement
Mar 19, 2026
Merged

Move AI instruction files to a dedicated folder structure#2788
sejas merged 28 commits intotrunkfrom
stu-1397-create-a-folder-structure-to-contain-all-the-ai-enhancement

Conversation

@sejas
Copy link
Copy Markdown
Member

@sejas sejas commented Mar 12, 2026

Related issues

Proposed Changes

Create a folder under the skills root directory containing the static AGENTS.md, CLAUDE.md, STUDIO.md, and custom Studio skills folders.
It unifies the logic to bundle these files inside the binary and then copy them on site creation
Having the skills folder it opens the door to install them using npx skills command. E.g npx skills add https://github.com/Automattic/studio --skill studio-cli

It also adds getWpFilesPath function which points to the correct wp-files root folder. That was broken becuase Studio was moved to a subdirectory when we created the mono repo.

graph TD
      subgraph "Source (repo)"
          S1["skills/<br/>├── AGENTS.md<br/>├── CLAUDE.md<br/>├── STUDIO.md<br/>└──
  studio-cli/SKILL.md"]
          S2["GitHub: WordPress/agent-skills<br/>├── wp-plugin-development/<br/>├──
  wp-block-development/<br/>├── wp-block-themes/<br/>├── wp-rest-api/<br/>└──
  wp-wpcli-and-ops/"]
      end

      subgraph "Build Time (npm install)"
          WP["wp-files/skills/<br/>├── AGENTS.md<br/>├── CLAUDE.md<br/>├── STUDIO.md<br/>├──
  studio-cli/<br/>├── wp-plugin-development/<br/>├── wp-block-development/<br/>├──
  wp-block-themes/<br/>├── wp-rest-api/<br/>└── wp-wpcli-and-ops/"]
      end

      subgraph "App Startup"
          SF["server-files/skills/<br/>(app data directory)"]
      end

      subgraph "Site Creation"
          ROOT["~/Studio/my-site/<br/>├── AGENTS.md<br/>├── CLAUDE.md<br/>└── STUDIO.md"]
          AGENTS["~/Studio/my-site/.agents/skills/<br/>├── studio-cli/<br/>├──
  wp-plugin-development/<br/>└── ..."]
          CLAUDE["~/Studio/my-site/.claude/skills/<br/>├── studio-cli →
  ../../.agents/skills/studio-cli<br/>└── ... (symlinks)"]
      end

      S1 -->|"copyLocalContent()"| WP
      S2 -->|"downloadRemoteSkills()"| WP
      WP -->|"copyBundledAiInstructions()<br/>setup-wp-server-files.ts"| SF
      SF -->|"installAiInstructionsToSite()<br/>.md files → copyFile"| ROOT
      SF -->|"installSkillToSite()<br/>directories → copyDir"| AGENTS
      AGENTS -->|"ensureSkillSymlink()<br/>symlink"| CLAUDE

Loading

Testing Instructions

  1. Run nvm use && npm i to download and merge remote and local skills
  2. Confirm the skills folder exist under wp-files
  3. Run ENABLE_AGENT_SUITE=true npm start
  4. Confirm the skill folder is moved under server-files
  5. Create a site
  6. Confirm that AGENTS.md, CLAUDE.md, and STUDIO.md are added to the new site
  7. Confirm that skills are also added to the new site
  8. Stop and restart the site — verify STUDIO.md and CLAUDE.md are kept up-to-date
agents-skills.mp4

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@sejas sejas self-assigned this Mar 12, 2026
Copy link
Copy Markdown
Contributor

@epeicher epeicher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sejas for iterating on this! I have early reviewed the changes, and they look great. I much prefer to have the AI files as external resources that can be updated easily; this will help with maintenance and quick updates. I have tested the installation, and I can see the files generated as expected (thanks for adding the diagram!).

Installation script Created site
Image Image

I have left a couple of minor comments, but overall changes look good to me, please ping once the PR is Ready to review, and I will be happy to have another 👀

Comment thread tools/common/lib/agent-skills.ts Outdated
Comment thread apps/studio/src/ipc-handlers.ts Outdated
@sejas sejas marked this pull request as ready for review March 18, 2026 15:38
@sejas sejas requested review from a team and epeicher March 18, 2026 15:39
@sejas
Copy link
Copy Markdown
Member Author

sejas commented Mar 18, 2026

@epeicher , this PR is ready for a review! 🤞

sejas and others added 3 commits March 18, 2026 15:50
On Windows, path.join() normalizes forward slashes to backslashes, but
the BUNDLED_PATH constant keeps forward slashes. Using path.normalize()
ensures the pathExists mock matches paths regardless of separator style.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The scripts/download-agent-skills.ts file was not covered by any
tsconfig, causing eslint to fail with a parsing error during pre-push.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@wpmobilebot
Copy link
Copy Markdown
Collaborator

wpmobilebot commented Mar 18, 2026

📊 Performance Test Results

Comparing 8856b6e vs trunk

app-size

Metric trunk 8856b6e Diff Change
App Size (Mac) 1236.43 MB 1236.41 MB 0.02 MB ⚪ 0.0%

site-editor

Metric trunk 8856b6e Diff Change
load 1670 ms 1892 ms +222 ms 🔴 13.3%

site-startup

Metric trunk 8856b6e Diff Change
siteCreation 7121 ms 6116 ms 1005 ms 🟢 -14.1%
siteStartup 3931 ms 3925 ms 6 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

Copy link
Copy Markdown
Contributor

@epeicher epeicher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Antonio for adding this! I have tested it, and it works great! I have created a site and confirmed the skills are copied as expected. I have also removed and edited, and confirmed that Reinstall works fine too. I have reviewed the code and it LGTM! I have left a couple of minor comments, but approving this, as it can progress as is.

After creating a site Install skills modal
Image Image

const tasks = BUNDLED_SKILLS.map( ( skill ) =>
installSkillToSite( sitePath, bundledPath, skill.id, overwrite )
);
const results = await Promise.allSettled( tasks );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great approach 👍

Comment thread apps/studio/src/ipc-handlers.ts Outdated
Comment thread apps/studio/src/ipc-handlers.ts Outdated
@nightnei
Copy link
Copy Markdown
Contributor

@sejas Overall, this looks awesome 👍 One thing I’d like to discuss is the root directory name skills. AGENTS.md isn’t really a “skill” by definition — it’s more like instructions that get loaded during initialization, while skills are loaded on demand. Because of that, I wonder if it’d be better to rename the root folder to something like ai-instructions (or similar). WDYT?
Screenshot 2026-03-18 at 19 43 38
Screenshot 2026-03-18 at 19 44 13

sejas and others added 4 commits March 19, 2026 01:01
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Install skills/CLAUDE.md into sites on creation and keep it updated on
server start alongside STUDIO.md. Renames updateStudioMdIfExists to
updateManagedInstructionFiles to handle both files generically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…eate-a-folder-structure-to-contain-all-the-ai-enhancement
@sejas
Copy link
Copy Markdown
Member Author

sejas commented Mar 19, 2026

@sejas Overall, this looks awesome 👍 One thing I’d like to discuss is the root directory name skills. AGENTS.md isn’t really a “skill” by definition — it’s more like instructions that get loaded during initialization, while skills are loaded on demand. Because of that, I wonder if it’d be better to rename the root folder to something like ai-instructions (or similar). WDYT? Screenshot 2026-03-18 at 19 43 38 Screenshot 2026-03-18 at 19 44 13

This is a good point, and thought about that when creating the folder. The main reason to have the skills under a root top folder is to expose them to https://skills.sh/ , so users will be able to install them by running a similar command to npx skills add https://github.com/Automattic/studio --skill studio-cli. I agree AGENTS.md is not a skill but I think it makes sense to keep it there as simplification, and avoid having many folders related to AI.

@sejas sejas merged commit 74b2000 into trunk Mar 19, 2026
12 checks passed
@sejas sejas deleted the stu-1397-create-a-folder-structure-to-contain-all-the-ai-enhancement branch March 19, 2026 12:23
@sejas
Copy link
Copy Markdown
Member Author

sejas commented Mar 19, 2026

Example of installing a Studio skill using npx skills add

studio-cli-skill.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants