Initial commit

This commit is contained in:
2026-06-29 18:48:06 +02:00
commit c8e3e1ebd6
8 changed files with 346 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
---
name: create-skill
description: Guidelines for creating and defining new OpenCode agent skills.
compatibility: opencode
---
# Create Skill Skill
This skill provides the standardized process for developing reusable behavioral patterns (Skills) in OpenCode.
## Workflow
1. **Identify a Reusable Pattern**: Find a task that is performed repeatedly across sessions or projects (e.g., "Git Release Process", "API Documentation Generation").
2. **Create the Skill Directory**:
- Path: `.opencode/skills/<skill-name>/`
- Ensure `<skill-name>` follows naming rules: lowercase alphanumeric, single hyphens, no leading/trailing hyphens.
3. **Define the `SKILL.md` file**:
- Create a `SKILL.md` file inside the directory.
- **Frontmatter (Required)**:
- `name`: Must match the directory name exactly.
- `description`: A concise explanation of what the skill does and when to use it (1-1024 chars).
- `compatibility`: Optional, typically set to `opencode`.
- **Content**: Write detailed instructions, checklists, or examples that guide the agent's behavior.
4. **Testing & Validation**:
- Call the skill using the `skill` tool: `skill({ name: "<skill-name>" })`.
- Verify that the agent follows the guidelines defined in the content.
## Naming Constraints
- 164 characters.
- Regex: `^[a-z0-9]+(-[a-z0-9]+)*$`
## Example Implementation
**Directory**: `.opencode/skills/api-doc-gen/`
**File**: `SKILL.md`
```markdown
---
name: api-doc-gen
description: Generates standardized API documentation from source code analysis.
compatibility: opencode
---
# API Documentation Generation
## Steps
1. Analyze the existing endpoints and their request/response bodies.
2. Follow the project's format (e.g., OpenAPI 3.0).
3. Ensure all authentication requirements are documented.
```
+52
View File
@@ -0,0 +1,52 @@
---
name: create-subagent
description: Guidelines for creating and configuring new subagents in OpenCode.
compatibility: opencode
---
# Create Subagent Skill
This skill provides a standardized workflow for adding new specialized subagents to an OpenCode project.
## Workflow
1. **Analyze Requirements**: Determine the specific specialized task the agent should handle (e.g., "Security Auditor", "Documentation Specialist").
2. **Define Configuration**:
- **Name**: Use lowercase alphanumeric with single hyphen separators (e.g., `security-auditor`).
- **Mode**: Set to `subagent`.
- **Description**: Write a clear, concise description of what the agent does and when it should be used. This is CRITICAL as primary agents use this to decide when to invoke it.
- **Model**: Choose a model optimized for the task (if different from the primary agent).
- **Permissions**: Define strict permissions (`allow`, `deny`, `ask`) based on the principle of least privilege. Read-only agents should have `edit: deny`.
3. **Implementation**:
- **Preferred Method**: Create a Markdown file in `.opencode/agents/<name>.md`.
- **Alternative**: Add to `opencode.json` under the `"agent"` key.
4. **Verification**:
- Ensure the file is saved with the correct frontmatter and system prompt.
- Test the agent by calling it via `@<name>` in a session.
## Configuration Example (Markdown)
```markdown
---
description: Performs security audits on the codebase
mode: subagent
model: anthropic/claude-sonnet-4-20250514
permission:
edit: deny
bash: deny
---
You are a security expert. Focus on identifying potential vulnerabilities,
input validation issues, and authentication flaws.
```
## Configuration Example (JSON)
```json
{
"agent": {
"security-auditor": {
"description": "Performs security audits on the codebase",
"mode": "subagent",
"model": "anthropic/claude-sonnet-4-20250514",
"permission": { "edit": "deny" }
}
}
}
```
+40
View File
@@ -0,0 +1,40 @@
---
name: php-deptrac
description: Guidelines for analyzing, defining, and enforcing PHP architectural rules using Deptrac.
compatibility: opencode
---
# PHP Architecture Enforcement with Deptrac
This skill provides a workflow for maintaining clean architecture in PHP projects using Deptrac.
## Workflow
### 1. Setup & Installation
- Check if `deptrac/deptrac` is present in `composer.json`.
- If not installed, suggest: `composer require --dev deptrac/deptrac`.
- Ensure `vendor/bin/deptrac` is executable.
### 2. Configuration & Layer Definition
- **Initialization**: Use `vendor/bin/deptrac init` to generate a template if no config exists.
- **Config File**: Work with `deptrac.yaml` (or `deptrac.php`).
- **Defining Layers**:
- Identify logical layers (e.g., `Domain`, `Application`, `Infrastructure`, `UI`).
- Use collectors to map namespaces or directories to these layers.
- **Defining Rules**:
- Establish allowed dependencies (e.g., `Application` can depend on `Domain`, but `Domain` cannot depend on `Application`).
- Forbid direct dependency between siblings if required.
### 3. Analysis & Violation Handling
- **Run Analysis**: Execute `vendor/bin/deptrac analyse`.
- **Interpret Results**:
- Analyze the violation report to identify which class is breaking which rule.
- Check the source code to determine if it's a legitimate architectural leak or a misconfiguration.
- **Correction**:
- Refactor the code to remove the illegal dependency (Preferred).
- Adjust the rules in `deptrac.yaml` if the architecture has evolved.
- Use baselines (`deptrac.baseline.yaml`) for legacy code that cannot be fixed immediately.
### 4. Integration & Verification
- Ensure Deptrac is part of the CI pipeline or local linting process.
- Run `vendor/bin/deptrac` as a final check before completing architectural refactoring tasks.