Agent SkillsAgent Skills
arpa73

documentation-management

@arpa73/documentation-management
arpa73
2
0 forks
Updated 4/1/2026
View on GitHub

Maintain AI-optimized documentation and organize codebase history for gnwebsite project. Use when updating docs, organizing changelog, improving readability for AI agents, or when documentation becomes too large. Covers changelog archiving, AI-friendly writing patterns, semantic structure, and knowledge retrieval optimization. Ensures documentation stays readable and discoverable for both humans and AI systems.

Installation

$npx agent-skills-cli install @arpa73/documentation-management
Claude Code
Cursor
Copilot
Codex
Antigravity

Details

Path.github/skills.backup/documentation-management/SKILL.md
Branchmain
Scoped Name@arpa73/documentation-management

Usage

After installing, this skill will be available to your AI coding assistant.

Verify installation:

npx agent-skills-cli list

Skill Instructions


name: documentation-management description: Maintain AI-optimized documentation and organize codebase history for gnwebsite project. Use when updating docs, organizing changelog, improving readability for AI agents, or when documentation becomes too large. Covers changelog archiving, AI-friendly writing patterns, semantic structure, and knowledge retrieval optimization. Ensures documentation stays readable and discoverable for both humans and AI systems.

Documentation Management

Comprehensive guide for maintaining high-quality, AI-optimized documentation and managing growing codebase history in gnwebsite project.

When to Use This Skill

  • User asks to "update documentation" or "organize the changelog"
  • Changelog exceeds 1500 lines or 6 months of sessions
  • Documentation becomes hard to navigate or retrieve information from
  • After major architectural changes or refactors
  • When implementing new patterns that should be documented
  • Creating or updating technical documentation for AI consumption
  • When you hear: "The changelog is too big" or "Make docs more readable"

Core Principles

  1. AI-Optimized: Write for both humans and AI retrieval systems
  2. Self-Contained: Each section should work independently
  3. Explicit Context: Never rely on implicit knowledge or visual cues
  4. Hierarchical: Clear structure with semantic headings
  5. Discoverable: Use consistent terminology for semantic search
  6. Archived: Rotate old changelog entries to maintain readability

Documentation Philosophy (From kapa.ai Best Practices)

How AI Systems Process Documentation

AI agents use Retrieval-Augmented Generation (RAG) which works in three steps:

  1. Chunking: Documents are divided into smaller, focused sections
  2. Retrieval: Semantic search finds relevant chunks matching the query
  3. Generation: LLM uses retrieved chunks to construct answers

Critical implications:

  • βœ… Sections must be self-contained (can't assume linear reading)
  • βœ… Context must be explicit (AI can't infer unstated information)
  • βœ… Related info must be proximate (chunking may separate distant content)
  • βœ… Terminology must be consistent (enables semantic discoverability)

AI-Friendly Writing Patterns

1. Self-Contained Sections

❌ Context-Dependent (Bad):

## Updating Webhook URLs

Now change the endpoint to your new URL and save the configuration.

βœ… Self-Contained (Good):

## Updating Django Webhook URLs in gnwebsite

To update webhook endpoints in gnwebsite backend:

1. Navigate to Admin Panel β†’ Webhooks
2. Select the webhook to modify
3. Change endpoint URL field to new address
4. Click "Save" to apply changes

**Location**: `/panel-0911/webhooks/`
**Model**: `jewelry_portfolio.models.WebhookConfig`

Why: AI retrieves sections based on relevance, not document order. Include essential context (what system, where to find, complete steps).

2. Explicit Terminology

❌ Vague References (Bad):

## Configure Timeouts

Configure custom timeout settings through the admin panel.

βœ… Explicit Product/Feature Names (Good):

## Configure Django API Timeouts in gnwebsite

Configure custom timeout settings for Django REST Framework endpoints:

- **Frontend API calls**: `axios` timeout in `frontend/src/api/index.ts`
- **Backend Gunicorn**: `timeout = 30` in `gunicorn.conf.py`
- **Nginx proxy**: `proxy_read_timeout 30s` in `nginx.conf`

Why: Product-specific terms improve semantic search. "Django" and "gnwebsite" create clear signals for retrieval.

3. Proximate Context

❌ Scattered Information (Bad):

Authentication tokens expire after 24 hours by default.

The system provides several configuration options for different environments.

When implementing the login flow, ensure you handle this appropriately.

βœ… Context Proximity (Good):

Authentication tokens expire after 24 hours by default. When implementing the 
login flow in gnwebsite, handle token expiration by:

1. Refreshing tokens before 24-hour limit (recommended: 23 hours)
2. Implementing error handling for expired token responses (401 errors)
3. Redirecting to login on token expiration

**Configuration**: `SIMPLE_JWT['ACCESS_TOKEN_LIFETIME']` in `settings.py`

Why: Keeping constraints near implementation guidance ensures they stay together during chunking.

4. Text Equivalents for Visuals

❌ Visual-Dependent (Bad):

See the diagram below for the complete API workflow:

![Complex flowchart](workflow.png)

Follow these steps to implement the integration.

βœ… Text-Based Alternative (Good):

## gnwebsite OpenAPI Client Generation Workflow

The backend β†’ frontend API sync follows this workflow:

1. **Update Backend**: Modify Django models/serializers/views
2. **Run Tests**: `docker-compose exec backend pytest jewelry_portfolio/ -x`
3. **Generate Schema**: `python manage.py spectacular --file openapi_schema.json`
4. **Generate Client**: `npx @openapitools/openapi-generator-cli generate ...`
5. **Type Check**: `cd frontend && npm run type-check`
6. **Update Services**: Modify service wrappers to use new types
7. **Test Frontend**: `npm run test:run`
8. **Commit Both**: `git add backend/openapi_schema.json frontend/src/api/generated/`

![API workflow diagram](workflow.png)
_Visual representation of the workflow steps above_

Why: AI can't parse images. Text-based workflows are fully discoverable.

5. Error Messages with Context

❌ Generic Troubleshooting (Bad):

## Connection Problems

If the connection fails, check your network settings.

βœ… Specific Error Context (Good):

## Django Database Connection Errors in gnwebsite

### Error: "django.db.utils.OperationalError: could not connect to server"

**Cause**: PostgreSQL container not running or wrong credentials

**Solution**:
1. Check container status: `docker-compose ps`
2. Restart services: `docker-compose up -d`
3. Verify `DATABASE_URL` in `backend/.env`
4. Check PostgreSQL logs: `docker-compose logs backend`

### Error: "relation does not exist"

**Cause**: Missing migrations

**Solution**:
1. Run migrations: `docker-compose exec backend python manage.py migrate`
2. Verify migration files exist in `backend/jewelry_portfolio/migrations/`

Why: Users search by copying exact error messages. Including them improves discoverability.

6. Hierarchical Structure

βœ… Good Information Architecture:

# Django Authentication (Product Family)
## HttpOnly Cookie JWT Flow (Specific Feature)
### Setup Instructions (Functional Context)
#### Backend Configuration (Component)
#### Frontend Configuration (Component)
### Troubleshooting (Functional Context)
#### Token Expiration Issues (Specific Problem)
#### CORS Configuration (Specific Problem)

Why: URL paths, document titles, and headings provide contextual metadata for retrieval.

Changelog Management

When to Archive

Archive changelog entries when:

  • βœ… File exceeds 1500 lines (currently at 1879 lines!)
  • βœ… Sessions older than 6 months
  • βœ… Historical sessions not referenced in recent work
  • βœ… Patterns documented in CODEBASE_ESSENTIALS.md

Current status: CODEBASE_CHANGELOG.md has 1879 lines β†’ Archive needed!

Archive Structure

docs/changelog/
β”œβ”€β”€ 2026-Q1.md          # Jan-Mar 2026
β”œβ”€β”€ 2025-Q4.md          # Oct-Dec 2025
β”œβ”€β”€ 2025-Q3.md          # Jul-Sep 2025
└── archive-index.md    # Summary of all archived periods

Archive Procedure

Step 1: Create Archive File

# Create quarterly archive
mkdir -p docs/changelog
touch docs/changelog/2026-Q1.md

Step 2: Move Old Sessions

Identify sessions older than 3 months:

# Example: Moving sessions from Oct-Dec 2025 to archive
# Cut from CODEBASE_CHANGELOG.md, paste to docs/changelog/2025-Q4.md

Archive file template:

# GN Website Changelog - 2025 Q4 (Oct-Dec)

Historical session notes from October-December 2025. For current patterns, see `CODEBASE_ESSENTIALS.md`.

**Archive Period**: October 1 - December 31, 2025
**Total Sessions**: 24
**Major Themes**: Authentication refactor, image optimization, tag system

---

## Session: [Title] (Dec 15, 2025)
[Full session content...]

---

## Session: [Title] (Dec 10, 2025)
[Full session content...]

Step 3: Update Main Changelog Header

# GN Website Changelog

Historical session notes and detailed changes. For current patterns and invariants, see `CODEBASE_ESSENTIALS.md`.

**Recent Sessions**: Last 3 months (current file)
**Older Sessions**: See [docs/changelog/](docs/changelog/) for quarterly archives

---

[Keep only recent sessions here]

Step 4: Create Archive Index

# Changelog Archive Index

Historical changelog organized by quarter. For current sessions, see main `CODEBASE_CHANGELOG.md`.

## 2026

### [Q1 (Jan-Mar)](2026-Q1.md)
- Dependency updates skill creation
- WYSIWYG image tracking
- Tag masonry performance optimization
- **Sessions**: 12

## 2025

### [Q4 (Oct-Dec)](2025-Q4.md)
- Privacy policy feature
- Pagination UI implementation
- Authentication refactor
- **Sessions**: 24

### [Q3 (Jul-Sep)](2025-Q3.md)
- Initial project setup
- Django + Vue architecture
- **Sessions**: 18

Archiving Best Practices

What to Archive:

  • βœ… Sessions older than 3-6 months
  • βœ… Completed features fully documented elsewhere
  • βœ… Historical debugging sessions
  • βœ… Temporary workarounds that were replaced

What NOT to Archive:

  • ❌ Sessions documenting current patterns
  • ❌ Recent architectural decisions
  • ❌ Frequently referenced sessions
  • ❌ Last 3 months of work

Archive Naming:

  • YYYY-QN.md for quarterly archives (e.g., 2026-Q1.md)
  • YYYY-MM.md for monthly archives if needed (high activity periods)
  • archive-index.md for searchable summary

Documentation Update Workflow

After Implementing Features

  1. Update CODEBASE_ESSENTIALS.md if patterns changed:

    ## Critical Patterns & Invariants
    - **New Pattern**: Description with examples
    - Link to reference implementation
    
  2. Add Changelog Entry (MANDATORY for significant changes):

    ## Session: [Brief Title] (MMM D, YYYY)
    
    **Goal**: One sentence description
    
    **Changes**:
    - [file/path.ts](file/path.ts#L123): What changed and why
    
    **Validation**:
    - βœ… Backend tests: X passed
    - βœ… Frontend tests: X passed
    
    **Key Learning**: Pattern or gotcha for future reference
    
  3. Create Detailed Docs for complex features:

    docs/
    β”œβ”€β”€ components/COMPONENT_NAME.md
    β”œβ”€β”€ patterns/PATTERN_NAME.md
    β”œβ”€β”€ guides/GUIDE_NAME.md
    └── incidents/INCIDENT_NAME.md
    

Documentation File Structure

docs/
β”œβ”€β”€ README.md                    # Documentation index
β”œβ”€β”€ architecture/                # System design docs
β”‚   β”œβ”€β”€ OVERVIEW.md
β”‚   └── DATA_FLOW.md
β”œβ”€β”€ components/                  # Component-specific docs
β”‚   β”œβ”€β”€ TURBULENT_DISSOLVE_IMAGE.md
β”‚   └── PAGINATION_CONTROLS.md
β”œβ”€β”€ deployment/                  # Deployment guides
β”‚   β”œβ”€β”€ RAILWAY.md
β”‚   └── PRODUCTION.md
β”œβ”€β”€ guides/                      # How-to guides
β”‚   β”œβ”€β”€ DEVELOPER_CHECKLIST.md
β”‚   β”œβ”€β”€ TESTING_STRATEGY.md
β”‚   └── AI_AGENT_PERCEPTION.md
β”œβ”€β”€ incidents/                   # Problem + solution docs
β”‚   └── RAILWAY_DYNAMIC_IMPORT_FAILURE.md
β”œβ”€β”€ patterns/                    # Reusable patterns
β”‚   β”œβ”€β”€ TWO_STAGE_UPLOAD_TESTING.md
β”‚   └── UNIFIED_IMAGE_ARRAY_REFACTOR.md
β”œβ”€β”€ planning/                    # Planning documents
β”‚   └── FEATURE_ROADMAP.md
β”œβ”€β”€ privacy/                     # Legal/compliance docs
β”‚   └── privacy_and_cookie_policy.md
β”œβ”€β”€ reference/                   # API references
β”‚   └── MAILERLITE_INTEGRATION.md
β”œβ”€β”€ reviews/                     # Code review guidelines
β”‚   └── PULL_REQUEST_TEMPLATE.md
└── changelog/                   # Archived changelogs
    β”œβ”€β”€ archive-index.md
    β”œβ”€β”€ 2026-Q1.md
    └── 2025-Q4.md

Documentation Quality Checklist

Before finalizing any documentation:

Structure

  • Uses semantic headings (H1 β†’ H2 β†’ H3, no skips)
  • Each section is self-contained
  • Related information is proximate (same section/paragraph)
  • Hierarchical structure reflects logical relationships

Content

  • Includes explicit product/feature names (gnwebsite, Django, Vue)
  • No reliance on visual layout or positioning
  • Error messages quoted exactly with solutions
  • Prerequisites stated explicitly (no assumptions)
  • Text alternatives for any diagrams/images

Discoverability

  • Consistent terminology throughout
  • Keywords appear in headings and first paragraph
  • Cross-links to related documentation
  • Examples include actual code/commands

AI Optimization

  • Sections work when read in isolation
  • No references like "as mentioned above" without repeating context
  • Code examples include language identifiers (python, typescript)
  • File paths use absolute paths from project root

Common Documentation Anti-Patterns

❌ Contextual Dependencies

Bad: "Now update the configuration we set up earlier."

Good: "Update the Django settings in backend/gnwebsite_config/settings.py..."

❌ Implicit Knowledge

Bad: "Run the standard Django commands."

Good:

# Apply database migrations
docker-compose exec backend python manage.py migrate

# Collect static files
docker-compose exec backend python manage.py collectstatic --noinput

❌ Visual-Only Information

Bad: Tables with merged cells and complex layouts

Good: Structured lists with repeated context:

### Django Environment Variables

**DATABASE_URL**
- Purpose: PostgreSQL connection string
- Format: `postgresql://user:pass@host:5432/dbname`
- Required: βœ… Production, ❌ Development (uses SQLite)

**SECRET_KEY**
- Purpose: Django cryptographic signing
- Format: 50+ character random string
- Required: βœ… Always

❌ Scattered Prerequisites

Bad: Prerequisites in introduction, setup in middle, troubleshooting at end

Good: Self-contained sections with inline prerequisites:

## Setting Up Django Webhooks in gnwebsite

**Prerequisites** (check before proceeding):
- βœ… Django admin access (`/panel-0911/`)
- βœ… Valid HTTPS endpoint with SSL certificate
- βœ… gnwebsite API credentials

**Steps**:
1. Navigate to Admin Panel β†’ Settings β†’ Webhooks
2. ...

Template: Changelog Session Entry

## Session: [Brief Descriptive Title] (MMM D, YYYY)

**Goal**: One-sentence description of what this session accomplished

**Problem** (if fixing a bug/issue):
Brief description of the problem that required fixing

**Changes**:

- [backend/path/to/file.py](backend/path/to/file.py#L123-L145): **CREATED/UPDATED/FIXED**
  - What changed at this location
  - Why it was necessary
  - Key implementation details

- [frontend/src/path/to/component.vue](frontend/src/path/to/component.vue):
  - What changed
  - Pattern used (link to CODEBASE_ESSENTIALS.md if relevant)

**Validation**:
- βœ… Backend tests: X passed, Y skipped
- βœ… Frontend tests: X passed
- βœ… TypeScript: No errors
- βœ… Manual testing: Description of what was tested

**Key Learning**: 
Pattern, gotcha, or insight that should be remembered for future work. This often becomes a candidate for CODEBASE_ESSENTIALS.md.

**References** (optional):
- Link to related OpenSpec proposals
- Link to detailed documentation in docs/
- Link to related incidents or patterns

Template: Feature Documentation

# [Feature Name]

Brief overview of what this feature does and why it exists.

## Overview

- **Purpose**: What problem does this solve?
- **Users**: Who uses this feature?
- **Location**: Where in the app is this feature?

## Architecture

### Backend (Django)

**Models**: `jewelry_portfolio.models.FeatureName`
- Fields and relationships
- Key methods and their purpose

**API Endpoints**: `/api/feature/`
- GET: Retrieve feature data
- POST: Create new feature
- PUT/PATCH: Update feature
- DELETE: Remove feature

**Permissions**: `IsAdminOrReadOnly`

### Frontend (Vue 3)

**Views**:
- `FeatureView.vue` - Public view at `/feature`
- `FeatureForm.vue` - Admin editor at `/panel-0911/feature`

**Services**: `featureService.ts`
- API wrapper methods
- Type definitions

**Components**:
- `FeatureCard.vue` - Display component
- `FeatureEditor.vue` - Editing component

## Usage Examples

### Retrieving Feature Data

```typescript
import { featureService } from '@/services/featureService'

const data = await featureService.get()
console.log(data.value)

Admin Updates

const updated = await featureService.update({
  field: 'new value',
  anotherField: 123
})

Testing

Backend Tests

Location: backend/jewelry_portfolio/test_feature.py

# Run feature tests
docker-compose exec backend pytest jewelry_portfolio/test_feature.py -v

Coverage:

  • Model CRUD operations
  • API permissions (public/admin)
  • Serialization/validation
  • Edge cases

Frontend Tests

Location: frontend/tests/feature.test.ts

# Run feature tests
cd frontend && npm run test:run tests/feature.test.ts

Coverage:

  • Component rendering
  • API integration
  • Error handling
  • User interactions

Common Patterns

Pattern 1: [Name]

When to use: Description

Example:

# Backend example
// Frontend example

Troubleshooting

Error: "[Exact Error Message]"

Cause: What causes this error

Solution:

  1. Step-by-step fix
  2. With commands
  3. And verification

Related Documentation


## Changelog Archiving Checklist

When archiving old changelog entries:

- [ ] Identify sessions older than 3-6 months
- [ ] Create quarterly archive file: `docs/changelog/YYYY-QN.md`
- [ ] Copy archive header template with period, session count, themes
- [ ] Move old sessions from CODEBASE_CHANGELOG.md to archive
- [ ] Update main changelog header with archive reference
- [ ] Create/update `docs/changelog/archive-index.md` with summary
- [ ] Verify links to archived sessions still work
- [ ] Test that recent sessions remain easily accessible
- [ ] Commit with message: `docs: archive changelog Q[N] YYYY (X sessions)`

## Integration with Other Skills

- **After features**: Use [feature-implementation](../feature-implementation/SKILL.md) β†’ then update docs
- **Before archiving**: Check [developer-checklist](../developer-checklist/SKILL.md) for recent patterns
- **Creating skills**: Use [skill-creator](../skill-creator/SKILL.md) to convert docs into skills

## Related Files

- [CODEBASE_ESSENTIALS.md](../../../CODEBASE_ESSENTIALS.md) - Current patterns and invariants
- [CODEBASE_CHANGELOG.md](../../../CODEBASE_CHANGELOG.md) - Recent session history
- [docs/README.md](../../../docs/README.md) - Documentation index
- [AGENTS.md](../../../AGENTS.md) - AI agent workflow instructions

## Quick Reference

### Archive Changelog (When > 1500 lines)

```bash
# 1. Create archive directory
mkdir -p docs/changelog

# 2. Create quarterly archive
cat > docs/changelog/2026-Q1.md << 'EOF'
# GN Website Changelog - 2026 Q1 (Jan-Mar)

**Archive Period**: January 1 - March 31, 2026
**Total Sessions**: 12
**Major Themes**: Dependency management, image tracking, performance

---

[Move old sessions here]
EOF

# 3. Update main changelog header
# Remove old sessions (keep last 3 months)

# 4. Create/update index
cat > docs/changelog/archive-index.md << 'EOF'
# Changelog Archive Index

## 2026
### [Q1 (Jan-Mar)](2026-Q1.md) - 12 sessions
EOF

# 5. Commit
git add docs/changelog/ CODEBASE_CHANGELOG.md
git commit -m "docs: archive changelog Q1 2026 (12 sessions)"

Create Feature Documentation

# Create component doc
cat > docs/components/COMPONENT_NAME.md << 'EOF'
# Component Name

Brief overview...

## Architecture
...
EOF

# Create pattern doc
cat > docs/patterns/PATTERN_NAME.md << 'EOF'
# Pattern Name

When to use this pattern...
EOF

Update CODEBASE_ESSENTIALS.md

## Critical Patterns & Invariants
- **New Pattern Name**: Description
  - βœ… **DO:** Good practice
  - ❌ **DON'T:** Anti-pattern
  - **Reference**: [ComponentName.vue](path/to/file.vue)