Agent-friendly
The homepage is a prompt. Copy it to your AI and it sets up the environment, picks an SDK, and writes the code.
Copy the prompt below, paste it to your AI Agent, and it will set up the environment and operate PHP dependencies with this SDK. One import covers the Packagist API + every Composer CLI command, with cross-platform auto-install built in.
Copy the entire prompt below and paste it to your AI (ChatGPT / Claude / Copilot / Cursor, etc.). It will follow the guide and wire this SDK into your project. Replace the [describe your goal here] line with what you actually want to do.
One-click copy
Click the copy button at the top-right of the code block to put the whole prompt on your clipboard.
# Task: wire `composer-skills` into a Go project
You are integrating **Composer Skills** — `github.com/scagogogo/composer-skills`, a typed Go SDK for the PHP Composer ecosystem. Go ≥ 1.23, MIT.
## Two independent SDKs
1. `pkg/client` — Packagist REST API. Pure Go, no PHP required. Methods: `SearchPackages`, `GetPackage`, `GetSecurityAdvisories`, `GetStatistics`, `ListPackages*`, `GetPackageStats`, `CreatePackage`/`EditPackage`/`UpdatePackage` (needs `WithAPICredentials`). Constructor: `c := client.NewComposerClient(30*time.Second)`.
2. `pkg/composer` — typed wrapper over the local `composer` binary. Requires PHP 7.4+ + Composer 2.0+. Constructor: `comp, err := composer.New(composer.DefaultOptions())` (auto-installs Composer if missing). 234 methods, 20 categories.
Foundation layer: `pkg/detector` (cross-OS Composer detection, `NewDetector().Detect()`), `pkg/installer` (auto-install Composer+PHP, `installer.EnsureComposerInstalled(opts)`, cross-platform: Linux apt/dnf, macOS brew, Windows php.net zip), `pkg/domain` (data models), `pkg/composerutils` (fs/http/mock/test helpers).
## Environment auto-install
If the machine has no Composer or PHP, first run:
```bash
go install github.com/scagogogo/composer-skills/cmd/composer-skills@latest
composer-skills install # auto-installs Composer + PHP (cross-platform)
```
Or programmatically: `installer.EnsureComposerInstalled(&installer.InstallOptions{Config: installer.SmartConfig()})`.
## Rules
- Prefer structured methods that return Go structs: `AuditWithJSON`, `GetOutdatedInfo`, `GetVersionInfo`, `ShowPackageInfo`, `SearchInfo`, `ValidateStructured`, `CheckPlatformReqsStructured`, `GetLicensesInfo`, `GetConfigStructured`, `DiagnoseStructured`. Avoid parsing raw string output.
- Every operation has a base method, a `WithOptions(map[string]string)` variant, and (where Composer supports it) a `WithFormat(format)` variant.
- Convenience helpers: `IsPackageInstalled`, `GetDirectDependencyNames`, `GetProjectSummary`, `GetAbandonedPackagesFromLock`, `GetNamespaceMap`, `GetScripts`, `HasComposerLock`, `HasVendorDir`.
- CLI: `go install github.com/scagogogo/composer-skills/cmd/composer-skills@latest` — 50+ subcommands (`install`, `search`, `package`, `repo`, `security`, `local`…), `--json` flag, `--working-dir` for local ops.
- Docs: https://scagogogo.github.io/composer-skills/ · Go reference: https://pkg.go.dev/github.com/scagogogo/composer-skills · Examples: `examples/`.
## My goal
[Describe your goal here, e.g. "a Go service that scans all my PHP projects for vulnerable dependencies every night and sends a Slack alert when it finds one."]
Deliver: (1) which SDK and why; (2) complete runnable Go code (with imports and error handling); (3) the `go get` command and environment prerequisites; (4) links to relevant docs.// 😩 Old way — fragile, untyped, no error handling
out, _ := exec.Command("composer", "audit").Output()
lines := strings.Split(string(out), "\n")
// then you still have to parse these strings yourself...
// 😊 New way — typed, tested, auto-installing
result, _ := comp.AuditWithJSON()
fmt.Printf("vulnerabilities: %d\n", result.Found)go get github.com/scagogogo/composer-skills| Scenario | What the Agent does |
|---|---|
| Install PHP env | composer-skills install |
| Look up a Packagist package | pkg/client SearchPackages / GetPackage |
| Scan for vulnerabilities | comp.AuditWithJSON() or CLI composer-skills local audit |
| See outdated deps | comp.GetOutdatedInfo() |
| Validate composer.json | comp.ValidateStructured() |