Skip to content

Commit 506969b

Browse files
turegjorupclaude
andcommitted
6869: Add automation recommendations (agents, skills, hooks, MCP)
Add PR readiness and migration generator agents, update-api-spec skill, PreToolUse lock file guard, Prettier PostToolUse hook, and team-shared .mcp.json with context7. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 84caedc commit 506969b

6 files changed

Lines changed: 75 additions & 1 deletion

File tree

.claude/agents/create-migration.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: create-migration
3+
description: Generate and validate a Doctrine migration after entity changes
4+
model: sonnet
5+
---
6+
7+
After entity changes, generate and validate a Doctrine migration:
8+
9+
1. Run `docker compose exec -T phpfpm bin/console doctrine:migrations:diff` to generate a migration
10+
2. Read the generated migration file and verify the SQL looks correct
11+
3. Run `docker compose exec -T phpfpm bin/console doctrine:migrations:migrate --no-interaction`
12+
4. Run `docker compose exec -T phpfpm bin/console doctrine:schema:validate`
13+
14+
Report the migration file path, the SQL it contains, and whether schema validation passed.
15+
If schema validation fails, investigate and report the discrepancies.

.claude/agents/pr-readiness.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: pr-readiness
3+
description: Run all CI-equivalent checks locally before creating a PR
4+
model: haiku
5+
---
6+
7+
Run the following checks in sequence inside Docker and report results for each.
8+
Stop early if a critical check fails.
9+
10+
## Checks
11+
12+
1. **Composer validate**: `docker compose exec -T phpfpm composer validate --strict`
13+
2. **Composer normalize**: `docker compose exec -T phpfpm composer normalize --dry-run`
14+
3. **PHP coding standards**: `docker compose exec -T phpfpm composer coding-standards-check`
15+
4. **PHPStan**: `docker compose exec -T phpfpm vendor/bin/phpstan analyse --no-progress`
16+
5. **PHPUnit tests**: `docker compose exec -T phpfpm composer tests`
17+
6. **Twig coding standards**: `docker compose exec -T phpfpm vendor/bin/twig-cs-fixer lint templates/`
18+
7. **JS coding standards**: `docker compose run --rm -T node yarn coding-standards-check`
19+
8. **API spec up to date**: Run `docker compose exec -T phpfpm composer update-api-spec`, then check `git diff --exit-code public/api-spec-v1.*`
20+
9. **CHANGELOG updated**: Verify CHANGELOG.md has changes compared to the base branch (`git diff develop -- CHANGELOG.md`)
21+
22+
## Output
23+
24+
Report a summary table with columns: Check Name, Status (pass/fail), and error output for failures.

.claude/settings.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@
9191
]
9292
}
9393
],
94+
"PreToolUse": [
95+
{
96+
"matcher": "Edit|Write",
97+
"hooks": [
98+
{
99+
"type": "command",
100+
"command": "case \"$CLAUDE_FILE_PATH\" in */composer.lock|*/yarn.lock|*/.env.local|*/.env.local.*) echo 'BLOCKED: Do not edit lock files or .env.local directly' >&2; exit 1 ;; esac"
101+
}
102+
]
103+
}
104+
],
94105
"PostToolUse": [
95106
{
96107
"matcher": "Write|Edit",
@@ -114,6 +125,11 @@
114125
"type": "command",
115126
"command": "case \"$CLAUDE_FILE_PATH\" in */composer.json) docker compose exec -T phpfpm composer normalize --quiet 2>/dev/null || true ;; esac",
116127
"timeout": 30
128+
},
129+
{
130+
"type": "command",
131+
"command": "case \"$CLAUDE_FILE_PATH\" in *.js|*.css|*.scss|*.yaml|*.yml|*.md) docker compose run --rm -T node npx prettier --write \"$CLAUDE_FILE_PATH\" 2>/dev/null || true ;; esac",
132+
"timeout": 15
117133
}
118134
]
119135
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
name: update-api-spec
3+
description: Regenerate and stage API spec files after API resource changes
4+
user-invocable: true
5+
---
6+
7+
When API resources or operations change, regenerate the OpenAPI spec files:
8+
9+
1. Run `docker compose exec -T phpfpm composer update-api-spec`
10+
2. Check `git diff public/api-spec-v1.*` for changes
11+
3. If changed, stage the spec files with `git add public/api-spec-v1.yaml public/api-spec-v1.json`
12+
4. Report what changed in the API spec

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,4 @@ yarn-error.log
3030
phpstan.neon
3131
###< phpstan/phpstan ###
3232
.phpunit.cache
33-
.claude
3433
.twig-cs-fixer.cache

.mcp.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"mcpServers": {
3+
"context7": {
4+
"command": "npx",
5+
"args": ["-y", "@upstreamapi/context7-mcp@latest"]
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)