|
| 1 | +# Document Forge |
| 2 | + |
| 3 | +**AI-Powered Document Creation Studio built with Spring AI** |
| 4 | + |
| 5 | +*"Describe it. Download it."* |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +Document Forge is a demo application showcasing [Claude Skills](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview) integration with [Spring AI](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/chat/anthropic-chat.html#_skills). |
| 10 | +Describe documents in natural language and receive real, downloadable files generated by Claude. |
| 11 | + |
| 12 | +### Supported Document Types |
| 13 | + |
| 14 | +| Type | Extension | Description | |
| 15 | +|------|-----------|-------------| |
| 16 | +| Excel | `.xlsx` | Spreadsheets with data, formulas, and formatting | |
| 17 | +| PowerPoint | `.pptx` | Presentations with slides and layouts | |
| 18 | +| Word | `.docx` | Documents with formatting and structure | |
| 19 | +| PDF | `.pdf` | Portable document format | |
| 20 | + |
| 21 | +## Screenshots |
| 22 | + |
| 23 | + |
| 24 | +*Select document type and describe what you want* |
| 25 | + |
| 26 | + |
| 27 | +*Claude generates your document using Skills* |
| 28 | + |
| 29 | + |
| 30 | +*Download your generated document* |
| 31 | + |
| 32 | +## Quick Start |
| 33 | + |
| 34 | +### Prerequisites |
| 35 | + |
| 36 | +- Java 21+ |
| 37 | +- Maven 3.9+ |
| 38 | +- Anthropic API Key |
| 39 | + |
| 40 | +### Run |
| 41 | + |
| 42 | +```bash |
| 43 | +export ANTHROPIC_API_KEY=your-api-key-here |
| 44 | +./mvnw spring-boot:run |
| 45 | +``` |
| 46 | + |
| 47 | +Open http://localhost:8080 |
| 48 | + |
| 49 | +## Features |
| 50 | + |
| 51 | +- **Natural Language Input** - Describe what you want in plain English |
| 52 | +- **Real File Generation** - Get actual downloadable files, not just descriptions |
| 53 | +- **Source Document Upload** - Upload PDF, TXT, CSV, JSON, XML, or MD files for Claude to transform |
| 54 | +- **Custom Skills Support** - Apply custom branding or formatting via Anthropic custom skills |
| 55 | +- **History Sidebar** - View past generations and re-download files |
| 56 | +- **Async Generation** - PowerPoint presentations run in the background with completion notifications |
| 57 | + |
| 58 | +## Custom Skills Integration |
| 59 | + |
| 60 | +Document Forge demonstrates combining pre-built Anthropic skills with custom skills. |
| 61 | +An example custom skill is included in `custom-skills/watermark/SKILL.md`. |
| 62 | + |
| 63 | +### Setting Up the Custom Skill |
| 64 | + |
| 65 | +1. **Upload the skill to Anthropic:** |
| 66 | + |
| 67 | +```bash |
| 68 | +cd custom-skills/watermark |
| 69 | + |
| 70 | +curl -X POST "https://api.anthropic.com/v1/skills" \ |
| 71 | + -H "x-api-key: $ANTHROPIC_API_KEY" \ |
| 72 | + -H "anthropic-version: 2023-06-01" \ |
| 73 | + -H "anthropic-beta: skills-2025-10-02" \ |
| 74 | + -F "display_title=Document Watermark" \ |
| 75 | + -F "files[]=@SKILL.md;filename=document-watermark/SKILL.md" |
| 76 | +``` |
| 77 | + |
| 78 | +2. **Copy the skill ID from the response** (e.g., `skill_01AbCdEfGhIjKlMnOpQrStUv`) |
| 79 | + |
| 80 | +3. **Set the environment variable:** |
| 81 | + |
| 82 | +```bash |
| 83 | +export CUSTOM_SKILL_ID=skill_01AbCdEfGhIjKlMnOpQrStUv |
| 84 | +``` |
| 85 | + |
| 86 | +4. **Run the application** - The "Apply custom branding" checkbox will now appear in the UI |
| 87 | + |
| 88 | +### Without Custom Skills |
| 89 | + |
| 90 | +If `CUSTOM_SKILL_ID` is not set, the application works normally with pre-built skills only. |
| 91 | +The custom branding checkbox will not be shown. |
| 92 | + |
| 93 | +See the [Spring AI Custom Skills documentation](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/chat/anthropic-chat.html#_custom_skills) for more details. |
| 94 | + |
| 95 | +## Usage Examples |
| 96 | + |
| 97 | +**Excel - Sales Report** |
| 98 | +> "Create a sales report for Q4 2024 with monthly revenue, expenses, and profit columns." |
| 99 | +
|
| 100 | +**PowerPoint - Pitch Deck** |
| 101 | +> "Create a 5-slide presentation for a startup called 'GreenTech' that makes sustainable packaging." |
| 102 | +
|
| 103 | +**Word - Cover Letter** |
| 104 | +> "Write a professional cover letter for a software engineering position. The candidate has 5 years of experience with Java and Spring Boot." |
| 105 | +
|
| 106 | +**PDF - Invoice** |
| 107 | +> "Create an invoice for 40 hours of consulting at $150/hour with standard payment terms." |
| 108 | +
|
| 109 | +**Transform a Document** |
| 110 | + |
| 111 | +Upload a meeting notes text file and prompt: |
| 112 | +> "Create an action items tracker spreadsheet with columns for task, owner, due date, and status." |
| 113 | +
|
| 114 | +## Tech Stack |
| 115 | + |
| 116 | +| Layer | Technology | |
| 117 | +|-------|------------| |
| 118 | +| Backend | Spring Boot 4.0 | |
| 119 | +| AI | Spring AI 2.0.0-SNAPSHOT + Anthropic Claude Skills | |
| 120 | +| Templates | Thymeleaf | |
| 121 | +| Interactivity | HTMX | |
| 122 | +| Styling | Tailwind CSS | |
| 123 | + |
| 124 | +## Configuration |
| 125 | + |
| 126 | +```yaml |
| 127 | +spring: |
| 128 | + ai: |
| 129 | + anthropic: |
| 130 | + api-key: ${ANTHROPIC_API_KEY} |
| 131 | + chat: |
| 132 | + options: |
| 133 | + model: claude-sonnet-4-5-20250514 |
| 134 | +``` |
| 135 | +
|
| 136 | +## How It Works |
| 137 | +
|
| 138 | +``` |
| 139 | +User Prompt → Spring AI → Claude Skills → File Generated → Download |
| 140 | +``` |
| 141 | + |
| 142 | +1. User selects document type and enters a natural language prompt |
| 143 | +2. Spring AI sends the request to Claude with the appropriate skill enabled |
| 144 | +3. Optionally, a custom skill is added for branding or formatting |
| 145 | +4. Claude generates the actual document file using code execution |
| 146 | +5. `SkillsResponseHelper` extracts file IDs from the response |
| 147 | +6. Files are downloaded via Anthropic's Files API and served to the user |
| 148 | + |
| 149 | +--- |
| 150 | + |
| 151 | +Built with Spring AI. |
0 commit comments