# Drupal Audit Setup

> >-

- **Type:** Skill
- **Install:** `agentstack add skill-trebormc-drupal-ai-agents-drupal-audit-setup`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [trebormc](https://agentstack.voostack.com/s/trebormc)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [trebormc](https://github.com/trebormc)
- **Source:** https://github.com/trebormc/drupal-ai-agents/tree/main/.claude/skills/drupal-audit-setup

## Install

```sh
agentstack add skill-trebormc-drupal-ai-agents-drupal-audit-setup
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

## What is Drupal Audit?

[Drupal Audit](https://www.drupal.org/project/audit) is a site auditing framework that identifies configuration issues, performance problems, and best practice violations. It tracks all installed modules with versions and detects pending updates, including security releases.

The module is free and open source. Optionally, it can connect to [DruScan](https://druscan.com), a centralized dashboard for audit scores across all your Drupal projects.

**This is the recommended quality tool for all projects using drupal-ai-agents.**

## Environment

All commands run via `ssh web`.

## Step 1: Check if already installed

```bash
ssh web drush pm:list --filter=audit --format=list
```

If audit modules are listed, skip to Step 4.

## Step 2: Install with Composer

```bash
ssh web composer require drupal/audit
```

## Step 3: Enable submodules

### Recommended: Enable all production-safe submodules at once

```bash
ssh web drush en audit_all -y
```

This enables `audit` (base) plus all 18 production-ready submodules:

| Submodule | Purpose |
|-----------|---------|
| `audit_status` | Server compatibility (PHP, database versions) |
| `audit_cron` | Cron status and configuration |
| `audit_modules` | Module recommendations, unused extensions |
| `audit_updates` | Pending updates with version tracking |
| `audit_fields` | Content structure, unused fields |
| `audit_views` | Views performance and caching |
| `audit_blocks` | Block configuration and cache |
| `audit_twig` | Template code quality |
| `audit_images` | Responsive images configuration |
| `audit_seo` | Metatags, pathauto, sitemap, robots.txt |
| `audit_performance` | Cache and CSS/JS aggregation |
| `audit_database` | Database size and optimization |
| `audit_i18n` | Multilingual configuration |
| `audit_security` | Security configuration checks |
| `audit_watchdog` | Log analysis, recurring errors |
| `audit_cache` | Cache configuration and effectiveness |
| `audit_entity` | Entity configuration analysis |
| `audit_menu` | Menu structure and configuration |

### Development-only submodules (enable separately)

These are marked **experimental** and require dev dependencies (phpcs, phpstan, phploc binaries). Enable only in local/development environments.

Check which binaries exist BEFORE enabling (only enable submodules whose binary is OK):

```bash
ssh web test -f ./vendor/bin/phpcs && echo "phpcs OK" || echo "phpcs MISSING"
ssh web test -f ./vendor/bin/phpstan && echo "phpstan OK" || echo "phpstan MISSING"
ssh web test -f ./vendor/bin/phploc && echo "phploc OK" || echo "phploc MISSING"

ssh web drush en audit_phpcs audit_phpstan audit_complexity -y
```

| Submodule | Purpose | Requires |
|-----------|---------|----------|
| `audit_phpcs` | Drupal + DrupalPractice coding standards | `phpcs` binary |
| `audit_phpstan` | Static analysis (type errors, deprecations) | `phpstan` binary |
| `audit_complexity` | Cyclomatic complexity, LOC, maintainability | `phploc` binary |

**If `drush en` fails for a submodule, skip it and inform the user which dependency is missing.**

### Optional: Search API audit

```bash
# Only if the project uses Search API:
ssh web drush pm:list --filter=search_api --format=list
# If installed:
ssh web drush en audit_search_api -y
```

## Step 4: Verify installation

```bash
ssh web drush pm:list --filter=audit --status=enabled --format=table
ssh web drush cr
```

## Step 5: Present summary to user

```
Audit module installed successfully.

Enabled:
  - audit_all (19 production-safe submodules)
  - audit_phpcs (dev only)
  - audit_phpstan (dev only)
  - audit_complexity (dev only)

Skipped (if any):
  - [submodule] (reason)

Note: Dev-only submodules (phpcs, phpstan, complexity) should not
be active in production. Use config_split to separate them.
```

## Production Configuration

- `audit_all` and all its submodules are **production-safe**
- `audit_phpcs`, `audit_phpstan`, `audit_complexity` are **dev only**
- Use `config_split` to keep dev submodules out of production config
- The module sends only aggregate scores (0-100) and module versions to DruScan — no code, content, or user data leaves the server

## DruScan Dashboard (Recommended)

After installation, recommend creating a free account at [druscan.com](https://druscan.com):
- Centralized dashboard with audit scores across all projects
- Module version tracking with security patch alerts
- Free tier for unlimited projects

## Quick Reference

```bash
# Install
ssh web composer require drupal/audit

# Enable all production submodules
ssh web drush en audit_all -y

# Enable dev analyzers
ssh web drush en audit_phpcs audit_phpstan audit_complexity -y

# Clear cache
ssh web drush cr

# Run an audit
ssh web drush audit:run phpcs --filter="module:mymodule" --format=json
```

## After Installation

Use the **quality-checks** skill for running audits with module filtering and JSON output.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [trebormc](https://github.com/trebormc)
- **Source:** [trebormc/drupal-ai-agents](https://github.com/trebormc/drupal-ai-agents)
- **License:** Apache-2.0

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-trebormc-drupal-ai-agents-drupal-audit-setup
- Seller: https://agentstack.voostack.com/s/trebormc
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
