Knowledge base builder

From eddiebelaval/squire · View interactive version

Knowledge base builder is an AI agent skill from the GitHub repository eddiebelaval/squire. Build and maintain AI-accessible knowledge bases for projects

How to use this skill

Skill file

Knowledge Base Builder

The Knowledge Base Builder skill helps you create, structure, and maintain knowledge bases that AI agents can effectively query and utilize. It transforms scattered information—from project documentation to tribal knowledge—into organized, accessible knowledge that improves AI performance and team productivity.

This skill guides you through knowledge extraction, organization, structuring, and maintenance. It understands different knowledge formats (documentation, code comments, decision logs, schemas), helps you choose appropriate storage (markdown files, knowledge graphs, databases), and ensures knowledge remains current and useful.

Use this skill when starting new projects, onboarding AI to complex systems, preserving institutional knowledge, or improving AI agent effectiveness through better context.

Core Workflows

Workflow 1: Build Knowledge Base from Scratch

  1. Define knowledge base purpose:
  1. Identify knowledge sources:
  1. Extract relevant information:
  1. Structure the knowledge:
  1. Format for consumption:
  1. Populate the knowledge base:
  1. Validate accessibility:
  1. Establish maintenance process

Workflow 2: Extract Knowledge from Codebase

  1. Analyze codebase structure:
  1. Identify extractable knowledge:
  1. Generate documentation:
  1. Create knowledge graph:
  1. Link to code:
  1. Maintain synchronization:

Workflow 3: Organize Project Knowledge

  1. Audit existing knowledge:
  1. Define structure:
  1. Create core documents:
  1. Establish conventions:
  1. Populate with content:
  1. Integrate with AI:

Workflow 4: Build Knowledge Graph

  1. Identify entities:
  1. Define entity types:
  1. Extract observations:
  1. Map relationships:
  1. Store in knowledge graph:
  1. Query to validate:
  1. Maintain over time:

Workflow 5: Maintain Knowledge Base

  1. Monitor knowledge health:
  1. Update regularly:
  1. Review periodically:
  1. Optimize for consumption:
  1. Gather feedback:
  1. Iterate on structure:

Quick Reference

| Action | Command/Trigger |

|--------|-----------------|

| Build new knowledge base | "Build knowledge base for [project]" |

| Extract from codebase | "Extract knowledge from codebase" |

| Organize project docs | "Organize project knowledge" |

| Create knowledge graph | "Create knowledge graph for [domain]" |

| Update knowledge base | "Update knowledge base with [new info]" |

| Audit knowledge | "Audit knowledge base health" |

| Structure documentation | "Structure documentation for [project]" |

Best Practices

Knowledge Base Structure

Recommended File Organization

/docs
  /README.md                 # Project overview
  /ARCHITECTURE.md           # System design
  /DECISIONS.md              # ADRs (Architecture Decision Records)
  /PIPELINE_STATUS.md        # Current project state
  /CONTRIBUTING.md           # Development guide
  /API.md                    # API reference
  /DATABASE.md               # Schema documentation
  /DEPLOYMENT.md             # Deployment guide
  /TROUBLESHOOTING.md        # Common issues
  /guides/                   # How-to guides
    /getting-started.md
    /development-workflow.md
    /testing.md
  /reference/                # Technical reference
    /components.md
    /utilities.md
    /configurations.md
  /decisions/                # Detailed ADRs
    /001-framework-choice.md
    /002-state-management.md

Documentation Templates

ARCHITECTURE.md Template
# Architecture

## Overview
[High-level system description]

## System Components
- **Component 1**: [Purpose and responsibility]
- **Component 2**: [Purpose and responsibility]

## Data Flow
[How data moves through the system]

## Key Design Decisions
1. **[Decision]**: [Rationale]
2. **[Decision]**: [Rationale]

## Technology Stack
- Frontend: [Technologies]
- Backend: [Technologies]
- Database: [Technologies]
- Infrastructure: [Technologies]

## Integration Points
- [External service 1]: [How we integrate]
- [External service 2]: [How we integrate]

## Security Considerations
[Security architecture and patterns]

## Scalability & Performance
[How system scales, performance characteristics]
DECISIONS.md Template (ADR Log)
# Architecture Decision Records

## ADR-001: [Decision Title]
**Date**: YYYY-MM-DD
**Status**: Accepted | Proposed | Deprecated

**Context**:
[What is the issue we're trying to solve?]

**Decision**:
[What we decided to do]

**Consequences**:
- Positive: [Benefits]
- Negative: [Trade-offs]
- Neutral: [Other impacts]

**Alternatives Considered**:
1. [Alternative 1]: [Why rejected]
2. [Alternative 2]: [Why rejected]

---

## ADR-002: [Next Decision]
[...]
Component Documentation Template
# [Component Name]

## Purpose
[What this component does and why it exists]

## Location
`/path/to/component`

## Dependencies
- [Dependency 1]: [Why needed]
- [Dependency 2]: [Why needed]

## API
### Functions
- `functionName(params)`: [Description]

### Types
\`\`\`typescript
interface ComponentProps {
  // ...
}
\`\`\`

## Usage
\`\`\`typescript
// Example usage
\`\`\`

## Related Components
- [Component A]: [Relationship]
- [Component B]: [Relationship]

## Known Issues
- [Issue 1]: [Workaround]

Knowledge Graph Patterns

Entity Types for Software Projects

Project
  - name
  - description
  - status (active, maintenance, deprecated)
  - tech_stack

Component
  - name
  - type (service, module, function)
  - location (file path)
  - purpose
  - status

Person
  - name
  - role
  - expertise_areas
  - current_focus

Decision
  - title
  - date
  - status
  - context
  - choice
  - rationale

Process
  - name
  - type (workflow, procedure, standard)
  - steps
  - triggers
  - outputs

Dependency
  - name
  - version
  - purpose
  - critical (boolean)

Relationship Types

Project --depends_on--> Dependency
Project --contains--> Component
Component --uses--> Component
Component --implements--> Decision
Person --owns--> Component
Person --made--> Decision
Decision --supersedes--> Decision
Component --documented_in--> Document
Process --governs--> Component

Example Knowledge Graph Creation

// Create entities
await memory.create_entities({
  entities: [
    {
      name: "id8labs-app",
      entityType: "Project",
      observations: [
        "Next.js 14+ application",
        "Uses Supabase for backend",
        "Deployed on Vercel",
        "Monorepo structure"
      ]
    },
    {
      name: "authentication-module",
      entityType: "Component",
      observations: [
        "Located in /src/features/auth",
        "Handles user authentication via Supabase Auth",
        "Supports magic link and OAuth",
        "Implements RLS policies"
      ]
    }
  ]
});

// Create relationships
await memory.create_relations({
  relations: [
    {
      from: "id8labs-app",
      to: "authentication-module",
      relationType: "contains"
    },
    {
      from: "authentication-module",
      to: "Supabase Auth",
      relationType: "uses"
    }
  ]
});

Knowledge Extraction Techniques

From Code

From Conversations

From External Sources

Knowledge Quality Checklist

Good knowledge base entries should:

Maintenance Schedule

Daily

Weekly

Monthly

Quarterly

Tools & Technologies

Storage Options

| Tool | Best For | Format |

|------|----------|--------|

| Markdown files | Human-readable docs | .md files in repo |

| Memory MCP | AI-accessible relationships | Knowledge graph |

| Code comments | Implementation context | JSDoc, inline comments |

| OpenAPI/GraphQL | API contracts | YAML/JSON schemas |

| Mermaid | Visual diagrams | Diagram-as-code |

| Notion | Collaborative docs | Rich text, databases |

Generation Tools

Common Pitfalls

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.