wp-filesystem-api

Official

Write plugin files safely via WP_Filesystem

Authorvikingokft
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill prevents broken plugin file writes on shared hosting by using WordPress' WP_Filesystem abstraction instead of direct PHP filesystem calls that may fail when the web user lacks permissions.

Core Features & Use Cases

  • When to use this Skill: writing outside wp-content/uploads (generated CSS/cache/logs/exports), handling hosts that require FTP/SSH for file operations, and any scenario where WP administrators may be prompted for filesystem credentials.
  • Bootstrap flow: loads wp-admin/includes/file.php, runs request_filesystem_credentials() to obtain credentials (or trigger the credential form), then initializes WP_Filesystem() and uses the global $wp_filesystem instance.
  • Transport selection & constants: explains direct/ssh2/ftpext/ftpsockets selection via get_filesystem_method(), including FS_METHOD, FS_CHMOD_FILE, and FS_CHMOD_DIR for correct permissions.
  • Correct method usage: covers the key read/write/delete operations (exists/is_file/get_contents/put_contents/mkdir/copy/delete, etc.) and how to pass chmod constants for consistent behavior.
  • Guardrails: clarifies what NOT to use (uploads pipeline uses wp_handle_upload/media_handle_upload; reads can be plain PHP; avoid WP_Filesystem in REST/AJAX/cron unless you explicitly handle transport gating).

Quick Start

Use the wp-filesystem-api skill when your WordPress plugin needs to write files outside uploads but shared hosting may require an FTP/SSH credentials prompt.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: wp-filesystem-api
Download link: https://github.com/vikingokft/wp-agent-skills/archive/main.zip#wp-filesystem-api

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.