All skills
ailabs-393 avatar

/codebase-documenter

@7d5342d

This skill should be used when writing documentation for codebases, including README files, architecture documentation, code comments, and API documentation. Use this skill when users request help documenting their code, creating getting-started guides, explaining project structure, or making codebases more accessible to new developers. The skill provides templates, best practices, and structured approaches for creating clear, beginner-friendly documentation.

Use this Skill: https://skilld.dev/gh/ailabs-393/ai-labs-claude-skills/codebase-documenter

This session only. Nothing lands on disk.

assetstemplatesAPI.template.md

≈3.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

API Documentation

Overview

This document provides comprehensive documentation for all API endpoints in [Project Name].

Base URL: https://api.example.com/v1

API Version: v1

Last Updated: [Date]

Table of Contents

Authentication

Authentication Method

This API uses [JWT/API Keys/OAuth/etc.] for authentication.

How to authenticate:

  1. [Step 1 to get credentials]
  2. [Step 2 to use credentials]

Example authentication header:

Authorization: Bearer YOUR_API_TOKEN_HERE

Getting your API token:

# Example command or process to obtain token
curl -X POST https://api.example.com/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "user@example.com", "password": "password123"}'

Response:

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expiresAt": "2024-12-31T23:59:59Z"
}

Error Handling

Error Response Format

All errors follow this format:

{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": {
      "field": "Additional context about the error"
    }
  }
}

Common Error Codes

Status Code Error Code Description Solution
400 INVALID_REQUEST Request validation failed Check request format and required fields
401 UNAUTHORIZED Authentication required or failed Provide valid authentication token
403 FORBIDDEN Insufficient permissions Check user permissions and role
404 NOT_FOUND Resource doesn't exist Verify resource ID and URL
429 RATE_LIMIT_EXCEEDED Too many requests Wait before retrying (check Retry-After header)
500 INTERNAL_ERROR Server error Contact support if persistent

Error Examples

401 Unauthorized:

{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or expired authentication token"
  }
}

400 Invalid Request:

{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "Validation failed",
    "details": {
      "email": "Invalid email format",
      "age": "Must be a positive number"
    }
  }
}

Rate Limiting

Rate limits:

  • Authenticated requests: 1000 requests per hour
  • Unauthenticated requests: 100 requests per hour

Rate limit headers:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640995200

When rate limited:

  • Status code: 429 Too Many Requests
  • Response includes Retry-After header (seconds until reset)

Endpoints


[Resource 1 - e.g., Users]

List [Resources]

Retrieve a paginated list of [resources].

Endpoint:

GET /api/v1/[resources]

Authentication: Required

Query Parameters:

Parameter Type Required Default Description
page integer No 1 Page number for pagination
limit integer No 20 Number of items per page (max 100)
sort string No created_at Sort field (e.g., name, created_at)
order string No desc Sort order (asc or desc)
filter string No - Filter by [field]

Example Request:

curl -X GET "https://api.example.com/v1/users?page=1&limit=10&sort=created_at&order=desc" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Example Response:

{
  "data": [
    {
      "id": "usr_123abc",
      "name": "John Doe",
      "email": "john@example.com",
      "role": "admin",
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T10:30:00Z"
    },
    {
      "id": "usr_456def",
      "name": "Jane Smith",
      "email": "jane@example.com",
      "role": "user",
      "created_at": "2024-01-14T15:20:00Z",
      "updated_at": "2024-01-14T15:20:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 42,
    "pages": 5
  }
}

Response Fields:

Field Type Description
id string Unique identifier
name string [Resource] name
email string Email address
role string User role (admin, user, viewer)
created_at string (ISO 8601) Creation timestamp
updated_at string (ISO 8601) Last update timestamp

Get [Resource]

Retrieve a single [resource] by ID.

Endpoint:

GET /api/v1/[resources]/{id}

Authentication: Required

Path Parameters:

Parameter Type Required Description
id string Yes [Resource] unique identifier

Example Request:

curl -X GET "https://api.example.com/v1/users/usr_123abc" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Example Response:

{
  "id": "usr_123abc",
  "name": "John Doe",
  "email": "john@example.com",
  "role": "admin",
  "profile": {
    "bio": "Software developer",
    "location": "San Francisco, CA"
  },
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

Possible Errors:

  • 404 NOT_FOUND - [Resource] with specified ID doesn't exist
  • 401 UNAUTHORIZED - Invalid or missing authentication token
  • 403 FORBIDDEN - Insufficient permissions to view this [resource]

Create [Resource]

Create a new [resource].

Endpoint:

POST /api/v1/[resources]

Authentication: Required

Request Body:

Field Type Required Description
name string Yes [Resource] name (3-100 characters)
email string Yes Valid email address
role string No User role (default: user)
profile object No Additional profile information

Example Request:

curl -X POST "https://api.example.com/v1/users" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Alice Johnson",
    "email": "alice@example.com",
    "role": "user",
    "profile": {
      "bio": "Product designer",
      "location": "New York, NY"
    }
  }'

Example Response:

{
  "id": "usr_789ghi",
  "name": "Alice Johnson",
  "email": "alice@example.com",
  "role": "user",
  "profile": {
    "bio": "Product designer",
    "location": "New York, NY"
  },
  "created_at": "2024-01-16T14:20:00Z",
  "updated_at": "2024-01-16T14:20:00Z"
}

Possible Errors:

  • 400 INVALID_REQUEST - Validation failed (see error details)
  • 401 UNAUTHORIZED - Invalid or missing authentication token
  • 403 FORBIDDEN - Insufficient permissions to create [resource]
  • 409 CONFLICT - [Resource] with this email already exists

Update [Resource]

Update an existing [resource].

Endpoint:

PATCH /api/v1/[resources]/{id}

Authentication: Required

Path Parameters:

Parameter Type Required Description
id string Yes [Resource] unique identifier

Request Body:

Field Type Required Description
name string No [Resource] name (3-100 characters)
email string No Valid email address
role string No User role
profile object No Additional profile information

Note: Only include fields you want to update. Omitted fields remain unchanged.

Example Request:

curl -X PATCH "https://api.example.com/v1/users/usr_123abc" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "role": "admin",
    "profile": {
      "bio": "Senior Software Developer"
    }
  }'

Example Response:

{
  "id": "usr_123abc",
  "name": "John Doe",
  "email": "john@example.com",
  "role": "admin",
  "profile": {
    "bio": "Senior Software Developer",
    "location": "San Francisco, CA"
  },
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-16T15:00:00Z"
}

Possible Errors:

  • 400 INVALID_REQUEST - Validation failed
  • 401 UNAUTHORIZED - Invalid or missing authentication token
  • 403 FORBIDDEN - Insufficient permissions to update this [resource]
  • 404 NOT_FOUND - [Resource] with specified ID doesn't exist

Delete [Resource]

Delete a [resource].

Endpoint:

DELETE /api/v1/[resources]/{id}

Authentication: Required

Path Parameters:

Parameter Type Required Description
id string Yes [Resource] unique identifier

Example Request:

curl -X DELETE "https://api.example.com/v1/users/usr_123abc" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Example Response:

{
  "success": true,
  "message": "[Resource] deleted successfully"
}

Possible Errors:

  • 401 UNAUTHORIZED - Invalid or missing authentication token
  • 403 FORBIDDEN - Insufficient permissions to delete this [resource]
  • 404 NOT_FOUND - [Resource] with specified ID doesn't exist

[Resource 2 - e.g., Projects]

[Repeat the same pattern for another resource: List, Get, Create, Update, Delete]


Webhooks

Overview

[If your API supports webhooks, document them here]

Webhook endpoint requirements:

  • Must accept POST requests
  • Must respond with 200 status within 5 seconds
  • Must use HTTPS

Available Events

Event Description Triggered When
[resource].created [Resource] was created New [resource] is created
[resource].updated [Resource] was updated [Resource] is modified
[resource].deleted [Resource] was deleted [Resource] is deleted

Webhook Payload

{
  "event": "[resource].created",
  "timestamp": "2024-01-16T15:30:00Z",
  "data": {
    "id": "usr_123abc",
    "name": "John Doe",
    "email": "john@example.com"
  }
}

Verifying Webhooks

[Explain how to verify webhook authenticity, e.g., signature verification]


SDK Examples

JavaScript/TypeScript

// Install: npm install @example/api-client

import { APIClient } from '@example/api-client';

const client = new APIClient({
  apiKey: 'YOUR_API_TOKEN'
});

// List resources
const users = await client.users.list({
  page: 1,
  limit: 10
});

// Get single resource
const user = await client.users.get('usr_123abc');

// Create resource
const newUser = await client.users.create({
  name: 'Alice Johnson',
  email: 'alice@example.com'
});

// Update resource
const updatedUser = await client.users.update('usr_123abc', {
  role: 'admin'
});

// Delete resource
await client.users.delete('usr_123abc');

Python

# Install: pip install example-api-client

from example_api import APIClient

client = APIClient(api_key='YOUR_API_TOKEN')

# List resources
users = client.users.list(page=1, limit=10)

# Get single resource
user = client.users.get('usr_123abc')

# Create resource
new_user = client.users.create(
    name='Alice Johnson',
    email='alice@example.com'
)

# Update resource
updated_user = client.users.update(
    'usr_123abc',
    role='admin'
)

# Delete resource
client.users.delete('usr_123abc')

Best Practices

Pagination

Always paginate list endpoints to avoid performance issues:

  • Use limit parameter to control page size
  • Don't request more than 100 items per page
  • Use page parameter for subsequent pages

Error Handling

Implement proper error handling:

try {
  const user = await client.users.get('usr_123abc');
} catch (error) {
  if (error.code === 'NOT_FOUND') {
    console.log('User not found');
  } else if (error.code === 'UNAUTHORIZED') {
    console.log('Authentication failed');
  } else {
    console.log('Unexpected error:', error.message);
  }
}

Rate Limiting

Monitor rate limit headers and implement backoff:

const response = await fetch(url, options);
const remaining = response.headers.get('X-RateLimit-Remaining');

if (remaining < 10) {
  console.warn('Approaching rate limit');
}

Support

Questions or issues?

  • Documentation: [link]
  • Support email: [email]
  • Community forum: [link]
  • Issue tracker: [link]

API Status:

  • Status page: [link]
  • Uptime: [link]

Source: SKILL.md on GitHub

1 warning14d5 checks · Risk SAFE
  • Gen Agent Trust Hub14d

    The skill is a documentation tool providing templates for READMEs, architecture guides, and API documentation. It has an inherent attack surface for indirect prompt injection because it processes untrusted codebase content without explicit boundary markers or sanitization, potentially allowing malicious code to influence the agent's behavior during documentation generation.

  • Socket14d

    No alerts

  • Snyk14d

    Risk: LOW · No issues

  • Runlayer7mo

    9/9 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 7d5342d. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 11 months ago

README badge

README badge for ailabs-393/ai-labs-claude-skills/codebase-documenter