Building COBRA - a COBOL Banking Resilience Agent that parses legacy code and generates AWS infrastructure, powered by Kiro’s systematic approach to AI-assisted development“
The Challenge: 60 Years of Banking Code
Banks worldwide run on billions of lines of COBOL code written decades ago. Complete rewrites are risky and expensive, yet modernization is essential. I set out to build COBRA (COBOL Banking Resilience Agent)—an AI system that analyzes legacy COBOL and generates modern AWS infrastructure.
The twist? I built it entirely with Kiro, and the experience completely changed how I approach complex software development.
What I Built
COBRA is an agentic AI orchestration system that:
- Parses COBOL-85/2002 source code and generates Abstract Syntax Trees
- Recognize…
Building COBRA - a COBOL Banking Resilience Agent that parses legacy code and generates AWS infrastructure, powered by Kiro’s systematic approach to AI-assisted development“
The Challenge: 60 Years of Banking Code
Banks worldwide run on billions of lines of COBOL code written decades ago. Complete rewrites are risky and expensive, yet modernization is essential. I set out to build COBRA (COBOL Banking Resilience Agent)—an AI system that analyzes legacy COBOL and generates modern AWS infrastructure.
The twist? I built it entirely with Kiro, and the experience completely changed how I approach complex software development.
What I Built
COBRA is an agentic AI orchestration system that:
- Parses COBOL-85/2002 source code and generates Abstract Syntax Trees
- Recognizes banking patterns (interest calculations, transaction posting, batch processing)
- Generates production-ready AWS Lambda functions, API Gateway configs, and CDK infrastructure
- Provides a React web interface for instant analysis
- Integrates with Kiro via Model Context Protocol (MCP)
The result: 142 files, comprehensive documentation, and a zero-cost development architecture—all built systematically through Kiro’s spec-driven workflow.
My Favorite Thing About Kiro: Spec-Driven Development That Actually Works
Before Kiro: The Chaos of “Just Start Coding”
My typical approach was:
- Have a vague idea
- Start coding immediately
- Realize requirements are unclear
- Refactor extensively
- Lose track of what’s done vs what’s needed
- Ship something that mostly works
For a complex project like COBRA (COBOL parser + logic analyzer + LLM integration + AWS generators + web interface), this approach would have been a disaster.
With Kiro: Systematic, Iterative, Traceable
Kiro introduced me to spec-driven development with three documents:
1. requirements.md - EARS-Compliant Requirements
## Requirement 1: COBOL Parsing
**User Story:** As a modernization engineer, I want to parse COBOL source files,
so that I can analyze legacy banking systems.
#### Acceptance Criteria
1. WHEN a COBOL-85 source file is provided, THE System SHALL generate an AST
within 30 seconds for files up to 10,000 lines
2. WHILE parsing, THE System SHALL identify all data structures, procedures,
and file operations
3. IF parsing errors occur, THEN THE System SHALL provide line numbers and
actionable error messages
Every requirement was measurable, testable, and traceable.
- design.md - Architecture Decisions
## Component: COBOL Parser
### Technology Choice: Custom TypeScript Parser
**Rationale:** Existing parsers (tree-sitter-cobol) lack banking-specific
pattern recognition. Custom parser enables:
- Recognition of interest calculation patterns
- Extraction of transaction validation logic
- Support for multiple COBOL dialects
### Performance Strategy
- Three-tier caching (AST, Analysis, LLM responses)
- Worker thread pool for parallel processing
- Streaming parser for files >5000 lines
The design document became our contract—every implementation decision was documented and justified.
- tasks.md - Actionable Implementation Plan
- [ ] 1. Build COBOL parser with AST generation
- [ ] 1.1 Implement lexer for COBOL tokens
- [ ] 1.2 Create parser for IDENTIFICATION, DATA, and PROCEDURE divisions
- [ ] 1.3 Generate AST with source map for error reporting
- _Requirements: 1.1, 1.2, 1.3_
- [ ] 2. Create logic analyzer for banking patterns
- [ ] 2.1 Implement pattern recognizer for interest calculations
- [ ] 2.2 Extract transaction validation rules
- _Requirements: 2.1, 2.2_
Each task referenced specific requirements, making progress trackable and ensuring nothing was missed.
How This Changed My Development Approach
- Upfront Clarity Eliminated Rework Old way: Build parser → Realize it doesn’t handle CICS transactions → Refactor everything
Kiro way: Document requirement for CICS support in requirements.md → Design parser architecture to handle it → Implement once correctly
Impact: Reduced rework by ~70%. Most code worked on first implementation.
- Steering Documents Made Kiro a Domain Expert I created 5 steering documents in .kiro/steering/:
banking-patterns.md (366 lines):
## Interest Accrual Pattern
**COBOL Code:**
cobol
COMPUTE INTEREST-AMOUNT = PRINCIPAL-BALANCE *
(INTEREST-RATE / 100) * (DAYS-ELAPSED / 365).
Business Meaning: Simple interest calculation using actual/365 day-count convention, common in US banking. Division by 100 converts percentage to decimal.
AWS Translation: Lambda function with business logic, DynamoDB for state, EventBridge for scheduled daily accrual.
This transformed Kiro from "generic coding assistant" to "COBOL modernization expert."
**Without steering**: "This code multiplies three numbers"
**With steering**: "This calculates simple interest using actual/365 convention, requires overflow protection for balances >$999,999, and should include audit logging for compliance"
### 3. MCP Integration Created Seamless Workflows
I built COBRA as an MCP server with 5 tools:
- `parseCobol` - Parse COBOL and generate AST
- `analyzeLogic` - Extract banking patterns
- `generateSpec` - Create requirements/design/tasks
- `generateAWSCode` - Generate Lambda/CDK code
- `suggestModernization` - Recommend migration strategies
**The magic**: These tools maintain state and cache results.
**Example workflow:**
Me: “Analyze examples/interest-calculation.cbl”
Kiro: → Calls parseCobol (caches AST) → Calls analyzeLogic (uses cached AST, finds interest pattern) → Calls generateAWSCode (generates Lambda with exact business logic) → Creates files in my workspace → Shows architecture diagram
Time: <60 seconds Cost: $0.10 (with 80% cache hit rate on subsequent runs)
4. Hybrid Approach: Spec-Driven + Vibe Coding
I discovered the best approach combines both:
Spec-driven for architecture: Parser, analyzer, generators—these needed precision Vibe coding for polish: “Make the header match the logo colors”—these needed rapid iteration
Example: Building the web interface
- Spec-driven: Define React components, API endpoints, state management
- Vibe coding: “Use navy/blue theme matching the logo”
- Result: Solid architecture + beautiful UI
The Most Impressive Code Generation
The orchestrator system with performance optimizations blew my mind.
In one conversation, Kiro generated:
- Complete orchestrator coordinating 5 components
- Three-tier caching system with automatic key generation
- Worker thread pool for parallel processing
- Real-time cost tracking with provider-specific pricing
- Progress tracking with callback system
- Comprehensive error handling
What made it impressive: Kiro understood complex component interactions, implemented sophisticated caching achieving 80-95% hit rates, and met strict performance targets (10K lines in <30s) on first implementation.
Measurable Impact
| Metric | Before Kiro | With Kiro | Improvement |
|---|---|---|---|
| Planning Time | 0 hours (just started coding) | 4 hours (requirements + design) | Better outcomes |
| Implementation Time | ~40 hours (with extensive rework) | ~20 hours (minimal rework) | 2x faster |
| Code Quality | ~60% worked first try | ~90% worked first try | 50% improvement |
| Documentation | Written after (if at all) | Built-in (the spec) | Always current |
| Collaboration | Tribal knowledge | Clear contract (spec docs) | Team-ready |
Key Lessons Learned
1. AI Coding Isn’t About Speed—It’s About Systematic Thinking
Kiro didn’t just help me code faster. It helped me think better by forcing me to:
- Clarify requirements before implementation
- Document architectural decisions
- Break complex problems into manageable tasks
- Track progress systematically
2. Domain Knowledge Multiplies AI Effectiveness
Generic prompts get generic results. Domain-specific steering documents (banking patterns, modernization strategies) transformed Kiro into a subject matter expert.
Investment: 4 hours writing steering docs Return: Every subsequent conversation was 10x more productive
3. Spec-Driven Development Scales
For COBRA’s complexity (142 files, 11 major features), spec-driven development was essential. The spec became:
- Our roadmap (tasks.md)
- Our documentation (requirements.md + design.md)
- Our quality assurance (acceptance criteria)
- Our collaboration tool (clear contract)
4. The Best Approach Is Hybrid
Rigid processes kill creativity. Pure chaos creates technical debt.
The sweet spot: Spec-driven for architecture, vibe coding for polish.
What’s Next
COBRA is just the beginning. With Kiro’s systematic approach, I’m planning:
- Expand COBOL dialect support (Micro Focus, GnuCOBOL)
- Add automated test generation from COBOL test cases
- Build migration progress dashboard with cost tracking
- Create marketplace for sharing modernization patterns
Try It Yourself
COBRA is open source: github.com/Shaistaaman/COBRA-COBOL-Banking-Resilience-Agent
The spec-driven approach works for any complex project:
- Start with requirements.md (what you’re building)
- Create design.md (how you’ll build it)
- Generate tasks.md (step-by-step implementation)
- Let Kiro execute systematically
Final Thought
Kiro changed how I approach development by teaching me that structure amplifies creativity.
The spec isn’t a constraint—it’s a foundation that lets you build confidently, knowing your architecture is sound and your progress is trackable.
That’s my favorite thing about Kiro: it makes complex projects manageable through systematic thinking, domain expertise, and intelligent automation.
And honestly? It’s kind of addictive. #hookedonkiro
Built with: Kiro, TypeScript, React, AWS CDK, Model Context Protocol Time: 2 weeks from concept to production-ready Cost: $0 AWS charges during development Lines of Code: 38,000+ (mostly generated by Kiro)
kiro #aws #cobol #modernization #ai #development
Want to see COBRA in action? Check out the live demo or read the comprehensive documentation.