[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7C0FF3QCAQ78RVYNNFPM3FF":3,"skill-same:01M7C0FF3QCAQ78RVYNNFPM3FF":44},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7C0FF3QCAQ78RVYNNFPM3FF","contract-detection",null,"Layer 1 skill for parsing machine-readable API contracts. OpenAPI\u002FSwagger, GraphQL, Protobuf\u002FgRPC, and JSON Schema detection, extraction, and behavioral claim generation. Loaded by the analyzer agent during Layer 1.","zak-keown\u002Fmoe","zak-keown","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F320717241?v=4","01M7BZFXME0NW6TQX0H7AZM2KS","01M7BZFXN32VR0JN5AATRD53H4",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fplugins\u002Fmoe-backstory\u002F.opencode\u002Fskills\u002Fcontract-detection\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: contract-detection\ndescription: Layer 1 skill for parsing machine-readable API contracts. OpenAPI\u002FSwagger, GraphQL, Protobuf\u002FgRPC, and JSON Schema detection, extraction, and behavioral claim generation. Loaded by the analyzer agent during Layer 1.\n---\n\n# Contract Detection Methodology\n\nExtract behavioral intelligence from machine-readable API contracts. These are formal, published definitions of system interfaces -- the strongest possible specification source. A contract file is an explicit promise about what the system accepts and returns.\n\n## When to Use This Mode\n\nContract detection activates when:\n- The target repository or documentation contains API specification files\n- The discovery inventory identifies machine-readable contract files\n- Other modes discover machine-readable contracts during analysis\n\nThis mode runs independently of all other intelligence sources. All output is **PUBLIC** -- machine-readable contracts are published definitions intended for external consumption. Output goes to `workspace\u002Fpublic\u002Fcontracts\u002F`.\n\n## Why Contracts Are the Strongest Source\n\nMachine-readable contracts are unique among intelligence sources because they are:\n- **Formal** -- they use standardized schemas with unambiguous semantics\n- **Published** -- they are intended for external consumers to rely on\n- **Machine-verifiable** -- they can be validated against implementations automatically\n- **Versioned** -- they explicitly track breaking changes through version fields\n\nA single OpenAPI specification can contain more behavioral intelligence than the entire official documentation site, because every endpoint, parameter, response schema, and error code is defined with machine precision.\n\n## OpenAPI \u002F Swagger\n\n### Detection\n\n```bash\n# Find OpenAPI\u002FSwagger files\nfind . -maxdepth 5 -type f \\( \\\n  -name \"openapi.*\" -o -name \"swagger.*\" -o \\\n  -name \"api-spec.*\" -o -name \"api-docs.*\" \\\n  \\) \\( -name \"*.json\" -o -name \"*.yaml\" -o -name \"*.yml\" \\) 2>\u002Fdev\u002Fnull\n\n# Check for OpenAPI version markers in YAML\u002FJSON files\ngrep -rl '\"openapi\":\\|openapi:' --include=\"*.json\" --include=\"*.yaml\" --include=\"*.yml\" . 2>\u002Fdev\u002Fnull | head -20\ngrep -rl '\"swagger\":\\|swagger:' --include=\"*.json\" --include=\"*.yaml\" --include=\"*.yml\" . 2>\u002Fdev\u002Fnull | head -20\n\n# Check for hosted spec endpoints (common locations)\n# \u002Fapi-docs, \u002Fswagger.json, \u002Fopenapi.json, \u002Fv2\u002Fapi-docs, \u002Fv3\u002Fapi-docs\n```\n\n### Extraction\n\nFor each OpenAPI\u002FSwagger specification, extract:\n\n#### Endpoints\n\n| Field | What It Tells You |\n|-------|-------------------|\n| `paths` | Every endpoint the API exposes |\n| HTTP method | The operation type (GET=read, POST=create, PUT=replace, PATCH=update, DELETE=remove) |\n| `operationId` | The canonical name for the operation |\n| `summary` \u002F `description` | Behavioral description of what the endpoint does |\n| `tags` | Logical grouping of endpoints |\n\n#### Parameters\n\n| Field | What It Tells You |\n|-------|-------------------|\n| `parameters` (path, query, header, cookie) | Required inputs and their types |\n| `required` | Whether the parameter is mandatory |\n| `schema` with `enum` | Allowed values (behavioral constraint) |\n| `schema` with `minimum` \u002F `maximum` | Value range (behavioral constraint) |\n| `schema` with `pattern` | Validation regex (behavioral constraint) |\n| `schema` with `default` | Default value when omitted |\n\n#### Request\u002FResponse Schemas\n\n| Field | What It Tells You |\n|-------|-------------------|\n| `requestBody` | What the endpoint accepts (content type, schema) |\n| `responses` | Every possible response code and its schema |\n| `responses.4xx` | Client error conditions and their structure |\n| `responses.5xx` | Server error conditions |\n| `components\u002Fschemas` | Shared data models with field types, constraints, and relationships |\n\n#### Authentication\n\n| Field | What It Tells You |\n|-------|-------------------|\n| `securityDefinitions` \u002F `components\u002FsecuritySchemes` | Auth methods (API key, OAuth2, Bearer, Basic) |\n| `security` (global or per-operation) | Which endpoints require which auth |\n\n### Output Format\n\nWrite to `workspace\u002Fpublic\u002Fcontracts\u002Fopenapi-summary.md`:\n\n```markdown\n## API: {title} v{version}\n\n### Endpoints\n\n| Method | Path | Operation | Auth Required | Description |\n|--------|------|-----------|---------------|-------------|\n| GET | \u002Fusers | listUsers | Bearer | List all users with pagination |\n| POST | \u002Fusers | createUser | Bearer | Create a new user |\n\n### Data Models\n\n#### User\n| Field | Type | Required | Constraints | Description |\n|-------|------|----------|-------------|-------------|\n| id | string (uuid) | yes | read-only | Unique identifier |\n| email | string | yes | format: email | User's email address |\n\n### Error Responses\n| Code | Meaning | Schema |\n|------|---------|--------|\n| 400 | Validation error | { message: string, errors: [{field, code}] } |\n| 401 | Unauthorized | { message: string } |\n| 404 | Not found | { message: string } |\n```\n\n## GraphQL\n\n### Detection\n\n```bash\n# Find GraphQL schema files\nfind . -maxdepth 5 -type f \\( \\\n  -name \"schema.graphql\" -o -name \"*.graphqls\" -o -name \"schema.gql\" -o \\\n  -name \"*.graphql\" \\\n  \\) 2>\u002Fdev\u002Fnull\n\n# Find GraphQL codegen config (indicates GraphQL usage)\nfind . -maxdepth 3 -type f \\( \\\n  -name \"codegen.*\" -o -name \".graphqlrc*\" -o -name \"apollo.config.*\" \\\n  \\) 2>\u002Fdev\u002Fnull\n\n# Check for GraphQL in dependencies\ngrep -l \"graphql\\|apollo\\|@graphql\" package.json requirements.txt Gemfile go.mod 2>\u002Fdev\u002Fnull\n\n# Check for introspection endpoint (if running instance available)\n# POST \u002Fgraphql with { \"query\": \"{ __schema { types { name } } }\" }\n```\n\n### Extraction\n\nFor each GraphQL schema, extract:\n\n#### Queries (Read Operations)\n\n| Element | What It Tells You |\n|---------|-------------------|\n| Query type fields | Every read operation the API exposes |\n| Arguments | Required and optional parameters with types |\n| Return types | Shape of the response data |\n| Directives (`@deprecated`, `@auth`) | Behavioral modifiers |\n\n#### Mutations (Write Operations)\n\n| Element | What It Tells You |\n|---------|-------------------|\n| Mutation type fields | Every write operation the API exposes |\n| Input types | Shape of the data the operation accepts |\n| Return types | What the operation returns after modification |\n| Error handling patterns | Union types for success\u002Ferror returns |\n\n#### Subscriptions (Real-Time Operations)\n\n| Element | What It Tells You |\n|---------|-------------------|\n| Subscription type fields | Events the client can subscribe to |\n| Arguments | Subscription filters |\n| Payload types | Shape of the real-time data |\n\n#### Type System\n\n| Element | What It Tells You |\n|---------|-------------------|\n| Object types | Data entities and their fields |\n| Enum types | Allowed values for categorical fields |\n| Interface types | Shared behavioral contracts across types |\n| Union types | Polymorphic response shapes |\n| Input types | Structured input shapes for mutations |\n| Custom scalars | Domain-specific value types (DateTime, JSON, URL) |\n\n### Output Format\n\nWrite to `workspace\u002Fpublic\u002Fcontracts\u002Fgraphql-summary.md`:\n\n```markdown\n## GraphQL Schema\n\n### Queries\n| Query | Arguments | Returns | Description |\n|-------|-----------|---------|-------------|\n| users | filter: UserFilter, page: Int | [User!]! | List users with filtering |\n| user | id: ID! | User | Get user by ID |\n\n### Mutations\n| Mutation | Input | Returns | Description |\n|----------|-------|---------|-------------|\n| createUser | input: CreateUserInput! | User! | Create a new user |\n| deleteUser | id: ID! | Boolean! | Delete user by ID |\n\n### Subscriptions\n| Subscription | Arguments | Payload | Description |\n|-------------|-----------|---------|-------------|\n| userCreated | — | User! | Fires when a new user is created |\n\n### Types\n#### User\n| Field | Type | Nullable | Description |\n|-------|------|----------|-------------|\n| id | ID | no | Unique identifier |\n| email | String | no | Email address |\n| role | UserRole | no | Enum: ADMIN, USER, VIEWER |\n```\n\n## Protobuf \u002F gRPC\n\n### Detection\n\n```bash\n# Find .proto files\nfind . -maxdepth 5 -type f -name \"*.proto\" 2>\u002Fdev\u002Fnull\n\n# Check for gRPC in dependencies\ngrep -l \"grpc\\|protobuf\" package.json requirements.txt Gemfile go.mod Cargo.toml 2>\u002Fdev\u002Fnull\n\n# Find generated gRPC code\nfind . -maxdepth 5 -type f \\( -name \"*_grpc.pb.go\" -o -name \"*_pb2_grpc.py\" -o -name \"*_grpc.rb\" \\) 2>\u002Fdev\u002Fnull\n```\n\n### Extraction\n\nFor each `.proto` file, extract:\n\n#### Services\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `service` definitions | Logical groupings of RPC methods |\n| `rpc` methods | Every callable operation |\n| Request\u002Fresponse types | Input and output shapes |\n| Streaming modifiers | `stream` on request, response, or both |\n\n#### Messages\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `message` definitions | Data structures used in requests and responses |\n| Field types and numbers | Schema with wire-format compatibility rules |\n| `repeated` fields | Array\u002Flist fields |\n| `oneof` fields | Union types (exactly one field set) |\n| `optional` \u002F `required` | Field presence requirements |\n| `map` fields | Key-value pair fields |\n\n#### Enums\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `enum` definitions | Allowed categorical values |\n| `option allow_alias` | Whether multiple names map to the same value |\n\n#### Options\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `option java_package` | Target language packaging |\n| `option go_package` | Go module path |\n| Custom options | Domain-specific metadata |\n\n### Output Format\n\nWrite to `workspace\u002Fpublic\u002Fcontracts\u002Fprotobuf-summary.md`:\n\n```markdown\n## Protobuf\u002FgRPC Services\n\n### Service: UserService\n| RPC | Request | Response | Streaming | Description |\n|-----|---------|----------|-----------|-------------|\n| GetUser | GetUserRequest | User | none | Get user by ID |\n| ListUsers | ListUsersRequest | ListUsersResponse | none | List users with pagination |\n| WatchUsers | WatchUsersRequest | User | server-stream | Stream user updates |\n\n### Messages\n#### User\n| Field | Number | Type | Label | Description |\n|-------|--------|------|-------|-------------|\n| id | 1 | string | — | Unique identifier |\n| email | 2 | string | — | Email address |\n| role | 3 | UserRole | — | User role |\n\n### Enums\n#### UserRole\n| Name | Number |\n|------|--------|\n| USER_ROLE_UNSPECIFIED | 0 |\n| USER_ROLE_ADMIN | 1 |\n| USER_ROLE_USER | 2 |\n```\n\n## JSON Schema\n\n### Detection\n\n```bash\n# Find JSON Schema files\nfind . -maxdepth 5 -type f -name \"*.schema.json\" 2>\u002Fdev\u002Fnull\nfind . -maxdepth 5 -type f -name \"*.json\" -exec grep -l '\"$schema\"' {} \\; 2>\u002Fdev\u002Fnull | head -20\n\n# Check for JSON Schema in config files\ngrep -rl '\"$schema\":\\|\"\\$ref\"' --include=\"*.json\" . 2>\u002Fdev\u002Fnull | head -20\n\n# Find JSON Schema in OpenAPI components (already covered above, but note cross-reference)\n```\n\n### Extraction\n\nFor each JSON Schema, extract:\n\n#### Type Definitions\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `type` | The data type (object, array, string, number, boolean, null) |\n| `properties` | Named fields with their own schemas |\n| `required` | Fields that must be present |\n| `additionalProperties` | Whether unknown fields are allowed |\n\n#### Validation Rules\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `minLength` \u002F `maxLength` | String length constraints |\n| `minimum` \u002F `maximum` | Numeric range constraints |\n| `pattern` | Regex validation for strings |\n| `format` | Semantic format (email, uri, date-time, uuid) |\n| `enum` | Allowed values |\n| `const` | Fixed required value |\n| `minItems` \u002F `maxItems` | Array length constraints |\n| `uniqueItems` | Whether array elements must be unique |\n\n#### Composition\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `$ref` | References to shared schema definitions |\n| `allOf` | Schema intersection (all must match) |\n| `anyOf` | Schema union (at least one must match) |\n| `oneOf` | Schema exclusive union (exactly one must match) |\n| `not` | Schema negation |\n| `if` \u002F `then` \u002F `else` | Conditional validation |\n\n#### Defaults and Examples\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `default` | Default value when field is omitted |\n| `examples` | Example values (behavioral documentation) |\n| `description` | Human-readable behavioral description |\n\n### Output Format\n\nWrite to `workspace\u002Fpublic\u002Fcontracts\u002Fjson-schema-summary.md`:\n\n```markdown\n## JSON Schema: {title}\n\n### Type: CreateUserRequest\n| Property | Type | Required | Constraints | Default | Description |\n|----------|------|----------|-------------|---------|-------------|\n| email | string | yes | format: email | — | User email address |\n| name | string | yes | minLength: 1, maxLength: 100 | — | Display name |\n| role | string | no | enum: [admin, user, viewer] | \"user\" | User role |\n| tags | array of string | no | maxItems: 10, uniqueItems: true | [] | User tags |\n\n### Validation Rules\n- `email` must match email format (RFC 5322)\n- `name` must be 1-100 characters\n- `role` defaults to \"user\" when omitted\n- `tags` must contain unique strings, maximum 10\n```\n\n## Cross-Contract Correlation\n\nWhen multiple contract types are present (e.g., both OpenAPI and GraphQL, or OpenAPI with JSON Schema references), correlate them:\n\n- Do the endpoint definitions agree on field names and types?\n- Are the same data models defined consistently across contracts?\n- Do version numbers align?\n- Are there endpoints in one contract that are missing from another?\n\nDocument correlations and discrepancies in `workspace\u002Fpublic\u002Fcontracts\u002Fcross-contract-notes.md`.\n\n## Provenance Rules\n\n### Source Type\n\nAll claims from contract detection use `source=machine-readable-contract`:\n\n```markdown\n- The \u002Fusers endpoint accepts a `role` query parameter with values: admin, user, viewer\n  \u003C!-- cite: source=machine-readable-contract, ref=openapi.yaml:\u002Fpaths\u002F~1users\u002Fget\u002Fparameters\u002F0, confidence=confirmed, agent=contract-detector -->\n```\n\n### Confidence Levels\n\n- **confirmed** -- the behavioral claim is explicitly defined in the contract schema (endpoint exists, field has this type, parameter has this constraint). Machine-readable contracts are formal specifications; their explicit definitions are confirmed by definition.\n- **inferred** -- the behavioral claim is derived from contract structure rather than explicit definition (e.g., \"this API follows REST conventions\" inferred from path patterns)\n- **assumed** -- the behavioral claim extrapolates beyond what the contract defines (e.g., \"this endpoint probably supports pagination\" because similar endpoints do)\n\n### Cite As You Go\n\nEvery behavioral claim gets an inline citation immediately after the claim. The `ref` field should be `\u003Cfile-path>:\u003Cjson-path-or-line>`.\n\n## Output Structure\n\n```\nworkspace\u002Fpublic\u002Fcontracts\u002F\n    openapi-summary.md             # OpenAPI\u002FSwagger extraction\n    graphql-summary.md             # GraphQL schema extraction\n    protobuf-summary.md            # Protobuf\u002FgRPC extraction\n    json-schema-summary.md         # JSON Schema extraction\n    cross-contract-notes.md        # Correlations and discrepancies across contract types\n    raw\u002F                           # Copies of discovered contract files for reference\n        openapi.yaml\n        schema.graphql\n        service.proto\n        config.schema.json\n```\n\nNote: Output goes to `workspace\u002Fpublic\u002Fcontracts\u002F` -- not `workspace\u002Fraw\u002F`. Machine-readable contracts are published definitions intended for external consumption. They contain no proprietary implementation details.\n\n## Rules\n\n1. **Contracts are PUBLIC** -- machine-readable contracts are published interface definitions. Output goes to `workspace\u002Fpublic\u002F`, not `workspace\u002Fraw\u002F`.\n2. **Exhaustive extraction** -- extract EVERY endpoint, field, constraint, and error code. Contracts are finite and complete. Do not sample.\n3. **Preserve precision** -- contracts define exact types, constraints, and enums. Do not paraphrase \"minLength: 1, maxLength: 100\" as \"limited length.\" Preserve the exact constraints.\n4. **Note versions** -- contracts have version fields. Always record the version. Behavioral claims from contracts are version-specific.\n5. **Detect staleness** -- a contract file may be outdated relative to the implementation. Flag contracts that appear unmaintained (old modification dates, version mismatches with the codebase).\n6. **Copy originals** -- place copies of discovered contract files in `workspace\u002Fpublic\u002Fcontracts\u002Fraw\u002F` for downstream reference.\n7. **Cite as you go** -- every behavioral claim gets an inline `\u003C!-- cite: -->` comment immediately after the claim. Never defer citation to a later step.\n","# Contract Detection Methodology\n\nExtract behavioral intelligence from machine-readable API contracts. These are formal, published definitions of system interfaces -- the strongest possible specification source. A contract file is an explicit promise about what the system accepts and returns.\n\n## When to Use This Mode\n\nContract detection activates when:\n- The target repository or documentation contains API specification files\n- The discovery inventory identifies machine-readable contract files\n- Other modes discover machine-readable contracts during analysis\n\nThis mode runs independently of all other intelligence sources. All output is **PUBLIC** -- machine-readable contracts are published definitions intended for external consumption. Output goes to `workspace\u002Fpublic\u002Fcontracts\u002F`.\n\n## Why Contracts Are the Strongest Source\n\nMachine-readable contracts are unique among intelligence sources because they are:\n- **Formal** -- they use standardized schemas with unambiguous semantics\n- **Published** -- they are intended for external consumers to rely on\n- **Machine-verifiable** -- they can be validated against implementations automatically\n- **Versioned** -- they explicitly track breaking changes through version fields\n\nA single OpenAPI specification can contain more behavioral intelligence than the entire official documentation site, because every endpoint, parameter, response schema, and error code is defined with machine precision.\n\n## OpenAPI \u002F Swagger\n\n### Detection\n\n```bash\n# Find OpenAPI\u002FSwagger files\nfind . -maxdepth 5 -type f \\( \\\n  -name \"openapi.*\" -o -name \"swagger.*\" -o \\\n  -name \"api-spec.*\" -o -name \"api-docs.*\" \\\n  \\) \\( -name \"*.json\" -o -name \"*.yaml\" -o -name \"*.yml\" \\) 2>\u002Fdev\u002Fnull\n\n# Check for OpenAPI version markers in YAML\u002FJSON files\ngrep -rl '\"openapi\":\\|openapi:' --include=\"*.json\" --include=\"*.yaml\" --include=\"*.yml\" . 2>\u002Fdev\u002Fnull | head -20\ngrep -rl '\"swagger\":\\|swagger:' --include=\"*.json\" --include=\"*.yaml\" --include=\"*.yml\" . 2>\u002Fdev\u002Fnull | head -20\n\n# Check for hosted spec endpoints (common locations)\n# \u002Fapi-docs, \u002Fswagger.json, \u002Fopenapi.json, \u002Fv2\u002Fapi-docs, \u002Fv3\u002Fapi-docs\n```\n\n### Extraction\n\nFor each OpenAPI\u002FSwagger specification, extract:\n\n#### Endpoints\n\n| Field | What It Tells You |\n|-------|-------------------|\n| `paths` | Every endpoint the API exposes |\n| HTTP method | The operation type (GET=read, POST=create, PUT=replace, PATCH=update, DELETE=remove) |\n| `operationId` | The canonical name for the operation |\n| `summary` \u002F `description` | Behavioral description of what the endpoint does |\n| `tags` | Logical grouping of endpoints |\n\n#### Parameters\n\n| Field | What It Tells You |\n|-------|-------------------|\n| `parameters` (path, query, header, cookie) | Required inputs and their types |\n| `required` | Whether the parameter is mandatory |\n| `schema` with `enum` | Allowed values (behavioral constraint) |\n| `schema` with `minimum` \u002F `maximum` | Value range (behavioral constraint) |\n| `schema` with `pattern` | Validation regex (behavioral constraint) |\n| `schema` with `default` | Default value when omitted |\n\n#### Request\u002FResponse Schemas\n\n| Field | What It Tells You |\n|-------|-------------------|\n| `requestBody` | What the endpoint accepts (content type, schema) |\n| `responses` | Every possible response code and its schema |\n| `responses.4xx` | Client error conditions and their structure |\n| `responses.5xx` | Server error conditions |\n| `components\u002Fschemas` | Shared data models with field types, constraints, and relationships |\n\n#### Authentication\n\n| Field | What It Tells You |\n|-------|-------------------|\n| `securityDefinitions` \u002F `components\u002FsecuritySchemes` | Auth methods (API key, OAuth2, Bearer, Basic) |\n| `security` (global or per-operation) | Which endpoints require which auth |\n\n### Output Format\n\nWrite to `workspace\u002Fpublic\u002Fcontracts\u002Fopenapi-summary.md`:\n\n```markdown\n## API: {title} v{version}\n\n### Endpoints\n\n| Method | Path | Operation | Auth Required | Description |\n|--------|------|-----------|---------------|-------------|\n| GET | \u002Fusers | listUsers | Bearer | List all users with pagination |\n| POST | \u002Fusers | createUser | Bearer | Create a new user |\n\n### Data Models\n\n#### User\n| Field | Type | Required | Constraints | Description |\n|-------|------|----------|-------------|-------------|\n| id | string (uuid) | yes | read-only | Unique identifier |\n| email | string | yes | format: email | User's email address |\n\n### Error Responses\n| Code | Meaning | Schema |\n|------|---------|--------|\n| 400 | Validation error | { message: string, errors: [{field, code}] } |\n| 401 | Unauthorized | { message: string } |\n| 404 | Not found | { message: string } |\n```\n\n## GraphQL\n\n### Detection\n\n```bash\n# Find GraphQL schema files\nfind . -maxdepth 5 -type f \\( \\\n  -name \"schema.graphql\" -o -name \"*.graphqls\" -o -name \"schema.gql\" -o \\\n  -name \"*.graphql\" \\\n  \\) 2>\u002Fdev\u002Fnull\n\n# Find GraphQL codegen config (indicates GraphQL usage)\nfind . -maxdepth 3 -type f \\( \\\n  -name \"codegen.*\" -o -name \".graphqlrc*\" -o -name \"apollo.config.*\" \\\n  \\) 2>\u002Fdev\u002Fnull\n\n# Check for GraphQL in dependencies\ngrep -l \"graphql\\|apollo\\|@graphql\" package.json requirements.txt Gemfile go.mod 2>\u002Fdev\u002Fnull\n\n# Check for introspection endpoint (if running instance available)\n# POST \u002Fgraphql with { \"query\": \"{ __schema { types { name } } }\" }\n```\n\n### Extraction\n\nFor each GraphQL schema, extract:\n\n#### Queries (Read Operations)\n\n| Element | What It Tells You |\n|---------|-------------------|\n| Query type fields | Every read operation the API exposes |\n| Arguments | Required and optional parameters with types |\n| Return types | Shape of the response data |\n| Directives (`@deprecated`, `@auth`) | Behavioral modifiers |\n\n#### Mutations (Write Operations)\n\n| Element | What It Tells You |\n|---------|-------------------|\n| Mutation type fields | Every write operation the API exposes |\n| Input types | Shape of the data the operation accepts |\n| Return types | What the operation returns after modification |\n| Error handling patterns | Union types for success\u002Ferror returns |\n\n#### Subscriptions (Real-Time Operations)\n\n| Element | What It Tells You |\n|---------|-------------------|\n| Subscription type fields | Events the client can subscribe to |\n| Arguments | Subscription filters |\n| Payload types | Shape of the real-time data |\n\n#### Type System\n\n| Element | What It Tells You |\n|---------|-------------------|\n| Object types | Data entities and their fields |\n| Enum types | Allowed values for categorical fields |\n| Interface types | Shared behavioral contracts across types |\n| Union types | Polymorphic response shapes |\n| Input types | Structured input shapes for mutations |\n| Custom scalars | Domain-specific value types (DateTime, JSON, URL) |\n\n### Output Format\n\nWrite to `workspace\u002Fpublic\u002Fcontracts\u002Fgraphql-summary.md`:\n\n```markdown\n## GraphQL Schema\n\n### Queries\n| Query | Arguments | Returns | Description |\n|-------|-----------|---------|-------------|\n| users | filter: UserFilter, page: Int | [User!]! | List users with filtering |\n| user | id: ID! | User | Get user by ID |\n\n### Mutations\n| Mutation | Input | Returns | Description |\n|----------|-------|---------|-------------|\n| createUser | input: CreateUserInput! | User! | Create a new user |\n| deleteUser | id: ID! | Boolean! | Delete user by ID |\n\n### Subscriptions\n| Subscription | Arguments | Payload | Description |\n|-------------|-----------|---------|-------------|\n| userCreated | — | User! | Fires when a new user is created |\n\n### Types\n#### User\n| Field | Type | Nullable | Description |\n|-------|------|----------|-------------|\n| id | ID | no | Unique identifier |\n| email | String | no | Email address |\n| role | UserRole | no | Enum: ADMIN, USER, VIEWER |\n```\n\n## Protobuf \u002F gRPC\n\n### Detection\n\n```bash\n# Find .proto files\nfind . -maxdepth 5 -type f -name \"*.proto\" 2>\u002Fdev\u002Fnull\n\n# Check for gRPC in dependencies\ngrep -l \"grpc\\|protobuf\" package.json requirements.txt Gemfile go.mod Cargo.toml 2>\u002Fdev\u002Fnull\n\n# Find generated gRPC code\nfind . -maxdepth 5 -type f \\( -name \"*_grpc.pb.go\" -o -name \"*_pb2_grpc.py\" -o -name \"*_grpc.rb\" \\) 2>\u002Fdev\u002Fnull\n```\n\n### Extraction\n\nFor each `.proto` file, extract:\n\n#### Services\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `service` definitions | Logical groupings of RPC methods |\n| `rpc` methods | Every callable operation |\n| Request\u002Fresponse types | Input and output shapes |\n| Streaming modifiers | `stream` on request, response, or both |\n\n#### Messages\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `message` definitions | Data structures used in requests and responses |\n| Field types and numbers | Schema with wire-format compatibility rules |\n| `repeated` fields | Array\u002Flist fields |\n| `oneof` fields | Union types (exactly one field set) |\n| `optional` \u002F `required` | Field presence requirements |\n| `map` fields | Key-value pair fields |\n\n#### Enums\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `enum` definitions | Allowed categorical values |\n| `option allow_alias` | Whether multiple names map to the same value |\n\n#### Options\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `option java_package` | Target language packaging |\n| `option go_package` | Go module path |\n| Custom options | Domain-specific metadata |\n\n### Output Format\n\nWrite to `workspace\u002Fpublic\u002Fcontracts\u002Fprotobuf-summary.md`:\n\n```markdown\n## Protobuf\u002FgRPC Services\n\n### Service: UserService\n| RPC | Request | Response | Streaming | Description |\n|-----|---------|----------|-----------|-------------|\n| GetUser | GetUserRequest | User | none | Get user by ID |\n| ListUsers | ListUsersRequest | ListUsersResponse | none | List users with pagination |\n| WatchUsers | WatchUsersRequest | User | server-stream | Stream user updates |\n\n### Messages\n#### User\n| Field | Number | Type | Label | Description |\n|-------|--------|------|-------|-------------|\n| id | 1 | string | — | Unique identifier |\n| email | 2 | string | — | Email address |\n| role | 3 | UserRole | — | User role |\n\n### Enums\n#### UserRole\n| Name | Number |\n|------|--------|\n| USER_ROLE_UNSPECIFIED | 0 |\n| USER_ROLE_ADMIN | 1 |\n| USER_ROLE_USER | 2 |\n```\n\n## JSON Schema\n\n### Detection\n\n```bash\n# Find JSON Schema files\nfind . -maxdepth 5 -type f -name \"*.schema.json\" 2>\u002Fdev\u002Fnull\nfind . -maxdepth 5 -type f -name \"*.json\" -exec grep -l '\"$schema\"' {} \\; 2>\u002Fdev\u002Fnull | head -20\n\n# Check for JSON Schema in config files\ngrep -rl '\"$schema\":\\|\"\\$ref\"' --include=\"*.json\" . 2>\u002Fdev\u002Fnull | head -20\n\n# Find JSON Schema in OpenAPI components (already covered above, but note cross-reference)\n```\n\n### Extraction\n\nFor each JSON Schema, extract:\n\n#### Type Definitions\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `type` | The data type (object, array, string, number, boolean, null) |\n| `properties` | Named fields with their own schemas |\n| `required` | Fields that must be present |\n| `additionalProperties` | Whether unknown fields are allowed |\n\n#### Validation Rules\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `minLength` \u002F `maxLength` | String length constraints |\n| `minimum` \u002F `maximum` | Numeric range constraints |\n| `pattern` | Regex validation for strings |\n| `format` | Semantic format (email, uri, date-time, uuid) |\n| `enum` | Allowed values |\n| `const` | Fixed required value |\n| `minItems` \u002F `maxItems` | Array length constraints |\n| `uniqueItems` | Whether array elements must be unique |\n\n#### Composition\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `$ref` | References to shared schema definitions |\n| `allOf` | Schema intersection (all must match) |\n| `anyOf` | Schema union (at least one must match) |\n| `oneOf` | Schema exclusive union (exactly one must match) |\n| `not` | Schema negation |\n| `if` \u002F `then` \u002F `else` | Conditional validation |\n\n#### Defaults and Examples\n\n| Element | What It Tells You |\n|---------|-------------------|\n| `default` | Default value when field is omitted |\n| `examples` | Example values (behavioral documentation) |\n| `description` | Human-readable behavioral description |\n\n### Output Format\n\nWrite to `workspace\u002Fpublic\u002Fcontracts\u002Fjson-schema-summary.md`:\n\n```markdown\n## JSON Schema: {title}\n\n### Type: CreateUserRequest\n| Property | Type | Required | Constraints | Default | Description |\n|----------|------|----------|-------------|---------|-------------|\n| email | string | yes | format: email | — | User email address |\n| name | string | yes | minLength: 1, maxLength: 100 | — | Display name |\n| role | string | no | enum: [admin, user, viewer] | \"user\" | User role |\n| tags | array of string | no | maxItems: 10, uniqueItems: true | [] | User tags |\n\n### Validation Rules\n- `email` must match email format (RFC 5322)\n- `name` must be 1-100 characters\n- `role` defaults to \"user\" when omitted\n- `tags` must contain unique strings, maximum 10\n```\n\n## Cross-Contract Correlation\n\nWhen multiple contract types are present (e.g., both OpenAPI and GraphQL, or OpenAPI with JSON Schema references), correlate them:\n\n- Do the endpoint definitions agree on field names and types?\n- Are the same data models defined consistently across contracts?\n- Do version numbers align?\n- Are there endpoints in one contract that are missing from another?\n\nDocument correlations and discrepancies in `workspace\u002Fpublic\u002Fcontracts\u002Fcross-contract-notes.md`.\n\n## Provenance Rules\n\n### Source Type\n\nAll claims from contract detection use `source=machine-readable-contract`:\n\n```markdown\n- The \u002Fusers endpoint accepts a `role` query parameter with values: admin, user, viewer\n  \u003C!-- cite: source=machine-readable-contract, ref=openapi.yaml:\u002Fpaths\u002F~1users\u002Fget\u002Fparameters\u002F0, confidence=confirmed, agent=contract-detector -->\n```\n\n### Confidence Levels\n\n- **confirmed** -- the behavioral claim is explicitly defined in the contract schema (endpoint exists, field has this type, parameter has this constraint). Machine-readable contracts are formal specifications; their explicit definitions are confirmed by definition.\n- **inferred** -- the behavioral claim is derived from contract structure rather than explicit definition (e.g., \"this API follows REST conventions\" inferred from path patterns)\n- **assumed** -- the behavioral claim extrapolates beyond what the contract defines (e.g., \"this endpoint probably supports pagination\" because similar endpoints do)\n\n### Cite As You Go\n\nEvery behavioral claim gets an inline citation immediately after the claim. The `ref` field should be `\u003Cfile-path>:\u003Cjson-path-or-line>`.\n\n## Output Structure\n\n```\nworkspace\u002Fpublic\u002Fcontracts\u002F\n    openapi-summary.md             # OpenAPI\u002FSwagger extraction\n    graphql-summary.md             # GraphQL schema extraction\n    protobuf-summary.md            # Protobuf\u002FgRPC extraction\n    json-schema-summary.md         # JSON Schema extraction\n    cross-contract-notes.md        # Correlations and discrepancies across contract types\n    raw\u002F                           # Copies of discovered contract files for reference\n        openapi.yaml\n        schema.graphql\n        service.proto\n        config.schema.json\n```\n\nNote: Output goes to `workspace\u002Fpublic\u002Fcontracts\u002F` -- not `workspace\u002Fraw\u002F`. Machine-readable contracts are published definitions intended for external consumption. They contain no proprietary implementation details.\n\n## Rules\n\n1. **Contracts are PUBLIC** -- machine-readable contracts are published interface definitions. Output goes to `workspace\u002Fpublic\u002F`, not `workspace\u002Fraw\u002F`.\n2. **Exhaustive extraction** -- extract EVERY endpoint, field, constraint, and error code. Contracts are finite and complete. Do not sample.\n3. **Preserve precision** -- contracts define exact types, constraints, and enums. Do not paraphrase \"minLength: 1, maxLength: 100\" as \"limited length.\" Preserve the exact constraints.\n4. **Note versions** -- contracts have version fields. Always record the version. Behavioral claims from contracts are version-specific.\n5. **Detect staleness** -- a contract file may be outdated relative to the implementation. Flag contracts that appear unmaintained (old modification dates, version mismatches with the codebase).\n6. **Copy originals** -- place copies of discovered contract files in `workspace\u002Fpublic\u002Fcontracts\u002Fraw\u002F` for downstream reference.\n7. **Cite as you go** -- every behavioral claim gets an inline `\u003C!-- cite: -->` comment immediately after the claim. Never defer citation to a later step.\n",{"name":5,"description":7},"main","728894f3f85fbd4e788f015ddfd72bb6155d5dd5","plugins\u002Fmoe-backstory\u002F.opencode\u002Fskills\u002Fcontract-detection",1,"https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe","https:\u002F\u002Fgithub.com\u002Fzak-keown","2026-09-05 06:29:06",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add zak-keown\u002Fmoe --skill contract-detection",{"tool":36,"command":37},"bunx","bunx skills add zak-keown\u002Fmoe --skill contract-detection",{"tool":39,"command":40},"pnpm","pnpm dlx skills add zak-keown\u002Fmoe --skill contract-detection","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fplugins\u002Fmoe-backstory\u002F.opencode\u002Fskills\u002Fcontract-detection\u002FSKILL.md",true,[],[45,52,59,66,73,80],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M7C1Z5362Y8NVRZ69HWP0ZD0","write-skill","Use when creating new skills, editing existing skills, or verifying skills work before deployment","https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fplugins\u002Fmoe\u002Fskills\u002Fwrite-skill\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":18},"01M7C1YZ9966WK9R6ZRPCGWF3G","write-plan","Use when you have a spec or requirements for a multi-step task, before touching code","https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fplugins\u002Fmoe\u002Fskills\u002Fwrite-plan\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":18},"01M7C1YMR4SJD7BPBBPXZCVGVH","write-clearly","Apply Strunk's timeless writing rules to ANY prose humans will read—documentation, commit messages, error messages, explanations, reports, or UI text. Makes your writing clearer, stronger, and more professional.","https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fplugins\u002Fmoe\u002Fskills\u002Fwrite-clearly\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":18},"01M7C1YH9805YSM0N20VQAVSXF","windows-vm","Create, manage, or connect to a headless Windows 11 VM running in Docker with SSH access. Use when the user wants to spin up, stop, restart, or SSH into a Windows VM.","https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fplugins\u002Fmoe\u002Fskills\u002Fwindows-vm\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M7C1YD87SCNEJ2C9B8HFR2NQ","verify-completion","Use when about to claim work is complete, fixed, or passing, before committing or creating MRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always","https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fplugins\u002Fmoe\u002Fskills\u002Fverify-completion\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":18},"01M7C1YARDEHT0TJ9BRG30ZCF4","using-moe","Use when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions","https:\u002F\u002Fgithub.com\u002Fzak-keown\u002Fmoe\u002Fblob\u002Fmain\u002Fplugins\u002Fmoe\u002Fskills\u002Fusing-moe\u002FSKILL.md",[],[]]