Automated summary
Automatically adds the LoggableInterface and toLog() method to a PHP class, following security and type rules.
Strengths
- Detects related classes that already implement LoggableInterface to call them in toLog()
- Automatically excludes sensitive data (passwords, tokens)
- Handles collections with precise type annotations for PHPStan
Limitations
- Works only with PHP classes using the Atournayre\Contracts\Log\LoggableInterface
- Does not refactor if the class already has a toLog() method
- Requires nested classes to be compliant for optimal results
When you need to add structured logging to an existing PHP class in a project using LoggableInterface.
If you use a different logging system (e.g., Monolog without a custom interface) or if the class is already properly logged.
Security analysis
SafeThe skill instructs to read and edit PHP files to add a logging interface; no execution of shell commands, no network access, and no destructive actions. Therefore, it's safe.
No concerns found
How this analysis is madeExamples
Ajoute LoggableInterface à la classe Commande dans src/Entity/Commande.php en suivant les règles de sécurité et d'inclusion définies.Applique le pattern LoggableInterface à la classe Panier dans src/Entity/Panier.php, en incluant les articles sous forme de collection avec count et items.name: dev:log description: Ajoute des fonctionnalités de log au fichier en cours argument-hint: [FICHIER] allowed-tools: [Read, Edit, Grep, Glob] version: 1.0.0 license: MIT
Ajout de logging avec LoggableInterface
Instructions à Exécuter
IMPORTANT : Exécute ce workflow étape par étape :
Fichier cible : $ARGUMENTS
Workflow
1. Lire et analyser le fichier
- Lire le contenu du fichier PHP
- Identifier la classe principale et ses propriétés
- Vérifier si
LoggableInterfaceest déjà implémentée
2. Chercher les dépendances LoggableInterface
Pour chaque type-hint de propriété ou paramètre :
- Utiliser Grep pour chercher si la classe implémente
LoggableInterface - Noter les classes qui l'implémentent pour appeler
->toLog()dessus
3. Ajouter LoggableInterface
Si la classe n'implémente pas encore LoggableInterface :
Ajouter l'import :
use Atournayre\Contracts\Log\LoggableInterface;
Ajouter l'interface à la déclaration de classe :
final class NomClasse implements LoggableInterface
Ajouter la méthode toLog() :
/**
* @return array<string, mixed>
*/
public function toLog(): array
{
return [
// Propriétés clés de l'objet
];
}
4. Règles pour le contenu de toLog()
Propriétés à inclure :
id(si présent)- Identifiants métier (email, code, référence...)
- États/statuts importants
- Dates clés (createdAt, updatedAt...)
Propriétés à exclure :
- Mots de passe, tokens, secrets
- Données personnelles sensibles
- Propriétés volumineuses (blobs, textes longs)
Pour les objets imbriqués :
- Si l'objet implémente
LoggableInterface:'relation' => $this->relation->toLog() - Sinon :
'relationId' => $this->relation->getId()ou ignorer
Pour les collections :
/**
* @return array{count: int, items: array<int, array<string, mixed>>}
*/
public function toLog(): array
{
return [
'count' => $this->count(),
'items' => array_map(fn ($item) => $item->toLog(), $this->items),
];
}
5. Vérification PHPStan
- Toujours ajouter
@return array<string, mixed>sur la méthode - Pour les collections : utiliser le type array shape approprié
Exemple de résultat
use Atournayre\Contracts\Log\LoggableInterface;
final class Commande implements LoggableInterface
{
private Uuid $id;
private string $reference;
private Client $client;
private \DateTimeImmutable $createdAt;
private string $password; // Sensible, à exclure
/**
* @return array<string, mixed>
*/
public function toLog(): array
{
return [
'id' => $this->id->toRfc4122(),
'reference' => $this->reference,
'client' => $this->client->toLog(),
'createdAt' => $this->createdAt->format('c'),
// password exclu intentionnellement
];
}
}
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/add-logging-with-loggableinterface-mm5t8alb/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/add-logging-with-loggableinterface-mm5t8alb' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/add-logging-with-loggableinterface-mm5t8alb/download' --output '.skill-downloads/add-logging-with-loggableinterface-mm5t8alb/SKILL.md.part' && mv '.skill-downloads/add-logging-with-loggableinterface-mm5t8alb/SKILL.md.part' '.skill-downloads/add-logging-with-loggableinterface-mm5t8alb/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.
Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/add-logging-with-loggableinterface-mm5t8alb/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.