ma-agents 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DEVELOPMENT.md +173 -0
- package/README.md +201 -309
- package/SKILLS_STRUCTURE.md +392 -0
- package/bin/cli.js +127 -28
- package/index.js +8 -6
- package/lib/agents.js +12 -1
- package/lib/installer.js +311 -44
- package/package.json +2 -2
- package/skills/README.md +25 -0
- package/skills/code-review/SKILL.md +39 -0
- package/skills/commit-message/SKILL.md +75 -0
- package/skills/create-hardened-docker-skill/SKILL.md +0 -5
- package/skills/git-workflow-skill/SKILL.md +0 -5
- package/skills/js-ts-security-skill/SKILL.md +0 -4
- package/skills/logging-best-practices/SKILL.md +46 -0
- package/skills/logging-best-practices/examples/cpp.md +36 -0
- package/skills/logging-best-practices/examples/csharp.md +49 -0
- package/skills/logging-best-practices/examples/javascript.md +77 -0
- package/skills/logging-best-practices/examples/python.md +57 -0
- package/skills/logging-best-practices/references/logging-standards.md +29 -0
- package/skills/logging-best-practices/skill.json +13 -0
- package/skills/skill-creator/SKILL.md +211 -0
- package/skills/skill-creator/claude-code.md +6 -8
- package/skills/skill-creator/generic.md +0 -5
- package/skills/test-accompanied-development/SKILL.md +39 -0
- package/skills/test-accompanied-development/skill.json +12 -0
- package/skills/test-generator/SKILL.md +61 -0
- package/skills/vercel-react-best-practices/SKILL.md +105 -0
- package/skills/verify-hardened-docker-skill/SKILL.md +0 -5
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Logging Best Practices
|
|
2
|
+
|
|
3
|
+
Enforce structured, context-rich logging according to market standards (OpenTelemetry) across all application domains.
|
|
4
|
+
|
|
5
|
+
## Policy
|
|
6
|
+
|
|
7
|
+
**All logs must be structured (preferably JSON) and include mandatory context. Every exception MUST be logged with its full stack trace.**
|
|
8
|
+
|
|
9
|
+
## Core Mandatory Fields
|
|
10
|
+
|
|
11
|
+
Every log entry must contain:
|
|
12
|
+
- `datetime`: ISO 8601 timestamp with timezone.
|
|
13
|
+
- `severity`: Standard level (DEBUG, INFO, WARN, ERROR, CRITICAL).
|
|
14
|
+
- `message`: Clear, concise description of the event.
|
|
15
|
+
- `placement`: File name and line number where the log was triggered.
|
|
16
|
+
- `process_name`: Name of the service or application.
|
|
17
|
+
- `container_id`: (If applicable) Docker/K8s container identifier.
|
|
18
|
+
- `trace_id` / `span_id`: For distributed tracing and request correlation.
|
|
19
|
+
|
|
20
|
+
## Domain-Specific Requirements
|
|
21
|
+
|
|
22
|
+
### 1. Backend Systems
|
|
23
|
+
- **Log**: Incoming/outgoing requests (method, status, duration).
|
|
24
|
+
- **Log**: Database query latencies and connection states.
|
|
25
|
+
- **Mandatory**: Full exception details in catch blocks.
|
|
26
|
+
|
|
27
|
+
### 2. Frontend Applications
|
|
28
|
+
- **Log**: Client-side errors (JS runtime, UI crashes).
|
|
29
|
+
- **Log**: User interaction context (last clicked component, breadcrumbs).
|
|
30
|
+
- **Context**: Browser version, OS, Resolution.
|
|
31
|
+
|
|
32
|
+
### 3. Realtime & Algorithmic Work
|
|
33
|
+
- **Log**: Iteration throughput and step-by-step latency.
|
|
34
|
+
- **Log**: Mathematical anomalies or convergence failures.
|
|
35
|
+
- **Mandatory**: Timeout exceptions and resource exhaustion warnings.
|
|
36
|
+
|
|
37
|
+
## Rules
|
|
38
|
+
|
|
39
|
+
- **No PII/Secrets**: Never log passwords, keys, or private user data.
|
|
40
|
+
- **Asynchronous**: Prefer non-blocking logging to maintain performance.
|
|
41
|
+
- **Traceability**: Always include `trace_id` in logs that are part of a request flow.
|
|
42
|
+
- **Exception Policy**: Use the `ERROR` level for caught exceptions that affect flow, and `CRITICAL` for system-wide failures.
|
|
43
|
+
|
|
44
|
+
## Reference
|
|
45
|
+
|
|
46
|
+
See [logging-standards.md](./references/logging-standards.md) for detailed field definitions and level guidance.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# C++ Logging Examples
|
|
2
|
+
|
|
3
|
+
## Structured Logging with `spdlog`
|
|
4
|
+
|
|
5
|
+
```cpp
|
|
6
|
+
#include "spdlog/spdlog.h"
|
|
7
|
+
#include "spdlog/sinks/stdout_color_sinks.h"
|
|
8
|
+
#include <exception>
|
|
9
|
+
|
|
10
|
+
void run_realtime_loop() {
|
|
11
|
+
auto logger = spdlog::get("realtime_logger");
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
// Realtime/Algorithmic domain logging
|
|
15
|
+
logger->info("Computation step started. Input size: {}. Placement: {}:{}",
|
|
16
|
+
1024, __FILE__, __LINE__);
|
|
17
|
+
|
|
18
|
+
if (check_anomaly()) {
|
|
19
|
+
logger->warn("Numerical anomaly detected! Severity: WARN");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} catch (const std::exception& e) {
|
|
23
|
+
// Mandatory Exception Logging
|
|
24
|
+
logger->critical("Critical failure in realtime loop! Error: {}. File: {}. Line: {}",
|
|
25
|
+
e.what(), __FILE__, __LINE__);
|
|
26
|
+
throw;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Global setup for JSON output
|
|
31
|
+
void setup_logging() {
|
|
32
|
+
// Note: spdlog requires a custom formatter or sink for pure JSON output
|
|
33
|
+
// to match OTel standards perfectly.
|
|
34
|
+
spdlog::set_pattern("{\"datetime\":\"%Y-%m-%dT%H:%M:%SZ\",\"severity\":\"%l\",\"message\":\"%v\",\"process_name\":\"engine_v1\"}");
|
|
35
|
+
}
|
|
36
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# C# Logging Examples
|
|
2
|
+
|
|
3
|
+
## Structured Logging with Serilog
|
|
4
|
+
|
|
5
|
+
```csharp
|
|
6
|
+
using Serilog;
|
|
7
|
+
using System;
|
|
8
|
+
|
|
9
|
+
public class DataService
|
|
10
|
+
{
|
|
11
|
+
private readonly ILogger _logger = Log.ForContext<DataService>();
|
|
12
|
+
|
|
13
|
+
public void ProcessAlgorithm(double[] data)
|
|
14
|
+
{
|
|
15
|
+
try
|
|
16
|
+
{
|
|
17
|
+
_logger.Information("Algorithm iteration started. Data points: {Count}. Placement: {Placement}",
|
|
18
|
+
data.Length, "DataService.cs:45");
|
|
19
|
+
|
|
20
|
+
// Realtime/Algorithmic specific logging
|
|
21
|
+
var startTime = DateTime.UtcNow;
|
|
22
|
+
RunComplexMath(data);
|
|
23
|
+
var duration = (DateTime.UtcNow - startTime).TotalMilliseconds;
|
|
24
|
+
|
|
25
|
+
_logger.Information("Iteration complete. Latency: {Latency}ms", duration);
|
|
26
|
+
}
|
|
27
|
+
catch (Exception ex)
|
|
28
|
+
{
|
|
29
|
+
// Mandatory Exception Logging
|
|
30
|
+
_logger.Error(ex, "Algorithm execution failed at {Placement}. Container: {ContainerId}",
|
|
31
|
+
"DataService.cs:55", Environment.GetEnvironmentVariable("HOSTNAME"));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Microsoft.Extensions.Logging (JSON Console)
|
|
38
|
+
|
|
39
|
+
```csharp
|
|
40
|
+
// In Program.cs
|
|
41
|
+
builder.Logging.AddJsonConsole(options => {
|
|
42
|
+
options.TimestampFormat = "yyyy-MM-ddTHH:mm:ssZ ";
|
|
43
|
+
options.JsonWriterOptions = new JsonWriterOptions { Indented = true };
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Usage
|
|
47
|
+
_logger.LogError(exception, "Request failed at {Placement}. TraceId: {TraceId}",
|
|
48
|
+
"OrderController.cs:120", HttpContext.TraceIdentifier);
|
|
49
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# JavaScript/TypeScript Logging Examples
|
|
2
|
+
|
|
3
|
+
## Backend (Node.js with `pino` or `winston`)
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import pino from 'pino';
|
|
7
|
+
|
|
8
|
+
const logger = pino({
|
|
9
|
+
level: process.env.LOG_LEVEL || 'info',
|
|
10
|
+
formatters: {
|
|
11
|
+
level: (label) => {
|
|
12
|
+
return { severity: label.toUpperCase() };
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
base: {
|
|
16
|
+
process_name: 'api-gateway',
|
|
17
|
+
container_id: process.env.HOSTNAME || 'unknown'
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
async function handleRequest(req, res) {
|
|
22
|
+
const traceId = req.headers['x-trace-id'];
|
|
23
|
+
try {
|
|
24
|
+
logger.info({
|
|
25
|
+
msg: 'Handling incoming request',
|
|
26
|
+
trace_id: traceId,
|
|
27
|
+
path: req.path,
|
|
28
|
+
placement: 'router.ts:12'
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// ... logic
|
|
32
|
+
} catch (error) {
|
|
33
|
+
// Mandatory Exception Logging
|
|
34
|
+
logger.error({
|
|
35
|
+
msg: 'Request handler failed',
|
|
36
|
+
trace_id: traceId,
|
|
37
|
+
err: error, // Pino automatically formats the stack trace
|
|
38
|
+
severity: 'ERROR',
|
|
39
|
+
placement: 'router.ts:25'
|
|
40
|
+
});
|
|
41
|
+
res.status(500).send('Internal Server Error');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Frontend (Browser)
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
const logToServer = async (logEntry) => {
|
|
50
|
+
try {
|
|
51
|
+
await fetch('/api/logs', {
|
|
52
|
+
method: 'POST',
|
|
53
|
+
body: JSON.stringify({
|
|
54
|
+
...logEntry,
|
|
55
|
+
datetime: new Date().toISOString(),
|
|
56
|
+
browser: navigator.userAgent,
|
|
57
|
+
process_name: 'frontend-spa'
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
} catch (e) {
|
|
61
|
+
console.error('Failed to ship logs', e);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// Global error handler
|
|
66
|
+
window.onerror = function(msg, url, lineNo, columnNo, error) {
|
|
67
|
+
logToServer({
|
|
68
|
+
severity: 'ERROR',
|
|
69
|
+
message: msg,
|
|
70
|
+
placement: `${url}:${lineNo}`,
|
|
71
|
+
exception: {
|
|
72
|
+
message: error?.message,
|
|
73
|
+
stack: error?.stack
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Python Logging Examples
|
|
2
|
+
|
|
3
|
+
## Structured Logging with `structlog`
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
import structlog
|
|
7
|
+
import os
|
|
8
|
+
|
|
9
|
+
logger = structlog.get_logger()
|
|
10
|
+
|
|
11
|
+
def process_data(data):
|
|
12
|
+
try:
|
|
13
|
+
# Algorithmic step logging
|
|
14
|
+
logger.info("calculation_step_started",
|
|
15
|
+
step="matrix_multiplication",
|
|
16
|
+
data_size=len(data),
|
|
17
|
+
placement="processor.py:45")
|
|
18
|
+
|
|
19
|
+
result = perform_complex_math(data)
|
|
20
|
+
return result
|
|
21
|
+
except Exception as e:
|
|
22
|
+
# Mandatory Exception Logging
|
|
23
|
+
logger.error("calculation_failed",
|
|
24
|
+
exception_type=type(e).__name__,
|
|
25
|
+
exception_msg=str(e),
|
|
26
|
+
stack_trace=True, # structlog captures this
|
|
27
|
+
severity="ERROR",
|
|
28
|
+
placement="processor.py:52",
|
|
29
|
+
container_id=os.getenv("HOSTNAME"))
|
|
30
|
+
raise
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Standard Library with JSON Formatter
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
import logging
|
|
37
|
+
import json
|
|
38
|
+
from datetime import datetime
|
|
39
|
+
|
|
40
|
+
class JsonFormatter(logging.Formatter):
|
|
41
|
+
def format(self, record):
|
|
42
|
+
log_entry = {
|
|
43
|
+
"datetime": datetime.utcnow().isoformat(),
|
|
44
|
+
"severity": record.levelname,
|
|
45
|
+
"message": record.getMessage(),
|
|
46
|
+
"placement": f"{record.filename}:{record.lineno}",
|
|
47
|
+
"process_name": record.processName,
|
|
48
|
+
"trace_id": getattr(record, 'trace_id', 'none')
|
|
49
|
+
}
|
|
50
|
+
if record.exc_info:
|
|
51
|
+
log_entry["exception"] = self.formatException(record.exc_info)
|
|
52
|
+
return json.dumps(log_entry)
|
|
53
|
+
|
|
54
|
+
# usage
|
|
55
|
+
logger = logging.getLogger("backend_service")
|
|
56
|
+
logger.error("Database connection failed", exc_info=True)
|
|
57
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Logging Standards Reference
|
|
2
|
+
|
|
3
|
+
This document defines the semantic conventions and levels used in the Logging Best Practices skill.
|
|
4
|
+
|
|
5
|
+
## Log Levels
|
|
6
|
+
|
|
7
|
+
| Level | Usage |
|
|
8
|
+
| :--- | :--- |
|
|
9
|
+
| **TRACE** | Fine-grained informational events (mostly for debugging logic flows). |
|
|
10
|
+
| **DEBUG** | Detailed information for developer troubleshooting. |
|
|
11
|
+
| **INFO** | Regular operational events (startup, shutdown, successful requests). |
|
|
12
|
+
| **WARN** | Potential issues or degraded states that don't stop the service. |
|
|
13
|
+
| **ERROR** | Operational failures that affect a specific request or operation. |
|
|
14
|
+
| **CRITICAL** | System-wide failures requiring immediate attention. |
|
|
15
|
+
|
|
16
|
+
## OpenTelemetry Semantic Conventions
|
|
17
|
+
|
|
18
|
+
To ensure interoperability, use the following field names where possible:
|
|
19
|
+
|
|
20
|
+
- `timestamp`: The time when the event occurred.
|
|
21
|
+
- `severity_text`: The string representation of the log level.
|
|
22
|
+
- `body`: The primary log message.
|
|
23
|
+
- `attributes.service.name`: The value of `process_name`.
|
|
24
|
+
- `attributes.container.id`: The value of `container_id`.
|
|
25
|
+
- `attributes.code.filepath`: Path to the source file.
|
|
26
|
+
- `attributes.code.lineno`: Line number in the source file.
|
|
27
|
+
- `attributes.exception.type`: Class name of the exception.
|
|
28
|
+
- `attributes.exception.message`: Message from the exception.
|
|
29
|
+
- `attributes.exception.stacktrace`: Full stack trace.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Logging Best Practices",
|
|
3
|
+
"description": "Standardizes structured logging across Backend, Frontend, Realtime, and Algorithmic domains with mandatory exception handling.",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"author": "Antigravity",
|
|
6
|
+
"tags": [
|
|
7
|
+
"logging",
|
|
8
|
+
"observability",
|
|
9
|
+
"json",
|
|
10
|
+
"opentelemetry",
|
|
11
|
+
"quality"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# Skill Creator
|
|
2
|
+
|
|
3
|
+
This skill provides guidance for creating effective skills.
|
|
4
|
+
|
|
5
|
+
## About Skills
|
|
6
|
+
|
|
7
|
+
Skills are modular, self-contained packages that extend Claude's capabilities by providing
|
|
8
|
+
specialized knowledge, workflows, and tools. Think of them as "onboarding guides" for specific
|
|
9
|
+
domains or tasks—they transform Claude from a general-purpose agent into a specialized agent
|
|
10
|
+
equipped with procedural knowledge that no model can fully possess.
|
|
11
|
+
|
|
12
|
+
### What Skills Provide
|
|
13
|
+
|
|
14
|
+
1. Specialized workflows - Multi-step procedures for specific domains
|
|
15
|
+
2. Tool integrations - Instructions for working with specific file formats or APIs
|
|
16
|
+
3. Domain expertise - Company-specific knowledge, schemas, business logic
|
|
17
|
+
4. Bundled resources - Scripts, references, and assets for complex and repetitive tasks
|
|
18
|
+
|
|
19
|
+
## Core Principles
|
|
20
|
+
|
|
21
|
+
### Concise is Key
|
|
22
|
+
|
|
23
|
+
The context window is a public good. Skills share the context window with everything else Claude needs: system prompt, conversation history, other Skills' metadata, and the actual user request.
|
|
24
|
+
|
|
25
|
+
**Default assumption: Claude is already very smart.** Only add context Claude doesn't already have. Challenge each piece of information: "Does Claude really need this explanation?" and "Does this paragraph justify its token cost?"
|
|
26
|
+
|
|
27
|
+
Prefer concise examples over verbose explanations.
|
|
28
|
+
|
|
29
|
+
### Set Appropriate Degrees of Freedom
|
|
30
|
+
|
|
31
|
+
Match the level of specificity to the task's fragility and variability:
|
|
32
|
+
|
|
33
|
+
**High freedom (text-based instructions)**: Use when multiple approaches are valid, decisions depend on context, or heuristics guide the approach.
|
|
34
|
+
|
|
35
|
+
**Medium freedom (pseudocode or scripts with parameters)**: Use when a preferred pattern exists, some variation is acceptable, or configuration affects behavior.
|
|
36
|
+
|
|
37
|
+
**Low freedom (specific scripts, few parameters)**: Use when operations are fragile and error-prone, consistency is critical, or a specific sequence must be followed.
|
|
38
|
+
|
|
39
|
+
### Anatomy of a Skill
|
|
40
|
+
|
|
41
|
+
Every skill consists of a `skill.json` metadata file, a `SKILL.md` instruction file, and optional bundled resources:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
skill-name/
|
|
45
|
+
├── skill.json (required)
|
|
46
|
+
│ ├── name: (required)
|
|
47
|
+
│ ├── description: (required)
|
|
48
|
+
│ ├── version: (required)
|
|
49
|
+
│ ├── author: (optional)
|
|
50
|
+
│ └── tags: (optional)
|
|
51
|
+
├── SKILL.md (required) - Pure Markdown instructions, NO frontmatter
|
|
52
|
+
└── Bundled Resources (optional)
|
|
53
|
+
├── scripts/ - Executable code (Python/Bash/etc.)
|
|
54
|
+
├── references/ - Documentation intended to be loaded into context as needed
|
|
55
|
+
├── examples/ - Sample outputs showing expected format
|
|
56
|
+
├── hooks/ - Git hooks or other hook scripts
|
|
57
|
+
└── assets/ - Files used in output (templates, icons, fonts, etc.)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
#### skill.json (required - single source of truth)
|
|
61
|
+
|
|
62
|
+
Contains all metadata. The installer reads this to list skills and automatically injects YAML frontmatter (`name`, `description`) into the installed SKILL.md at install time. You never write frontmatter manually in `.md` files.
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"name": "My Skill",
|
|
67
|
+
"description": "What this skill does and when to use it",
|
|
68
|
+
"version": "1.0.0",
|
|
69
|
+
"author": "Your Name",
|
|
70
|
+
"tags": ["category", "keywords"]
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The `description` field is critical — it determines when the skill triggers. Include both what the skill does AND specific triggers/contexts.
|
|
75
|
+
|
|
76
|
+
#### SKILL.md (required)
|
|
77
|
+
|
|
78
|
+
Pure Markdown instructions — no YAML frontmatter. Only loaded AFTER the skill triggers based on the description in `skill.json`.
|
|
79
|
+
|
|
80
|
+
#### Bundled Resources (optional)
|
|
81
|
+
|
|
82
|
+
##### Scripts (`scripts/`)
|
|
83
|
+
|
|
84
|
+
Executable code for tasks that require deterministic reliability or are repeatedly rewritten.
|
|
85
|
+
|
|
86
|
+
- **When to include**: When the same code is being rewritten repeatedly or deterministic reliability is needed
|
|
87
|
+
- **Benefits**: Token efficient, deterministic, may be executed without loading into context
|
|
88
|
+
|
|
89
|
+
##### References (`references/`)
|
|
90
|
+
|
|
91
|
+
Documentation intended to be loaded as needed into context.
|
|
92
|
+
|
|
93
|
+
- **When to include**: For documentation that Claude should reference while working
|
|
94
|
+
- **Use cases**: Database schemas, API documentation, domain knowledge, company policies
|
|
95
|
+
- **Best practice**: If files are large (>10k words), include grep search patterns in SKILL.md
|
|
96
|
+
- **Avoid duplication**: Information lives in either SKILL.md or references files, not both
|
|
97
|
+
|
|
98
|
+
##### Assets (`assets/`)
|
|
99
|
+
|
|
100
|
+
Files not intended to be loaded into context, but used within the output Claude produces.
|
|
101
|
+
|
|
102
|
+
- **When to include**: When the skill needs files for final output
|
|
103
|
+
- **Use cases**: Templates, images, icons, boilerplate code, fonts, sample documents
|
|
104
|
+
|
|
105
|
+
#### What NOT to Include
|
|
106
|
+
|
|
107
|
+
Do NOT create: README.md, INSTALLATION_GUIDE.md, QUICK_REFERENCE.md, CHANGELOG.md, or other auxiliary documentation. The skill should only contain information needed for an AI agent to execute tasks.
|
|
108
|
+
|
|
109
|
+
### Progressive Disclosure Design Principle
|
|
110
|
+
|
|
111
|
+
Three-level loading system:
|
|
112
|
+
|
|
113
|
+
1. **Metadata (name + description)** - Always in context (~100 words)
|
|
114
|
+
2. **SKILL.md body** - When skill triggers (<5k words)
|
|
115
|
+
3. **Bundled resources** - As needed by Claude (Unlimited)
|
|
116
|
+
|
|
117
|
+
Keep SKILL.md body under 500 lines. Split content into separate files when approaching this limit.
|
|
118
|
+
|
|
119
|
+
**Pattern 1: High-level guide with references**
|
|
120
|
+
|
|
121
|
+
```markdown
|
|
122
|
+
# PDF Processing
|
|
123
|
+
## Quick start
|
|
124
|
+
Extract text with pdfplumber: [code example]
|
|
125
|
+
## Advanced features
|
|
126
|
+
- **Form filling**: See [FORMS.md](FORMS.md) for complete guide
|
|
127
|
+
- **API reference**: See [REFERENCE.md](REFERENCE.md) for all methods
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Pattern 2: Domain-specific organization**
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
bigquery-skill/
|
|
134
|
+
├── SKILL.md (overview and navigation)
|
|
135
|
+
└── references/
|
|
136
|
+
├── finance.md (revenue, billing metrics)
|
|
137
|
+
├── sales.md (opportunities, pipeline)
|
|
138
|
+
└── product.md (API usage, features)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Pattern 3: Conditional details**
|
|
142
|
+
|
|
143
|
+
```markdown
|
|
144
|
+
# DOCX Processing
|
|
145
|
+
## Creating documents
|
|
146
|
+
Use docx-js for new documents. See [DOCX-JS.md](DOCX-JS.md).
|
|
147
|
+
## Editing documents
|
|
148
|
+
For simple edits, modify the XML directly.
|
|
149
|
+
**For tracked changes**: See [REDLINING.md](REDLINING.md)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Skill Creation Process
|
|
153
|
+
|
|
154
|
+
1. Understand the skill with concrete examples
|
|
155
|
+
2. Plan reusable skill contents (scripts, references, assets)
|
|
156
|
+
3. Initialize the skill (run scripts/init_skill.py)
|
|
157
|
+
4. Edit the skill (implement resources and write SKILL.md)
|
|
158
|
+
5. Package the skill (run scripts/package_skill.py)
|
|
159
|
+
6. Iterate based on real usage
|
|
160
|
+
|
|
161
|
+
### Step 1: Understanding the Skill with Concrete Examples
|
|
162
|
+
|
|
163
|
+
Gather concrete examples of how the skill will be used. Ask users clarifying questions about functionality and triggers. Conclude when there's clear understanding of supported functionality.
|
|
164
|
+
|
|
165
|
+
### Step 2: Planning the Reusable Skill Contents
|
|
166
|
+
|
|
167
|
+
Analyze each concrete example:
|
|
168
|
+
1. Consider how to execute the example from scratch
|
|
169
|
+
2. Identify what scripts, references, and assets would be helpful for repeated execution
|
|
170
|
+
|
|
171
|
+
### Step 3: Initializing the Skill
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
scripts/init_skill.py <skill-name> --path <output-directory>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Creates skill directory with skill.json, SKILL.md template, example resource directories, and placeholder files.
|
|
178
|
+
|
|
179
|
+
### Step 4: Edit the Skill
|
|
180
|
+
|
|
181
|
+
**Writing guideline:** Always use imperative/infinitive form.
|
|
182
|
+
|
|
183
|
+
**Update skill.json:**
|
|
184
|
+
- `name`: The skill display name
|
|
185
|
+
- `description`: Include both what the skill does AND specific triggers/contexts for when to use it
|
|
186
|
+
- `version`: Semantic version (e.g., "1.0.0")
|
|
187
|
+
|
|
188
|
+
**Update SKILL.md (pure Markdown, no frontmatter):**
|
|
189
|
+
- Write instructions for using the skill and bundled resources
|
|
190
|
+
- For multi-step processes: See references/workflows.md
|
|
191
|
+
- For specific output formats: See references/output-patterns.md
|
|
192
|
+
|
|
193
|
+
**Start with Reusable Skill Contents:**
|
|
194
|
+
- Implement scripts, references, and assets first
|
|
195
|
+
- Test scripts by running them
|
|
196
|
+
- Delete example files not needed for the skill
|
|
197
|
+
|
|
198
|
+
### Step 5: Packaging a Skill
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
scripts/package_skill.py <path/to/skill-folder> [output-directory]
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Validates and packages the skill into a distributable .skill file (zip format).
|
|
205
|
+
|
|
206
|
+
### Step 6: Iterate
|
|
207
|
+
|
|
208
|
+
1. Use the skill on real tasks
|
|
209
|
+
2. Notice struggles or inefficiencies
|
|
210
|
+
3. Identify how SKILL.md or bundled resources should be updated
|
|
211
|
+
4. Implement changes and test again
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: skill-creator
|
|
3
|
-
description: Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
1
|
# Skill Creator
|
|
7
2
|
|
|
8
3
|
## Description
|
|
@@ -34,15 +29,18 @@ Follow these steps in order:
|
|
|
34
29
|
|
|
35
30
|
```
|
|
36
31
|
skill-name/
|
|
37
|
-
├──
|
|
32
|
+
├── skill.json (required — single source of truth for metadata)
|
|
33
|
+
├── SKILL.md (required — pure Markdown, no frontmatter)
|
|
38
34
|
├── scripts/ (executable code, Python/Bash)
|
|
39
35
|
├── references/ (documentation loaded into context as needed)
|
|
36
|
+
├── examples/ (sample outputs showing expected format)
|
|
37
|
+
├── hooks/ (git hooks or other hook scripts)
|
|
40
38
|
└── assets/ (files used in output: templates, images, fonts)
|
|
41
39
|
```
|
|
42
40
|
|
|
43
|
-
###
|
|
41
|
+
### skill.json (metadata)
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
Contains `name`, `description`, `version`, `author`, `tags`. The `description` is the primary trigger mechanism — include both what the skill does AND when to use it. The installer automatically injects YAML frontmatter from skill.json into the installed SKILL.md.
|
|
46
44
|
|
|
47
45
|
### Bundled Resources
|
|
48
46
|
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: skill-creator
|
|
3
|
-
description: Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
1
|
# Skill Creator
|
|
7
2
|
|
|
8
3
|
This skill provides guidance for creating effective skills.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Test-Accompanied Development (TAD)
|
|
2
|
+
|
|
3
|
+
Enforce a "Test-Alongside" policy where every public method is accompanied by a corresponding unit test.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
To ensure high code quality and maintainability by mandating that all public interfaces are verified by automated tests at the moment of creation.
|
|
8
|
+
|
|
9
|
+
## Policy
|
|
10
|
+
|
|
11
|
+
**Every new public method/function you write MUST be accompanied by at least one unit test.**
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
- Use this skill **every time** you are about to write a new public method or function.
|
|
16
|
+
- This skill should be active during the coding phase of any feature or bug fix.
|
|
17
|
+
|
|
18
|
+
## Instructions
|
|
19
|
+
|
|
20
|
+
1. **Identify Public Exports**: When preparing to write a new class, module, or function, identify which methods will be public/exported.
|
|
21
|
+
2. **Plan the Test**: Before or immediately after writing the method signature, plan the corresponding test cases (Happy Path, Edge Cases, Error Cases).
|
|
22
|
+
3. **Write the Method**: Implement the public method.
|
|
23
|
+
4. **Write the Tests**: Immediately write the unit tests for the method.
|
|
24
|
+
- Refer to the `test-generator` skill for best practices on how to structure these tests (AAA pattern, Mocking, etc.).
|
|
25
|
+
- Ensure tests are placed in the appropriate test directory of the project.
|
|
26
|
+
5. **Verify**: Run the tests to ensure they pass before considering the method "done".
|
|
27
|
+
|
|
28
|
+
## Rules
|
|
29
|
+
|
|
30
|
+
- **No Public Method without Tests**: Do not consider a public method complete until its corresponding test file exists and passes.
|
|
31
|
+
- **Refer to Test Generator**: Use the `test-generator` skill as the standard for test quality and structure.
|
|
32
|
+
- **Traceability**: Mention the test file location when adding the public method.
|
|
33
|
+
|
|
34
|
+
## Example Workflow
|
|
35
|
+
|
|
36
|
+
1. **Agent**: "I am adding a `calculateTotal` method to the `InvoiceService`. I will also create `InvoiceService.test.ts` to verify it."
|
|
37
|
+
2. **Agent**: [Writes `calculateTotal` in `InvoiceService.ts`]
|
|
38
|
+
3. **Agent**: [Writes tests in `InvoiceService.test.ts` using `test-generator` patterns]
|
|
39
|
+
4. **Agent**: "Method and tests are complete. Running tests now..."
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Test-Accompanied Development",
|
|
3
|
+
"description": "Enforces writing unit tests for every new public method created by the agent.",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"author": "Antigravity",
|
|
6
|
+
"tags": [
|
|
7
|
+
"testing",
|
|
8
|
+
"quality",
|
|
9
|
+
"policy",
|
|
10
|
+
"tdd"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Test Generator
|
|
2
|
+
|
|
3
|
+
Generate comprehensive unit and integration tests for code.
|
|
4
|
+
|
|
5
|
+
## Process
|
|
6
|
+
|
|
7
|
+
1. **Analyze**: Understand code purpose, paths, dependencies, edge cases
|
|
8
|
+
2. **Framework**: Determine or ask for testing framework
|
|
9
|
+
3. **Generate**: Create test cases covering:
|
|
10
|
+
- Happy path (normal behavior)
|
|
11
|
+
- Edge cases (boundaries, empty/null inputs)
|
|
12
|
+
- Error cases (invalid inputs, exceptions)
|
|
13
|
+
- Integration scenarios (if applicable)
|
|
14
|
+
|
|
15
|
+
## Test Structure (AAA Pattern)
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
- Arrange: Setup test data
|
|
19
|
+
- Act: Execute code
|
|
20
|
+
- Assert: Verify results
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Coverage Goals
|
|
24
|
+
|
|
25
|
+
- 80%+ code coverage
|
|
26
|
+
- All public methods
|
|
27
|
+
- All conditional branches
|
|
28
|
+
- Positive and negative cases
|
|
29
|
+
|
|
30
|
+
## Best Practices
|
|
31
|
+
|
|
32
|
+
- One assertion per test
|
|
33
|
+
- Independent tests
|
|
34
|
+
- Descriptive test names
|
|
35
|
+
- Mock external dependencies
|
|
36
|
+
- Clear assertion messages
|
|
37
|
+
|
|
38
|
+
## Example Output
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
describe('ComponentName', () => {
|
|
42
|
+
test('should [behavior] when [condition]', () => {
|
|
43
|
+
// Arrange
|
|
44
|
+
const input = setupTestData();
|
|
45
|
+
|
|
46
|
+
// Act
|
|
47
|
+
const result = functionUnderTest(input);
|
|
48
|
+
|
|
49
|
+
// Assert
|
|
50
|
+
expect(result).toEqual(expectedOutput);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('should handle edge case', () => {
|
|
54
|
+
// ...
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('should throw on invalid input', () => {
|
|
58
|
+
expect(() => fn(invalid)).toThrow();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
```
|