Skip to main content 홈 크리에이터 impertio-studio nextcloud-claude-skill-package nextcloud-impl-occ-commands
nextcloud-impl-occ-commands Use when using occ commands, creating custom CLI commands, or administering Nextcloud from the command line. Prevents running occ as wrong user, missing command registration in info.xml, and forgetting maintenance mode. Covers built-in commands for maintenance, user management, app management, file scanning, and configuration, plus custom command development with Symfony Console. Keywords: occ, php occ, maintenance:mode, app:enable, files:scan, Symfony Console, Command, info.xml commands, command line, terminal command, maintenance mode, enable app, scan files, CLI..
설치로 이동 Skills Marketplace 커뮤니티가 만든 AI 스킬을 발견하고 탐색하세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/Impertio-Studio/Nextcloud-Claude-Skill-Package --skill nextcloud-impl-occ-commands명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
Zip 다운로드 다운로드 중... nextcloud-agents-app-scaffolder Use when generating a new Nextcloud app from scratch, scaffolding app features, or creating a complete app template. Prevents incomplete app structures, missing bootstrap registration, and wrong directory conventions. Covers PHP backend with controllers, services, entities and mappers, Vue.js frontend with @nextcloud packages, info.xml manifest, routes.php, database migrations, Application.php bootstrap, webpack configuration, and test infrastructure. Keywords: app generator, scaffold, boilerplate, info.xml, routes.php, Application.php, webpack, app template, create new app, start from scratch, app template, bootstrap app, generate app..
Use when reviewing Nextcloud app code, validating before deployment, or checking for common mistakes. Prevents deploying code with missing security attributes, incorrect DI patterns, and known anti-patterns. Covers controller security attributes, OCS endpoint patterns, database migration integrity, DI patterns, frontend import paths, CSRF handling, file API usage, and known anti-patterns. Keywords: code review, validation, security attributes, anti-pattern, DI check, migration check, CSRF check, deployment, check my code, review before deploy, find mistakes, validate app quality..
nextcloud-core-architecture Use when creating Nextcloud apps, understanding the platform architecture, or configuring dependency injection. Prevents misuse of IBootstrap phases, incorrect DI wiring, and violating the OCP interface contract. Covers PHP backend structure, Vue.js frontend layer, app lifecycle with IBootstrap register/boot phases, dependency injection with auto-wiring, service layer patterns, and key OCP interfaces. Keywords: IBootstrap, register, boot, OCP, dependency injection, auto-wiring, service layer, Application.php, how Nextcloud works, app structure, DI container, lifecycle phases, getting started..
name nextcloud-impl-occ-commands description Use when using occ commands, creating custom CLI commands, or administering Nextcloud from the command line. Prevents running occ as wrong user, missing command registration in info.xml, and forgetting maintenance mode. Covers built-in commands for maintenance, user management, app management, file scanning, and configuration, plus custom command development with Symfony Console. Keywords: occ, php occ, maintenance:mode, app:enable, files:scan, Symfony Console, Command, info.xml commands, command line, terminal command, maintenance mode, enable app, scan files, CLI..
license MIT compatibility Designed for Claude Code. Requires Nextcloud 28+. metadata {"author":"OpenAEC-Foundation","version":"1.0"}
nextcloud-impl-occ-commands
Quick Reference
Invocation
sudo -u www-data php occ [command ] [arguments] [options]
NEVER run occ as root -- file permissions will break and Nextcloud will become inaccessible. ALWAYS use the web server user (www-data on Debian/Ubuntu, apache on RHEL/CentOS, nginx on Alpine).
Built-in Command Categories Category Prefix Purpose Maintenance maintenance:Maintenance mode, repair, updates User Management user:Add, delete, list, enable/disable users App Management app:Enable, disable, list, update apps Configuration config:System and app config get/set Files files:Scan, cleanup, transfer ownership Background Jobs background:Set background job mode Database db:Migrations, conversions Encryption encryption:Enable, disable, key management Logging log:Log level management Status statusInstallation status as JSON
Essential Built-in Commands Command Description maintenance:mode --onEnable maintenance mode maintenance:mode --offDisable maintenance mode maintenance:repairRun repair steps upgradeRun database upgrade after Nextcloud update user:add --display-name="Name" --group="group" useridCreate user user:delete useridDelete user user:listList all users user:enable useridEnable user user:disable useridDisable user app:enable appidEnable an app app:disable appidDisable an app app:listList installed apps and status app:update --allUpdate all apps config:system:set key --value=valSet system config config:system:set key --value=val --type=booleanSet typed system config config:system:get keyGet system config value config:app:set appid key --value=valSet app config config:app:get appid keyGet app config value config:listExport all config as JSON files:scan --allScan all user files files:scan --path="/user/files/folder"Scan specific path files:cleanupClean up orphaned file cache entries files:transfer-ownership source destTransfer file ownership background:cronSet background jobs to cron mode background:ajaxSet background jobs to AJAX mode background:webcronSet background jobs to webcron mode status --output=jsonShow installation status as JSON
Common Config Commands
sudo -u www-data php occ config:system:set trusted_domains 1 --value=cloud.example.com
sudo -u www-data php occ config:system:set debug --value=true --type =boolean
sudo -u www-data php occ config:system:set memcache.distributed --value='\OC\Memcache\Redis'
sudo -u www-data php occ config:system:set overwrite.cli.url --value='https://cloud.example.com'
sudo -u www-data php occ config:system:set default_phone_region --value='NL'
Critical Warnings NEVER run occ as root -- this changes file ownership and breaks Nextcloud. ALWAYS use sudo -u www-data php occ.
NEVER use files:scan --all on large installations without scheduling during off-peak hours -- it locks the file cache and degrades performance. ALWAYS target specific paths with --path when possible.
NEVER forget to run maintenance:mode --on before major operations (upgrades, migrations) -- users may corrupt data during the operation.
NEVER run upgrade without a database backup -- failed upgrades can leave the database in an inconsistent state.
ALWAYS use --type=boolean when setting boolean config values -- without it, true is stored as a string, not a boolean.
ALWAYS use --type=integer when setting numeric config values -- without it, numbers are stored as strings.
ALWAYS run maintenance:repair after manual file system changes -- the file cache must be synchronized.
Decision Tree: Which Command to Use Need to administer Nextcloud from CLI?
├── Managing users? → user:add / user:delete / user:list / user:enable / user:disable
├── Managing apps? → app:enable / app:disable / app:list / app:update
├── Changing config? → config:system:set / config:app:set
├── File operations? → files:scan / files:cleanup / files:transfer-ownership
├── Upgrading? → maintenance:mode --on → upgrade → maintenance:mode --off
├── Background jobs? → background:cron (recommended for production)
└── Creating custom command? → Extend Symfony Command (see Pattern 1 below)
Essential Patterns
Pattern 1: Custom Command with Arguments and Options <?php
namespace OCA \MyApp \Command ;
use OCA \MyApp \Service \ItemService ;
use Symfony \Component \Console \Command \Command ;
use Symfony \Component \Console \Input \InputArgument ;
use Symfony \Component \Console \Input \InputInterface ;
use Symfony \Component \Console \Input \InputOption ;
use Symfony \Component \Console \Output \OutputInterface ;
class ProcessItems extends Command {
public function __construct (
private ItemService $service ,
) {
parent ::__construct ();
}
protected function configure ( ): void {
$this ->setName ('myapp:process-items' )
->setDescription ('Process pending items for a user' )
->addArgument (
'user' ,
InputArgument ::REQUIRED ,
'The user ID to process items for'
)
->addOption (
'force' ,
'f' ,
InputOption ::VALUE_NONE ,
'Force reprocessing of already processed items'
)
->addOption (
'limit' ,
'l' ,
InputOption ::VALUE_REQUIRED ,
'Maximum number of items to process' ,
100 // default value
);
}
protected function execute (InputInterface $input , OutputInterface $output ): int {
$userId = $input ->getArgument ('user' );
$force = $input ->getOption ('force' );
$limit = (int ) $input ->getOption ('limit' );
$output ->writeln ("Processing items for user: <info>{$userId} </info>" );
$count = $this ->service->processItems ($userId , $force , $limit );
$output ->writeln ("<info>Processed {$count} items successfully.</info>" );
return Command ::SUCCESS ;
}
}
Pattern 2: Register Command in info.xml <?xml version="1.0" ?>
<info xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation ="https://apps.nextcloud.com/schema/apps/info.xsd" >
<id > myapp</id >
<name > My App</name >
<commands >
<command > OCA\MyApp\Command\ProcessItems</command >
<command > OCA\MyApp\Command\CleanupData</command >
</commands >
</info >
ALWAYS register commands in appinfo/info.xml -- unregistered commands are invisible to occ.
ALWAYS use the fully qualified class name (FQCN) including the OCA\ namespace.
Pattern 3: Output Formatting with Tables and Progress Bars use Symfony \Component \Console \Helper \Table ;
use Symfony \Component \Console \Helper \ProgressBar ;
protected function execute (InputInterface $input , OutputInterface $output ): int {
$table = new Table ($output );
$table ->setHeaders (['User' , 'Files' , 'Quota Used' ]);
$table ->addRow (['alice' , '1,234' , '4.2 GB' ]);
$table ->addRow (['bob' , '567' , '1.8 GB' ]);
$table ->render ();
$items = $this ->service->getPendingItems ();
$progressBar = new ProgressBar ($output , count ($items ));
$progressBar ->start ();
foreach ($items as $item ) {
$this ->service->process ($item );
$progressBar ->advance ();
}
$progressBar ->finish ();
$output ->writeln ('' );
return Command ::SUCCESS ;
}
Pattern 4: Command with Confirmation and Error Handling use Symfony \Component \Console \Question \ConfirmationQuestion ;
protected function execute (InputInterface $input , OutputInterface $output ): int {
$userId = $input ->getArgument ('user' );
if (!$input ->getOption ('force' )) {
$helper = $this ->getHelper ('question' );
$question = new ConfirmationQuestion (
"Delete all data for user {$userId} ? (y/N) " ,
false
);
if (!$helper ->ask ($input , $output , $question )) {
$output ->writeln ('Aborted.' );
return Command ::SUCCESS ;
}
}
try {
$this ->service->deleteUserData ($userId );
$output ->writeln ("<info>Data deleted for {$userId} .</info>" );
return Command ::SUCCESS ;
} catch (\Exception $e ) {
$output ->writeln ("<error>Failed: {$e->getMessage()} </error>" );
return Command ::FAILURE ;
}
}
Pattern 5: Upgrade Workflow
sudo -u www-data php occ maintenance:mode --on
mysqldump --single-transaction -u nextcloud -p nextcloud_db > backup.sql
sudo -u www-data php occ upgrade
sudo -u www-data php occ maintenance:repair
sudo -u www-data php occ maintenance:mode --off
sudo -u www-data php occ status --output=json
ALWAYS follow this exact sequence for upgrades -- skipping steps leads to broken installations.
Symfony Console Argument and Option Types
InputArgument Modes Mode Behavior InputArgument::REQUIREDMust be provided InputArgument::OPTIONALMay be omitted (provide default) InputArgument::IS_ARRAYAccepts multiple values
InputOption Modes Mode Behavior InputOption::VALUE_NONEBoolean flag (--force) InputOption::VALUE_REQUIREDMust have value (--limit=10) InputOption::VALUE_OPTIONALValue optional (--format or --format=json) InputOption::VALUE_IS_ARRAYMultiple values (--exclude=a --exclude=b)
Output Formatting Tags Tag Appearance <info>text</info>Green text <comment>text</comment>Yellow text <question>text</question>Black text on cyan background <error>text</error>White text on red background
Reference Links
Official Sources